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). 8:- lib(fd). 9neq(_6701, _6704) :- or_neq(exists, _6701, _6704).
10neq_all(_6729, _6732) :- or_neq(forall, _6729, _6732).
11or_neq(_6757, _6760, _6763) :- _6760 =.. [_6776|_6777], _6763 =.. [_6786|_6787], (_6776 = _6786 -> or_neq(_6757, _6777, _6787, _6805), call(_6805) ; true).
12or_neq(_6976, [], [], 0 #\= 0).
13or_neq(_7019, [_7024|_7025], [_7030|_7031], _7034) :- or_neq(_7019, _7025, _7031, _7051), (_7019 = forall, var(_7024) -> _7034 = _7051 ; _7034 = #\/(_7024 #\= _7030, _7051)).
14and_eq([], [], 0 #= 0).
15and_eq([_7294|_7295], [_7300|_7301], _7304) :- and_eq(_7295, _7301, _7318), _7304 = #/\(_7294 #= _7300, _7318).
16or_and_eq([], 0 #\= 0).
17or_and_eq([eq(_7478, _7481)|_7485], #\/(_7488, _7492)) :- or_and_eq(_7485, _7488), and_eq(_7478, _7481, _7492).
18member(_7607, [_7607|_7612], _7612).
19member(_7627, [_7632|_7633], [_7632|_7638]) :- member(_7627, _7633, _7638).
20cancel(_7664, _7667, _7670) :- var(_7667) -> cancel(_7664, _7667), cancelled(_7664, _7667), _7670 = _7667 ; _7667 = [_7716|_7717], (_7664 \= _7716 -> cancel(_7664, _7717, _7733), _7670 = [_7716|_7733] ; cancel(_7664, _7717, _7670)).
21not_holds(A, B) :-
22 'CHRnot_holds_2'(not_holds(A, B), C, D, E).
23
24
25
27
28'CHRnot_holds_2'(not_holds(A, B), C, D, E) :-
29 (
30 'CHRnonvar'(C)
31 ;
32 'CHRalready_in'('CHRnot_holds_2'(not_holds(A, B), C, D, E)),
33 coca(already_in)
34 ),
35 !.
36'CHRnot_holds_2'(not_holds(A, [B|C]), D, E, F) ?-
37 !,
38 D = true,
39 neq(A, B),
40 not_holds(A, C).
41'CHRnot_holds_2'(not_holds(A, []), B, C, D) ?-
42 !,
43 B = true.
44'CHRnot_holds_2'(not_holds(A, B), C, D, E) ?-
45 'CHRget_delayed_goals'(B, F),
46 'CHRnot_holds_2__23'(F, [B], [G], H),
47 no_delayed_goals(instance(A, G)),
48 !,
49 C = true.
50'CHRnot_holds_2'(not_holds(A, B), C, D, E) ?-
51 'CHRget_delayed_goals'(B, F),
52 'CHRnot_holds_2__24'(F, [B], [G], H),
53 no_delayed_goals(\+ G \= A),
54 !,
55 C = true,
56 cancel(G, B).
57'CHRnot_holds_2'(not_holds(A, B), C, D, E) :-
58 'CHRnot_holds_2__22'(not_holds(A, B), C, D, E).
59'CHRnot_holds_2__23'(['CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)|F], [B], [G], H) ?-
60 var(C),
61 [A, E] = [G, H].
62'CHRnot_holds_2__23'([A|B], C, D, E) :-
63 'CHRnot_holds_2__23'(B, C, D, E).
64:- set_flag('CHRnot_holds_2__23' / 4, leash, notrace). 65'CHRnot_holds_2__24'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
66 var(C),
67 [A, E] = [G, H].
68'CHRnot_holds_2__24'([A|B], C, D, E) :-
69 'CHRnot_holds_2__24'(B, C, D, E).
70:- set_flag('CHRnot_holds_2__24' / 4, leash, notrace). 71:- set_flag('CHRnot_holds_2' / 4, leash, notrace). 72:- current_macro('CHRnot_holds_2' / 4, _9493, _9494, _9495) -> true ; define_macro('CHRnot_holds_2' / 4, tr_chr / 2, [write]). 73'CHRnot_holds_2__22'(A, B, C, D) :-
74 'CHRnot_holds_2__25'(A, B, C, D).
75:- set_flag('CHRnot_holds_2__22' / 4, leash, notrace). 76'CHRnot_holds_2__25'(not_holds(A, B), C, D, E) ?-
77 var(C),
78 !,
79 'CHRget_delayed_goals'(B, F),
80 'CHRnot_holds_2__25__26'(F, C, not_holds(A, B), D, E).
81'CHRnot_holds_2__25'(not_holds(A, B), C, D, E) :-
82 'CHRnot_holds_2__25__27'(not_holds(A, B), C, D, E).
83:- set_flag('CHRnot_holds_2__25' / 4, leash, notrace). 84'CHRnot_holds_2__25__26'(['CHRor_2'(or(A, B), C, D, E)|F], G, not_holds(H, B), I, J) ?-
85 var(C),
86 no_delayed_goals((member(K, A, L), H == K)),
87 !,
88 C = true,
89 'CHRnot_holds_2__25__26'(F, G, not_holds(H, B), I, J),
90 or(L, B).
91'CHRnot_holds_2__25__26'([A|B], C, D, E, F) :-
92 'CHRnot_holds_2__25__26'(B, C, D, E, F).
93'CHRnot_holds_2__25__26'([], A, B, C, D) :-
94 'CHRnot_holds_2__25__27'(B, A, C, D).
95:- set_flag('CHRnot_holds_2__25__26' / 5, leash, notrace). 96'CHRnot_holds_2__25__27'(not_holds(A, B), C, D, E) :-
97 (
98 'CHRvar'(C)
99 ->
100 'CHRdelay'([C, not_holds(A, B)], 'CHRnot_holds_2'(not_holds(A, B), C, D, E))
101 ;
102 true
103 ).
104:- set_flag('CHRnot_holds_2__25__27' / 4, leash, notrace). 105not_holds_all(A, B) :-
106 'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E).
107
108
109
111
112'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) :-
113 (
114 'CHRnonvar'(C)
115 ;
116 'CHRalready_in'('CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)),
117 coca(already_in)
118 ),
119 !.
120'CHRnot_holds_all_2'(not_holds_all(A, [B|C]), D, E, F) ?-
121 !,
122 D = true,
123 neq_all(A, B),
124 not_holds_all(A, C).
125'CHRnot_holds_all_2'(not_holds_all(A, []), B, C, D) ?-
126 !,
127 B = true.
128'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) ?-
129 'CHRget_delayed_goals'(B, F),
130 'CHRnot_holds_all_2__29'(F, [B], [G], H),
131 no_delayed_goals(instance(A, G)),
132 !,
133 C = true.
134'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E) :-
135 'CHRnot_holds_all_2__28'(not_holds_all(A, B), C, D, E).
136'CHRnot_holds_all_2__29'(['CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)|F], [B], [G], H) ?-
137 var(C),
138 [A, E] = [G, H].
139'CHRnot_holds_all_2__29'([A|B], C, D, E) :-
140 'CHRnot_holds_all_2__29'(B, C, D, E).
141:- set_flag('CHRnot_holds_all_2__29' / 4, leash, notrace). 142:- set_flag('CHRnot_holds_all_2' / 4, leash, notrace). 143:- current_macro('CHRnot_holds_all_2' / 4, _11159, _11160, _11161) -> true ; define_macro('CHRnot_holds_all_2' / 4, tr_chr / 2, [write]). 144'CHRnot_holds_all_2__28'(A, B, C, D) :-
145 'CHRnot_holds_all_2__30'(A, B, C, D).
146:- set_flag('CHRnot_holds_all_2__28' / 4, leash, notrace). 147'CHRnot_holds_all_2__30'(not_holds_all(A, B), C, D, E) ?-
148 var(C),
149 !,
150 'CHRget_delayed_goals'(B, F),
151 'CHRnot_holds_all_2__30__31'(F, C, not_holds_all(A, B), D, E).
152'CHRnot_holds_all_2__30'(not_holds_all(A, B), C, D, E) :-
153 'CHRnot_holds_all_2__30__32'(not_holds_all(A, B), C, D, E).
154:- set_flag('CHRnot_holds_all_2__30' / 4, leash, notrace). 155'CHRnot_holds_all_2__30__31'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], G, not_holds_all(H, B), I, J) ?-
156 var(C),
157 no_delayed_goals(instance(A, H)),
158 !,
159 C = true,
160 'CHRnot_holds_all_2__30__31'(F, G, not_holds_all(H, B), I, J).
161'CHRnot_holds_all_2__30__31'([A|B], C, D, E, F) :-
162 'CHRnot_holds_all_2__30__31'(B, C, D, E, F).
163'CHRnot_holds_all_2__30__31'([], A, B, C, D) :-
164 'CHRnot_holds_all_2__30__32'(B, A, C, D).
165:- set_flag('CHRnot_holds_all_2__30__31' / 5, leash, notrace). 166'CHRnot_holds_all_2__30__32'(not_holds_all(A, B), C, D, E) ?-
167 var(C),
168 !,
169 'CHRget_delayed_goals'(B, F),
170 'CHRnot_holds_all_2__30__32__33'(F, C, not_holds_all(A, B), D, E).
171'CHRnot_holds_all_2__30__32'(not_holds_all(A, B), C, D, E) :-
172 'CHRnot_holds_all_2__30__32__34'(not_holds_all(A, B), C, D, E).
173:- set_flag('CHRnot_holds_all_2__30__32' / 4, leash, notrace). 174'CHRnot_holds_all_2__30__32__33'(['CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)|F], G, not_holds_all(H, B), I, J) ?-
175 var(C),
176 no_delayed_goals(instance(A, H)),
177 !,
178 C = true,
179 'CHRnot_holds_all_2__30__32__33'(F, G, not_holds_all(H, B), I, J).
180'CHRnot_holds_all_2__30__32__33'([A|B], C, D, E, F) :-
181 'CHRnot_holds_all_2__30__32__33'(B, C, D, E, F).
182'CHRnot_holds_all_2__30__32__33'([], A, B, C, D) :-
183 'CHRnot_holds_all_2__30__32__34'(B, A, C, D).
184:- set_flag('CHRnot_holds_all_2__30__32__33' / 5, leash, notrace). 185'CHRnot_holds_all_2__30__32__34'(not_holds_all(A, B), C, D, E) ?-
186 var(C),
187 !,
188 'CHRget_delayed_goals'(B, F),
189 'CHRnot_holds_all_2__30__32__34__35'(F, C, not_holds_all(A, B), D, E).
190'CHRnot_holds_all_2__30__32__34'(not_holds_all(A, B), C, D, E) :-
191 'CHRnot_holds_all_2__30__32__34__36'(not_holds_all(A, B), C, D, E).
192:- set_flag('CHRnot_holds_all_2__30__32__34' / 4, leash, notrace). 193'CHRnot_holds_all_2__30__32__34__35'(['CHRor_2'(or(A, B), C, D, E)|F], G, not_holds_all(H, B), I, J) ?-
194 var(C),
195 no_delayed_goals((member(K, A, L), instance(K, H))),
196 !,
197 C = true,
198 'CHRnot_holds_all_2__30__32__34__35'(F, G, not_holds_all(H, B), I, J),
199 or(L, B).
200'CHRnot_holds_all_2__30__32__34__35'([A|B], C, D, E, F) :-
201 'CHRnot_holds_all_2__30__32__34__35'(B, C, D, E, F).
202'CHRnot_holds_all_2__30__32__34__35'([], A, B, C, D) :-
203 'CHRnot_holds_all_2__30__32__34__36'(B, A, C, D).
204:- set_flag('CHRnot_holds_all_2__30__32__34__35' / 5, leash, notrace). 205'CHRnot_holds_all_2__30__32__34__36'(not_holds_all(A, B), C, D, E) :-
206 (
207 'CHRvar'(C)
208 ->
209 'CHRdelay'([C, not_holds_all(A, B)], 'CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E))
210 ;
211 true
212 ).
213:- set_flag('CHRnot_holds_all_2__30__32__34__36' / 4, leash, notrace). 214duplicate_free(A) :-
215 'CHRduplicate_free_1'(duplicate_free(A), B, C, D).
216
217
218
220
221'CHRduplicate_free_1'(duplicate_free(A), B, C, D) :-
222 (
223 'CHRnonvar'(B)
224 ;
225 'CHRalready_in'('CHRduplicate_free_1'(duplicate_free(A), B, C, D)),
226 coca(already_in)
227 ),
228 !.
229'CHRduplicate_free_1'(duplicate_free([A|B]), C, D, E) ?-
230 !,
231 C = true,
232 not_holds(A, B),
233 duplicate_free(B).
234'CHRduplicate_free_1'(duplicate_free([]), A, B, C) ?-
235 !,
236 A = true.
237'CHRduplicate_free_1'(duplicate_free(A), B, C, D) :-
238 'CHRduplicate_free_1__37'(duplicate_free(A), B, C, D).
239:- set_flag('CHRduplicate_free_1' / 4, leash, notrace). 240:- current_macro('CHRduplicate_free_1' / 4, _13394, _13395, _13396) -> true ; define_macro('CHRduplicate_free_1' / 4, tr_chr / 2, [write]). 241'CHRduplicate_free_1__37'(A, B, C, D) :-
242 'CHRduplicate_free_1__38'(A, B, C, D).
243:- set_flag('CHRduplicate_free_1__37' / 4, leash, notrace). 244'CHRduplicate_free_1__38'(duplicate_free(A), B, C, D) :-
245 (
246 'CHRvar'(B)
247 ->
248 'CHRdelay'([B, duplicate_free(A)], 'CHRduplicate_free_1'(duplicate_free(A), B, C, D))
249 ;
250 true
251 ).
252:- set_flag('CHRduplicate_free_1__38' / 4, leash, notrace). 253or(A, B) :-
254 'CHRor_2'(or(A, B), C, D, E).
255
256
257
259
260'CHRor_2'(or(A, B), C, D, E) :-
261 (
262 'CHRnonvar'(C)
263 ;
264 'CHRalready_in'('CHRor_2'(or(A, B), C, D, E)),
265 coca(already_in)
266 ),
267 !.
268'CHRor_2'(or([eq(A, B)], C), D, E, F) ?-
269 !,
270 D = true,
271 and_eq(A, B, G),
272 call(G).
273'CHRor_2'(or([A], B), C, D, E) ?-
274 !,
275 C = true,
276 holds(A, B).
277'CHRor_2'(or(A, B), C, D, E) ?-
278 no_delayed_goals(\+ (member(F, A), F \= eq(G, H))),
279 !,
280 C = true,
281 or_and_eq(A, I),
282 call(I).
283'CHRor_2'(or(A, []), B, C, D) ?-
284 no_delayed_goals((member(E, A, F), E \= eq(G, H))),
285 !,
286 B = true,
287 or(F, []).
288'CHRor_2'(or(A, B), C, D, E) ?-
289 no_delayed_goals((member(eq(F, G), A), or_neq(exists, F, G, H), \+ call(H))),
290 !,
291 C = true.
292'CHRor_2'(or(A, B), C, D, E) ?-
293 no_delayed_goals((member(eq(F, G), A, H), \+ (and_eq(F, G, I), call(I)))),
294 !,
295 C = true,
296 or(H, B).
297'CHRor_2'(or(A, [B|C]), D, E, F) ?-
298 !,
299 D = true,
300 or(A, [], [B|C]).
301'CHRor_2'(or(A, B), C, D, E) ?-
302 'CHRget_delayed_goals'(B, F),
303 'CHRor_2__40'(F, [B], [G], H),
304 no_delayed_goals((member(I, A, J), G == I)),
305 !,
306 C = true,
307 or(J, B).
308'CHRor_2'(or(A, B), C, D, E) ?-
309 'CHRget_delayed_goals'(B, F),
310 'CHRor_2__41'(F, [B], [G], H),
311 no_delayed_goals((member(I, A, J), instance(I, G))),
312 !,
313 C = true,
314 or(J, B).
315'CHRor_2'(or(A, B), C, D, E) ?-
316 'CHRget_delayed_goals'(B, F),
317 'CHRor_2__42'(F, [B], [G], H),
318 no_delayed_goals((member(I, A), \+ G \= I)),
319 !,
320 C = true,
321 cancel(G, B).
322'CHRor_2'(or(A, B), C, D, E) :-
323 'CHRor_2__39'(or(A, B), C, D, E).
324'CHRor_2__40'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], [B], [G], H) ?-
325 var(C),
326 [A, E] = [G, H].
327'CHRor_2__40'([A|B], C, D, E) :-
328 'CHRor_2__40'(B, C, D, E).
329:- set_flag('CHRor_2__40' / 4, leash, notrace). 330'CHRor_2__41'(['CHRnot_holds_all_2'(not_holds_all(A, B), C, D, E)|F], [B], [G], H) ?-
331 var(C),
332 [A, E] = [G, H].
333'CHRor_2__41'([A|B], C, D, E) :-
334 'CHRor_2__41'(B, C, D, E).
335:- set_flag('CHRor_2__41' / 4, leash, notrace). 336'CHRor_2__42'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B], [G], H) ?-
337 var(C),
338 [A, E] = [G, H].
339'CHRor_2__42'([A|B], C, D, E) :-
340 'CHRor_2__42'(B, C, D, E).
341:- set_flag('CHRor_2__42' / 4, leash, notrace). 342:- set_flag('CHRor_2' / 4, leash, notrace). 343:- current_macro('CHRor_2' / 4, _16297, _16298, _16299) -> true ; define_macro('CHRor_2' / 4, tr_chr / 2, [write]). 344'CHRor_2__39'(A, B, C, D) :-
345 'CHRor_2__43'(A, B, C, D).
346:- set_flag('CHRor_2__39' / 4, leash, notrace). 347'CHRor_2__43'(or(A, B), C, D, E) :-
348 (
349 'CHRvar'(C)
350 ->
351 'CHRdelay'([C, or(A, B)], 'CHRor_2'(or(A, B), C, D, E))
352 ;
353 true
354 ).
355:- set_flag('CHRor_2__43' / 4, leash, notrace). 356or(A, B, C) :-
357 'CHRor_3'(or(A, B, C), D, E, F).
358
359
360
362
363'CHRor_3'(or(A, B, C), D, E, F) :-
364 (
365 'CHRnonvar'(D)
366 ;
367 'CHRalready_in'('CHRor_3'(or(A, B, C), D, E, F)),
368 coca(already_in)
369 ),
370 !.
371'CHRor_3'(or(A, B, [C|D]), E, F, G) ?-
372 no_delayed_goals((member(H, A, I), \+ C \= H)),
373 !,
374 E = true,
375 (
376 H == C
377 ->
378 true
379 ;
380 H =.. [J|K],
381 C =.. [L|M],
382 or(I, [eq(K, M), H|B], [C|D])
383 ).
384'CHRor_3'(or(A, B, [C|D]), E, F, G) ?-
385 !,
386 E = true,
387 append(A, B, H),
388 or(H, D).
389'CHRor_3'(or(A, B, C), D, E, F) :-
390 'CHRor_3__44'(or(A, B, C), D, E, F).
391:- set_flag('CHRor_3' / 4, leash, notrace). 392:- current_macro('CHRor_3' / 4, _17155, _17156, _17157) -> true ; define_macro('CHRor_3' / 4, tr_chr / 2, [write]). 393'CHRor_3__44'(A, B, C, D) :-
394 'CHRor_3__45'(A, B, C, D).
395:- set_flag('CHRor_3__44' / 4, leash, notrace). 396'CHRor_3__45'(or(A, B, C), D, E, F) :-
397 (
398 'CHRvar'(D)
399 ->
400 'CHRdelay'([D, or(A, B, C)], 'CHRor_3'(or(A, B, C), D, E, F))
401 ;
402 true
403 ).
404:- set_flag('CHRor_3__45' / 4, leash, notrace). 405cancel(A, B) :-
406 'CHRcancel_2'(cancel(A, B), C, D, E).
407
408
409
411
412'CHRcancel_2'(cancel(A, B), C, D, E) :-
413 (
414 'CHRnonvar'(C)
415 ;
416 'CHRalready_in'('CHRcancel_2'(cancel(A, B), C, D, E)),
417 coca(already_in)
418 ),
419 !.
420'CHRcancel_2'(cancel(A, B), C, D, E) ?-
421 'CHRget_delayed_goals'(B, F),
422 'CHRcancel_2__47'(F, [B, A], [], G),
423 !,
424 C = true.
425'CHRcancel_2'(cancel(A, B), C, D, E) :-
426 'CHRcancel_2__46'(cancel(A, B), C, D, E).
427'CHRcancel_2__47'(['CHRcancelled_2'(cancelled(A, B), C, D, E)|F], [B, A], [], G) ?-
428 var(C),
429 [C, E] = [true, G].
430'CHRcancel_2__47'([A|B], C, D, E) :-
431 'CHRcancel_2__47'(B, C, D, E).
432:- set_flag('CHRcancel_2__47' / 4, leash, notrace). 433:- set_flag('CHRcancel_2' / 4, leash, notrace). 434:- current_macro('CHRcancel_2' / 4, _18017, _18018, _18019) -> true ; define_macro('CHRcancel_2' / 4, tr_chr / 2, [write]). 435'CHRcancel_2__46'(A, B, C, D) :-
436 'CHRcancel_2__48'(A, B, C, D).
437:- set_flag('CHRcancel_2__46' / 4, leash, notrace). 438'CHRcancel_2__48'(cancel(A, B), C, D, E) ?-
439 var(C),
440 !,
441 'CHRget_delayed_goals'(B, F),
442 'CHRcancel_2__48__49'(F, C, cancel(A, B), D, E).
443'CHRcancel_2__48'(cancel(A, B), C, D, E) :-
444 'CHRcancel_2__48__50'(cancel(A, B), C, D, E).
445:- set_flag('CHRcancel_2__48' / 4, leash, notrace). 446'CHRcancel_2__48__49'(['CHRnot_holds_2'(not_holds(A, B), C, D, E)|F], G, cancel(H, B), I, J) ?-
447 var(C),
448 no_delayed_goals(\+ H \= A),
449 !,
450 C = true,
451 'CHRcancel_2__48__49'(F, G, cancel(H, B), I, J),
452 cancel(H, B).
453'CHRcancel_2__48__49'([A|B], C, D, E, F) :-
454 'CHRcancel_2__48__49'(B, C, D, E, F).
455'CHRcancel_2__48__49'([], A, B, C, D) :-
456 'CHRcancel_2__48__50'(B, A, C, D).
457:- set_flag('CHRcancel_2__48__49' / 5, leash, notrace). 458'CHRcancel_2__48__50'(cancel(A, B), C, D, E) ?-
459 var(C),
460 !,
461 'CHRget_delayed_goals'(B, F),
462 'CHRcancel_2__48__50__51'(F, C, cancel(A, B), D, E).
463'CHRcancel_2__48__50'(cancel(A, B), C, D, E) :-
464 'CHRcancel_2__48__50__52'(cancel(A, B), C, D, E).
465:- set_flag('CHRcancel_2__48__50' / 4, leash, notrace). 466'CHRcancel_2__48__50__51'(['CHRor_2'(or(A, B), C, D, E)|F], G, cancel(H, B), I, J) ?-
467 var(C),
468 no_delayed_goals((member(K, A), \+ H \= K)),
469 !,
470 C = true,
471 'CHRcancel_2__48__50__51'(F, G, cancel(H, B), I, J),
472 cancel(H, B).
473'CHRcancel_2__48__50__51'([A|B], C, D, E, F) :-
474 'CHRcancel_2__48__50__51'(B, C, D, E, F).
475'CHRcancel_2__48__50__51'([], A, B, C, D) :-
476 'CHRcancel_2__48__50__52'(B, A, C, D).
477:- set_flag('CHRcancel_2__48__50__51' / 5, leash, notrace). 478'CHRcancel_2__48__50__52'(cancel(A, B), C, D, E) :-
479 (
480 'CHRvar'(C)
481 ->
482 'CHRdelay'([C, cancel(A, B)], 'CHRcancel_2'(cancel(A, B), C, D, E))
483 ;
484 true
485 ).
486:- set_flag('CHRcancel_2__48__50__52' / 4, leash, notrace). 487cancelled(A, B) :-
488 'CHRcancelled_2'(cancelled(A, B), C, D, E).
489
490
491
493
494'CHRcancelled_2'(cancelled(A, B), C, D, E) :-
495 (
496 'CHRnonvar'(C)
497 ;
498 'CHRalready_in'('CHRcancelled_2'(cancelled(A, B), C, D, E)),
499 coca(already_in)
500 ),
501 !.
502'CHRcancelled_2'(cancelled(A, B), C, D, E) ?-
503 'CHRget_delayed_goals'(B, F),
504 'CHRcancelled_2__54'(F, [B, A], [], G),
505 !,
506 C = true.
507'CHRcancelled_2'(cancelled(A, B), C, D, E) :-
508 'CHRcancelled_2__53'(cancelled(A, B), C, D, E).
509'CHRcancelled_2__54'(['CHRcancel_2'(cancel(A, B), C, D, E)|F], [B, A], [], G) ?-
510 var(C),
511 [C, E] = [true, G].
512'CHRcancelled_2__54'([A|B], C, D, E) :-
513 'CHRcancelled_2__54'(B, C, D, E).
514:- set_flag('CHRcancelled_2__54' / 4, leash, notrace). 515:- set_flag('CHRcancelled_2' / 4, leash, notrace). 516:- current_macro('CHRcancelled_2' / 4, _19903, _19904, _19905) -> true ; define_macro('CHRcancelled_2' / 4, tr_chr / 2, [write]). 517'CHRcancelled_2__53'(A, B, C, D) :-
518 'CHRcancelled_2__55'(A, B, C, D).
519:- set_flag('CHRcancelled_2__53' / 4, leash, notrace). 520'CHRcancelled_2__55'(cancelled(A, B), C, D, E) :-
521 (
522 'CHRvar'(C)
523 ->
524 'CHRdelay'([C, cancelled(A, B)], 'CHRcancelled_2'(cancelled(A, B), C, D, E))
525 ;
526 true
527 ).
528:- set_flag('CHRcancelled_2__55' / 4, leash, notrace). 529
530:- getval(variable_names_flag, Val), set_flag(variable_names, Val).