* Deleted copy_term_nat/2 definition
[chr.git] / guard_entailment.pl
bloba64505cef3fad44ff76519884f17780a567b59d1
1 /* Generated by CHR bootstrap compiler
2 From: guard_entailment.chr
3 Date: Fri Jan 21 10:00:48 2005
5 DO NOT EDIT. EDIT THE CHR FILE INSTEAD
6 */
8 :-module(guard_entailment, [entails_guard/2, simplify_guards/5]).
9 :-use_module(chr_runtime).
10 :-style_check(-singleton).
11 :-style_check(- (discontiguous)).
12 :-use_module(library(lists)).
13 :-use_module(hprolog).
14 :-use_module(builtins).
15 entails_guard(A, B) :-
16 copy_term_nat((A, B), (C, D)),
17 term_variables(C, E),
18 variables(E),
19 entails_guard2(C), !,
20 test(D), !,
21 cleanup.
22 entails_guard2([]).
23 entails_guard2([A|B]) :-
24 known(A),
25 entails_guard2(B).
26 simplify_guards(A, B, C, D, E) :-
27 copy_term_nat((A, C), (F, G)),
28 term_variables(F, H),
29 variables(H),
30 entails_guard2(F), !,
31 simplify(G, I),
32 simplified(C, I, D, B, E), !,
33 cleanup.
34 simplified([], [], [], A, A).
35 simplified([A|B], [keep|C], [A|D], E, F) :-
36 simplified(B, C, D, E, F).
37 simplified([A|B], [fail|C], fail, D, D).
38 simplified([A|B], [true|C], [D|E], F, G) :-
39 builtins:binds_b(A, H),
40 term_variables(B, I),
41 intersect_eq(H, I, J), !,
42 ( J=[]
43 -> term_variables(F, K),
44 intersect_eq(H, K, L), !,
45 ( L=[]
46 -> D=true,
47 G=M
48 ; D=true,
49 G= (A, M)
51 ; D=A,
52 G=M
54 simplified(B, C, E, F, M).
55 simplify([], []).
56 simplify([A|B], [C|D]) :-
57 ( \+try(true, A)
58 -> C=true
59 ; builtins:negate_b(A, E),
60 ( \+try(true, E)
61 -> C=fail
62 ; C=keep
65 known(A),
66 simplify(B, D).
67 try(A, B) :-
68 ( known(A)
69 -> true
70 ; format(' ERROR: entailment checker: this is not supposed to happen.\n', [])
72 ( test(B)
73 -> fail
74 ; true
76 lookup([], [], A, B) :-
77 fail.
78 lookup([A|B], [C|D], E, F) :-
79 ( E==A
80 -> F=C
81 ; lookup(B, D, E, F)
83 add_args_unif([], [], true).
84 add_args_unif([A|B], [C|D], (A=C, E)) :-
85 add_args_unif(B, D, E).
86 add_args_nunif([], [], fail).
87 add_args_nunif([A|B], [C|D], (A\=C;E)) :-
88 add_args_nunif(B, D, E).
89 add_args_nmatch([], [], fail).
90 add_args_nmatch([A|B], [C|D], (A\==C;E)) :-
91 add_args_nmatch(B, D, E).
92 all_unique_vars(A, B) :-
93 all_unique_vars(A, B, []).
94 all_unique_vars([], A, B).
95 all_unique_vars([A|B], C, D) :-
96 var(A),
97 \+memberchk_eq(A, C),
98 \+memberchk_eq(A, D),
99 all_unique_vars(B, [A|D]).
100 :-use_module(chr(chr_runtime)).
101 :-use_module(chr(chr_hashtable_store)).
102 'attach_known/1'([], A).
103 'attach_known/1'([A|B], C) :-
104 ( get_attr(A, guard_entailment, D)
105 -> D=v(E, F, G),
106 ( E/\1=:=1
107 -> put_attr(A, guard_entailment, v(E, [C|F], G))
108 ; H is E\/1,
109 put_attr(A, guard_entailment, v(H, [C], G))
111 ; put_attr(A, guard_entailment, v(1, [C], [C]))
113 'attach_known/1'(B, C).
114 'detach_known/1'([], A).
115 'detach_known/1'([A|B], C) :-
116 ( get_attr(A, guard_entailment, D)
117 -> D=v(E, F, G),
118 ( E/\1=:=1
119 -> 'chr sbag_del_element'(F, C, H),
120 ( H==[]
121 -> I is E/\ -2,
122 ( I==0
123 -> del_attr(A, guard_entailment)
124 ; put_attr(A, guard_entailment, v(I, [], G))
126 ; put_attr(A, guard_entailment, v(E, H, G))
128 ; true
130 ; true
132 'detach_known/1'(B, C).
133 'attach_variables/1'([], A).
134 'attach_variables/1'([A|B], C) :-
135 ( get_attr(A, guard_entailment, D)
136 -> D=v(E, F, G),
137 ( E/\2=:=2
138 -> put_attr(A, guard_entailment, v(E, F, [C|G]))
139 ; H is E\/2,
140 put_attr(A, guard_entailment, v(H, F, [C]))
142 ; put_attr(A, guard_entailment, v(2, [C], [C]))
144 'attach_variables/1'(B, C).
145 'detach_variables/1'([], A).
146 'detach_variables/1'([A|B], C) :-
147 ( get_attr(A, guard_entailment, D)
148 -> D=v(E, F, G),
149 ( E/\2=:=2
150 -> 'chr sbag_del_element'(G, C, H),
151 ( H==[]
152 -> I is E/\ -3,
153 ( I==0
154 -> del_attr(A, guard_entailment)
155 ; put_attr(A, guard_entailment, v(I, F, []))
157 ; put_attr(A, guard_entailment, v(E, F, H))
159 ; true
161 ; true
163 'detach_variables/1'(B, C).
164 '$indexed_variables'(A, B) :-
165 A=known(C),
166 term_variables(A, B).
167 '$indexed_variables'(A, B) :-
168 A=variables(C),
169 term_variables(A, B).
170 attach_increment([], A).
171 attach_increment([A|B], v(C, D, E)) :-
172 'chr not_locked'(A),
173 ( get_attr(A, guard_entailment, F)
174 -> F=v(G, H, I),
175 sort(H, J),
176 'chr merge_attributes'(D, J, K),
177 sort(I, L),
178 'chr merge_attributes'(E, L, M),
179 N is C\/G,
180 put_attr(A, guard_entailment, v(N, K, M))
181 ; put_attr(A, guard_entailment, v(C, D, E))
183 attach_increment(B, v(C, D, E)).
184 attr_unify_hook(v(A, B, C), D) :-
185 sort(B, E),
186 sort(C, F),
187 ( var(D)
188 -> ( get_attr(D, guard_entailment, G)
189 -> G=v(H, I, J),
190 sort(I, K),
191 'chr merge_attributes'(E, K, L),
192 sort(J, M),
193 'chr merge_attributes'(F, M, N),
194 O is A\/H,
195 put_attr(D, guard_entailment, v(O, L, N)),
196 'chr run_suspensions_loop'([L, N])
197 ; put_attr(D, guard_entailment, v(A, E, F)),
198 'chr run_suspensions_loop'([E, F])
200 ; ( compound(D)
201 -> term_variables(D, P),
202 attach_increment(P, v(A, E, F))
203 ; true
205 'chr run_suspensions_loop'([E, F])
207 activate_constraint(A, B, C, D) :-
208 arg(2, C, E),
209 E=mutable(F),
210 'chr update_mutable'(active, E),
211 ( nonvar(D)
212 -> true
213 ; arg(4, C, G),
214 G=mutable(H),
215 D is H+1,
216 'chr update_mutable'(D, G)
218 ( compound(F)
219 -> term_variables(F, B),
220 'chr none_locked'(B),
221 A=yes
222 ; F==removed
223 -> chr_indexed_variables(C, B),
224 A=yes
225 ; B=[],
226 A=no
228 remove_constraint_internal(A, B, C) :-
229 arg(2, A, D),
230 D=mutable(E),
231 'chr update_mutable'(removed, D),
232 ( compound(E)
233 -> B=[],
234 C=no
235 ; E==removed
236 -> B=[],
237 C=no
238 ; C=yes,
239 chr_indexed_variables(A, B)
241 allocate_constraint(A, B, C, D) :-
242 B=..[suspension, E, F, A, G, H, C|D],
243 G=mutable(0),
244 'chr empty_history'(I),
245 H=mutable(I),
246 chr_indexed_variables(B, J),
247 F=mutable(passive(J)),
248 'chr gen_id'(E).
249 insert_constraint_internal(yes, A, B, C, D, E) :-
250 B=..[suspension, F, G, C, H, I, D|E],
251 chr_indexed_variables(B, A),
252 'chr none_locked'(A),
253 G=mutable(active),
254 H=mutable(0),
255 I=mutable(J),
256 'chr empty_history'(J),
257 'chr gen_id'(F).
258 chr_indexed_variables(A, B) :-
259 A=..[C, D, E, F, G, H, I|J],
260 '$indexed_variables'(I, B).
261 '$insert_in_store_known/1'(A) :-
262 true,
263 'chr global_term_ref_1'(B),
264 ( get_attr(B, guard_entailment, C)
265 -> C=v(D, E, F),
266 ( D/\1=:=1
267 -> put_attr(B, guard_entailment, v(D, [A|E], F))
268 ; G is D\/1,
269 put_attr(B, guard_entailment, v(G, [A], F))
271 ; put_attr(B, guard_entailment, v(1, [A], [A]))
273 '$delete_from_store_known/1'(A) :-
274 true,
275 'chr global_term_ref_1'(B),
276 ( get_attr(B, guard_entailment, C)
277 -> C=v(D, E, F),
278 ( D/\1=:=1
279 -> 'chr sbag_del_element'(E, A, G),
280 ( G==[]
281 -> H is D/\ -2,
282 ( H==0
283 -> del_attr(B, guard_entailment)
284 ; put_attr(B, guard_entailment, v(H, [], F))
286 ; put_attr(B, guard_entailment, v(D, G, F))
288 ; true
290 ; true
292 '$insert_in_store_variables/1'(A) :-
293 true,
294 'chr global_term_ref_1'(B),
295 ( get_attr(B, guard_entailment, C)
296 -> C=v(D, E, F),
297 ( D/\2=:=2
298 -> put_attr(B, guard_entailment, v(D, E, [A|F]))
299 ; G is D\/2,
300 put_attr(B, guard_entailment, v(G, E, [A]))
302 ; put_attr(B, guard_entailment, v(2, [A], [A]))
304 '$delete_from_store_variables/1'(A) :-
305 true,
306 'chr global_term_ref_1'(B),
307 ( get_attr(B, guard_entailment, C)
308 -> C=v(D, E, F),
309 ( D/\2=:=2
310 -> 'chr sbag_del_element'(F, A, G),
311 ( G==[]
312 -> H is D/\ -3,
313 ( H==0
314 -> del_attr(B, guard_entailment)
315 ; put_attr(B, guard_entailment, v(H, E, []))
317 ; put_attr(B, guard_entailment, v(D, E, G))
319 ; true
321 ; true
323 '$enumerate_suspensions'(A) :-
324 ( 'chr global_term_ref_1'(B),
325 get_attr(B, guard_entailment, C),
326 arg(2, C, D),
327 'chr sbag_member'(A, D)
328 ; 'chr global_term_ref_1'(E),
329 get_attr(E, guard_entailment, F),
330 arg(3, F, G),
331 'chr sbag_member'(A, G)
333 known(A) :-
334 'known/1__0'(A, B).
335 'known/1__0'(A, B) :-
336 'chr via_1'(A, C),
337 get_attr(C, guard_entailment, D),
338 D=v(E, F, G),
339 E/\1=:=1,
340 'chr sbag_member'(H, F),
341 H=suspension(I, J, K, L, M, N, O),
342 J=mutable(active),
343 O==A, !,
344 ( var(B)
345 -> true
346 ; remove_constraint_internal(B, P, Q),
347 ( Q==yes
348 -> '$delete_from_store_known/1'(B),
349 'detach_known/1'(P, B)
350 ; true
353 'known/1__0'(A, B) :-
354 nonvar(A),
355 A= (C>D), !,
356 ( var(B)
357 -> true
358 ; remove_constraint_internal(B, E, F),
359 ( F==yes
360 -> '$delete_from_store_known/1'(B),
361 'detach_known/1'(E, B)
362 ; true
365 known(D<C).
366 'known/1__0'(A, B) :-
367 nonvar(A),
368 A= (C>=D), !,
369 ( var(B)
370 -> true
371 ; remove_constraint_internal(B, E, F),
372 ( F==yes
373 -> '$delete_from_store_known/1'(B),
374 'detach_known/1'(E, B)
375 ; true
378 known(D=<C).
379 'known/1__0'(A, B) :-
380 nonvar(A),
381 A= (C<D), !,
382 ( var(B)
383 -> true
384 ; remove_constraint_internal(B, E, F),
385 ( F==yes
386 -> '$delete_from_store_known/1'(B),
387 'detach_known/1'(E, B)
388 ; true
391 known(C=<D),
392 known(C=\=D).
393 'known/1__0'(A, B) :-
394 nonvar(A),
395 A= (C is D), !,
396 ( var(B)
397 -> true
398 ; remove_constraint_internal(B, E, F),
399 ( F==yes
400 -> '$delete_from_store_known/1'(B),
401 'detach_known/1'(E, B)
402 ; true
405 known(C=:=D).
406 'known/1__0'(A, B) :-
407 nonvar(A),
408 A= (C==D),
409 ( var(B)
410 -> allocate_constraint(guard_entailment:'known/1__0'(A, B), B, known(A), [A])
411 ; true
413 'chr novel_production'(B, 21),
414 number(C), !,
415 'chr extend_history'(B, 21),
416 activate_constraint(E, F, B, G),
417 ( E==yes
418 -> '$insert_in_store_known/1'(B),
419 'attach_known/1'(F, B)
420 ; true
422 known(C=:=D),
423 ( B=suspension(H, I, J, K, L, M, N),
424 I=mutable(active),
425 K=mutable(G)
426 -> 'chr update_mutable'(inactive, I),
427 'known/1__1'(A, B)
428 ; true
430 'known/1__0'(A, B) :-
431 ( var(B)
432 -> allocate_constraint(guard_entailment:'known/1__0'(A, B), B, known(A), [A])
433 ; true
435 'known/1__1'(A, B).
436 'known/1__1'(A, B) :-
437 nonvar(A),
438 A= (C==D),
439 'chr novel_production'(B, 22),
440 number(D), !,
441 'chr extend_history'(B, 22),
442 activate_constraint(E, F, B, G),
443 ( E==yes
444 -> '$insert_in_store_known/1'(B),
445 'attach_known/1'(F, B)
446 ; true
448 known(C=:=D),
449 ( B=suspension(H, I, J, K, L, M, N),
450 I=mutable(active),
451 K=mutable(G)
452 -> 'chr update_mutable'(inactive, I),
453 'known/1__2'(A, B)
454 ; true
456 'known/1__1'(A, B) :-
457 'known/1__2'(A, B).
458 'known/1__2'(A, B) :-
459 nonvar(A),
460 A= (C\==D),
461 'chr novel_production'(B, 23),
462 number(C), !,
463 'chr extend_history'(B, 23),
464 activate_constraint(E, F, B, G),
465 ( E==yes
466 -> '$insert_in_store_known/1'(B),
467 'attach_known/1'(F, B)
468 ; true
470 known(C=\=D),
471 ( B=suspension(H, I, J, K, L, M, N),
472 I=mutable(active),
473 K=mutable(G)
474 -> 'chr update_mutable'(inactive, I),
475 'known/1__3'(A, B)
476 ; true
478 'known/1__2'(A, B) :-
479 'known/1__3'(A, B).
480 'known/1__3'(A, B) :-
481 nonvar(A),
482 A= (C\==D),
483 'chr novel_production'(B, 24),
484 number(D), !,
485 'chr extend_history'(B, 24),
486 activate_constraint(E, F, B, G),
487 ( E==yes
488 -> '$insert_in_store_known/1'(B),
489 'attach_known/1'(F, B)
490 ; true
492 known(C=\=D),
493 ( B=suspension(H, I, J, K, L, M, N),
494 I=mutable(active),
495 K=mutable(G)
496 -> 'chr update_mutable'(inactive, I),
497 'known/1__4'(A, B)
498 ; true
500 'known/1__3'(A, B) :-
501 'known/1__4'(A, B).
502 'known/1__4'(A, B) :-
503 'chr global_term_ref_1'(C),
504 get_attr(C, guard_entailment, D),
505 D=v(E, F, G),
506 E/\1=:=1,
507 'chr sbag_member'(H, F),
508 H=suspension(I, J, K, L, M, N, O),
509 J=mutable(active),
510 O==fail, !,
511 ( var(B)
512 -> true
513 ; remove_constraint_internal(B, P, Q),
514 ( Q==yes
515 -> '$delete_from_store_known/1'(B),
516 'detach_known/1'(P, B)
517 ; true
520 'known/1__4'(A, B) :-
521 A==fail,
522 'chr global_term_ref_1'(C),
523 get_attr(C, guard_entailment, D),
524 D=v(E, F, G),
525 E/\1=:=1, !,
526 'known/1__4__0'(F, A, B).
527 'known/1__4__0'([], A, B) :-
528 'known/1__5'(A, B).
529 'known/1__4__0'([A|B], C, D) :-
530 ( A=suspension(E, F, G, H, I, J, K),
531 F=mutable(active)
532 -> remove_constraint_internal(A, L, M),
533 ( M==yes
534 -> '$delete_from_store_known/1'(A),
535 'detach_known/1'(L, A)
536 ; true
538 'known/1__4__0'(B, C, D)
539 ; 'known/1__4__0'(B, C, D)
541 'known/1__4'(A, B) :-
542 'known/1__5'(A, B).
543 'known/1__5'(A, B) :-
544 nonvar(A),
545 A= (C, D), !,
546 ( var(B)
547 -> true
548 ; remove_constraint_internal(B, E, F),
549 ( F==yes
550 -> '$delete_from_store_known/1'(B),
551 'detach_known/1'(E, B)
552 ; true
555 known(C),
556 known(D).
557 'known/1__5'(A, B) :-
558 nonvar(A),
559 A= (C=:=D),
560 D==C, !,
561 ( var(B)
562 -> true
563 ; remove_constraint_internal(B, E, F),
564 ( F==yes
565 -> '$delete_from_store_known/1'(B),
566 'detach_known/1'(E, B)
567 ; true
570 'known/1__5'(A, B) :-
571 nonvar(A),
572 A= (C==D),
573 D==C, !,
574 ( var(B)
575 -> true
576 ; remove_constraint_internal(B, E, F),
577 ( F==yes
578 -> '$delete_from_store_known/1'(B),
579 'detach_known/1'(E, B)
580 ; true
583 'known/1__5'(A, B) :-
584 nonvar(A),
585 A= (C=<D),
586 D==C, !,
587 ( var(B)
588 -> true
589 ; remove_constraint_internal(B, E, F),
590 ( F==yes
591 -> '$delete_from_store_known/1'(B),
592 'detach_known/1'(E, B)
593 ; true
596 'known/1__5'(A, B) :-
597 nonvar(A),
598 A= (C=D),
599 D==C, !,
600 ( var(B)
601 -> true
602 ; remove_constraint_internal(B, E, F),
603 ( F==yes
604 -> '$delete_from_store_known/1'(B),
605 'detach_known/1'(E, B)
606 ; true
609 'known/1__5'(A, B) :-
610 nonvar(A),
611 A= (C=D),
612 var(C), !,
613 ( var(B)
614 -> true
615 ; remove_constraint_internal(B, E, F),
616 ( F==yes
617 -> '$delete_from_store_known/1'(B),
618 'detach_known/1'(E, B)
619 ; true
622 C=D.
623 'known/1__5'(A, B) :-
624 nonvar(A),
625 A= (C=D),
626 var(D), !,
627 ( var(B)
628 -> true
629 ; remove_constraint_internal(B, E, F),
630 ( F==yes
631 -> '$delete_from_store_known/1'(B),
632 'detach_known/1'(E, B)
633 ; true
636 C=D.
637 'known/1__5'(A, B) :-
638 nonvar(A),
639 A= (C\=D),
640 var(D),
641 var(C),
642 'chr lock'(C),
643 'chr lock'(D),
644 C=D,
645 chr_runtime:unlock(C),
646 chr_runtime:unlock(D), !,
647 ( var(B)
648 -> true
649 ; remove_constraint_internal(B, E, F),
650 ( F==yes
651 -> '$delete_from_store_known/1'(B),
652 'detach_known/1'(E, B)
653 ; true
656 known(fail).
657 'known/1__5'(A, B) :-
658 nonvar(A),
659 A= (C\=D),
660 ground(D),
661 ground(C),
662 'chr lock'(C),
663 'chr lock'(D),
664 C=D,
665 chr_runtime:unlock(C),
666 chr_runtime:unlock(D), !,
667 ( var(B)
668 -> true
669 ; remove_constraint_internal(B, E, F),
670 ( F==yes
671 -> '$delete_from_store_known/1'(B),
672 'detach_known/1'(E, B)
673 ; true
676 known(fail).
677 'known/1__5'(A, B) :-
678 nonvar(A),
679 A=functor(C, D, E),
680 ground(E),
681 ground(D),
682 var(C),
683 'chr global_term_ref_1'(F),
684 get_attr(F, guard_entailment, G),
685 G=v(H, I, J),
686 H/\2=:=2,
687 'chr sbag_member'(K, J),
688 K=suspension(L, M, N, O, P, Q, R),
689 M=mutable(active), !,
690 remove_constraint_internal(K, S, T),
691 ( T==yes
692 -> '$delete_from_store_variables/1'(K),
693 'detach_variables/1'(S, K)
694 ; true
696 ( var(B)
697 -> true
698 ; remove_constraint_internal(B, U, V),
699 ( V==yes
700 -> '$delete_from_store_known/1'(B),
701 'detach_known/1'(U, B)
702 ; true
705 functor(W, D, E),
706 C=W,
707 C=..[X|Y],
708 append(Y, R, Z),
709 variables(Z).
710 'known/1__5'(A, B) :-
711 nonvar(A),
712 A=functor(C, D, E),
713 nonvar(C),
714 'chr lock'(C),
715 'chr lock'(D),
716 'chr lock'(E),
717 \+functor(C, D, E),
718 chr_runtime:unlock(C),
719 chr_runtime:unlock(D),
720 chr_runtime:unlock(E), !,
721 ( var(B)
722 -> true
723 ; remove_constraint_internal(B, F, G),
724 ( G==yes
725 -> '$delete_from_store_known/1'(B),
726 'detach_known/1'(F, B)
727 ; true
730 known(fail).
731 'known/1__5'(A, B) :-
732 nonvar(A),
733 A= (\+C),
734 nonvar(C),
735 C=functor(D, E, F),
736 nonvar(D),
737 'chr lock'(D),
738 'chr lock'(E),
739 'chr lock'(F),
740 functor(D, E, F),
741 chr_runtime:unlock(D),
742 chr_runtime:unlock(E),
743 chr_runtime:unlock(F), !,
744 ( var(B)
745 -> true
746 ; remove_constraint_internal(B, G, H),
747 ( H==yes
748 -> '$delete_from_store_known/1'(B),
749 'detach_known/1'(G, B)
750 ; true
753 known(fail).
754 'known/1__5'(A, B) :-
755 nonvar(A),
756 A=functor(C, D, E),
757 nonvar(E),
758 nonvar(D),
759 'chr via_1'(C, F),
760 get_attr(F, guard_entailment, G),
761 G=v(H, I, J),
762 H/\1=:=1,
763 'chr sbag_member'(K, I),
764 K=suspension(L, M, N, O, P, Q, R),
765 M=mutable(active),
766 nonvar(R),
767 R=functor(S, T, U),
768 S==C,
769 nonvar(U),
770 nonvar(T), !,
771 remove_constraint_internal(K, V, W),
772 ( W==yes
773 -> '$delete_from_store_known/1'(K),
774 'detach_known/1'(V, K)
775 ; true
777 ( var(B)
778 -> true
779 ; remove_constraint_internal(B, X, Y),
780 ( Y==yes
781 -> '$delete_from_store_known/1'(B),
782 'detach_known/1'(X, B)
783 ; true
786 known(fail).
787 'known/1__5'(A, B) :-
788 nonvar(A),
789 A= (C\=D),
790 D==C, !,
791 ( var(B)
792 -> true
793 ; remove_constraint_internal(B, E, F),
794 ( F==yes
795 -> '$delete_from_store_known/1'(B),
796 'detach_known/1'(E, B)
797 ; true
800 known(fail).
801 'known/1__5'(A, B) :-
802 nonvar(A),
803 A= (C=D),
804 'chr lock'(C),
805 functor(C, E, F),
806 chr_runtime:unlock(C), !,
807 ( var(B)
808 -> true
809 ; remove_constraint_internal(B, G, H),
810 ( H==yes
811 -> '$delete_from_store_known/1'(B),
812 'detach_known/1'(G, B)
813 ; true
816 ( functor(D, E, F),
818 -> true
819 ; known(fail)
821 'known/1__5'(A, B) :-
822 nonvar(A),
823 A= (C\=D),
824 nonvar(D),
825 var(C),
826 'chr lock'(D),
827 functor(D, E, F),
828 F>0,
829 chr_runtime:unlock(D), !,
830 ( var(B)
831 -> true
832 ; remove_constraint_internal(B, G, H),
833 ( H==yes
834 -> '$delete_from_store_known/1'(B),
835 'detach_known/1'(G, B)
836 ; true
839 length(I, F),
840 D=..[E|J],
841 K=..[E|I],
842 add_args_nunif(J, I, L),
843 M= (\+functor(C, E, F);C=K, L),
844 known(M).
845 'known/1__5'(A, B) :-
846 nonvar(A),
847 A= (C\=D),
848 nonvar(D),
849 nonvar(C),
850 'chr lock'(C),
851 functor(C, E, F),
852 chr_runtime:unlock(C), !,
853 ( var(B)
854 -> true
855 ; remove_constraint_internal(B, G, H),
856 ( H==yes
857 -> '$delete_from_store_known/1'(B),
858 'detach_known/1'(G, B)
859 ; true
862 ( functor(D, E, F)
863 -> C=..[E|I],
864 D=..[E|J],
865 add_args_nunif(I, J, K),
866 known(K)
867 ; true
869 'known/1__5'(A, B) :-
870 nonvar(A),
871 A= (C\=D),
872 'chr novel_production'(B, 43), !,
873 'chr extend_history'(B, 43),
874 activate_constraint(E, F, B, G),
875 ( E==yes
876 -> '$insert_in_store_known/1'(B),
877 'attach_known/1'(F, B)
878 ; true
880 known(D\=C),
881 ( B=suspension(H, I, J, K, L, M, N),
882 I=mutable(active),
883 K=mutable(G)
884 -> 'chr update_mutable'(inactive, I),
885 'known/1__6'(A, B)
886 ; true
888 'known/1__5'(A, B) :-
889 'known/1__6'(A, B).
890 'known/1__6'(A, B) :-
891 nonvar(A),
892 A= (C=<D),
893 ground(D),
894 ground(C),
895 C>D, !,
896 ( var(B)
897 -> true
898 ; remove_constraint_internal(B, E, F),
899 ( F==yes
900 -> '$delete_from_store_known/1'(B),
901 'detach_known/1'(E, B)
902 ; true
905 known(fail).
906 'known/1__6'(A, B) :-
907 nonvar(A),
908 A= (C=<D),
909 ground(D),
910 'chr via_1'(C, E),
911 get_attr(E, guard_entailment, F),
912 F=v(G, H, I),
913 G/\1=:=1,
914 'chr sbag_member'(J, H),
915 J=suspension(K, L, M, N, O, P, Q),
916 L=mutable(active),
917 nonvar(Q),
918 Q= (R=<S),
919 R==C,
920 ground(S),
921 S=<D, !,
922 ( var(B)
923 -> true
924 ; remove_constraint_internal(B, T, U),
925 ( U==yes
926 -> '$delete_from_store_known/1'(B),
927 'detach_known/1'(T, B)
928 ; true
931 'known/1__6'(A, B) :-
932 nonvar(A),
933 A= (C=<D),
934 'chr via_1'(C, E),
935 get_attr(E, guard_entailment, F),
936 F=v(G, H, I),
937 G/\1=:=1, !,
938 'known/1__6__0'(H, A, B, C, D).
939 'known/1__6__0'([], A, B, C, D) :-
940 'known/1__7'(A, B).
941 'known/1__6__0'([A|B], C, D, E, F) :-
942 ( A=suspension(G, H, I, J, K, L, M),
943 H=mutable(active),
944 nonvar(M),
945 M= (N=<O),
946 N==E,
947 ground(O),
948 ground(F),
949 F=<O
950 -> remove_constraint_internal(A, P, Q),
951 ( Q==yes
952 -> '$delete_from_store_known/1'(A),
953 'detach_known/1'(P, A)
954 ; true
956 'known/1__6__0'(B, C, D, E, F)
957 ; 'known/1__6__0'(B, C, D, E, F)
959 'known/1__6'(A, B) :-
960 'known/1__7'(A, B).
961 'known/1__7'(A, B) :-
962 nonvar(A),
963 A= (C=<D),
964 ground(C),
965 'chr via_1'(D, E),
966 get_attr(E, guard_entailment, F),
967 F=v(G, H, I),
968 G/\1=:=1,
969 'chr sbag_member'(J, H),
970 J=suspension(K, L, M, N, O, P, Q),
971 L=mutable(active),
972 nonvar(Q),
973 Q= (R=<S),
974 S==D,
975 ground(R),
976 C=<R, !,
977 ( var(B)
978 -> true
979 ; remove_constraint_internal(B, T, U),
980 ( U==yes
981 -> '$delete_from_store_known/1'(B),
982 'detach_known/1'(T, B)
983 ; true
986 'known/1__7'(A, B) :-
987 nonvar(A),
988 A= (C=<D),
989 'chr via_1'(D, E),
990 get_attr(E, guard_entailment, F),
991 F=v(G, H, I),
992 G/\1=:=1, !,
993 'known/1__7__0'(H, A, B, C, D).
994 'known/1__7__0'([], A, B, C, D) :-
995 'known/1__8'(A, B).
996 'known/1__7__0'([A|B], C, D, E, F) :-
997 ( A=suspension(G, H, I, J, K, L, M),
998 H=mutable(active),
999 nonvar(M),
1000 M= (N=<O),
1001 O==F,
1002 ground(E),
1003 ground(N),
1004 N=<E
1005 -> remove_constraint_internal(A, P, Q),
1006 ( Q==yes
1007 -> '$delete_from_store_known/1'(A),
1008 'detach_known/1'(P, A)
1009 ; true
1011 'known/1__7__0'(B, C, D, E, F)
1012 ; 'known/1__7__0'(B, C, D, E, F)
1014 'known/1__7'(A, B) :-
1015 'known/1__8'(A, B).
1016 'known/1__8'(A, B) :-
1017 nonvar(A),
1018 A= (C=<D),
1019 'chr via_2'(D, C, E),
1020 get_attr(E, guard_entailment, F),
1021 F=v(G, H, I),
1022 G/\1=:=1,
1023 'chr sbag_member'(J, H),
1024 J=suspension(K, L, M, N, O, P, Q),
1025 L=mutable(active),
1026 nonvar(Q),
1027 Q= (R=<S),
1028 R==D,
1029 S==C, !,
1030 remove_constraint_internal(J, T, U),
1031 ( U==yes
1032 -> '$delete_from_store_known/1'(J),
1033 'detach_known/1'(T, J)
1034 ; true
1036 ( var(B)
1037 -> true
1038 ; remove_constraint_internal(B, V, W),
1039 ( W==yes
1040 -> '$delete_from_store_known/1'(B),
1041 'detach_known/1'(V, B)
1042 ; true
1045 known(C=:=D).
1046 'known/1__8'(A, B) :-
1047 nonvar(A),
1048 A= (C=<D),
1049 'chr via_1'(D, E),
1050 get_attr(E, guard_entailment, F),
1051 F=v(G, H, I),
1052 G/\1=:=1, !,
1053 'known/1__8__0'(H, A, B, C, D).
1054 'known/1__8__0'([], A, B, C, D) :-
1055 'known/1__9'(A, B).
1056 'known/1__8__0'([A|B], C, D, E, F) :-
1057 ( A=suspension(G, H, I, J, K, L, M),
1058 H=mutable(active),
1059 nonvar(M),
1060 M= (N=<O),
1061 N==F,
1062 P=t(48, D, A),
1063 'chr novel_production'(D, P),
1064 'chr novel_production'(A, P)
1065 -> 'chr extend_history'(D, P),
1066 activate_constraint(Q, R, D, S),
1067 ( Q==yes
1068 -> '$insert_in_store_known/1'(D),
1069 'attach_known/1'(R, D)
1070 ; true
1072 known(E=<O),
1073 ( D=suspension(T, U, V, W, X, Y, Z),
1074 U=mutable(active),
1075 W=mutable(S)
1076 -> 'chr update_mutable'(inactive, U),
1077 'known/1__8__0'(B, C, D, E, F)
1078 ; true
1080 ; 'known/1__8__0'(B, C, D, E, F)
1082 'known/1__8'(A, B) :-
1083 'known/1__9'(A, B).
1084 'known/1__9'(A, B) :-
1085 nonvar(A),
1086 A= (C=<D),
1087 'chr via_1'(C, E),
1088 get_attr(E, guard_entailment, F),
1089 F=v(G, H, I),
1090 G/\1=:=1, !,
1091 'known/1__9__0'(H, A, B, C, D).
1092 'known/1__9__0'([], A, B, C, D) :-
1093 'known/1__10'(A, B).
1094 'known/1__9__0'([A|B], C, D, E, F) :-
1095 ( A=suspension(G, H, I, J, K, L, M),
1096 H=mutable(active),
1097 nonvar(M),
1098 M= (N=<O),
1099 O==E,
1100 P=t(48, A, D),
1101 'chr novel_production'(A, P),
1102 'chr novel_production'(D, P)
1103 -> 'chr extend_history'(D, P),
1104 activate_constraint(Q, R, D, S),
1105 ( Q==yes
1106 -> '$insert_in_store_known/1'(D),
1107 'attach_known/1'(R, D)
1108 ; true
1110 known(N=<F),
1111 ( D=suspension(T, U, V, W, X, Y, Z),
1112 U=mutable(active),
1113 W=mutable(S)
1114 -> 'chr update_mutable'(inactive, U),
1115 'known/1__9__0'(B, C, D, E, F)
1116 ; true
1118 ; 'known/1__9__0'(B, C, D, E, F)
1120 'known/1__9'(A, B) :-
1121 'known/1__10'(A, B).
1122 'known/1__10'(A, B) :-
1123 nonvar(A),
1124 A= (C=<D),
1125 'chr via_1'(D, E),
1126 get_attr(E, guard_entailment, F),
1127 F=v(G, H, I),
1128 G/\1=:=1, !,
1129 'known/1__10__0'(H, A, B, C, D).
1130 'known/1__10__0'([], A, B, C, D) :-
1131 'known/1__11'(A, B).
1132 'known/1__10__0'([A|B], C, D, E, F) :-
1133 ( A=suspension(G, H, I, J, K, L, M),
1134 H=mutable(active),
1135 nonvar(M),
1136 M= (N=<O),
1137 N==F,
1138 'chr via_2'(F, O, P),
1139 get_attr(P, guard_entailment, Q),
1140 Q=v(R, S, T),
1141 R/\1=:=1
1142 -> 'known/1__10__1'(S, O, A, B, C, D, E, F)
1143 ; 'known/1__10__0'(B, C, D, E, F)
1145 'known/1__10__1'([], A, B, C, D, E, F, G) :-
1146 'known/1__10__0'(C, D, E, F, G).
1147 'known/1__10__1'([A|B], C, D, E, F, G, H, I) :-
1148 ( A=suspension(J, K, L, M, N, O, P),
1149 K=mutable(active),
1150 nonvar(P),
1151 P= (Q=\=R),
1152 Q==I,
1153 R==C,
1154 'chr via_2'(H, I, S),
1155 get_attr(S, guard_entailment, T),
1156 T=v(U, V, W),
1157 U/\1=:=1
1158 -> 'known/1__10__2'(V, A, B, C, D, E, F, G, H, I)
1159 ; 'known/1__10__1'(B, C, D, E, F, G, H, I)
1161 'known/1__10__2'([], A, B, C, D, E, F, G, H, I) :-
1162 'known/1__10__1'(B, C, D, E, F, G, H, I).
1163 'known/1__10__2'([A|B], C, D, E, F, G, H, I, J, K) :-
1164 ( A=suspension(L, M, N, O, P, Q, R),
1165 M=mutable(active),
1166 A\==C,
1167 nonvar(R),
1168 R= (S=\=T),
1169 S==J,
1170 T==K,
1171 U=t(49, I, A, F, C),
1172 'chr novel_production'(I, U),
1173 'chr novel_production'(A, U),
1174 'chr novel_production'(F, U),
1175 'chr novel_production'(C, U)
1176 -> 'chr extend_history'(I, U),
1177 activate_constraint(V, W, I, X),
1178 ( V==yes
1179 -> '$insert_in_store_known/1'(I),
1180 'attach_known/1'(W, I)
1181 ; true
1183 known(J=\=E),
1184 ( I=suspension(Y, Z, A1, B1, C1, D1, E1),
1185 Z=mutable(active),
1186 B1=mutable(X)
1187 -> 'chr update_mutable'(inactive, Z),
1188 'known/1__10__2'(B, C, D, E, F, G, H, I, J, K)
1189 ; true
1191 ; 'known/1__10__2'(B, C, D, E, F, G, H, I, J, K)
1193 'known/1__10'(A, B) :-
1194 'known/1__11'(A, B).
1195 'known/1__11'(A, B) :-
1196 nonvar(A),
1197 A= (C=\=D),
1198 'chr via_1'(D, E),
1199 get_attr(E, guard_entailment, F),
1200 F=v(G, H, I),
1201 G/\1=:=1, !,
1202 'known/1__11__0'(H, A, B, C, D).
1203 'known/1__11__0'([], A, B, C, D) :-
1204 'known/1__12'(A, B).
1205 'known/1__11__0'([A|B], C, D, E, F) :-
1206 ( A=suspension(G, H, I, J, K, L, M),
1207 H=mutable(active),
1208 nonvar(M),
1209 M= (N=<O),
1210 N==F,
1211 'chr via_2'(F, O, P),
1212 get_attr(P, guard_entailment, Q),
1213 Q=v(R, S, T),
1214 R/\1=:=1
1215 -> 'known/1__11__1'(S, O, A, B, C, D, E, F)
1216 ; 'known/1__11__0'(B, C, D, E, F)
1218 'known/1__11__1'([], A, B, C, D, E, F, G) :-
1219 'known/1__11__0'(C, D, E, F, G).
1220 'known/1__11__1'([A|B], C, D, E, F, G, H, I) :-
1221 ( A=suspension(J, K, L, M, N, O, P),
1222 K=mutable(active),
1223 nonvar(P),
1224 P= (Q=\=R),
1225 Q==I,
1226 R==C,
1227 'chr via_2'(H, I, S),
1228 get_attr(S, guard_entailment, T),
1229 T=v(U, V, W),
1230 U/\1=:=1
1231 -> 'known/1__11__2'(V, A, B, C, D, E, F, G, H, I)
1232 ; 'known/1__11__1'(B, C, D, E, F, G, H, I)
1234 'known/1__11__2'([], A, B, C, D, E, F, G, H, I) :-
1235 'known/1__11__1'(B, C, D, E, F, G, H, I).
1236 'known/1__11__2'([A|B], C, D, E, F, G, H, I, J, K) :-
1237 ( A=suspension(L, M, N, O, P, Q, R),
1238 M=mutable(active),
1239 A\==F,
1240 nonvar(R),
1241 R= (S=<T),
1242 S==J,
1243 T==K,
1244 U=t(49, A, I, F, C),
1245 'chr novel_production'(A, U),
1246 'chr novel_production'(I, U),
1247 'chr novel_production'(F, U),
1248 'chr novel_production'(C, U)
1249 -> 'chr extend_history'(I, U),
1250 activate_constraint(V, W, I, X),
1251 ( V==yes
1252 -> '$insert_in_store_known/1'(I),
1253 'attach_known/1'(W, I)
1254 ; true
1256 known(J=\=E),
1257 ( I=suspension(Y, Z, A1, B1, C1, D1, E1),
1258 Z=mutable(active),
1259 B1=mutable(X)
1260 -> 'chr update_mutable'(inactive, Z),
1261 'known/1__11__2'(B, C, D, E, F, G, H, I, J, K)
1262 ; true
1264 ; 'known/1__11__2'(B, C, D, E, F, G, H, I, J, K)
1266 'known/1__11'(A, B) :-
1267 'known/1__12'(A, B).
1268 'known/1__12'(A, B) :-
1269 nonvar(A),
1270 A= (C=<D),
1271 'chr via_1'(C, E),
1272 get_attr(E, guard_entailment, F),
1273 F=v(G, H, I),
1274 G/\1=:=1, !,
1275 'known/1__12__0'(H, A, B, C, D).
1276 'known/1__12__0'([], A, B, C, D) :-
1277 'known/1__13'(A, B).
1278 'known/1__12__0'([A|B], C, D, E, F) :-
1279 ( A=suspension(G, H, I, J, K, L, M),
1280 H=mutable(active),
1281 nonvar(M),
1282 M= (N=\=O),
1283 O==E,
1284 'chr via_2'(E, F, P),
1285 get_attr(P, guard_entailment, Q),
1286 Q=v(R, S, T),
1287 R/\1=:=1
1288 -> 'known/1__12__1'(S, N, A, B, C, D, E, F)
1289 ; 'known/1__12__0'(B, C, D, E, F)
1291 'known/1__12__1'([], A, B, C, D, E, F, G) :-
1292 'known/1__12__0'(C, D, E, F, G).
1293 'known/1__12__1'([A|B], C, D, E, F, G, H, I) :-
1294 ( A=suspension(J, K, L, M, N, O, P),
1295 K=mutable(active),
1296 A\==D,
1297 nonvar(P),
1298 P= (Q=\=R),
1299 Q==H,
1300 R==I,
1301 'chr via_2'(C, H, S),
1302 get_attr(S, guard_entailment, T),
1303 T=v(U, V, W),
1304 U/\1=:=1
1305 -> 'known/1__12__2'(V, A, B, C, D, E, F, G, H, I)
1306 ; 'known/1__12__1'(B, C, D, E, F, G, H, I)
1308 'known/1__12__2'([], A, B, C, D, E, F, G, H, I) :-
1309 'known/1__12__1'(B, C, D, E, F, G, H, I).
1310 'known/1__12__2'([A|B], C, D, E, F, G, H, I, J, K) :-
1311 ( A=suspension(L, M, N, O, P, Q, R),
1312 M=mutable(active),
1313 nonvar(R),
1314 R= (S=<T),
1315 S==E,
1316 T==J,
1317 U=t(49, A, F, I, C),
1318 'chr novel_production'(A, U),
1319 'chr novel_production'(F, U),
1320 'chr novel_production'(I, U),
1321 'chr novel_production'(C, U)
1322 -> 'chr extend_history'(I, U),
1323 activate_constraint(V, W, I, X),
1324 ( V==yes
1325 -> '$insert_in_store_known/1'(I),
1326 'attach_known/1'(W, I)
1327 ; true
1329 known(E=\=K),
1330 ( I=suspension(Y, Z, A1, B1, C1, D1, E1),
1331 Z=mutable(active),
1332 B1=mutable(X)
1333 -> 'chr update_mutable'(inactive, Z),
1334 'known/1__12__2'(B, C, D, E, F, G, H, I, J, K)
1335 ; true
1337 ; 'known/1__12__2'(B, C, D, E, F, G, H, I, J, K)
1339 'known/1__12'(A, B) :-
1340 'known/1__13'(A, B).
1341 'known/1__13'(A, B) :-
1342 nonvar(A),
1343 A= (C=\=D),
1344 'chr via_1'(C, E),
1345 get_attr(E, guard_entailment, F),
1346 F=v(G, H, I),
1347 G/\1=:=1, !,
1348 'known/1__13__0'(H, A, B, C, D).
1349 'known/1__13__0'([], A, B, C, D) :-
1350 'known/1__14'(A, B).
1351 'known/1__13__0'([A|B], C, D, E, F) :-
1352 ( A=suspension(G, H, I, J, K, L, M),
1353 H=mutable(active),
1354 nonvar(M),
1355 M= (N=\=O),
1356 O==E,
1357 'chr via_2'(E, F, P),
1358 get_attr(P, guard_entailment, Q),
1359 Q=v(R, S, T),
1360 R/\1=:=1
1361 -> 'known/1__13__1'(S, N, A, B, C, D, E, F)
1362 ; 'known/1__13__0'(B, C, D, E, F)
1364 'known/1__13__1'([], A, B, C, D, E, F, G) :-
1365 'known/1__13__0'(C, D, E, F, G).
1366 'known/1__13__1'([A|B], C, D, E, F, G, H, I) :-
1367 ( A=suspension(J, K, L, M, N, O, P),
1368 K=mutable(active),
1369 nonvar(P),
1370 P= (Q=<R),
1371 Q==H,
1372 R==I,
1373 'chr via_2'(C, H, S),
1374 get_attr(S, guard_entailment, T),
1375 T=v(U, V, W),
1376 U/\1=:=1
1377 -> 'known/1__13__2'(V, A, B, C, D, E, F, G, H, I)
1378 ; 'known/1__13__1'(B, C, D, E, F, G, H, I)
1380 'known/1__13__2'([], A, B, C, D, E, F, G, H, I) :-
1381 'known/1__13__1'(B, C, D, E, F, G, H, I).
1382 'known/1__13__2'([A|B], C, D, E, F, G, H, I, J, K) :-
1383 ( A=suspension(L, M, N, O, P, Q, R),
1384 M=mutable(active),
1385 A\==C,
1386 nonvar(R),
1387 R= (S=<T),
1388 S==E,
1389 T==J,
1390 U=t(49, A, F, C, I),
1391 'chr novel_production'(A, U),
1392 'chr novel_production'(F, U),
1393 'chr novel_production'(C, U),
1394 'chr novel_production'(I, U)
1395 -> 'chr extend_history'(I, U),
1396 activate_constraint(V, W, I, X),
1397 ( V==yes
1398 -> '$insert_in_store_known/1'(I),
1399 'attach_known/1'(W, I)
1400 ; true
1402 known(E=\=K),
1403 ( I=suspension(Y, Z, A1, B1, C1, D1, E1),
1404 Z=mutable(active),
1405 B1=mutable(X)
1406 -> 'chr update_mutable'(inactive, Z),
1407 'known/1__13__2'(B, C, D, E, F, G, H, I, J, K)
1408 ; true
1410 ; 'known/1__13__2'(B, C, D, E, F, G, H, I, J, K)
1412 'known/1__13'(A, B) :-
1413 'known/1__14'(A, B).
1414 'known/1__14'(A, B) :-
1415 nonvar(A),
1416 A= (C=:=D),
1417 ground(D),
1418 ground(C),
1419 C=\=D, !,
1420 ( var(B)
1421 -> true
1422 ; remove_constraint_internal(B, E, F),
1423 ( F==yes
1424 -> '$delete_from_store_known/1'(B),
1425 'detach_known/1'(E, B)
1426 ; true
1429 known(fail).
1430 'known/1__14'(A, B) :-
1431 nonvar(A),
1432 A= (C=\=D),
1433 ground(D),
1434 ground(C),
1435 C=:=D, !,
1436 ( var(B)
1437 -> true
1438 ; remove_constraint_internal(B, E, F),
1439 ( F==yes
1440 -> '$delete_from_store_known/1'(B),
1441 'detach_known/1'(E, B)
1442 ; true
1445 known(fail).
1446 'known/1__14'(A, B) :-
1447 nonvar(A),
1448 A= (C=\=D),
1449 D==C, !,
1450 ( var(B)
1451 -> true
1452 ; remove_constraint_internal(B, E, F),
1453 ( F==yes
1454 -> '$delete_from_store_known/1'(B),
1455 'detach_known/1'(E, B)
1456 ; true
1459 known(fail).
1460 'known/1__14'(A, B) :-
1461 nonvar(A),
1462 A= (C=:=D),
1463 'chr via_2'(C, D, E),
1464 get_attr(E, guard_entailment, F),
1465 F=v(G, H, I),
1466 G/\1=:=1,
1467 'chr sbag_member'(J, H),
1468 J=suspension(K, L, M, N, O, P, Q),
1469 L=mutable(active),
1470 nonvar(Q),
1471 Q= (R=\=S),
1472 R==C,
1473 S==D, !,
1474 remove_constraint_internal(J, T, U),
1475 ( U==yes
1476 -> '$delete_from_store_known/1'(J),
1477 'detach_known/1'(T, J)
1478 ; true
1480 ( var(B)
1481 -> true
1482 ; remove_constraint_internal(B, V, W),
1483 ( W==yes
1484 -> '$delete_from_store_known/1'(B),
1485 'detach_known/1'(V, B)
1486 ; true
1489 known(fail).
1490 'known/1__14'(A, B) :-
1491 nonvar(A),
1492 A= (C=\=D),
1493 'chr via_2'(C, D, E),
1494 get_attr(E, guard_entailment, F),
1495 F=v(G, H, I),
1496 G/\1=:=1,
1497 'chr sbag_member'(J, H),
1498 J=suspension(K, L, M, N, O, P, Q),
1499 L=mutable(active),
1500 nonvar(Q),
1501 Q= (R=:=S),
1502 R==C,
1503 S==D, !,
1504 remove_constraint_internal(J, T, U),
1505 ( U==yes
1506 -> '$delete_from_store_known/1'(J),
1507 'detach_known/1'(T, J)
1508 ; true
1510 ( var(B)
1511 -> true
1512 ; remove_constraint_internal(B, V, W),
1513 ( W==yes
1514 -> '$delete_from_store_known/1'(B),
1515 'detach_known/1'(V, B)
1516 ; true
1519 known(fail).
1520 'known/1__14'(A, B) :-
1521 nonvar(A),
1522 A= (C=:=D),
1523 'chr via_1'(D, E),
1524 get_attr(E, guard_entailment, F),
1525 F=v(G, H, I),
1526 G/\1=:=1, !,
1527 'known/1__14__0'(H, A, B, C, D).
1528 'known/1__14__0'([], A, B, C, D) :-
1529 'known/1__15'(A, B).
1530 'known/1__14__0'([A|B], C, D, E, F) :-
1531 ( A=suspension(G, H, I, J, K, L, M),
1532 H=mutable(active),
1533 nonvar(M),
1534 M= (N=:=O),
1535 N==F,
1536 P=t(54, D, A),
1537 'chr novel_production'(D, P),
1538 'chr novel_production'(A, P),
1539 E\==O
1540 -> 'chr extend_history'(D, P),
1541 activate_constraint(Q, R, D, S),
1542 ( Q==yes
1543 -> '$insert_in_store_known/1'(D),
1544 'attach_known/1'(R, D)
1545 ; true
1547 known(E=:=O),
1548 ( D=suspension(T, U, V, W, X, Y, Z),
1549 U=mutable(active),
1550 W=mutable(S)
1551 -> 'chr update_mutable'(inactive, U),
1552 'known/1__14__0'(B, C, D, E, F)
1553 ; true
1555 ; 'known/1__14__0'(B, C, D, E, F)
1557 'known/1__14'(A, B) :-
1558 'known/1__15'(A, B).
1559 'known/1__15'(A, B) :-
1560 nonvar(A),
1561 A= (C=:=D),
1562 'chr via_1'(C, E),
1563 get_attr(E, guard_entailment, F),
1564 F=v(G, H, I),
1565 G/\1=:=1, !,
1566 'known/1__15__0'(H, A, B, C, D).
1567 'known/1__15__0'([], A, B, C, D) :-
1568 'known/1__16'(A, B).
1569 'known/1__15__0'([A|B], C, D, E, F) :-
1570 ( A=suspension(G, H, I, J, K, L, M),
1571 H=mutable(active),
1572 nonvar(M),
1573 M= (N=:=O),
1574 O==E,
1575 P=t(54, A, D),
1576 'chr novel_production'(A, P),
1577 'chr novel_production'(D, P),
1578 N\==F
1579 -> 'chr extend_history'(D, P),
1580 activate_constraint(Q, R, D, S),
1581 ( Q==yes
1582 -> '$insert_in_store_known/1'(D),
1583 'attach_known/1'(R, D)
1584 ; true
1586 known(N=:=F),
1587 ( D=suspension(T, U, V, W, X, Y, Z),
1588 U=mutable(active),
1589 W=mutable(S)
1590 -> 'chr update_mutable'(inactive, U),
1591 'known/1__15__0'(B, C, D, E, F)
1592 ; true
1594 ; 'known/1__15__0'(B, C, D, E, F)
1596 'known/1__15'(A, B) :-
1597 'known/1__16'(A, B).
1598 'known/1__16'(A, B) :-
1599 nonvar(A),
1600 A= (C=:=D),
1601 'chr novel_production'(B, 55), !,
1602 'chr extend_history'(B, 55),
1603 activate_constraint(E, F, B, G),
1604 ( E==yes
1605 -> '$insert_in_store_known/1'(B),
1606 'attach_known/1'(F, B)
1607 ; true
1609 known(D=:=C),
1610 ( B=suspension(H, I, J, K, L, M, N),
1611 I=mutable(active),
1612 K=mutable(G)
1613 -> 'chr update_mutable'(inactive, I),
1614 'known/1__17'(A, B)
1615 ; true
1617 'known/1__16'(A, B) :-
1618 'known/1__17'(A, B).
1619 'known/1__17'(A, B) :-
1620 nonvar(A),
1621 A= (C=\=D),
1622 'chr novel_production'(B, 56), !,
1623 'chr extend_history'(B, 56),
1624 activate_constraint(E, F, B, G),
1625 ( E==yes
1626 -> '$insert_in_store_known/1'(B),
1627 'attach_known/1'(F, B)
1628 ; true
1630 known(D=\=C),
1631 ( B=suspension(H, I, J, K, L, M, N),
1632 I=mutable(active),
1633 K=mutable(G)
1634 -> 'chr update_mutable'(inactive, I),
1635 'known/1__18'(A, B)
1636 ; true
1638 'known/1__17'(A, B) :-
1639 'known/1__18'(A, B).
1640 'known/1__18'(A, B) :-
1641 nonvar(A),
1642 A=number(C),
1643 nonvar(C),
1644 \+number(C), !,
1645 ( var(B)
1646 -> true
1647 ; remove_constraint_internal(B, D, E),
1648 ( E==yes
1649 -> '$delete_from_store_known/1'(B),
1650 'detach_known/1'(D, B)
1651 ; true
1654 known(fail).
1655 'known/1__18'(A, B) :-
1656 nonvar(A),
1657 A=float(C),
1658 nonvar(C),
1659 \+float(C), !,
1660 ( var(B)
1661 -> true
1662 ; remove_constraint_internal(B, D, E),
1663 ( E==yes
1664 -> '$delete_from_store_known/1'(B),
1665 'detach_known/1'(D, B)
1666 ; true
1669 known(fail).
1670 'known/1__18'(A, B) :-
1671 nonvar(A),
1672 A=integer(C),
1673 nonvar(C),
1674 \+integer(C), !,
1675 ( var(B)
1676 -> true
1677 ; remove_constraint_internal(B, D, E),
1678 ( E==yes
1679 -> '$delete_from_store_known/1'(B),
1680 'detach_known/1'(D, B)
1681 ; true
1684 known(fail).
1685 'known/1__18'(A, B) :-
1686 nonvar(A),
1687 A=integer(C),
1688 'chr novel_production'(B, 60), !,
1689 'chr extend_history'(B, 60),
1690 activate_constraint(D, E, B, F),
1691 ( D==yes
1692 -> '$insert_in_store_known/1'(B),
1693 'attach_known/1'(E, B)
1694 ; true
1696 known(number(C)),
1697 ( B=suspension(G, H, I, J, K, L, M),
1698 H=mutable(active),
1699 J=mutable(F)
1700 -> 'chr update_mutable'(inactive, H),
1701 'known/1__19'(A, B)
1702 ; true
1704 'known/1__18'(A, B) :-
1705 'known/1__19'(A, B).
1706 'known/1__19'(A, B) :-
1707 nonvar(A),
1708 A=float(C),
1709 'chr novel_production'(B, 61), !,
1710 'chr extend_history'(B, 61),
1711 activate_constraint(D, E, B, F),
1712 ( D==yes
1713 -> '$insert_in_store_known/1'(B),
1714 'attach_known/1'(E, B)
1715 ; true
1717 known(number(C)),
1718 ( B=suspension(G, H, I, J, K, L, M),
1719 H=mutable(active),
1720 J=mutable(F)
1721 -> 'chr update_mutable'(inactive, H),
1722 'known/1__20'(A, B)
1723 ; true
1725 'known/1__19'(A, B) :-
1726 'known/1__20'(A, B).
1727 'known/1__20'(A, B) :-
1728 'chr via_1'(A, C),
1729 get_attr(C, guard_entailment, D),
1730 D=v(E, F, G),
1731 E/\1=:=1,
1732 'chr sbag_member'(H, F),
1733 H=suspension(I, J, K, L, M, N, O),
1734 J=mutable(active),
1735 nonvar(O),
1736 O= (\+P),
1737 P==A, !,
1738 remove_constraint_internal(H, Q, R),
1739 ( R==yes
1740 -> '$delete_from_store_known/1'(H),
1741 'detach_known/1'(Q, H)
1742 ; true
1744 ( var(B)
1745 -> true
1746 ; remove_constraint_internal(B, S, T),
1747 ( T==yes
1748 -> '$delete_from_store_known/1'(B),
1749 'detach_known/1'(S, B)
1750 ; true
1753 known(fail).
1754 'known/1__20'(A, B) :-
1755 nonvar(A),
1756 A= (\+C),
1757 'chr via_1'(C, D),
1758 get_attr(D, guard_entailment, E),
1759 E=v(F, G, H),
1760 F/\1=:=1,
1761 'chr sbag_member'(I, G),
1762 I=suspension(J, K, L, M, N, O, P),
1763 K=mutable(active),
1764 P==C, !,
1765 remove_constraint_internal(I, Q, R),
1766 ( R==yes
1767 -> '$delete_from_store_known/1'(I),
1768 'detach_known/1'(Q, I)
1769 ; true
1771 ( var(B)
1772 -> true
1773 ; remove_constraint_internal(B, S, T),
1774 ( T==yes
1775 -> '$delete_from_store_known/1'(B),
1776 'detach_known/1'(S, B)
1777 ; true
1780 known(fail).
1781 'known/1__20'(A, B) :-
1782 nonvar(A),
1783 A= (C\==D),
1784 'chr via_2'(C, D, E),
1785 get_attr(E, guard_entailment, F),
1786 F=v(G, H, I),
1787 G/\1=:=1,
1788 'chr sbag_member'(J, H),
1789 J=suspension(K, L, M, N, O, P, Q),
1790 L=mutable(active),
1791 nonvar(Q),
1792 Q= (R==S),
1793 R==C,
1794 S==D, !,
1795 remove_constraint_internal(J, T, U),
1796 ( U==yes
1797 -> '$delete_from_store_known/1'(J),
1798 'detach_known/1'(T, J)
1799 ; true
1801 ( var(B)
1802 -> true
1803 ; remove_constraint_internal(B, V, W),
1804 ( W==yes
1805 -> '$delete_from_store_known/1'(B),
1806 'detach_known/1'(V, B)
1807 ; true
1810 known(fail).
1811 'known/1__20'(A, B) :-
1812 nonvar(A),
1813 A= (C==D),
1814 'chr via_2'(C, D, E),
1815 get_attr(E, guard_entailment, F),
1816 F=v(G, H, I),
1817 G/\1=:=1,
1818 'chr sbag_member'(J, H),
1819 J=suspension(K, L, M, N, O, P, Q),
1820 L=mutable(active),
1821 nonvar(Q),
1822 Q= (R\==S),
1823 R==C,
1824 S==D, !,
1825 remove_constraint_internal(J, T, U),
1826 ( U==yes
1827 -> '$delete_from_store_known/1'(J),
1828 'detach_known/1'(T, J)
1829 ; true
1831 ( var(B)
1832 -> true
1833 ; remove_constraint_internal(B, V, W),
1834 ( W==yes
1835 -> '$delete_from_store_known/1'(B),
1836 'detach_known/1'(V, B)
1837 ; true
1840 known(fail).
1841 'known/1__20'(A, B) :-
1842 nonvar(A),
1843 A= (C==D),
1844 'chr via_1'(D, E),
1845 get_attr(E, guard_entailment, F),
1846 F=v(G, H, I),
1847 G/\1=:=1, !,
1848 'known/1__20__0'(H, A, B, C, D).
1849 'known/1__20__0'([], A, B, C, D) :-
1850 'known/1__21'(A, B).
1851 'known/1__20__0'([A|B], C, D, E, F) :-
1852 ( A=suspension(G, H, I, J, K, L, M),
1853 H=mutable(active),
1854 nonvar(M),
1855 M= (N==O),
1856 N==F,
1857 P=t(64, D, A),
1858 'chr novel_production'(D, P),
1859 'chr novel_production'(A, P)
1860 -> 'chr extend_history'(D, P),
1861 activate_constraint(Q, R, D, S),
1862 ( Q==yes
1863 -> '$insert_in_store_known/1'(D),
1864 'attach_known/1'(R, D)
1865 ; true
1867 known(E==O),
1868 ( D=suspension(T, U, V, W, X, Y, Z),
1869 U=mutable(active),
1870 W=mutable(S)
1871 -> 'chr update_mutable'(inactive, U),
1872 'known/1__20__0'(B, C, D, E, F)
1873 ; true
1875 ; 'known/1__20__0'(B, C, D, E, F)
1877 'known/1__20'(A, B) :-
1878 'known/1__21'(A, B).
1879 'known/1__21'(A, B) :-
1880 nonvar(A),
1881 A= (C==D),
1882 'chr via_1'(C, E),
1883 get_attr(E, guard_entailment, F),
1884 F=v(G, H, I),
1885 G/\1=:=1, !,
1886 'known/1__21__0'(H, A, B, C, D).
1887 'known/1__21__0'([], A, B, C, D) :-
1888 'known/1__22'(A, B).
1889 'known/1__21__0'([A|B], C, D, E, F) :-
1890 ( A=suspension(G, H, I, J, K, L, M),
1891 H=mutable(active),
1892 nonvar(M),
1893 M= (N==O),
1894 O==E,
1895 P=t(64, A, D),
1896 'chr novel_production'(A, P),
1897 'chr novel_production'(D, P)
1898 -> 'chr extend_history'(D, P),
1899 activate_constraint(Q, R, D, S),
1900 ( Q==yes
1901 -> '$insert_in_store_known/1'(D),
1902 'attach_known/1'(R, D)
1903 ; true
1905 known(N==F),
1906 ( D=suspension(T, U, V, W, X, Y, Z),
1907 U=mutable(active),
1908 W=mutable(S)
1909 -> 'chr update_mutable'(inactive, U),
1910 'known/1__21__0'(B, C, D, E, F)
1911 ; true
1913 ; 'known/1__21__0'(B, C, D, E, F)
1915 'known/1__21'(A, B) :-
1916 'known/1__22'(A, B).
1917 'known/1__22'(A, B) :-
1918 nonvar(A),
1919 A= (C==D),
1920 'chr via_1'(D, E),
1921 get_attr(E, guard_entailment, F),
1922 F=v(G, H, I),
1923 G/\1=:=1, !,
1924 'known/1__22__0'(H, A, B, C, D).
1925 'known/1__22__0'([], A, B, C, D) :-
1926 'known/1__23'(A, B).
1927 'known/1__22__0'([A|B], C, D, E, F) :-
1928 ( A=suspension(G, H, I, J, K, L, M),
1929 H=mutable(active),
1930 nonvar(M),
1931 M= (N\==O),
1932 N==F,
1933 P=t(65, D, A),
1934 'chr novel_production'(D, P),
1935 'chr novel_production'(A, P)
1936 -> 'chr extend_history'(D, P),
1937 activate_constraint(Q, R, D, S),
1938 ( Q==yes
1939 -> '$insert_in_store_known/1'(D),
1940 'attach_known/1'(R, D)
1941 ; true
1943 known(E\==O),
1944 ( D=suspension(T, U, V, W, X, Y, Z),
1945 U=mutable(active),
1946 W=mutable(S)
1947 -> 'chr update_mutable'(inactive, U),
1948 'known/1__22__0'(B, C, D, E, F)
1949 ; true
1951 ; 'known/1__22__0'(B, C, D, E, F)
1953 'known/1__22'(A, B) :-
1954 'known/1__23'(A, B).
1955 'known/1__23'(A, B) :-
1956 nonvar(A),
1957 A= (C\==D),
1958 'chr via_1'(C, E),
1959 get_attr(E, guard_entailment, F),
1960 F=v(G, H, I),
1961 G/\1=:=1, !,
1962 'known/1__23__0'(H, A, B, C, D).
1963 'known/1__23__0'([], A, B, C, D) :-
1964 'known/1__24'(A, B).
1965 'known/1__23__0'([A|B], C, D, E, F) :-
1966 ( A=suspension(G, H, I, J, K, L, M),
1967 H=mutable(active),
1968 nonvar(M),
1969 M= (N==O),
1970 O==E,
1971 P=t(65, A, D),
1972 'chr novel_production'(A, P),
1973 'chr novel_production'(D, P)
1974 -> 'chr extend_history'(D, P),
1975 activate_constraint(Q, R, D, S),
1976 ( Q==yes
1977 -> '$insert_in_store_known/1'(D),
1978 'attach_known/1'(R, D)
1979 ; true
1981 known(N\==F),
1982 ( D=suspension(T, U, V, W, X, Y, Z),
1983 U=mutable(active),
1984 W=mutable(S)
1985 -> 'chr update_mutable'(inactive, U),
1986 'known/1__23__0'(B, C, D, E, F)
1987 ; true
1989 ; 'known/1__23__0'(B, C, D, E, F)
1991 'known/1__23'(A, B) :-
1992 'known/1__24'(A, B).
1993 'known/1__24'(A, B) :-
1994 nonvar(A),
1995 A= (C==D),
1996 'chr novel_production'(B, 66), !,
1997 'chr extend_history'(B, 66),
1998 activate_constraint(E, F, B, G),
1999 ( E==yes
2000 -> '$insert_in_store_known/1'(B),
2001 'attach_known/1'(F, B)
2002 ; true
2004 known(D==C),
2005 ( B=suspension(H, I, J, K, L, M, N),
2006 I=mutable(active),
2007 K=mutable(G)
2008 -> 'chr update_mutable'(inactive, I),
2009 'known/1__25'(A, B)
2010 ; true
2012 'known/1__24'(A, B) :-
2013 'known/1__25'(A, B).
2014 'known/1__25'(A, B) :-
2015 nonvar(A),
2016 A= (C\==D),
2017 'chr novel_production'(B, 67), !,
2018 'chr extend_history'(B, 67),
2019 activate_constraint(E, F, B, G),
2020 ( E==yes
2021 -> '$insert_in_store_known/1'(B),
2022 'attach_known/1'(F, B)
2023 ; true
2025 known(D\==C),
2026 ( B=suspension(H, I, J, K, L, M, N),
2027 I=mutable(active),
2028 K=mutable(G)
2029 -> 'chr update_mutable'(inactive, I),
2030 'known/1__26'(A, B)
2031 ; true
2033 'known/1__25'(A, B) :-
2034 'known/1__26'(A, B).
2035 'known/1__26'(A, B) :-
2036 nonvar(A),
2037 A= (C\==D),
2038 D==C,
2039 'chr novel_production'(B, 68), !,
2040 'chr extend_history'(B, 68),
2041 activate_constraint(E, F, B, G),
2042 ( E==yes
2043 -> '$insert_in_store_known/1'(B),
2044 'attach_known/1'(F, B)
2045 ; true
2047 known(fail),
2048 ( B=suspension(H, I, J, K, L, M, N),
2049 I=mutable(active),
2050 K=mutable(G)
2051 -> 'chr update_mutable'(inactive, I),
2052 'known/1__27'(A, B)
2053 ; true
2055 'known/1__26'(A, B) :-
2056 'known/1__27'(A, B).
2057 'known/1__27'(A, B) :-
2058 nonvar(A),
2059 A= (C\==D),
2060 nonvar(D),
2061 nonvar(C),
2062 'chr lock'(C),
2063 functor(C, E, F),
2064 chr_runtime:unlock(C), !,
2065 ( var(B)
2066 -> true
2067 ; remove_constraint_internal(B, G, H),
2068 ( H==yes
2069 -> '$delete_from_store_known/1'(B),
2070 'detach_known/1'(G, B)
2071 ; true
2074 ( functor(D, E, F)
2075 -> C=..[E|I],
2076 D=..[E|J],
2077 add_args_nmatch(I, J, K),
2078 known(K)
2079 ; true
2081 'known/1__27'(A, B) :-
2082 nonvar(A),
2083 A= (C==D),
2084 'chr novel_production'(B, 70), !,
2085 'chr extend_history'(B, 70),
2086 activate_constraint(E, F, B, G),
2087 ( E==yes
2088 -> '$insert_in_store_known/1'(B),
2089 'attach_known/1'(F, B)
2090 ; true
2092 known(C=D),
2093 ( B=suspension(H, I, J, K, L, M, N),
2094 I=mutable(active),
2095 K=mutable(G)
2096 -> 'chr update_mutable'(inactive, I),
2097 'known/1__28'(A, B)
2098 ; true
2100 'known/1__27'(A, B) :-
2101 'known/1__28'(A, B).
2102 'known/1__28'(A, B) :-
2103 nonvar(A),
2104 A=ground(C),
2105 'chr novel_production'(B, 71), !,
2106 'chr extend_history'(B, 71),
2107 activate_constraint(D, E, B, F),
2108 ( D==yes
2109 -> '$insert_in_store_known/1'(B),
2110 'attach_known/1'(E, B)
2111 ; true
2113 known(nonvar(C)),
2114 ( B=suspension(G, H, I, J, K, L, M),
2115 H=mutable(active),
2116 J=mutable(F)
2117 -> 'chr update_mutable'(inactive, H),
2118 'known/1__29'(A, B)
2119 ; true
2121 'known/1__28'(A, B) :-
2122 'known/1__29'(A, B).
2123 'known/1__29'(A, B) :-
2124 nonvar(A),
2125 A=compound(C),
2126 'chr novel_production'(B, 72), !,
2127 'chr extend_history'(B, 72),
2128 activate_constraint(D, E, B, F),
2129 ( D==yes
2130 -> '$insert_in_store_known/1'(B),
2131 'attach_known/1'(E, B)
2132 ; true
2134 known(nonvar(C)),
2135 ( B=suspension(G, H, I, J, K, L, M),
2136 H=mutable(active),
2137 J=mutable(F)
2138 -> 'chr update_mutable'(inactive, H),
2139 'known/1__30'(A, B)
2140 ; true
2142 'known/1__29'(A, B) :-
2143 'known/1__30'(A, B).
2144 'known/1__30'(A, B) :-
2145 nonvar(A),
2146 A=atomic(C),
2147 'chr novel_production'(B, 73), !,
2148 'chr extend_history'(B, 73),
2149 activate_constraint(D, E, B, F),
2150 ( D==yes
2151 -> '$insert_in_store_known/1'(B),
2152 'attach_known/1'(E, B)
2153 ; true
2155 known(nonvar(C)),
2156 ( B=suspension(G, H, I, J, K, L, M),
2157 H=mutable(active),
2158 J=mutable(F)
2159 -> 'chr update_mutable'(inactive, H),
2160 'known/1__31'(A, B)
2161 ; true
2163 'known/1__30'(A, B) :-
2164 'known/1__31'(A, B).
2165 'known/1__31'(A, B) :-
2166 nonvar(A),
2167 A=number(C),
2168 'chr novel_production'(B, 74), !,
2169 'chr extend_history'(B, 74),
2170 activate_constraint(D, E, B, F),
2171 ( D==yes
2172 -> '$insert_in_store_known/1'(B),
2173 'attach_known/1'(E, B)
2174 ; true
2176 known(nonvar(C)),
2177 ( B=suspension(G, H, I, J, K, L, M),
2178 H=mutable(active),
2179 J=mutable(F)
2180 -> 'chr update_mutable'(inactive, H),
2181 'known/1__32'(A, B)
2182 ; true
2184 'known/1__31'(A, B) :-
2185 'known/1__32'(A, B).
2186 'known/1__32'(A, B) :-
2187 nonvar(A),
2188 A=atom(C),
2189 'chr novel_production'(B, 75), !,
2190 'chr extend_history'(B, 75),
2191 activate_constraint(D, E, B, F),
2192 ( D==yes
2193 -> '$insert_in_store_known/1'(B),
2194 'attach_known/1'(E, B)
2195 ; true
2197 known(nonvar(C)),
2198 ( B=suspension(G, H, I, J, K, L, M),
2199 H=mutable(active),
2200 J=mutable(F)
2201 -> 'chr update_mutable'(inactive, H),
2202 'known/1__33'(A, B)
2203 ; true
2205 'known/1__32'(A, B) :-
2206 'known/1__33'(A, B).
2207 'known/1__33'(A, B) :-
2208 nonvar(A),
2209 A=var(C),
2210 'chr via_1'(C, D),
2211 get_attr(D, guard_entailment, E),
2212 E=v(F, G, H),
2213 F/\1=:=1,
2214 'chr sbag_member'(I, G),
2215 I=suspension(J, K, L, M, N, O, P),
2216 K=mutable(active),
2217 nonvar(P),
2218 P=nonvar(Q),
2219 Q==C, !,
2220 remove_constraint_internal(I, R, S),
2221 ( S==yes
2222 -> '$delete_from_store_known/1'(I),
2223 'detach_known/1'(R, I)
2224 ; true
2226 ( var(B)
2227 -> true
2228 ; remove_constraint_internal(B, T, U),
2229 ( U==yes
2230 -> '$delete_from_store_known/1'(B),
2231 'detach_known/1'(T, B)
2232 ; true
2235 known(fail).
2236 'known/1__33'(A, B) :-
2237 nonvar(A),
2238 A=nonvar(C),
2239 'chr via_1'(C, D),
2240 get_attr(D, guard_entailment, E),
2241 E=v(F, G, H),
2242 F/\1=:=1,
2243 'chr sbag_member'(I, G),
2244 I=suspension(J, K, L, M, N, O, P),
2245 K=mutable(active),
2246 nonvar(P),
2247 P=var(Q),
2248 Q==C, !,
2249 remove_constraint_internal(I, R, S),
2250 ( S==yes
2251 -> '$delete_from_store_known/1'(I),
2252 'detach_known/1'(R, I)
2253 ; true
2255 ( var(B)
2256 -> true
2257 ; remove_constraint_internal(B, T, U),
2258 ( U==yes
2259 -> '$delete_from_store_known/1'(B),
2260 'detach_known/1'(T, B)
2261 ; true
2264 known(fail).
2265 'known/1__33'(A, B) :-
2266 nonvar(A),
2267 A= (C;D),
2268 nonvar(C),
2269 C= (\+E),
2270 'chr via_1'(E, F),
2271 get_attr(F, guard_entailment, G),
2272 G=v(H, I, J),
2273 H/\1=:=1,
2274 'chr sbag_member'(K, I),
2275 K=suspension(L, M, N, O, P, Q, R),
2276 M=mutable(active),
2277 R==E, !,
2278 ( var(B)
2279 -> true
2280 ; remove_constraint_internal(B, S, T),
2281 ( T==yes
2282 -> '$delete_from_store_known/1'(B),
2283 'detach_known/1'(S, B)
2284 ; true
2287 known(D).
2288 'known/1__33'(A, B) :-
2289 'chr via_1'(A, C),
2290 get_attr(C, guard_entailment, D),
2291 D=v(E, F, G),
2292 E/\1=:=1, !,
2293 'known/1__33__0'(F, A, B).
2294 'known/1__33__0'([], A, B) :-
2295 'known/1__34'(A, B).
2296 'known/1__33__0'([A|B], C, D) :-
2297 ( A=suspension(E, F, G, H, I, J, K),
2298 F=mutable(active),
2299 nonvar(K),
2300 K= (L;M),
2301 nonvar(L),
2302 L= (\+N),
2303 N==C
2304 -> remove_constraint_internal(A, O, P),
2305 ( P==yes
2306 -> '$delete_from_store_known/1'(A),
2307 'detach_known/1'(O, A)
2308 ; true
2310 activate_constraint(Q, R, D, S),
2311 ( Q==yes
2312 -> '$insert_in_store_known/1'(D),
2313 'attach_known/1'(R, D)
2314 ; true
2316 known(M),
2317 ( D=suspension(T, U, V, W, X, Y, Z),
2318 U=mutable(active),
2319 W=mutable(S)
2320 -> 'chr update_mutable'(inactive, U),
2321 'known/1__33__0'(B, C, D)
2322 ; true
2324 ; 'known/1__33__0'(B, C, D)
2326 'known/1__33'(A, B) :-
2327 'known/1__34'(A, B).
2328 'known/1__34'(A, B) :-
2329 nonvar(A),
2330 A= (C;D),
2331 nonvar(C),
2332 C= (E, F),
2333 nonvar(E),
2334 E= (\+G),
2335 'chr via_1'(G, H),
2336 get_attr(H, guard_entailment, I),
2337 I=v(J, K, L),
2338 J/\1=:=1,
2339 'chr sbag_member'(M, K),
2340 M=suspension(N, O, P, Q, R, S, T),
2341 O=mutable(active),
2342 T==G, !,
2343 ( var(B)
2344 -> true
2345 ; remove_constraint_internal(B, U, V),
2346 ( V==yes
2347 -> '$delete_from_store_known/1'(B),
2348 'detach_known/1'(U, B)
2349 ; true
2352 known(D).
2353 'known/1__34'(A, B) :-
2354 'chr via_1'(A, C),
2355 get_attr(C, guard_entailment, D),
2356 D=v(E, F, G),
2357 E/\1=:=1, !,
2358 'known/1__34__0'(F, A, B).
2359 'known/1__34__0'([], A, B) :-
2360 'known/1__35'(A, B).
2361 'known/1__34__0'([A|B], C, D) :-
2362 ( A=suspension(E, F, G, H, I, J, K),
2363 F=mutable(active),
2364 nonvar(K),
2365 K= (L;M),
2366 nonvar(L),
2367 L= (N, O),
2368 nonvar(N),
2369 N= (\+P),
2370 P==C
2371 -> remove_constraint_internal(A, Q, R),
2372 ( R==yes
2373 -> '$delete_from_store_known/1'(A),
2374 'detach_known/1'(Q, A)
2375 ; true
2377 activate_constraint(S, T, D, U),
2378 ( S==yes
2379 -> '$insert_in_store_known/1'(D),
2380 'attach_known/1'(T, D)
2381 ; true
2383 known(M),
2384 ( D=suspension(V, W, X, Y, Z, A1, B1),
2385 W=mutable(active),
2386 Y=mutable(U)
2387 -> 'chr update_mutable'(inactive, W),
2388 'known/1__34__0'(B, C, D)
2389 ; true
2391 ; 'known/1__34__0'(B, C, D)
2393 'known/1__34'(A, B) :-
2394 'known/1__35'(A, B).
2395 'known/1__35'(A, B) :-
2396 nonvar(A),
2397 A= (C;D),
2398 'chr via_1'(C, E),
2399 get_attr(E, guard_entailment, F),
2400 F=v(G, H, I),
2401 G/\1=:=1,
2402 'chr sbag_member'(J, H),
2403 J=suspension(K, L, M, N, O, P, Q),
2404 L=mutable(active),
2405 nonvar(Q),
2406 Q= (\+R),
2407 R==C, !,
2408 ( var(B)
2409 -> true
2410 ; remove_constraint_internal(B, S, T),
2411 ( T==yes
2412 -> '$delete_from_store_known/1'(B),
2413 'detach_known/1'(S, B)
2414 ; true
2417 known(D).
2418 'known/1__35'(A, B) :-
2419 nonvar(A),
2420 A= (\+C),
2421 'chr via_1'(C, D),
2422 get_attr(D, guard_entailment, E),
2423 E=v(F, G, H),
2424 F/\1=:=1, !,
2425 'known/1__35__0'(G, A, B, C).
2426 'known/1__35__0'([], A, B, C) :-
2427 'known/1__36'(A, B).
2428 'known/1__35__0'([A|B], C, D, E) :-
2429 ( A=suspension(F, G, H, I, J, K, L),
2430 G=mutable(active),
2431 nonvar(L),
2432 L= (M;N),
2433 M==E
2434 -> remove_constraint_internal(A, O, P),
2435 ( P==yes
2436 -> '$delete_from_store_known/1'(A),
2437 'detach_known/1'(O, A)
2438 ; true
2440 activate_constraint(Q, R, D, S),
2441 ( Q==yes
2442 -> '$insert_in_store_known/1'(D),
2443 'attach_known/1'(R, D)
2444 ; true
2446 known(N),
2447 ( D=suspension(T, U, V, W, X, Y, Z),
2448 U=mutable(active),
2449 W=mutable(S)
2450 -> 'chr update_mutable'(inactive, U),
2451 'known/1__35__0'(B, C, D, E)
2452 ; true
2454 ; 'known/1__35__0'(B, C, D, E)
2456 'known/1__35'(A, B) :-
2457 'known/1__36'(A, B).
2458 'known/1__36'(A, B) :-
2459 nonvar(A),
2460 A= (C;D),
2461 nonvar(C),
2462 C= (E, F),
2463 'chr via_1'(E, G),
2464 get_attr(G, guard_entailment, H),
2465 H=v(I, J, K),
2466 I/\1=:=1,
2467 'chr sbag_member'(L, J),
2468 L=suspension(M, N, O, P, Q, R, S),
2469 N=mutable(active),
2470 nonvar(S),
2471 S= (\+T),
2472 T==E, !,
2473 ( var(B)
2474 -> true
2475 ; remove_constraint_internal(B, U, V),
2476 ( V==yes
2477 -> '$delete_from_store_known/1'(B),
2478 'detach_known/1'(U, B)
2479 ; true
2482 known(D).
2483 'known/1__36'(A, B) :-
2484 nonvar(A),
2485 A= (\+C),
2486 'chr via_1'(C, D),
2487 get_attr(D, guard_entailment, E),
2488 E=v(F, G, H),
2489 F/\1=:=1, !,
2490 'known/1__36__0'(G, A, B, C).
2491 'known/1__36__0'([], A, B, C) :-
2492 'known/1__37'(A, B).
2493 'known/1__36__0'([A|B], C, D, E) :-
2494 ( A=suspension(F, G, H, I, J, K, L),
2495 G=mutable(active),
2496 nonvar(L),
2497 L= (M;N),
2498 nonvar(M),
2499 M= (O, P),
2500 O==E
2501 -> remove_constraint_internal(A, Q, R),
2502 ( R==yes
2503 -> '$delete_from_store_known/1'(A),
2504 'detach_known/1'(Q, A)
2505 ; true
2507 activate_constraint(S, T, D, U),
2508 ( S==yes
2509 -> '$insert_in_store_known/1'(D),
2510 'attach_known/1'(T, D)
2511 ; true
2513 known(N),
2514 ( D=suspension(V, W, X, Y, Z, A1, B1),
2515 W=mutable(active),
2516 Y=mutable(U)
2517 -> 'chr update_mutable'(inactive, W),
2518 'known/1__36__0'(B, C, D, E)
2519 ; true
2521 ; 'known/1__36__0'(B, C, D, E)
2523 'known/1__36'(A, B) :-
2524 'known/1__37'(A, B).
2525 'known/1__37'(A, B) :-
2526 nonvar(A),
2527 A= (C;D),
2528 C==fail, !,
2529 ( var(B)
2530 -> true
2531 ; remove_constraint_internal(B, E, F),
2532 ( F==yes
2533 -> '$delete_from_store_known/1'(B),
2534 'detach_known/1'(E, B)
2535 ; true
2538 known(D).
2539 'known/1__37'(A, B) :-
2540 nonvar(A),
2541 A= (C;D),
2542 D==fail, !,
2543 ( var(B)
2544 -> true
2545 ; remove_constraint_internal(B, E, F),
2546 ( F==yes
2547 -> '$delete_from_store_known/1'(B),
2548 'detach_known/1'(E, B)
2549 ; true
2552 known(C).
2553 'known/1__37'(A, B) :-
2554 nonvar(A),
2555 A= (C;D),
2556 nonvar(C),
2557 C= (\+E),
2558 nonvar(E),
2559 E=functor(F, G, H),
2560 'chr via_1'(F, I),
2561 get_attr(I, guard_entailment, J),
2562 J=v(K, L, M),
2563 K/\1=:=1,
2564 'chr sbag_member'(N, L),
2565 N=suspension(O, P, Q, R, S, T, U),
2566 P=mutable(active),
2567 nonvar(U),
2568 U=functor(V, W, X),
2569 V==F, !,
2570 ( var(B)
2571 -> true
2572 ; remove_constraint_internal(B, Y, Z),
2573 ( Z==yes
2574 -> '$delete_from_store_known/1'(B),
2575 'detach_known/1'(Y, B)
2576 ; true
2579 'known/1__37'(A, B) :-
2580 nonvar(A),
2581 A=functor(C, D, E),
2582 'chr via_1'(C, F),
2583 get_attr(F, guard_entailment, G),
2584 G=v(H, I, J),
2585 H/\1=:=1, !,
2586 'known/1__37__0'(I, A, B, C).
2587 'known/1__37__0'([], A, B, C) :-
2588 'known/1__38'(A, B).
2589 'known/1__37__0'([A|B], C, D, E) :-
2590 ( A=suspension(F, G, H, I, J, K, L),
2591 G=mutable(active),
2592 nonvar(L),
2593 L= (M;N),
2594 nonvar(M),
2595 M= (\+O),
2596 nonvar(O),
2597 O=functor(P, Q, R),
2598 P==E
2599 -> remove_constraint_internal(A, S, T),
2600 ( T==yes
2601 -> '$delete_from_store_known/1'(A),
2602 'detach_known/1'(S, A)
2603 ; true
2605 'known/1__37__0'(B, C, D, E)
2606 ; 'known/1__37__0'(B, C, D, E)
2608 'known/1__37'(A, B) :-
2609 'known/1__38'(A, B).
2610 'known/1__38'(A, B) :-
2611 nonvar(A),
2612 A= (C;D),
2613 nonvar(C),
2614 C= (\+E),
2615 nonvar(E),
2616 E=functor(F, G, H),
2617 nonvar(F),
2618 'chr lock'(F),
2619 'chr lock'(G),
2620 'chr lock'(H),
2621 functor(F, G, H),
2622 chr_runtime:unlock(F),
2623 chr_runtime:unlock(G),
2624 chr_runtime:unlock(H), !,
2625 ( var(B)
2626 -> true
2627 ; remove_constraint_internal(B, I, J),
2628 ( J==yes
2629 -> '$delete_from_store_known/1'(B),
2630 'detach_known/1'(I, B)
2631 ; true
2634 known(D).
2635 'known/1__38'(A, B) :-
2636 nonvar(A),
2637 A= (C;D),
2638 nonvar(C),
2639 C= (\+E),
2640 nonvar(E),
2641 E=functor(F, G, H),
2642 nonvar(F), !,
2643 ( var(B)
2644 -> true
2645 ; remove_constraint_internal(B, I, J),
2646 ( J==yes
2647 -> '$delete_from_store_known/1'(B),
2648 'detach_known/1'(I, B)
2649 ; true
2652 'known/1__38'(A, B) :-
2653 activate_constraint(C, D, B, E),
2654 ( C==yes
2655 -> '$insert_in_store_known/1'(B),
2656 'attach_known/1'(D, B)
2657 ; true
2659 test(A) :-
2660 'chr global_term_ref_1'(B),
2661 get_attr(B, guard_entailment, C),
2662 C=v(D, E, F),
2663 D/\1=:=1,
2664 'chr sbag_member'(G, E),
2665 G=suspension(H, I, J, K, L, M, N),
2666 I=mutable(active),
2667 N==fail, !.
2668 test(A) :-
2669 'chr via_1'(A, B),
2670 get_attr(B, guard_entailment, C),
2671 C=v(D, E, F),
2672 D/\1=:=1,
2673 'chr sbag_member'(G, E),
2674 G=suspension(H, I, J, K, L, M, N),
2675 I=mutable(active),
2676 N==A, !.
2677 test(A) :-
2678 nonvar(A),
2679 A= (B\==C),
2680 nonvar(B), !,
2681 test(C\==B).
2682 test(A) :-
2683 nonvar(A),
2684 A= (B\==C),
2685 nonvar(C),
2686 'chr lock'(C),
2687 functor(C, D, E),
2688 chr_runtime:unlock(C), !,
2689 C=..[F|G],
2690 length(H, E),
2691 I=..[D|H],
2692 add_args_nmatch(H, G, J),
2693 K= (\+functor(B, D, E);functor(B, D, E), B=I, J),
2694 test(K).
2695 test(A) :-
2696 nonvar(A),
2697 A= (B=<C),
2698 'chr via_2'(B, C, D),
2699 get_attr(D, guard_entailment, E),
2700 E=v(F, G, H),
2701 F/\1=:=1,
2702 'chr sbag_member'(I, G),
2703 I=suspension(J, K, L, M, N, O, P),
2704 K=mutable(active),
2705 nonvar(P),
2706 P= (Q=:=R),
2707 Q==B,
2708 R==C, !.
2709 test(A) :-
2710 nonvar(A),
2711 A= (B=<C),
2712 ground(C),
2713 'chr via_1'(B, D),
2714 get_attr(D, guard_entailment, E),
2715 E=v(F, G, H),
2716 F/\1=:=1,
2717 'chr sbag_member'(I, G),
2718 I=suspension(J, K, L, M, N, O, P),
2719 K=mutable(active),
2720 nonvar(P),
2721 P= (Q=:=R),
2722 Q==B,
2723 ground(R),
2724 R=<C, !.
2725 test(A) :-
2726 nonvar(A),
2727 A= (B=<C),
2728 ground(B),
2729 'chr via_1'(C, D),
2730 get_attr(D, guard_entailment, E),
2731 E=v(F, G, H),
2732 F/\1=:=1,
2733 'chr sbag_member'(I, G),
2734 I=suspension(J, K, L, M, N, O, P),
2735 K=mutable(active),
2736 nonvar(P),
2737 P= (Q=:=R),
2738 Q==C,
2739 ground(R),
2740 B=<R, !.
2741 test(A) :-
2742 nonvar(A),
2743 A= (B=<C),
2744 ground(C),
2745 'chr via_1'(B, D),
2746 get_attr(D, guard_entailment, E),
2747 E=v(F, G, H),
2748 F/\1=:=1,
2749 'chr sbag_member'(I, G),
2750 I=suspension(J, K, L, M, N, O, P),
2751 K=mutable(active),
2752 nonvar(P),
2753 P= (Q=<R),
2754 Q==B,
2755 ground(R),
2756 R=<C, !.
2757 test(A) :-
2758 nonvar(A),
2759 A= (B=<C),
2760 ground(B),
2761 'chr via_1'(C, D),
2762 get_attr(D, guard_entailment, E),
2763 E=v(F, G, H),
2764 F/\1=:=1,
2765 'chr sbag_member'(I, G),
2766 I=suspension(J, K, L, M, N, O, P),
2767 K=mutable(active),
2768 nonvar(P),
2769 P= (Q=<R),
2770 R==C,
2771 ground(Q),
2772 B=<Q, !.
2773 test(A) :-
2774 nonvar(A),
2775 A= (B=\=C),
2776 ground(C),
2777 'chr via_1'(B, D),
2778 get_attr(D, guard_entailment, E),
2779 E=v(F, G, H),
2780 F/\1=:=1,
2781 'chr sbag_member'(I, G),
2782 I=suspension(J, K, L, M, N, O, P),
2783 K=mutable(active),
2784 nonvar(P),
2785 P= (Q=<R),
2786 Q==B,
2787 ground(R),
2788 C>R, !.
2789 test(A) :-
2790 nonvar(A),
2791 A= (B=\=C),
2792 ground(C),
2793 'chr via_1'(B, D),
2794 get_attr(D, guard_entailment, E),
2795 E=v(F, G, H),
2796 F/\1=:=1,
2797 'chr sbag_member'(I, G),
2798 I=suspension(J, K, L, M, N, O, P),
2799 K=mutable(active),
2800 nonvar(P),
2801 P= (Q=<R),
2802 R==B,
2803 ground(Q),
2804 C<Q, !.
2805 test(A) :-
2806 nonvar(A),
2807 A= (B>C), !,
2808 test(C<B).
2809 test(A) :-
2810 nonvar(A),
2811 A= (B>=C), !,
2812 test(C=<B).
2813 test(A) :-
2814 nonvar(A),
2815 A= (B<C), !,
2816 test((B=<C, B=\=C)).
2817 test(A) :-
2818 nonvar(A),
2819 A= (B is C), !,
2820 test(B=:=C).
2821 test(A) :-
2822 nonvar(A),
2823 A= (B;C),
2824 B==fail, !,
2825 test(C).
2826 test(A) :-
2827 nonvar(A),
2828 A= (B;C),
2829 C==fail, !,
2830 test(B).
2831 test(A) :-
2832 nonvar(A),
2833 A= (B=C),
2834 'chr lock'(B),
2835 'chr lock'(C),
2836 B=C,
2837 chr_runtime:unlock(B),
2838 chr_runtime:unlock(C), !,
2839 B=C.
2840 test(A) :-
2841 nonvar(A),
2842 A= (B=C),
2843 ground(C),
2844 ground(B), !,
2845 B=C.
2846 test(A) :-
2847 nonvar(A),
2848 A= (B=C),
2849 var(C),
2850 nonvar(B), !,
2851 test(C=B).
2852 test(A) :-
2853 nonvar(A),
2854 A= (B=C),
2855 nonvar(C),
2856 var(B),
2857 'chr global_term_ref_1'(D),
2858 get_attr(D, guard_entailment, E),
2859 E=v(F, G, H),
2860 F/\2=:=2,
2861 'chr sbag_member'(I, H),
2862 I=suspension(J, K, L, M, N, O, P),
2863 K=mutable(active),
2864 'chr lock'(C),
2865 'chr lock'(P),
2866 functor(C, Q, R),
2867 R>0,
2868 C=..[Q|S],
2869 \+all_unique_vars(S, P),
2870 chr_runtime:unlock(C),
2871 chr_runtime:unlock(P), !,
2872 T= (functor(B, Q, R), B=C),
2873 test(T).
2874 test(A) :-
2875 nonvar(A),
2876 A= (B=C),
2877 nonvar(C),
2878 var(B),
2879 'chr lock'(C),
2880 functor(C, D, E),
2881 C=..[D|F],
2882 chr_runtime:unlock(C), !,
2883 G=functor(B, D, E),
2884 test(G).
2885 test(A) :-
2886 nonvar(A),
2887 A= (B=C),
2888 nonvar(B),
2889 'chr lock'(C),
2890 functor(C, D, E),
2891 C=..[D|F],
2892 chr_runtime:unlock(C), !,
2893 functor(B, D, E),
2894 B=..[D|G],
2895 add_args_unif(G, F, H),
2896 test(H).
2897 test(A) :-
2898 nonvar(A),
2899 A= (B=C),
2900 'chr global_term_ref_1'(D),
2901 get_attr(D, guard_entailment, E),
2902 E=v(F, G, H),
2903 F/\2=:=2,
2904 'chr sbag_member'(I, H),
2905 I=suspension(J, K, L, M, N, O, P),
2906 K=mutable(active),
2907 'chr lock'(C),
2908 'chr lock'(P),
2909 'chr lock'(B),
2910 \+((
2911 memberchk_eq(C, P),
2912 memberchk_eq(B, P)
2914 chr_runtime:unlock(C),
2915 chr_runtime:unlock(P),
2916 chr_runtime:unlock(B), !,
2917 B=C.
2918 test(A) :-
2919 nonvar(A),
2920 A=functor(B, C, D),
2921 ground(D),
2922 ground(C),
2923 var(B),
2924 'chr global_term_ref_1'(E),
2925 get_attr(E, guard_entailment, F),
2926 F=v(G, H, I),
2927 G/\2=:=2,
2928 'chr sbag_member'(J, I),
2929 J=suspension(K, L, M, N, O, P, Q),
2930 L=mutable(active),
2931 'chr lock'(B),
2932 'chr lock'(Q),
2933 \+memberchk_eq(B, Q),
2934 chr_runtime:unlock(B),
2935 chr_runtime:unlock(Q), !,
2936 functor(B, C, D).
2937 test(A) :-
2938 A==true, !.
2939 test(A) :-
2940 nonvar(A),
2941 A= (B==C),
2942 B==C, !.
2943 test(A) :-
2944 nonvar(A),
2945 A= (B=:=C),
2946 B==C, !.
2947 test(A) :-
2948 nonvar(A),
2949 A= (B=<C),
2950 B==C, !.
2951 test(A) :-
2952 nonvar(A),
2953 A= (B=<C),
2954 ground(C),
2955 ground(B),
2956 B=<C, !.
2957 test(A) :-
2958 nonvar(A),
2959 A= (B=<C),
2960 ground(C),
2961 ground(B), !,
2962 fail.
2963 test(A) :-
2964 nonvar(A),
2965 A= (B=:=C),
2966 ground(C),
2967 ground(B),
2968 B=:=C, !.
2969 test(A) :-
2970 nonvar(A),
2971 A= (B=:=C),
2972 ground(C),
2973 ground(B), !,
2974 fail.
2975 test(A) :-
2976 nonvar(A),
2977 A= (B=\=C),
2978 ground(C),
2979 ground(B),
2980 B=\=C, !.
2981 test(A) :-
2982 nonvar(A),
2983 A= (B=\=C),
2984 ground(C),
2985 ground(B), !,
2986 fail.
2987 test(A) :-
2988 nonvar(A),
2989 A=functor(B, C, D),
2990 nonvar(B),
2991 'chr lock'(B),
2992 'chr lock'(C),
2993 'chr lock'(D),
2994 functor(B, C, D),
2995 chr_runtime:unlock(B),
2996 chr_runtime:unlock(C),
2997 chr_runtime:unlock(D), !.
2998 test(A) :-
2999 nonvar(A),
3000 A=functor(B, C, D),
3001 nonvar(B), !,
3002 fail.
3003 test(A) :-
3004 nonvar(A),
3005 A=ground(B),
3006 ground(B), !.
3007 test(A) :-
3008 nonvar(A),
3009 A=number(B),
3010 number(B), !.
3011 test(A) :-
3012 nonvar(A),
3013 A=float(B),
3014 float(B), !.
3015 test(A) :-
3016 nonvar(A),
3017 A=integer(B),
3018 integer(B), !.
3019 test(A) :-
3020 nonvar(A),
3021 A=number(B),
3022 nonvar(B), !,
3023 fail.
3024 test(A) :-
3025 nonvar(A),
3026 A=float(B),
3027 nonvar(B), !,
3028 fail.
3029 test(A) :-
3030 nonvar(A),
3031 A=integer(B),
3032 nonvar(B), !,
3033 fail.
3034 test(A) :-
3035 nonvar(A),
3036 A= (\+B),
3037 nonvar(B),
3038 B=functor(C, D, E),
3039 nonvar(C),
3040 'chr lock'(C),
3041 'chr lock'(D),
3042 'chr lock'(E),
3043 functor(C, D, E),
3044 chr_runtime:unlock(C),
3045 chr_runtime:unlock(D),
3046 chr_runtime:unlock(E), !,
3047 fail.
3048 test(A) :-
3049 nonvar(A),
3050 A= (\+B),
3051 nonvar(B),
3052 B=functor(C, D, E),
3053 nonvar(C), !.
3054 test(A) :-
3055 nonvar(A),
3056 A= (\+B),
3057 nonvar(B),
3058 B=ground(C),
3059 ground(C), !,
3060 fail.
3061 test(A) :-
3062 nonvar(A),
3063 A= (\+B),
3064 nonvar(B),
3065 B=number(C),
3066 number(C), !,
3067 fail.
3068 test(A) :-
3069 nonvar(A),
3070 A= (\+B),
3071 nonvar(B),
3072 B=float(C),
3073 float(C), !,
3074 fail.
3075 test(A) :-
3076 nonvar(A),
3077 A= (\+B),
3078 nonvar(B),
3079 B=integer(C),
3080 integer(C), !,
3081 fail.
3082 test(A) :-
3083 nonvar(A),
3084 A= (\+B),
3085 nonvar(B),
3086 B=number(C),
3087 nonvar(C), !.
3088 test(A) :-
3089 nonvar(A),
3090 A= (\+B),
3091 nonvar(B),
3092 B=float(C),
3093 nonvar(C), !.
3094 test(A) :-
3095 nonvar(A),
3096 A= (\+B),
3097 nonvar(B),
3098 B=integer(C),
3099 nonvar(C), !.
3100 test(A) :-
3101 nonvar(A),
3102 A= (B, C), !,
3103 test(B),
3104 known(B),
3105 test(C).
3106 test(A) :-
3107 nonvar(A),
3108 A= (B;C), !,
3109 builtins:negate_b(B, D),
3110 builtins:negate_b(C, E),
3111 ( known(E),
3112 test(B)
3113 ; known(D),
3114 test(C)
3116 test(A) :-
3117 'chr global_term_ref_1'(B),
3118 get_attr(B, guard_entailment, C),
3119 C=v(D, E, F),
3120 D/\1=:=1,
3121 'chr sbag_member'(G, E),
3122 G=suspension(H, I, J, K, L, M, N),
3123 I=mutable(active),
3124 nonvar(N),
3125 N= (O;P), !,
3126 remove_constraint_internal(G, Q, R),
3127 ( R==yes
3128 -> '$delete_from_store_known/1'(G),
3129 'detach_known/1'(Q, G)
3130 ; true
3132 \+try(O, A), !,
3133 builtins:negate_b(O, S),
3134 known(S),
3135 \+try(P, A).
3136 test(A) :-
3137 fail.
3138 cleanup :-
3139 'chr global_term_ref_1'(A),
3140 get_attr(A, guard_entailment, B),
3141 B=v(C, D, E),
3142 C/\1=:=1, !,
3143 'cleanup/0__0__0'(D).
3144 'cleanup/0__0__0'([]) :-
3145 'cleanup/0__1'.
3146 'cleanup/0__0__0'([A|B]) :-
3147 ( A=suspension(C, D, E, F, G, H, I),
3148 D=mutable(active)
3149 -> remove_constraint_internal(A, J, K),
3150 ( K==yes
3151 -> '$delete_from_store_known/1'(A),
3152 'detach_known/1'(J, A)
3153 ; true
3155 'cleanup/0__0__0'(B)
3156 ; 'cleanup/0__0__0'(B)
3158 cleanup :-
3159 'cleanup/0__1'.
3160 'cleanup/0__1' :-
3161 'chr global_term_ref_1'(A),
3162 get_attr(A, guard_entailment, B),
3163 B=v(C, D, E),
3164 C/\2=:=2, !,
3165 'cleanup/0__1__0'(E).
3166 'cleanup/0__1__0'([]) :-
3167 'cleanup/0__2'.
3168 'cleanup/0__1__0'([A|B]) :-
3169 ( A=suspension(C, D, E, F, G, H, I),
3170 D=mutable(active)
3171 -> remove_constraint_internal(A, J, K),
3172 ( K==yes
3173 -> '$delete_from_store_variables/1'(A),
3174 'detach_variables/1'(J, A)
3175 ; true
3177 'cleanup/0__1__0'(B)
3178 ; 'cleanup/0__1__0'(B)
3180 'cleanup/0__1' :-
3181 'cleanup/0__2'.
3182 'cleanup/0__2'.
3183 variables(A) :-
3184 'variables/1__0'(A, B).
3185 'variables/1__0'(A, B) :-
3186 'chr global_term_ref_1'(C),
3187 get_attr(C, guard_entailment, D),
3188 D=v(E, F, G),
3189 E/\1=:=1,
3190 'chr sbag_member'(H, F),
3191 H=suspension(I, J, K, L, M, N, O),
3192 J=mutable(active),
3193 nonvar(O),
3194 O=functor(P, Q, R),
3195 ground(R),
3196 ground(Q),
3197 var(P), !,
3198 remove_constraint_internal(H, S, T),
3199 ( T==yes
3200 -> '$delete_from_store_known/1'(H),
3201 'detach_known/1'(S, H)
3202 ; true
3204 ( var(B)
3205 -> true
3206 ; remove_constraint_internal(B, U, V),
3207 ( V==yes
3208 -> '$delete_from_store_variables/1'(B),
3209 'detach_variables/1'(U, B)
3210 ; true
3213 functor(W, Q, R),
3214 P=W,
3215 P=..[X|Y],
3216 append(Y, A, Z),
3217 variables(Z).
3218 'variables/1__0'(A, B) :-
3219 ( var(B)
3220 -> insert_constraint_internal(C, D, B, guard_entailment:'variables/1__0'(A, B), variables(A), [A])
3221 ; activate_constraint(C, D, B, E)
3223 ( C==yes
3224 -> '$insert_in_store_variables/1'(B),
3225 'attach_variables/1'(D, B)
3226 ; true
3228 :-multifile chr:'$chr_module'/1.
3229 chr:'$chr_module'(guard_entailment).