3
4
5:- ( current_module(chr) -> true ; use_module(library(chr)) ). 6
7:- get_flag(variable_names, Val), setval(variable_names_flag, Val), set_flag(variable_names, off). 8eq(_25428, _25431, _25434) :- functor(_25428, _25446, _25449), functor(_25431, _25461, _25464), (_25446 = _25461, _25449 = _25464 -> _25428 =.. [_25487|_25489], _25431 =.. [_25496|_25498], and_eq(_25489, _25498, _25434) ; _25434 = (0 #\= 0)).
9neq(_25973, _25976) :- or_neq(exists, _25973, _25976).
10neq(_26004, _26007, _26010) :- or_neq_c(exists, _26004, _26007, _26010).
11neq_all(_26042, _26045) :- or_neq(forall, _26042, _26045).
12neq_all(_26073, _26076, _26079) :- or_neq_c(forall, _26073, _26076, _26079).
13or_neq(_26111, _26114, _26117) :- functor(_26114, _26129, _26132), functor(_26117, _26144, _26147), (_26129 = _26144, _26132 = _26147 -> _26114 =.. [_26170|_26172], _26117 =.. [_26179|_26181], or_neq(_26111, _26172, _26181, _26193), call(_26193) ; true).
14or_neq_c(_26658, _26661, _26664, _26667) :- functor(_26661, _26680, _26683), functor(_26664, _26695, _26698), (_26680 = _26695, _26683 = _26698 -> _26661 =.. [_26721|_26723], _26664 =.. [_26730|_26732], or_neq(_26658, _26723, _26732, _26667) ; _26667 = (0 #= 0)).
15or_neq(_27236, [], [], 0 #\= 0).
16or_neq(_27324, [_27329|_27330], [_27335|_27336], _27339) :- or_neq(_27324, _27330, _27336, _27356), (_27324 = forall, var(_27329), \+ is_domain(_27329) -> (binding(_27329, _27330, _27336, _27395) -> _27339 = #\/(_27335 #\= _27395, _27356) ; _27339 = _27356) ; _27339 = #\/(_27329 #\= _27335, _27356)).
17binding(_27952, [_27957|_27958], [_27963|_27964], _27967) :- _27952 == _27957 -> _27967 = _27963 ; binding(_27952, _27958, _27964, _27967).
18and_eq([], [], 0 #= 0).
19and_eq([_28101|_28102], [_28107|_28108], _28111) :- and_eq(_28102, _28108, _28125), _28111 = #/\(_28101 #= _28107, _28125).
20or_and_eq([], 0 #\= 0).
21or_and_eq([_28427|_28428], #\/(_28431, _28435)) :- (_28427 = eq(_28447, _28450) -> and_eq(_28447, _28450, _28431) ; _28427 = neq(_28447, _28450), or_neq(exists, _28447, _28450, _28431)), or_and_eq(_28428, _28435).
22inst(_28848, _28851) :- \+ (term_variables(_28848, _28864), term_variables(_28851, _28875), bound_free(_28875, _28864, _28888, _28891), copy_term_vars(_28891, _28851, _28906), \+ no_global_bindings(_28848 = _28906, _28888)).
23copy_fluent(_29230, _29233, _29236, _29239) :- term_variables(_29230, _29252), bound_free(_29252, [], _29271, _29267), copy_term_vars(_29267, [_29230, _29233], [_29236, _29239]).
24bound_free([], _29577, _29577, []).
25bound_free([_29600|_29601], _29604, _29607, _29610) :- bound_free(_29601, _29604, _29625, _29628), (is_domain(_29600) -> _29607 = [_29600|_29625], _29610 = _29628 ; _29607 = _29625, _29610 = [_29600|_29628]).
26member(_30026, [_30026|_30031], _30031).
27member(_30049, [_30054|_30055], [_30054|_30060]) :- member(_30049, _30055, _30060).
28not_holds(A, B) :-
29 'CHRgen_num'(C),
30 coca(add_one_constraint(C, not_holds(A, B))),
31 'CHRnot_holds_2'(not_holds(A, B), D, E, C).
32
33
34
36
37'CHRnot_holds_2'(not_holds(A, B), C, D, E) :-
38 (
39 'CHRnonvar'(C)
40 ;
41 'CHRalready_in'('CHRnot_holds_2'(not_holds(A, B), C, D, E)),
42 coca(already_in)
43 ),
44 !.
45'CHRnot_holds_2'(not_holds(A, [B|C]), D, E, F) ?-
46 coca(try_rule(F, not_holds(A, [B|C]), anonymous("0"), not_holds(G, [H|I]), replacement, true, (neq(G, H), not_holds(G, I)))),
47 !,
48 'CHRkill'(D),
49 coca(fired_rule(anonymous("0"))),
50 neq(A, B),
51 not_holds(A, C).
52'CHRnot_holds_2'(not_holds(A, []), B, C, D) ?-
53 coca(try_rule(D, not_holds(A, []), anonymous("1"), not_holds(E, []), replacement, true, true)),
54 !,
55 'CHRkill'(B),
56 coca(fired_rule(anonymous("1"))).
57'CHRnot_holds_2'(not_holds(A, B), C, D, E) ?-
58 'CHRget_delayed_goals'(B, F),
59 'CHRnot_holds_2__46'(F, [B], [G, H], I),
60 coca(try_double(E, not_holds(A, B), I, all_not_holds(H, G, B), not_holds(J, K), all_not_holds(L, M, K), keep_second, (copy_fluent(L, M, N, O), N = J, \+ call(#\+(O))), true, anonymous("13"))),
61 no_delayed_goals((copy_fluent(H, G, P, Q), P = A, \+ call(#\+(Q)))),
62 !,
63 'CHRkill'(C),
64 coca(fired_rule(anonymous("13"))).
65'CHRnot_holds_2'(not_holds(A, B), C, D, E) ?-
66 'CHRget_delayed_goals'(B, F),
67 'CHRnot_holds_2__47'(F, [B], [G], H),
68 coca(try_double(E, not_holds(A, B), H, cancel(G, B), not_holds(I, J), cancel(K, J), keep_second, \+ K \= I, true, anonymous("39"))),
69 no_delayed_goals(\+ G \= A),
70 !,
71 'CHRkill'(C),
72 coca(fired_rule(anonymous("39"))).
73'CHRnot_holds_2'(not_holds(A, B), C, D, E) :-
74 'CHRnot_holds_2__45'(not_holds(A, B), C, D, E).
75'CHRnot_holds_2__46'(['CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
76 'CHRvar'(D),
77 'CHR='([B, A], [H, I]),
78 'CHR='(F, J).
79'CHRnot_holds_2__46'([A|B], C, D, E) :-
80 'CHRnot_holds_2__46'(B, C, D, E).
81:- set_flag('CHRnot_holds_2__46' / 4, leash, notrace). 82'CHRnot_holds_2__47'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
83 'CHRvar'(C),
84 'CHR='([A], [G]),
85 'CHR='(E, H).
86'CHRnot_holds_2__47'([A|B], C, D, E) :-
87 'CHRnot_holds_2__47'(B, C, D, E).
88:- set_flag('CHRnot_holds_2__47' / 4, leash, notrace). 89:- set_flag('CHRnot_holds_2' / 4, leash, notrace). 90:- current_macro('CHRnot_holds_2' / 4, _31937, _31938, _31939) -> true ; define_macro('CHRnot_holds_2' / 4, tr_chr / 2, [write]). 91'CHRnot_holds_2__45'(A, B, C, D) :-
92 'CHRnot_holds_2__48'(A, B, C, D).
93:- set_flag('CHRnot_holds_2__45' / 4, leash, notrace). 94'CHRnot_holds_2__48'(not_holds(A, B), C, D, E) ?-
95 'CHRvar'(C),
96 !,
97 'CHRget_delayed_goals'(B, F),
98 'CHRnot_holds_2__48__49'(F, C, not_holds(A, B), D, E).
99'CHRnot_holds_2__48'(not_holds(A, B), C, D, E) :-
100 'CHRnot_holds_2__48__50'(not_holds(A, B), C, D, E).
101:- set_flag('CHRnot_holds_2__48' / 4, leash, notrace). 102'CHRnot_holds_2__48__49'(['CHRor_holds_2'(or_holds(A, B), C, D, E)|F], G, not_holds(H, B), I, J) ?-
103 'CHRvar'(C),
104 coca(try_double(J, not_holds(H, B), E, or_holds(A, B), not_holds(K, L), or_holds(M, L), keep_first, (member(N, M, O), K == N), or_holds(O, L), anonymous("28"))),
105 no_delayed_goals((member(P, A, Q), H == P)),
106 !,
107 'CHRkill'(C),
108 coca(fired_rule(anonymous("28"))),
109 'CHRnot_holds_2__48__49'(F, G, not_holds(H, B), I, J),
110 or_holds(Q, B).
111'CHRnot_holds_2__48__49'([A|B], C, D, E, F) :-
112 'CHRnot_holds_2__48__49'(B, C, D, E, F).
113'CHRnot_holds_2__48__49'([], A, B, C, D) :-
114 'CHRnot_holds_2__48__50'(B, A, C, D).
115:- set_flag('CHRnot_holds_2__48__49' / 5, leash, notrace). 116'CHRnot_holds_2__48__50'(not_holds(A, B), C, D, E) ?-
117 'CHRvar'(C),
118 !,
119 'CHRget_delayed_goals'(B, F),
120 'CHRnot_holds_2__48__50__51'(F, C, not_holds(A, B), D, E).
121'CHRnot_holds_2__48__50'(not_holds(A, B), C, D, E) :-
122 'CHRnot_holds_2__48__50__52'(not_holds(A, B), C, D, E).
123:- set_flag('CHRnot_holds_2__48__50' / 4, leash, notrace). 124'CHRnot_holds_2__48__50__51'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, not_holds(I, C), J, K) ?-
125 'CHRvar'(D),
126 coca(try_double(K, not_holds(I, C), F, if_then_or_holds(A, B, C), not_holds(L, M), if_then_or_holds(N, O, M), keep_first, L == N, true, anonymous("37"))),
127 no_delayed_goals(I == A),
128 !,
129 'CHRkill'(D),
130 coca(fired_rule(anonymous("37"))),
131 'CHRnot_holds_2__48__50__51'(G, H, not_holds(I, C), J, K).
132'CHRnot_holds_2__48__50__51'([A|B], C, D, E, F) :-
133 'CHRnot_holds_2__48__50__51'(B, C, D, E, F).
134'CHRnot_holds_2__48__50__51'([], A, B, C, D) :-
135 'CHRnot_holds_2__48__50__52'(B, A, C, D).
136:- set_flag('CHRnot_holds_2__48__50__51' / 5, leash, notrace). 137'CHRnot_holds_2__48__50__52'(not_holds(A, B), C, D, E) ?-
138 'CHRvar'(C),
139 !,
140 'CHRget_delayed_goals'(B, F),
141 'CHRnot_holds_2__48__50__52__53'(F, C, not_holds(A, B), D, E).
142'CHRnot_holds_2__48__50__52'(not_holds(A, B), C, D, E) :-
143 'CHRnot_holds_2__48__50__52__54'(not_holds(A, B), C, D, E).
144:- set_flag('CHRnot_holds_2__48__50__52' / 4, leash, notrace). 145'CHRnot_holds_2__48__50__52__53'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, not_holds(I, C), J, K) ?-
146 'CHRvar'(D),
147 coca(try_double(K, not_holds(I, C), F, if_then_or_holds(A, B, C), not_holds(L, M), if_then_or_holds(N, O, M), keep_first, (member(P, O, Q), L == P), if_then_or_holds(N, Q, M), anonymous("38"))),
148 no_delayed_goals((member(R, B, S), I == R)),
149 !,
150 'CHRkill'(D),
151 coca(fired_rule(anonymous("38"))),
152 'CHRnot_holds_2__48__50__52__53'(G, H, not_holds(I, C), J, K),
153 if_then_or_holds(A, S, C).
154'CHRnot_holds_2__48__50__52__53'([A|B], C, D, E, F) :-
155 'CHRnot_holds_2__48__50__52__53'(B, C, D, E, F).
156'CHRnot_holds_2__48__50__52__53'([], A, B, C, D) :-
157 'CHRnot_holds_2__48__50__52__54'(B, A, C, D).
158:- set_flag('CHRnot_holds_2__48__50__52__53' / 5, leash, notrace). 159'CHRnot_holds_2__48__50__52__54'(not_holds(A, B), C, D, E) ?-
160 'CHRvar'(C),
161 !,
162 'CHRget_delayed_goals'(B, F),
163 'CHRnot_holds_2__48__50__52__54__55'(F, C, not_holds(A, B), D, E).
164'CHRnot_holds_2__48__50__52__54'(not_holds(A, B), C, D, E) :-
165 'CHRnot_holds_2__48__50__52__54__56'(not_holds(A, B), C, D, E).
166:- set_flag('CHRnot_holds_2__48__50__52__54' / 4, leash, notrace). 167'CHRnot_holds_2__48__50__52__54__55'(['CHRall_holds_3'(all_holds(A, B, C), D, E, F)|G], H, not_holds(I, C), J, K) ?-
168 'CHRvar'(D),
169 'CHRcheck_and_mark_applied'(anonymous("6"), H, D, J, E),
170 coca(try_double(K, not_holds(I, C), F, all_holds(A, B, C), not_holds(L, M), all_holds(N, O, M), augmentation, copy_fluent(N, O, P, Q), (P = L, call(#\+(Q))), anonymous("6"))),
171 no_delayed_goals(copy_fluent(A, B, R, S)),
172 !,
173 coca(fired_rule(anonymous("6"))),
174 'CHRnot_holds_2__48__50__52__54__55'(G, H, not_holds(I, C), J, K),
175 R = I,
176 call(#\+(S)).
177'CHRnot_holds_2__48__50__52__54__55'([A|B], C, D, E, F) :-
178 'CHRnot_holds_2__48__50__52__54__55'(B, C, D, E, F).
179'CHRnot_holds_2__48__50__52__54__55'([], A, B, C, D) :-
180 'CHRnot_holds_2__48__50__52__54__56'(B, A, C, D).
181:- set_flag('CHRnot_holds_2__48__50__52__54__55' / 5, leash, notrace). 182'CHRnot_holds_2__48__50__52__54__56'(not_holds(A, B), C, D, E) :-
183 (
184 'CHRvar'(C)
185 ->
186 'CHRdelay'([C, not_holds(A, B)], 'CHRnot_holds_2'(not_holds(A, B), C, D, E))
187 ;
188 true
189 ).
190:- set_flag('CHRnot_holds_2__48__50__52__54__56' / 4, leash, notrace). 191not_holds_all(A, B) :-
192 'CHRgen_num'(C),
193 coca(add_one_constraint(C, not_holds_all(A, B))),
194 'CHRnot_holds_all_2'(not_holds_all(A, B), D, E, C).
195
196
197
199
200'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) :-
201 (
202 'CHRnonvar'(C)
203 ;
204 'CHRalready_in'('CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)),
205 coca(already_in)
206 ),
207 !.
208'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) ?-
209 coca(try_rule(E, not_holds_all(A, B), anonymous("11"), not_holds_all(F, G), replacement, true, all_not_holds(F, 0 #= 0, G))),
210 !,
211 'CHRkill'(C),
212 coca(fired_rule(anonymous("11"))),
213 all_not_holds(A, 0 #= 0, B).
214'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) ?-
215 'CHRget_delayed_goals'(B, F),
216 'CHRnot_holds_all_2__58'(F, [B], [G], H),
217 coca(try_double(E, not_holds_all(A, B), H, cancel(G, B), not_holds_all(I, J), cancel(K, J), keep_second, \+ K \= I, true, anonymous("40"))),
218 no_delayed_goals(\+ G \= A),
219 !,
220 'CHRkill'(C),
221 coca(fired_rule(anonymous("40"))).
222'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) :-
223 'CHRnot_holds_all_2__57'(not_holds_all(A, B), C, D, E).
224'CHRnot_holds_all_2__58'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
225 'CHRvar'(C),
226 'CHR='([A], [G]),
227 'CHR='(E, H).
228'CHRnot_holds_all_2__58'([A|B], C, D, E) :-
229 'CHRnot_holds_all_2__58'(B, C, D, E).
230:- set_flag('CHRnot_holds_all_2__58' / 4, leash, notrace). 231:- set_flag('CHRnot_holds_all_2' / 4, leash, notrace). 232:- current_macro('CHRnot_holds_all_2' / 4, _35272, _35273, _35274) -> true ; define_macro('CHRnot_holds_all_2' / 4, tr_chr / 2, [write]). 233'CHRnot_holds_all_2__57'(A, B, C, D) :-
234 'CHRnot_holds_all_2__59'(A, B, C, D).
235:- set_flag('CHRnot_holds_all_2__57' / 4, leash, notrace). 236'CHRnot_holds_all_2__59'(not_holds_all(A, B), C, D, E) :-
237 (
238 'CHRvar'(C)
239 ->
240 'CHRdelay'([C, not_holds_all(A, B)], 'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E))
241 ;
242 true
243 ).
244:- set_flag('CHRnot_holds_all_2__59' / 4, leash, notrace). 245duplicate_free(A) :-
246 'CHRgen_num'(B),
247 coca(add_one_constraint(B, duplicate_free(A))),
248 'CHRduplicate_free_1'(duplicate_free(A), C, D, B).
249
250
251
253
254'CHRduplicate_free_1'(duplicate_free(A), B, C, D) :-
255 (
256 'CHRnonvar'(B)
257 ;
258 'CHRalready_in'('CHRduplicate_free_1'(duplicate_free(A), B, C, D)),
259 coca(already_in)
260 ),
261 !.
262'CHRduplicate_free_1'(duplicate_free([A|B]), C, D, E) ?-
263 coca(try_rule(E, duplicate_free([A|B]), anonymous("2"), duplicate_free([F|G]), replacement, true, (not_holds(F, G), duplicate_free(G)))),
264 !,
265 'CHRkill'(C),
266 coca(fired_rule(anonymous("2"))),
267 not_holds(A, B),
268 duplicate_free(B).
269'CHRduplicate_free_1'(duplicate_free([]), A, B, C) ?-
270 coca(try_rule(C, duplicate_free([]), anonymous("3"), duplicate_free([]), replacement, true, true)),
271 !,
272 'CHRkill'(A),
273 coca(fired_rule(anonymous("3"))).
274'CHRduplicate_free_1'(duplicate_free(A), B, C, D) :-
275 'CHRduplicate_free_1__60'(duplicate_free(A), B, C, D).
276:- set_flag('CHRduplicate_free_1' / 4, leash, notrace). 277:- current_macro('CHRduplicate_free_1' / 4, _36069, _36070, _36071) -> true ; define_macro('CHRduplicate_free_1' / 4, tr_chr / 2, [write]). 278'CHRduplicate_free_1__60'(A, B, C, D) :-
279 'CHRduplicate_free_1__61'(A, B, C, D).
280:- set_flag('CHRduplicate_free_1__60' / 4, leash, notrace). 281'CHRduplicate_free_1__61'(duplicate_free(A), B, C, D) :-
282 (
283 'CHRvar'(B)
284 ->
285 'CHRdelay'([B, duplicate_free(A)], 'CHRduplicate_free_1'(duplicate_free(A), B, C, D))
286 ;
287 true
288 ).
289:- set_flag('CHRduplicate_free_1__61' / 4, leash, notrace). 290or_holds(A, B) :-
291 'CHRgen_num'(C),
292 coca(add_one_constraint(C, or_holds(A, B))),
293 'CHRor_holds_2'(or_holds(A, B), D, E, C).
294
295
296
298
299'CHRor_holds_2'(or_holds(A, B), C, D, E) :-
300 (
301 'CHRnonvar'(C)
302 ;
303 'CHRalready_in'('CHRor_holds_2'(or_holds(A, B), C, D, E)),
304 coca(already_in)
305 ),
306 !.
307'CHRor_holds_2'(or_holds([A], B), C, D, E) ?-
308 coca(try_rule(E, or_holds([A], B), anonymous("18"), or_holds([F], G), replacement, (F \= eq(H, I), F \= neq(J, K)), holds(F, G))),
309 no_delayed_goals((A \= eq(L, M), A \= neq(N, O))),
310 !,
311 'CHRkill'(C),
312 coca(fired_rule(anonymous("18"))),
313 holds(A, B).
314'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
315 coca(try_rule(E, or_holds(A, B), anonymous("19"), or_holds(F, G), replacement, \+ (member(H, F), H \= eq(I, J), H \= neq(K, L)), (or_and_eq(F, M), call(M)))),
316 no_delayed_goals(\+ (member(N, A), N \= eq(O, P), N \= neq(Q, R))),
317 !,
318 'CHRkill'(C),
319 coca(fired_rule(anonymous("19"))),
320 or_and_eq(A, S),
321 call(S).
322'CHRor_holds_2'(or_holds(A, []), B, C, D) ?-
323 coca(try_rule(D, or_holds(A, []), anonymous("20"), or_holds(E, []), replacement, (member(F, E, G), F \= eq(H, I), F \= neq(J, K)), or_holds(G, []))),
324 no_delayed_goals((member(L, A, M), L \= eq(N, O), L \= neq(P, Q))),
325 !,
326 'CHRkill'(B),
327 coca(fired_rule(anonymous("20"))),
328 or_holds(M, []).
329'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
330 coca(try_rule(E, or_holds(A, B), anonymous("21"), or_holds(F, G), replacement, (member(eq(H, I), F), or_neq(exists, H, I, J), \+ call(J)), true)),
331 no_delayed_goals((member(eq(K, L), A), or_neq(exists, K, L, M), \+ call(M))),
332 !,
333 'CHRkill'(C),
334 coca(fired_rule(anonymous("21"))).
335'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
336 coca(try_rule(E, or_holds(A, B), anonymous("22"), or_holds(F, G), replacement, (member(neq(H, I), F), and_eq(H, I, J), \+ call(J)), true)),
337 no_delayed_goals((member(neq(K, L), A), and_eq(K, L, M), \+ call(M))),
338 !,
339 'CHRkill'(C),
340 coca(fired_rule(anonymous("22"))).
341'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
342 coca(try_rule(E, or_holds(A, B), anonymous("23"), or_holds(F, G), replacement, (member(eq(H, I), F, J), \+ (and_eq(H, I, K), call(K))), or_holds(J, G))),
343 no_delayed_goals((member(eq(L, M), A, N), \+ (and_eq(L, M, O), call(O)))),
344 !,
345 'CHRkill'(C),
346 coca(fired_rule(anonymous("23"))),
347 or_holds(N, B).
348'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
349 coca(try_rule(E, or_holds(A, B), anonymous("24"), or_holds(F, G), replacement, (member(neq(H, I), F, J), \+ (or_neq(exists, H, I, K), call(K))), or_holds(J, G))),
350 no_delayed_goals((member(neq(L, M), A, N), \+ (or_neq(exists, L, M, O), call(O)))),
351 !,
352 'CHRkill'(C),
353 coca(fired_rule(anonymous("24"))),
354 or_holds(N, B).
355'CHRor_holds_2'(or_holds(A, [B|C]), D, E, F) ?-
356 coca(try_rule(F, or_holds(A, [B|C]), anonymous("25"), or_holds(G, [H|I]), replacement, true, or_holds(G, [], [H|I]))),
357 !,
358 'CHRkill'(D),
359 coca(fired_rule(anonymous("25"))),
360 or_holds(A, [], [B|C]).
361'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
362 'CHRget_delayed_goals'(B, F),
363 'CHRor_holds_2__63'(F, [B], [G, H], I),
364 coca(try_double(E, or_holds(A, B), I, all_holds(H, G, B), or_holds(J, K), all_holds(L, M, K), keep_second, (member(N, J), copy_fluent(L, M, O, P), O = N, \+ call(#\+(P))), true, anonymous("8"))),
365 no_delayed_goals((member(Q, A), copy_fluent(H, G, R, S), R = Q, \+ call(#\+(S)))),
366 !,
367 'CHRkill'(C),
368 coca(fired_rule(anonymous("8"))).
369'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
370 'CHRget_delayed_goals'(B, F),
371 'CHRor_holds_2__64'(F, [B], [G, H], I),
372 coca(try_double(E, or_holds(A, B), I, all_not_holds(H, G, B), or_holds(J, K), all_not_holds(L, M, K), keep_second, (member(N, J, O), copy_fluent(L, M, P, Q), P = N, \+ call(#\+(Q))), or_holds(O, K), anonymous("14"))),
373 no_delayed_goals((member(R, A, S), copy_fluent(H, G, T, U), T = R, \+ call(#\+(U)))),
374 !,
375 'CHRkill'(C),
376 coca(fired_rule(anonymous("14"))),
377 or_holds(S, B).
378'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
379 'CHRget_delayed_goals'(B, F),
380 'CHRor_holds_2__65'(F, [B], [G], H),
381 coca(try_double(E, or_holds(A, B), H, not_holds(G, B), or_holds(I, J), not_holds(K, J), keep_second, (member(L, I, M), K == L), or_holds(M, J), anonymous("28"))),
382 no_delayed_goals((member(N, A, O), G == N)),
383 !,
384 'CHRkill'(C),
385 coca(fired_rule(anonymous("28"))),
386 or_holds(O, B).
387'CHRor_holds_2'(or_holds(A, B), C, D, E) ?-
388 'CHRget_delayed_goals'(B, F),
389 'CHRor_holds_2__66'(F, [B], [G], H),
390 coca(try_double(E, or_holds(A, B), H, cancel(G, B), or_holds(I, J), cancel(K, J), keep_second, (member(L, I), \+ K \= L), true, anonymous("41"))),
391 no_delayed_goals((member(M, A), \+ G \= M)),
392 !,
393 'CHRkill'(C),
394 coca(fired_rule(anonymous("41"))).
395'CHRor_holds_2'(or_holds(A, B), C, D, E) :-
396 'CHRor_holds_2__62'(or_holds(A, B), C, D, E).
397'CHRor_holds_2__63'(['CHRall_holds_3'(all_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
398 'CHRvar'(D),
399 'CHR='([B, A], [H, I]),
400 'CHR='(F, J).
401'CHRor_holds_2__63'([A|B], C, D, E) :-
402 'CHRor_holds_2__63'(B, C, D, E).
403:- set_flag('CHRor_holds_2__63' / 4, leash, notrace). 404'CHRor_holds_2__64'(['CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
405 'CHRvar'(D),
406 'CHR='([B, A], [H, I]),
407 'CHR='(F, J).
408'CHRor_holds_2__64'([A|B], C, D, E) :-
409 'CHRor_holds_2__64'(B, C, D, E).
410:- set_flag('CHRor_holds_2__64' / 4, leash, notrace). 411'CHRor_holds_2__65'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], [B], [G], H) ?-
412 'CHRvar'(C),
413 'CHR='([A], [G]),
414 'CHR='(E, H).
415'CHRor_holds_2__65'([A|B], C, D, E) :-
416 'CHRor_holds_2__65'(B, C, D, E).
417:- set_flag('CHRor_holds_2__65' / 4, leash, notrace). 418'CHRor_holds_2__66'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
419 'CHRvar'(C),
420 'CHR='([A], [G]),
421 'CHR='(E, H).
422'CHRor_holds_2__66'([A|B], C, D, E) :-
423 'CHRor_holds_2__66'(B, C, D, E).
424:- set_flag('CHRor_holds_2__66' / 4, leash, notrace). 425:- set_flag('CHRor_holds_2' / 4, leash, notrace). 426:- current_macro('CHRor_holds_2' / 4, _39990, _39991, _39992) -> true ; define_macro('CHRor_holds_2' / 4, tr_chr / 2, [write]). 427'CHRor_holds_2__62'(A, B, C, D) :-
428 'CHRor_holds_2__67'(A, B, C, D).
429:- set_flag('CHRor_holds_2__62' / 4, leash, notrace). 430'CHRor_holds_2__67'(or_holds(A, B), C, D, E) :-
431 (
432 'CHRvar'(C)
433 ->
434 'CHRdelay'([C, or_holds(A, B)], 'CHRor_holds_2'(or_holds(A, B), C, D, E))
435 ;
436 true
437 ).
438:- set_flag('CHRor_holds_2__67' / 4, leash, notrace). 439or_holds(A, B, C) :-
440 'CHRgen_num'(D),
441 coca(add_one_constraint(D, or_holds(A, B, C))),
442 'CHRor_holds_3'(or_holds(A, B, C), E, F, D).
443
444
445
447
448'CHRor_holds_3'(or_holds(A, B, C), D, E, F) :-
449 (
450 'CHRnonvar'(D)
451 ;
452 'CHRalready_in'('CHRor_holds_3'(or_holds(A, B, C), D, E, F)),
453 coca(already_in)
454 ),
455 !.
456'CHRor_holds_3'(or_holds([A|B], C, [D|E]), F, G, H) ?-
457 coca(try_rule(H, or_holds([A|B], C, [D|E]), anonymous("26"), or_holds([I|J], K, [L|M]), replacement, true, I == L -> true ; I \= L -> or_holds(J, [I|K], [L|M]) ; (I =.. [N|O], L =.. [P|Q], or_holds(J, [eq(O, Q), I|K], [L|M])))),
458 !,
459 'CHRkill'(F),
460 coca(fired_rule(anonymous("26"))),
461 (
462 A == D
463 ->
464 true
465 ;
466 (
467 A \= D
468 ->
469 or_holds(B, [A|C], [D|E])
470 ;
471 A =.. [R|S],
472 D =.. [T|U],
473 or_holds(B, [eq(S, U), A|C], [D|E])
474 )
475 ).
476'CHRor_holds_3'(or_holds([], A, [B|C]), D, E, F) ?-
477 coca(try_rule(F, or_holds([], A, [B|C]), anonymous("27"), or_holds([], G, [H|I]), replacement, true, or_holds(G, I))),
478 !,
479 'CHRkill'(D),
480 coca(fired_rule(anonymous("27"))),
481 or_holds(A, C).
482'CHRor_holds_3'(or_holds(A, B, C), D, E, F) :-
483 'CHRor_holds_3__68'(or_holds(A, B, C), D, E, F).
484:- set_flag('CHRor_holds_3' / 4, leash, notrace). 485:- current_macro('CHRor_holds_3' / 4, _40931, _40932, _40933) -> true ; define_macro('CHRor_holds_3' / 4, tr_chr / 2, [write]). 486'CHRor_holds_3__68'(A, B, C, D) :-
487 'CHRor_holds_3__69'(A, B, C, D).
488:- set_flag('CHRor_holds_3__68' / 4, leash, notrace). 489'CHRor_holds_3__69'(or_holds(A, B, C), D, E, F) :-
490 (
491 'CHRvar'(D)
492 ->
493 'CHRdelay'([D, or_holds(A, B, C)], 'CHRor_holds_3'(or_holds(A, B, C), D, E, F))
494 ;
495 true
496 ).
497:- set_flag('CHRor_holds_3__69' / 4, leash, notrace). 498all_holds(A, B) :-
499 'CHRgen_num'(C),
500 coca(add_one_constraint(C, all_holds(A, B))),
501 'CHRall_holds_2'(all_holds(A, B), D, E, C).
502
503
504
506
507'CHRall_holds_2'(all_holds(A, B), C, D, E) :-
508 (
509 'CHRnonvar'(C)
510 ;
511 'CHRalready_in'('CHRall_holds_2'(all_holds(A, B), C, D, E)),
512 coca(already_in)
513 ),
514 !.
515'CHRall_holds_2'(all_holds(A, B), C, D, E) ?-
516 coca(try_rule(E, all_holds(A, B), anonymous("4"), all_holds(F, G), replacement, true, all_holds(F, 0 #= 0, G))),
517 !,
518 'CHRkill'(C),
519 coca(fired_rule(anonymous("4"))),
520 all_holds(A, 0 #= 0, B).
521'CHRall_holds_2'(all_holds(A, B), C, D, E) :-
522 'CHRall_holds_2__70'(all_holds(A, B), C, D, E).
523:- set_flag('CHRall_holds_2' / 4, leash, notrace). 524:- current_macro('CHRall_holds_2' / 4, _41603, _41604, _41605) -> true ; define_macro('CHRall_holds_2' / 4, tr_chr / 2, [write]). 525'CHRall_holds_2__70'(A, B, C, D) :-
526 'CHRall_holds_2__71'(A, B, C, D).
527:- set_flag('CHRall_holds_2__70' / 4, leash, notrace). 528'CHRall_holds_2__71'(all_holds(A, B), C, D, E) :-
529 (
530 'CHRvar'(C)
531 ->
532 'CHRdelay'([C, all_holds(A, B)], 'CHRall_holds_2'(all_holds(A, B), C, D, E))
533 ;
534 true
535 ).
536:- set_flag('CHRall_holds_2__71' / 4, leash, notrace). 537all_holds(A, B, C) :-
538 'CHRgen_num'(D),
539 coca(add_one_constraint(D, all_holds(A, B, C))),
540 'CHRall_holds_3'(all_holds(A, B, C), E, F, D).
541
542
543
545
546'CHRall_holds_3'(all_holds(A, B, C), D, E, F) :-
547 (
548 'CHRnonvar'(D)
549 ;
550 'CHRalready_in'('CHRall_holds_3'(all_holds(A, B, C), D, E, F)),
551 coca(already_in)
552 ),
553 !.
554'CHRall_holds_3'(all_holds(A, B, [C|D]), E, F, G) ?-
555 coca(try_rule(G, all_holds(A, B, [C|D]), anonymous("5"), all_holds(H, I, [J|K]), replacement, true, \+ (H = J, call(I)) -> all_holds(H, I, K) ; (H =.. [L|M], J =.. [N|O], or_neq(exists, M, O, P), all_holds(H, #/\(I, P), K)))),
556 !,
557 'CHRkill'(E),
558 coca(fired_rule(anonymous("5"))),
559 (
560 \+ (A = C, call(B))
561 ->
562 all_holds(A, B, D)
563 ;
564 A =.. [Q|R],
565 C =.. [S|T],
566 or_neq(exists, R, T, U),
567 all_holds(A, #/\(B, U), D)
568 ).
569'CHRall_holds_3'(all_holds(A, B, C), D, E, F) ?-
570 'CHRget_delayed_goals'(C, G),
571 'CHRall_holds_3__73'(G, [C], [H, I], J),
572 coca(try_double(F, all_holds(A, B, C), J, all_not_holds(I, H, C), all_holds(K, L, M), all_not_holds(N, O, M), replacement, (copy_fluent(K, L, P, Q), copy_fluent(N, O, R, S), P = R, call(#/\(Q, S))), false, anonymous("7"))),
573 no_delayed_goals((copy_fluent(A, B, T, U), copy_fluent(I, H, V, W), T = V, call(#/\(U, W)))),
574 !,
575 'CHRkill'(D),
576 coca(fired_rule(anonymous("7"))),
577 false.
578'CHRall_holds_3'(all_holds(A, B, C), D, E, F) :-
579 'CHRall_holds_3__72'(all_holds(A, B, C), D, E, F).
580'CHRall_holds_3__73'(['CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
581 'CHRvar'(D),
582 'CHRkill'(D),
583 'CHR='([B, A], [H, I]),
584 'CHR='(F, J).
585'CHRall_holds_3__73'([A|B], C, D, E) :-
586 'CHRall_holds_3__73'(B, C, D, E).
587:- set_flag('CHRall_holds_3__73' / 4, leash, notrace). 588:- set_flag('CHRall_holds_3' / 4, leash, notrace). 589:- current_macro('CHRall_holds_3' / 4, _42907, _42908, _42909) -> true ; define_macro('CHRall_holds_3' / 4, tr_chr / 2, [write]). 590'CHRall_holds_3__72'(A, B, C, D) :-
591 'CHRall_holds_3__74'(A, B, C, D).
592:- set_flag('CHRall_holds_3__72' / 4, leash, notrace). 593'CHRall_holds_3__74'(all_holds(A, B, C), D, E, F) ?-
594 'CHRvar'(D),
595 !,
596 'CHRget_delayed_goals'(C, G),
597 'CHRall_holds_3__74__75'(G, D, all_holds(A, B, C), E, F).
598'CHRall_holds_3__74'(all_holds(A, B, C), D, E, F) :-
599 'CHRall_holds_3__74__76'(all_holds(A, B, C), D, E, F).
600:- set_flag('CHRall_holds_3__74' / 4, leash, notrace). 601'CHRall_holds_3__74__75'(['CHRor_holds_2'(or_holds(A, B), C, D, E)|F], G, all_holds(H, I, B), J, K) ?-
602 'CHRvar'(C),
603 coca(try_double(K, all_holds(H, I, B), E, or_holds(A, B), all_holds(L, M, N), or_holds(O, N), keep_first, (member(P, O), copy_fluent(L, M, Q, R), Q = P, \+ call(#\+(R))), true, anonymous("8"))),
604 no_delayed_goals((member(S, A), copy_fluent(H, I, T, U), T = S, \+ call(#\+(U)))),
605 !,
606 'CHRkill'(C),
607 coca(fired_rule(anonymous("8"))),
608 'CHRall_holds_3__74__75'(F, G, all_holds(H, I, B), J, K).
609'CHRall_holds_3__74__75'([A|B], C, D, E, F) :-
610 'CHRall_holds_3__74__75'(B, C, D, E, F).
611'CHRall_holds_3__74__75'([], A, B, C, D) :-
612 'CHRall_holds_3__74__76'(B, A, C, D).
613:- set_flag('CHRall_holds_3__74__75' / 5, leash, notrace). 614'CHRall_holds_3__74__76'(all_holds(A, B, C), D, E, F) ?-
615 'CHRvar'(D),
616 !,
617 'CHRget_delayed_goals'(C, G),
618 'CHRall_holds_3__74__76__77'(G, D, all_holds(A, B, C), E, F).
619'CHRall_holds_3__74__76'(all_holds(A, B, C), D, E, F) :-
620 'CHRall_holds_3__74__76__78'(all_holds(A, B, C), D, E, F).
621:- set_flag('CHRall_holds_3__74__76' / 4, leash, notrace). 622'CHRall_holds_3__74__76__77'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, all_holds(I, J, C), K, L) ?-
623 'CHRvar'(D),
624 coca(try_double(L, all_holds(I, J, C), F, if_then_or_holds(A, B, C), all_holds(M, N, O), if_then_or_holds(P, Q, O), keep_first, (copy_fluent(M, N, R, S), R = P, \+ call(#\+(S))), or_holds(Q, O), anonymous("9"))),
625 no_delayed_goals((copy_fluent(I, J, T, U), T = A, \+ call(#\+(U)))),
626 !,
627 'CHRkill'(D),
628 coca(fired_rule(anonymous("9"))),
629 'CHRall_holds_3__74__76__77'(G, H, all_holds(I, J, C), K, L),
630 or_holds(B, C).
631'CHRall_holds_3__74__76__77'([A|B], C, D, E, F) :-
632 'CHRall_holds_3__74__76__77'(B, C, D, E, F).
633'CHRall_holds_3__74__76__77'([], A, B, C, D) :-
634 'CHRall_holds_3__74__76__78'(B, A, C, D).
635:- set_flag('CHRall_holds_3__74__76__77' / 5, leash, notrace). 636'CHRall_holds_3__74__76__78'(all_holds(A, B, C), D, E, F) ?-
637 'CHRvar'(D),
638 !,
639 'CHRget_delayed_goals'(C, G),
640 'CHRall_holds_3__74__76__78__79'(G, D, all_holds(A, B, C), E, F).
641'CHRall_holds_3__74__76__78'(all_holds(A, B, C), D, E, F) :-
642 'CHRall_holds_3__74__76__78__80'(all_holds(A, B, C), D, E, F).
643:- set_flag('CHRall_holds_3__74__76__78' / 4, leash, notrace). 644'CHRall_holds_3__74__76__78__79'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, all_holds(I, J, C), K, L) ?-
645 'CHRvar'(D),
646 coca(try_double(L, all_holds(I, J, C), F, if_then_or_holds(A, B, C), all_holds(M, N, O), if_then_or_holds(P, Q, O), keep_first, (member(R, Q), copy_fluent(M, N, S, T), S = R, \+ call(#\+(T))), true, anonymous("10"))),
647 no_delayed_goals((member(U, B), copy_fluent(I, J, V, W), V = U, \+ call(#\+(W)))),
648 !,
649 'CHRkill'(D),
650 coca(fired_rule(anonymous("10"))),
651 'CHRall_holds_3__74__76__78__79'(G, H, all_holds(I, J, C), K, L).
652'CHRall_holds_3__74__76__78__79'([A|B], C, D, E, F) :-
653 'CHRall_holds_3__74__76__78__79'(B, C, D, E, F).
654'CHRall_holds_3__74__76__78__79'([], A, B, C, D) :-
655 'CHRall_holds_3__74__76__78__80'(B, A, C, D).
656:- set_flag('CHRall_holds_3__74__76__78__79' / 5, leash, notrace). 657'CHRall_holds_3__74__76__78__80'(all_holds(A, B, C), D, E, F) ?-
658 'CHRvar'(D),
659 !,
660 'CHRget_delayed_goals'(C, G),
661 'CHRall_holds_3__74__76__78__80__81'(G, D, all_holds(A, B, C), E, F).
662'CHRall_holds_3__74__76__78__80'(all_holds(A, B, C), D, E, F) :-
663 'CHRall_holds_3__74__76__78__80__82'(all_holds(A, B, C), D, E, F).
664:- set_flag('CHRall_holds_3__74__76__78__80' / 4, leash, notrace). 665'CHRall_holds_3__74__76__78__80__81'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], G, all_holds(H, I, B), J, K) ?-
666 'CHRvar'(C),
667 'CHRcheck_and_mark_applied'(anonymous("6"), G, C, J, D),
668 coca(try_double(K, all_holds(H, I, B), E, not_holds(A, B), all_holds(L, M, N), not_holds(O, N), augmentation, copy_fluent(L, M, P, Q), (P = O, call(#\+(Q))), anonymous("6"))),
669 no_delayed_goals(copy_fluent(H, I, R, S)),
670 !,
671 coca(fired_rule(anonymous("6"))),
672 'CHRall_holds_3__74__76__78__80__81'(F, G, all_holds(H, I, B), J, K),
673 R = A,
674 call(#\+(S)).
675'CHRall_holds_3__74__76__78__80__81'([A|B], C, D, E, F) :-
676 'CHRall_holds_3__74__76__78__80__81'(B, C, D, E, F).
677'CHRall_holds_3__74__76__78__80__81'([], A, B, C, D) :-
678 'CHRall_holds_3__74__76__78__80__82'(B, A, C, D).
679:- set_flag('CHRall_holds_3__74__76__78__80__81' / 5, leash, notrace). 680'CHRall_holds_3__74__76__78__80__82'(all_holds(A, B, C), D, E, F) :-
681 (
682 'CHRvar'(D)
683 ->
684 'CHRdelay'([D, all_holds(A, B, C)], 'CHRall_holds_3'(all_holds(A, B, C), D, E, F))
685 ;
686 true
687 ).
688:- set_flag('CHRall_holds_3__74__76__78__80__82' / 4, leash, notrace). 689all_not_holds(A, B, C) :-
690 'CHRgen_num'(D),
691 coca(add_one_constraint(D, all_not_holds(A, B, C))),
692 'CHRall_not_holds_3'(all_not_holds(A, B, C), E, F, D).
693
694
695
697
698'CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F) :-
699 (
700 'CHRnonvar'(D)
701 ;
702 'CHRalready_in'('CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)),
703 coca(already_in)
704 ),
705 !.
706'CHRall_not_holds_3'(all_not_holds(A, B, []), C, D, E) ?-
707 coca(try_rule(E, all_not_holds(A, B, []), anonymous("12"), all_not_holds(F, G, []), replacement, true, true)),
708 !,
709 'CHRkill'(C),
710 coca(fired_rule(anonymous("12"))).
711'CHRall_not_holds_3'(all_not_holds(A, B, [C|D]), E, F, G) ?-
712 coca(try_rule(G, all_not_holds(A, B, [C|D]), anonymous("17"), all_not_holds(H, I, [J|K]), replacement, true, ((\+ (H = J, call(I)) -> true ; copy_fluent(H = J, I, L = M, N), L = M, eq(J, M, O), neq_all(H, J, P), call(#\/(#/\(O, #\+(N)), P))), all_not_holds(H, I, K)))),
713 !,
714 'CHRkill'(E),
715 coca(fired_rule(anonymous("17"))),
716 (
717 \+ (A = C, call(B))
718 ->
719 true
720 ;
721 copy_fluent(A = C, B, Q = R, S),
722 Q = R,
723 eq(C, R, T),
724 neq_all(A, C, U),
725 call(#\/(#/\(T, #\+(S)), U))
726 ),
727 all_not_holds(A, B, D).
728'CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F) ?-
729 'CHRget_delayed_goals'(C, G),
730 'CHRall_not_holds_3__84'(G, [C], [H, I], J),
731 coca(try_double(F, all_not_holds(A, B, C), J, all_holds(I, H, C), all_not_holds(K, L, M), all_holds(N, O, M), replacement, (copy_fluent(N, O, P, Q), copy_fluent(K, L, R, S), P = R, call(#/\(Q, S))), false, anonymous("7"))),
732 no_delayed_goals((copy_fluent(I, H, T, U), copy_fluent(A, B, V, W), T = V, call(#/\(U, W)))),
733 !,
734 'CHRkill'(D),
735 coca(fired_rule(anonymous("7"))),
736 false.
737'CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F) :-
738 'CHRall_not_holds_3__83'(all_not_holds(A, B, C), D, E, F).
739'CHRall_not_holds_3__84'(['CHRall_holds_3'(all_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
740 'CHRvar'(D),
741 'CHRkill'(D),
742 'CHR='([B, A], [H, I]),
743 'CHR='(F, J).
744'CHRall_not_holds_3__84'([A|B], C, D, E) :-
745 'CHRall_not_holds_3__84'(B, C, D, E).
746:- set_flag('CHRall_not_holds_3__84' / 4, leash, notrace). 747:- set_flag('CHRall_not_holds_3' / 4, leash, notrace). 748:- current_macro('CHRall_not_holds_3' / 4, _46737, _46738, _46739) -> true ; define_macro('CHRall_not_holds_3' / 4, tr_chr / 2, [write]). 749'CHRall_not_holds_3__83'(A, B, C, D) :-
750 'CHRall_not_holds_3__85'(A, B, C, D).
751:- set_flag('CHRall_not_holds_3__83' / 4, leash, notrace). 752'CHRall_not_holds_3__85'(all_not_holds(A, B, C), D, E, F) ?-
753 'CHRvar'(D),
754 !,
755 'CHRget_delayed_goals'(C, G),
756 'CHRall_not_holds_3__85__86'(G, D, all_not_holds(A, B, C), E, F).
757'CHRall_not_holds_3__85'(all_not_holds(A, B, C), D, E, F) :-
758 'CHRall_not_holds_3__85__87'(all_not_holds(A, B, C), D, E, F).
759:- set_flag('CHRall_not_holds_3__85' / 4, leash, notrace). 760'CHRall_not_holds_3__85__86'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], G, all_not_holds(H, I, B), J, K) ?-
761 'CHRvar'(C),
762 coca(try_double(K, all_not_holds(H, I, B), E, not_holds(A, B), all_not_holds(L, M, N), not_holds(O, N), keep_first, (copy_fluent(L, M, P, Q), P = O, \+ call(#\+(Q))), true, anonymous("13"))),
763 no_delayed_goals((copy_fluent(H, I, R, S), R = A, \+ call(#\+(S)))),
764 !,
765 'CHRkill'(C),
766 coca(fired_rule(anonymous("13"))),
767 'CHRall_not_holds_3__85__86'(F, G, all_not_holds(H, I, B), J, K).
768'CHRall_not_holds_3__85__86'([A|B], C, D, E, F) :-
769 'CHRall_not_holds_3__85__86'(B, C, D, E, F).
770'CHRall_not_holds_3__85__86'([], A, B, C, D) :-
771 'CHRall_not_holds_3__85__87'(B, A, C, D).
772:- set_flag('CHRall_not_holds_3__85__86' / 5, leash, notrace). 773'CHRall_not_holds_3__85__87'(all_not_holds(A, B, C), D, E, F) ?-
774 'CHRvar'(D),
775 !,
776 'CHRget_delayed_goals'(C, G),
777 'CHRall_not_holds_3__85__87__88'(G, D, all_not_holds(A, B, C), E, F).
778'CHRall_not_holds_3__85__87'(all_not_holds(A, B, C), D, E, F) :-
779 'CHRall_not_holds_3__85__87__89'(all_not_holds(A, B, C), D, E, F).
780:- set_flag('CHRall_not_holds_3__85__87' / 4, leash, notrace). 781'CHRall_not_holds_3__85__87__88'(['CHRor_holds_2'(or_holds(A, B), C, D, E)|F], G, all_not_holds(H, I, B), J, K) ?-
782 'CHRvar'(C),
783 coca(try_double(K, all_not_holds(H, I, B), E, or_holds(A, B), all_not_holds(L, M, N), or_holds(O, N), keep_first, (member(P, O, Q), copy_fluent(L, M, R, S), R = P, \+ call(#\+(S))), or_holds(Q, N), anonymous("14"))),
784 no_delayed_goals((member(T, A, U), copy_fluent(H, I, V, W), V = T, \+ call(#\+(W)))),
785 !,
786 'CHRkill'(C),
787 coca(fired_rule(anonymous("14"))),
788 'CHRall_not_holds_3__85__87__88'(F, G, all_not_holds(H, I, B), J, K),
789 or_holds(U, B).
790'CHRall_not_holds_3__85__87__88'([A|B], C, D, E, F) :-
791 'CHRall_not_holds_3__85__87__88'(B, C, D, E, F).
792'CHRall_not_holds_3__85__87__88'([], A, B, C, D) :-
793 'CHRall_not_holds_3__85__87__89'(B, A, C, D).
794:- set_flag('CHRall_not_holds_3__85__87__88' / 5, leash, notrace). 795'CHRall_not_holds_3__85__87__89'(all_not_holds(A, B, C), D, E, F) ?-
796 'CHRvar'(D),
797 !,
798 'CHRget_delayed_goals'(C, G),
799 'CHRall_not_holds_3__85__87__89__90'(G, D, all_not_holds(A, B, C), E, F).
800'CHRall_not_holds_3__85__87__89'(all_not_holds(A, B, C), D, E, F) :-
801 'CHRall_not_holds_3__85__87__89__91'(all_not_holds(A, B, C), D, E, F).
802:- set_flag('CHRall_not_holds_3__85__87__89' / 4, leash, notrace). 803'CHRall_not_holds_3__85__87__89__90'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, all_not_holds(I, J, C), K, L) ?-
804 'CHRvar'(D),
805 coca(try_double(L, all_not_holds(I, J, C), F, if_then_or_holds(A, B, C), all_not_holds(M, N, O), if_then_or_holds(P, Q, O), keep_first, (copy_fluent(M, N, R, S), R = P, \+ call(#\+(S))), true, anonymous("15"))),
806 no_delayed_goals((copy_fluent(I, J, T, U), T = A, \+ call(#\+(U)))),
807 !,
808 'CHRkill'(D),
809 coca(fired_rule(anonymous("15"))),
810 'CHRall_not_holds_3__85__87__89__90'(G, H, all_not_holds(I, J, C), K, L).
811'CHRall_not_holds_3__85__87__89__90'([A|B], C, D, E, F) :-
812 'CHRall_not_holds_3__85__87__89__90'(B, C, D, E, F).
813'CHRall_not_holds_3__85__87__89__90'([], A, B, C, D) :-
814 'CHRall_not_holds_3__85__87__89__91'(B, A, C, D).
815:- set_flag('CHRall_not_holds_3__85__87__89__90' / 5, leash, notrace). 816'CHRall_not_holds_3__85__87__89__91'(all_not_holds(A, B, C), D, E, F) ?-
817 'CHRvar'(D),
818 !,
819 'CHRget_delayed_goals'(C, G),
820 'CHRall_not_holds_3__85__87__89__91__92'(G, D, all_not_holds(A, B, C), E, F).
821'CHRall_not_holds_3__85__87__89__91'(all_not_holds(A, B, C), D, E, F) :-
822 'CHRall_not_holds_3__85__87__89__91__93'(all_not_holds(A, B, C), D, E, F).
823:- set_flag('CHRall_not_holds_3__85__87__89__91' / 4, leash, notrace). 824'CHRall_not_holds_3__85__87__89__91__92'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, all_not_holds(I, J, C), K, L) ?-
825 'CHRvar'(D),
826 coca(try_double(L, all_not_holds(I, J, C), F, if_then_or_holds(A, B, C), all_not_holds(M, N, O), if_then_or_holds(P, Q, O), keep_first, (member(R, Q, S), copy_fluent(M, N, T, U), T = R, \+ call(#\+(U))), if_then_or_holds(P, S, O), anonymous("16"))),
827 no_delayed_goals((member(V, B, W), copy_fluent(I, J, X, Y), X = V, \+ call(#\+(Y)))),
828 !,
829 'CHRkill'(D),
830 coca(fired_rule(anonymous("16"))),
831 'CHRall_not_holds_3__85__87__89__91__92'(G, H, all_not_holds(I, J, C), K, L),
832 if_then_or_holds(A, W, C).
833'CHRall_not_holds_3__85__87__89__91__92'([A|B], C, D, E, F) :-
834 'CHRall_not_holds_3__85__87__89__91__92'(B, C, D, E, F).
835'CHRall_not_holds_3__85__87__89__91__92'([], A, B, C, D) :-
836 'CHRall_not_holds_3__85__87__89__91__93'(B, A, C, D).
837:- set_flag('CHRall_not_holds_3__85__87__89__91__92' / 5, leash, notrace). 838'CHRall_not_holds_3__85__87__89__91__93'(all_not_holds(A, B, C), D, E, F) :-
839 (
840 'CHRvar'(D)
841 ->
842 'CHRdelay'([D, all_not_holds(A, B, C)], 'CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F))
843 ;
844 true
845 ).
846:- set_flag('CHRall_not_holds_3__85__87__89__91__93' / 4, leash, notrace). 847if_then_holds(A, B, C) :-
848 'CHRgen_num'(D),
849 coca(add_one_constraint(D, if_then_holds(A, B, C))),
850 'CHRif_then_holds_3'(if_then_holds(A, B, C), E, F, D).
851
852
853
855
856'CHRif_then_holds_3'(if_then_holds(A, B, C), D, E, F) :-
857 (
858 'CHRnonvar'(D)
859 ;
860 'CHRalready_in'('CHRif_then_holds_3'(if_then_holds(A, B, C), D, E, F)),
861 coca(already_in)
862 ),
863 !.
864'CHRif_then_holds_3'(if_then_holds(A, B, C), D, E, F) ?-
865 coca(try_rule(F, if_then_holds(A, B, C), anonymous("29"), if_then_holds(G, H, I), replacement, true, if_then_or_holds(G, [H], I))),
866 !,
867 'CHRkill'(D),
868 coca(fired_rule(anonymous("29"))),
869 if_then_or_holds(A, [B], C).
870'CHRif_then_holds_3'(if_then_holds(A, B, C), D, E, F) :-
871 'CHRif_then_holds_3__94'(if_then_holds(A, B, C), D, E, F).
872:- set_flag('CHRif_then_holds_3' / 4, leash, notrace). 873:- current_macro('CHRif_then_holds_3' / 4, _49791, _49792, _49793) -> true ; define_macro('CHRif_then_holds_3' / 4, tr_chr / 2, [write]). 874'CHRif_then_holds_3__94'(A, B, C, D) :-
875 'CHRif_then_holds_3__95'(A, B, C, D).
876:- set_flag('CHRif_then_holds_3__94' / 4, leash, notrace). 877'CHRif_then_holds_3__95'(if_then_holds(A, B, C), D, E, F) :-
878 (
879 'CHRvar'(D)
880 ->
881 'CHRdelay'([D, if_then_holds(A, B, C)], 'CHRif_then_holds_3'(if_then_holds(A, B, C), D, E, F))
882 ;
883 true
884 ).
885:- set_flag('CHRif_then_holds_3__95' / 4, leash, notrace). 886if_then_or_holds(A, B, C) :-
887 'CHRgen_num'(D),
888 coca(add_one_constraint(D, if_then_or_holds(A, B, C))),
889 'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), E, F, D).
890
891
892
894
895'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) :-
896 (
897 'CHRnonvar'(D)
898 ;
899 'CHRalready_in'('CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)),
900 coca(already_in)
901 ),
902 !.
903'CHRif_then_or_holds_3'(if_then_or_holds(A, [], B), C, D, E) ?-
904 coca(try_rule(E, if_then_or_holds(A, [], B), anonymous("30"), if_then_or_holds(F, [], G), replacement, true, not_holds(F, G))),
905 !,
906 'CHRkill'(C),
907 coca(fired_rule(anonymous("30"))),
908 not_holds(A, B).
909'CHRif_then_or_holds_3'(if_then_or_holds(A, B, []), C, D, E) ?-
910 coca(try_rule(E, if_then_or_holds(A, B, []), anonymous("31"), if_then_or_holds(F, G, []), replacement, true, true)),
911 !,
912 'CHRkill'(C),
913 coca(fired_rule(anonymous("31"))).
914'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
915 coca(try_rule(F, if_then_or_holds(A, B, C), anonymous("32"), if_then_or_holds(G, H, I), replacement, (member(eq(J, K), H), or_neq(exists, J, K, L), \+ call(L)), true)),
916 no_delayed_goals((member(eq(M, N), B), or_neq(exists, M, N, O), \+ call(O))),
917 !,
918 'CHRkill'(D),
919 coca(fired_rule(anonymous("32"))).
920'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
921 coca(try_rule(F, if_then_or_holds(A, B, C), anonymous("33"), if_then_or_holds(G, H, I), replacement, (member(eq(J, K), H, L), \+ (and_eq(J, K, M), call(M))), if_then_or_holds(G, L, I))),
922 no_delayed_goals((member(eq(N, O), B, P), \+ (and_eq(N, O, Q), call(Q)))),
923 !,
924 'CHRkill'(D),
925 coca(fired_rule(anonymous("33"))),
926 if_then_or_holds(A, P, C).
927'CHRif_then_or_holds_3'(if_then_or_holds(A, B, [C|D]), E, F, G) ?-
928 coca(try_rule(G, if_then_or_holds(A, B, [C|D]), anonymous("34"), if_then_or_holds(H, I, [J|K]), replacement, true, H == J -> or_holds(I, [J|K]) ; H \= J -> if_then_or_holds(H, I, [], [J|K]) ; (H =.. [L|M], J =.. [N|O], or_holds([neq(M, O)|I], [J|K]), if_then_or_holds(H, I, [], [J|K])))),
929 !,
930 'CHRkill'(E),
931 coca(fired_rule(anonymous("34"))),
932 (
933 A == C
934 ->
935 or_holds(B, [C|D])
936 ;
937 (
938 A \= C
939 ->
940 if_then_or_holds(A, B, [], [C|D])
941 ;
942 A =.. [P|Q],
943 C =.. [R|S],
944 or_holds([neq(Q, S)|B], [C|D]),
945 if_then_or_holds(A, B, [], [C|D])
946 )
947 ).
948'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
949 'CHRget_delayed_goals'(C, G),
950 'CHRif_then_or_holds_3__97'(G, [C], [H, I], J),
951 coca(try_double(F, if_then_or_holds(A, B, C), J, all_holds(I, H, C), if_then_or_holds(K, L, M), all_holds(N, O, M), keep_second, (copy_fluent(N, O, P, Q), P = K, \+ call(#\+(Q))), or_holds(L, M), anonymous("9"))),
952 no_delayed_goals((copy_fluent(I, H, R, S), R = A, \+ call(#\+(S)))),
953 !,
954 'CHRkill'(D),
955 coca(fired_rule(anonymous("9"))),
956 or_holds(B, C).
957'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
958 'CHRget_delayed_goals'(C, G),
959 'CHRif_then_or_holds_3__98'(G, [C], [H, I], J),
960 coca(try_double(F, if_then_or_holds(A, B, C), J, all_holds(I, H, C), if_then_or_holds(K, L, M), all_holds(N, O, M), keep_second, (member(P, L), copy_fluent(N, O, Q, R), Q = P, \+ call(#\+(R))), true, anonymous("10"))),
961 no_delayed_goals((member(S, B), copy_fluent(I, H, T, U), T = S, \+ call(#\+(U)))),
962 !,
963 'CHRkill'(D),
964 coca(fired_rule(anonymous("10"))).
965'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
966 'CHRget_delayed_goals'(C, G),
967 'CHRif_then_or_holds_3__99'(G, [C], [H, I], J),
968 coca(try_double(F, if_then_or_holds(A, B, C), J, all_not_holds(I, H, C), if_then_or_holds(K, L, M), all_not_holds(N, O, M), keep_second, (copy_fluent(N, O, P, Q), P = K, \+ call(#\+(Q))), true, anonymous("15"))),
969 no_delayed_goals((copy_fluent(I, H, R, S), R = A, \+ call(#\+(S)))),
970 !,
971 'CHRkill'(D),
972 coca(fired_rule(anonymous("15"))).
973'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
974 'CHRget_delayed_goals'(C, G),
975 'CHRif_then_or_holds_3__100'(G, [C], [H, I], J),
976 coca(try_double(F, if_then_or_holds(A, B, C), J, all_not_holds(I, H, C), if_then_or_holds(K, L, M), all_not_holds(N, O, M), keep_second, (member(P, L, Q), copy_fluent(N, O, R, S), R = P, \+ call(#\+(S))), if_then_or_holds(K, Q, M), anonymous("16"))),
977 no_delayed_goals((member(T, B, U), copy_fluent(I, H, V, W), V = T, \+ call(#\+(W)))),
978 !,
979 'CHRkill'(D),
980 coca(fired_rule(anonymous("16"))),
981 if_then_or_holds(A, U, C).
982'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
983 'CHRget_delayed_goals'(C, G),
984 'CHRif_then_or_holds_3__101'(G, [C], [H], I),
985 coca(try_double(F, if_then_or_holds(A, B, C), I, not_holds(H, C), if_then_or_holds(J, K, L), not_holds(M, L), keep_second, M == J, true, anonymous("37"))),
986 no_delayed_goals(H == A),
987 !,
988 'CHRkill'(D),
989 coca(fired_rule(anonymous("37"))).
990'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
991 'CHRget_delayed_goals'(C, G),
992 'CHRif_then_or_holds_3__102'(G, [C], [H], I),
993 coca(try_double(F, if_then_or_holds(A, B, C), I, not_holds(H, C), if_then_or_holds(J, K, L), not_holds(M, L), keep_second, (member(N, K, O), M == N), if_then_or_holds(J, O, L), anonymous("38"))),
994 no_delayed_goals((member(P, B, Q), H == P)),
995 !,
996 'CHRkill'(D),
997 coca(fired_rule(anonymous("38"))),
998 if_then_or_holds(A, Q, C).
999'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
1000 'CHRget_delayed_goals'(C, G),
1001 'CHRif_then_or_holds_3__103'(G, [C], [H], I),
1002 coca(try_double(F, if_then_or_holds(A, B, C), I, cancel(H, C), if_then_or_holds(J, K, L), cancel(M, L), keep_second, \+ M \= J, true, anonymous("42"))),
1003 no_delayed_goals(\+ H \= A),
1004 !,
1005 'CHRkill'(D),
1006 coca(fired_rule(anonymous("42"))).
1007'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) ?-
1008 'CHRget_delayed_goals'(C, G),
1009 'CHRif_then_or_holds_3__104'(G, [C], [H], I),
1010 coca(try_double(F, if_then_or_holds(A, B, C), I, cancel(H, C), if_then_or_holds(J, K, L), cancel(M, L), keep_second, (member(N, K), \+ M \= N), true, anonymous("43"))),
1011 no_delayed_goals((member(O, B), \+ H \= O)),
1012 !,
1013 'CHRkill'(D),
1014 coca(fired_rule(anonymous("43"))).
1015'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F) :-
1016 'CHRif_then_or_holds_3__96'(if_then_or_holds(A, B, C), D, E, F).
1017'CHRif_then_or_holds_3__97'(['CHRall_holds_3'(all_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
1018 'CHRvar'(D),
1019 'CHR='([B, A], [H, I]),
1020 'CHR='(F, J).
1021'CHRif_then_or_holds_3__97'([A|B], C, D, E) :-
1022 'CHRif_then_or_holds_3__97'(B, C, D, E).
1023:- set_flag('CHRif_then_or_holds_3__97' / 4, leash, notrace). 1024'CHRif_then_or_holds_3__98'(['CHRall_holds_3'(all_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
1025 'CHRvar'(D),
1026 'CHR='([B, A], [H, I]),
1027 'CHR='(F, J).
1028'CHRif_then_or_holds_3__98'([A|B], C, D, E) :-
1029 'CHRif_then_or_holds_3__98'(B, C, D, E).
1030:- set_flag('CHRif_then_or_holds_3__98' / 4, leash, notrace). 1031'CHRif_then_or_holds_3__99'(['CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
1032 'CHRvar'(D),
1033 'CHR='([B, A], [H, I]),
1034 'CHR='(F, J).
1035'CHRif_then_or_holds_3__99'([A|B], C, D, E) :-
1036 'CHRif_then_or_holds_3__99'(B, C, D, E).
1037:- set_flag('CHRif_then_or_holds_3__99' / 4, leash, notrace). 1038'CHRif_then_or_holds_3__100'(['CHRall_not_holds_3'(all_not_holds(A, B, C), D, E, F)|G], [C], [H, I], J) ?-
1039 'CHRvar'(D),
1040 'CHR='([B, A], [H, I]),
1041 'CHR='(F, J).
1042'CHRif_then_or_holds_3__100'([A|B], C, D, E) :-
1043 'CHRif_then_or_holds_3__100'(B, C, D, E).
1044:- set_flag('CHRif_then_or_holds_3__100' / 4, leash, notrace). 1045'CHRif_then_or_holds_3__101'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], [B], [G], H) ?-
1046 'CHRvar'(C),
1047 'CHR='([A], [G]),
1048 'CHR='(E, H).
1049'CHRif_then_or_holds_3__101'([A|B], C, D, E) :-
1050 'CHRif_then_or_holds_3__101'(B, C, D, E).
1051:- set_flag('CHRif_then_or_holds_3__101' / 4, leash, notrace). 1052'CHRif_then_or_holds_3__102'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], [B], [G], H) ?-
1053 'CHRvar'(C),
1054 'CHR='([A], [G]),
1055 'CHR='(E, H).
1056'CHRif_then_or_holds_3__102'([A|B], C, D, E) :-
1057 'CHRif_then_or_holds_3__102'(B, C, D, E).
1058:- set_flag('CHRif_then_or_holds_3__102' / 4, leash, notrace). 1059'CHRif_then_or_holds_3__103'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
1060 'CHRvar'(C),
1061 'CHR='([A], [G]),
1062 'CHR='(E, H).
1063'CHRif_then_or_holds_3__103'([A|B], C, D, E) :-
1064 'CHRif_then_or_holds_3__103'(B, C, D, E).
1065:- set_flag('CHRif_then_or_holds_3__103' / 4, leash, notrace). 1066'CHRif_then_or_holds_3__104'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
1067 'CHRvar'(C),
1068 'CHR='([A], [G]),
1069 'CHR='(E, H).
1070'CHRif_then_or_holds_3__104'([A|B], C, D, E) :-
1071 'CHRif_then_or_holds_3__104'(B, C, D, E).
1072:- set_flag('CHRif_then_or_holds_3__104' / 4, leash, notrace). 1073:- set_flag('CHRif_then_or_holds_3' / 4, leash, notrace). 1074:- current_macro('CHRif_then_or_holds_3' / 4, _55080, _55081, _55082) -> true ; define_macro('CHRif_then_or_holds_3' / 4, tr_chr / 2, [write]). 1075'CHRif_then_or_holds_3__96'(A, B, C, D) :-
1076 'CHRif_then_or_holds_3__105'(A, B, C, D).
1077:- set_flag('CHRif_then_or_holds_3__96' / 4, leash, notrace). 1078'CHRif_then_or_holds_3__105'(if_then_or_holds(A, B, C), D, E, F) :-
1079 (
1080 'CHRvar'(D)
1081 ->
1082 'CHRdelay'([D, if_then_or_holds(A, B, C)], 'CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F))
1083 ;
1084 true
1085 ).
1086:- set_flag('CHRif_then_or_holds_3__105' / 4, leash, notrace). 1087if_then_or_holds(A, B, C, D) :-
1088 'CHRgen_num'(E),
1089 coca(add_one_constraint(E, if_then_or_holds(A, B, C, D))),
1090 'CHRif_then_or_holds_4'(if_then_or_holds(A, B, C, D), F, G, E).
1091
1092
1093
1095
1096'CHRif_then_or_holds_4'(if_then_or_holds(A, B, C, D), E, F, G) :-
1097 (
1098 'CHRnonvar'(E)
1099 ;
1100 'CHRalready_in'('CHRif_then_or_holds_4'(if_then_or_holds(A, B, C, D), E, F, G)),
1101 coca(already_in)
1102 ),
1103 !.
1104'CHRif_then_or_holds_4'(if_then_or_holds(A, [B|C], D, [E|F]), G, H, I) ?-
1105 coca(try_rule(I, if_then_or_holds(A, [B|C], D, [E|F]), anonymous("35"), if_then_or_holds(J, [K|L], M, [N|O]), replacement, true, K == N -> true ; K \= N -> if_then_or_holds(J, L, [K|M], [N|O]) ; (K =.. [P|Q], N =.. [R|S], if_then_or_holds(J, L, [eq(Q, S), K|M], [N|O])))),
1106 !,
1107 'CHRkill'(G),
1108 coca(fired_rule(anonymous("35"))),
1109 (
1110 B == E
1111 ->
1112 true
1113 ;
1114 (
1115 B \= E
1116 ->
1117 if_then_or_holds(A, C, [B|D], [E|F])
1118 ;
1119 B =.. [T|U],
1120 E =.. [V|W],
1121 if_then_or_holds(A, C, [eq(U, W), B|D], [E|F])
1122 )
1123 ).
1124'CHRif_then_or_holds_4'(if_then_or_holds(A, [], B, [C|D]), E, F, G) ?-
1125 coca(try_rule(G, if_then_or_holds(A, [], B, [C|D]), anonymous("36"), if_then_or_holds(H, [], I, [J|K]), replacement, true, if_then_or_holds(H, I, K))),
1126 !,
1127 'CHRkill'(E),
1128 coca(fired_rule(anonymous("36"))),
1129 if_then_or_holds(A, B, D).
1130'CHRif_then_or_holds_4'(if_then_or_holds(A, B, C, D), E, F, G) :-
1131 'CHRif_then_or_holds_4__106'(if_then_or_holds(A, B, C, D), E, F, G).
1132:- set_flag('CHRif_then_or_holds_4' / 4, leash, notrace). 1133:- current_macro('CHRif_then_or_holds_4' / 4, _56042, _56043, _56044) -> true ; define_macro('CHRif_then_or_holds_4' / 4, tr_chr / 2, [write]). 1134'CHRif_then_or_holds_4__106'(A, B, C, D) :-
1135 'CHRif_then_or_holds_4__107'(A, B, C, D).
1136:- set_flag('CHRif_then_or_holds_4__106' / 4, leash, notrace). 1137'CHRif_then_or_holds_4__107'(if_then_or_holds(A, B, C, D), E, F, G) :-
1138 (
1139 'CHRvar'(E)
1140 ->
1141 'CHRdelay'([E, if_then_or_holds(A, B, C, D)], 'CHRif_then_or_holds_4'(if_then_or_holds(A, B, C, D), E, F, G))
1142 ;
1143 true
1144 ).
1145:- set_flag('CHRif_then_or_holds_4__107' / 4, leash, notrace). 1146cancel(A, B) :-
1147 'CHRgen_num'(C),
1148 coca(add_one_constraint(C, cancel(A, B))),
1149 'CHRcancel_2'(cancel(A, B), D, E, C).
1150
1151
1152
1154
1155'CHRcancel_2'(cancel(A, B), C, D, E) :-
1156 (
1157 'CHRnonvar'(C)
1158 ;
1159 'CHRalready_in'('CHRcancel_2'(cancel(A, B), C, D, E)),
1160 coca(already_in)
1161 ),
1162 !.
1163'CHRcancel_2'(cancel(A, B), C, D, E) ?-
1164 'CHRget_delayed_goals'(B, F),
1165 'CHRcancel_2__109'(F, [B, A], [], G),
1166 coca(try_double(E, cancel(A, B), G, cancelled(A, B), cancel(H, I), cancelled(H, I), replacement, true, true, anonymous("44"))),
1167 !,
1168 'CHRkill'(C),
1169 coca(fired_rule(anonymous("44"))).
1170'CHRcancel_2'(cancel(A, B), C, D, E) :-
1171 'CHRcancel_2__108'(cancel(A, B), C, D, E).
1172'CHRcancel_2__109'(['CHRcancelled_2'(cancelled(A, B), C, D, E)|F], [B, A], [], G) ?-
1173 'CHRvar'(C),
1174 'CHRkill'(C),
1175 'CHR='([], []),
1176 'CHR='(E, G).
1177'CHRcancel_2__109'([A|B], C, D, E) :-
1178 'CHRcancel_2__109'(B, C, D, E).
1179:- set_flag('CHRcancel_2__109' / 4, leash, notrace). 1180:- set_flag('CHRcancel_2' / 4, leash, notrace). 1181:- current_macro('CHRcancel_2' / 4, _56976, _56977, _56978) -> true ; define_macro('CHRcancel_2' / 4, tr_chr / 2, [write]). 1182'CHRcancel_2__108'(A, B, C, D) :-
1183 'CHRcancel_2__110'(A, B, C, D).
1184:- set_flag('CHRcancel_2__108' / 4, leash, notrace). 1185'CHRcancel_2__110'(cancel(A, B), C, D, E) ?-
1186 'CHRvar'(C),
1187 !,
1188 'CHRget_delayed_goals'(B, F),
1189 'CHRcancel_2__110__111'(F, C, cancel(A, B), D, E).
1190'CHRcancel_2__110'(cancel(A, B), C, D, E) :-
1191 'CHRcancel_2__110__112'(cancel(A, B), C, D, E).
1192:- set_flag('CHRcancel_2__110' / 4, leash, notrace). 1193'CHRcancel_2__110__111'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], G, cancel(H, B), I, J) ?-
1194 'CHRvar'(C),
1195 coca(try_double(J, cancel(H, B), E, not_holds(A, B), cancel(K, L), not_holds(M, L), keep_first, \+ K \= M, true, anonymous("39"))),
1196 no_delayed_goals(\+ H \= A),
1197 !,
1198 'CHRkill'(C),
1199 coca(fired_rule(anonymous("39"))),
1200 'CHRcancel_2__110__111'(F, G, cancel(H, B), I, J).
1201'CHRcancel_2__110__111'([A|B], C, D, E, F) :-
1202 'CHRcancel_2__110__111'(B, C, D, E, F).
1203'CHRcancel_2__110__111'([], A, B, C, D) :-
1204 'CHRcancel_2__110__112'(B, A, C, D).
1205:- set_flag('CHRcancel_2__110__111' / 5, leash, notrace). 1206'CHRcancel_2__110__112'(cancel(A, B), C, D, E) ?-
1207 'CHRvar'(C),
1208 !,
1209 'CHRget_delayed_goals'(B, F),
1210 'CHRcancel_2__110__112__113'(F, C, cancel(A, B), D, E).
1211'CHRcancel_2__110__112'(cancel(A, B), C, D, E) :-
1212 'CHRcancel_2__110__112__114'(cancel(A, B), C, D, E).
1213:- set_flag('CHRcancel_2__110__112' / 4, leash, notrace). 1214'CHRcancel_2__110__112__113'(['CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)|F], G, cancel(H, B), I, J) ?-
1215 'CHRvar'(C),
1216 coca(try_double(J, cancel(H, B), E, not_holds_all(A, B), cancel(K, L), not_holds_all(M, L), keep_first, \+ K \= M, true, anonymous("40"))),
1217 no_delayed_goals(\+ H \= A),
1218 !,
1219 'CHRkill'(C),
1220 coca(fired_rule(anonymous("40"))),
1221 'CHRcancel_2__110__112__113'(F, G, cancel(H, B), I, J).
1222'CHRcancel_2__110__112__113'([A|B], C, D, E, F) :-
1223 'CHRcancel_2__110__112__113'(B, C, D, E, F).
1224'CHRcancel_2__110__112__113'([], A, B, C, D) :-
1225 'CHRcancel_2__110__112__114'(B, A, C, D).
1226:- set_flag('CHRcancel_2__110__112__113' / 5, leash, notrace). 1227'CHRcancel_2__110__112__114'(cancel(A, B), C, D, E) ?-
1228 'CHRvar'(C),
1229 !,
1230 'CHRget_delayed_goals'(B, F),
1231 'CHRcancel_2__110__112__114__115'(F, C, cancel(A, B), D, E).
1232'CHRcancel_2__110__112__114'(cancel(A, B), C, D, E) :-
1233 'CHRcancel_2__110__112__114__116'(cancel(A, B), C, D, E).
1234:- set_flag('CHRcancel_2__110__112__114' / 4, leash, notrace). 1235'CHRcancel_2__110__112__114__115'(['CHRor_holds_2'(or_holds(A, B), C, D, E)|F], G, cancel(H, B), I, J) ?-
1236 'CHRvar'(C),
1237 coca(try_double(J, cancel(H, B), E, or_holds(A, B), cancel(K, L), or_holds(M, L), keep_first, (member(N, M), \+ K \= N), true, anonymous("41"))),
1238 no_delayed_goals((member(O, A), \+ H \= O)),
1239 !,
1240 'CHRkill'(C),
1241 coca(fired_rule(anonymous("41"))),
1242 'CHRcancel_2__110__112__114__115'(F, G, cancel(H, B), I, J).
1243'CHRcancel_2__110__112__114__115'([A|B], C, D, E, F) :-
1244 'CHRcancel_2__110__112__114__115'(B, C, D, E, F).
1245'CHRcancel_2__110__112__114__115'([], A, B, C, D) :-
1246 'CHRcancel_2__110__112__114__116'(B, A, C, D).
1247:- set_flag('CHRcancel_2__110__112__114__115' / 5, leash, notrace). 1248'CHRcancel_2__110__112__114__116'(cancel(A, B), C, D, E) ?-
1249 'CHRvar'(C),
1250 !,
1251 'CHRget_delayed_goals'(B, F),
1252 'CHRcancel_2__110__112__114__116__117'(F, C, cancel(A, B), D, E).
1253'CHRcancel_2__110__112__114__116'(cancel(A, B), C, D, E) :-
1254 'CHRcancel_2__110__112__114__116__118'(cancel(A, B), C, D, E).
1255:- set_flag('CHRcancel_2__110__112__114__116' / 4, leash, notrace). 1256'CHRcancel_2__110__112__114__116__117'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, cancel(I, C), J, K) ?-
1257 'CHRvar'(D),
1258 coca(try_double(K, cancel(I, C), F, if_then_or_holds(A, B, C), cancel(L, M), if_then_or_holds(N, O, M), keep_first, \+ L \= N, true, anonymous("42"))),
1259 no_delayed_goals(\+ I \= A),
1260 !,
1261 'CHRkill'(D),
1262 coca(fired_rule(anonymous("42"))),
1263 'CHRcancel_2__110__112__114__116__117'(G, H, cancel(I, C), J, K).
1264'CHRcancel_2__110__112__114__116__117'([A|B], C, D, E, F) :-
1265 'CHRcancel_2__110__112__114__116__117'(B, C, D, E, F).
1266'CHRcancel_2__110__112__114__116__117'([], A, B, C, D) :-
1267 'CHRcancel_2__110__112__114__116__118'(B, A, C, D).
1268:- set_flag('CHRcancel_2__110__112__114__116__117' / 5, leash, notrace). 1269'CHRcancel_2__110__112__114__116__118'(cancel(A, B), C, D, E) ?-
1270 'CHRvar'(C),
1271 !,
1272 'CHRget_delayed_goals'(B, F),
1273 'CHRcancel_2__110__112__114__116__118__119'(F, C, cancel(A, B), D, E).
1274'CHRcancel_2__110__112__114__116__118'(cancel(A, B), C, D, E) :-
1275 'CHRcancel_2__110__112__114__116__118__120'(cancel(A, B), C, D, E).
1276:- set_flag('CHRcancel_2__110__112__114__116__118' / 4, leash, notrace). 1277'CHRcancel_2__110__112__114__116__118__119'(['CHRif_then_or_holds_3'(if_then_or_holds(A, B, C), D, E, F)|G], H, cancel(I, C), J, K) ?-
1278 'CHRvar'(D),
1279 coca(try_double(K, cancel(I, C), F, if_then_or_holds(A, B, C), cancel(L, M), if_then_or_holds(N, O, M), keep_first, (member(P, O), \+ L \= P), true, anonymous("43"))),
1280 no_delayed_goals((member(Q, B), \+ I \= Q)),
1281 !,
1282 'CHRkill'(D),
1283 coca(fired_rule(anonymous("43"))),
1284 'CHRcancel_2__110__112__114__116__118__119'(G, H, cancel(I, C), J, K).
1285'CHRcancel_2__110__112__114__116__118__119'([A|B], C, D, E, F) :-
1286 'CHRcancel_2__110__112__114__116__118__119'(B, C, D, E, F).
1287'CHRcancel_2__110__112__114__116__118__119'([], A, B, C, D) :-
1288 'CHRcancel_2__110__112__114__116__118__120'(B, A, C, D).
1289:- set_flag('CHRcancel_2__110__112__114__116__118__119' / 5, leash, notrace). 1290'CHRcancel_2__110__112__114__116__118__120'(cancel(A, B), C, D, E) :-
1291 (
1292 'CHRvar'(C)
1293 ->
1294 'CHRdelay'([C, cancel(A, B)], 'CHRcancel_2'(cancel(A, B), C, D, E))
1295 ;
1296 true
1297 ).
1298:- set_flag('CHRcancel_2__110__112__114__116__118__120' / 4, leash, notrace). 1299cancelled(A, B) :-
1300 'CHRgen_num'(C),
1301 coca(add_one_constraint(C, cancelled(A, B))),
1302 'CHRcancelled_2'(cancelled(A, B), D, E, C).
1303
1304
1305
1307
1308'CHRcancelled_2'(cancelled(A, B), C, D, E) :-
1309 (
1310 'CHRnonvar'(C)
1311 ;
1312 'CHRalready_in'('CHRcancelled_2'(cancelled(A, B), C, D, E)),
1313 coca(already_in)
1314 ),
1315 !.
1316'CHRcancelled_2'(cancelled(A, B), C, D, E) ?-
1317 'CHRget_delayed_goals'(B, F),
1318 'CHRcancelled_2__122'(F, [B, A], [], G),
1319 coca(try_double(E, cancelled(A, B), G, cancel(A, B), cancelled(H, I), cancel(H, I), replacement, true, true, anonymous("44"))),
1320 !,
1321 'CHRkill'(C),
1322 coca(fired_rule(anonymous("44"))).
1323'CHRcancelled_2'(cancelled(A, B), C, D, E) :-
1324 'CHRcancelled_2__121'(cancelled(A, B), C, D, E).
1325'CHRcancelled_2__122'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B, A], [], G) ?-
1326 'CHRvar'(C),
1327 'CHRkill'(C),
1328 'CHR='([], []),
1329 'CHR='(E, G).
1330'CHRcancelled_2__122'([A|B], C, D, E) :-
1331 'CHRcancelled_2__122'(B, C, D, E).
1332:- set_flag('CHRcancelled_2__122' / 4, leash, notrace). 1333:- set_flag('CHRcancelled_2' / 4, leash, notrace). 1334:- current_macro('CHRcancelled_2' / 4, _60627, _60628, _60629) -> true ; define_macro('CHRcancelled_2' / 4, tr_chr / 2, [write]). 1335'CHRcancelled_2__121'(A, B, C, D) :-
1336 'CHRcancelled_2__123'(A, B, C, D).
1337:- set_flag('CHRcancelled_2__121' / 4, leash, notrace). 1338'CHRcancelled_2__123'(cancelled(A, B), C, D, E) :-
1339 (
1340 'CHRvar'(C)
1341 ->
1342 'CHRdelay'([C, cancelled(A, B)], 'CHRcancelled_2'(cancelled(A, B), C, D, E))
1343 ;
1344 true
1345 ).
1346:- set_flag('CHRcancelled_2__123' / 4, leash, notrace). 1347
1348:- getval(variable_names_flag, Val), set_flag(variable_names, Val).