3 Part of CHR (Constraint Handling Rules)
6 E-mail: Tom.Schrijvers@cs.kuleuven.ac.be
7 WWW: http://www.swi-prolog.org
8 Copyright (C): 2003-2004, K.U. Leuven
12 :- module(chrdif,[chrdif/2]).
13 :- use_module(library(chr)).
15 :- constraints dif/2, dif2/3, or/2, or_seq/2, del_or/1.
17 chrdif(X,Y) :- dif(X,Y).
19 dif(X,Y) <=> compound(X), compound(Y) | dif1(X,Y).
21 dif(X,Y) <=> nonvar(X), nonvar(Y) /* X \== Y holds */ | true.
38 dif1l_2([X|Xs],[Y|Ys],Or) :-
42 or_seq(OrP,Or) \ or(Or,0), or(OrP,N) <=> M is N - 1, or_seq(OrP,M).
45 dif2(X,Y,Or) <=> compound(X), compound(Y) | dif3(X,Y,Or).
46 dif2(X,X,Or), or(Or,N) <=> M is N - 1, or(Or,M).
47 dif2(X,Y,Or) <=> nonvar(X), nonvar(Y) /* X \== Y holds */ | del_or(Or).
49 del_or(Or) \ or_seq(OrP,Or) <=> del_or(OrP).
50 del_or(Or) \ or_seq(Or,OrC) <=> del_or(OrC).
51 del_or(Or) \ or(Or,_) <=> true.
52 del_or(Or) \ dif2(_,_,Or) <=> true.