* Fix running Prolog inside the build environment
[chr.git] / Tests / leq.chr
blob446581ceaf326e567dbb31a2922212563d5ea61f
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%
3 %% simple constraint solver for inequalities between variables
4 %% thom fruehwirth ECRC 950519, LMU 980207, 980311
5 %%
6 %% ported to hProlog by Tom Schrijvers 
8 :- module(leq,[leq/0]).
9 :- use_module(library(chr)).
11 :- constraints leq/2.
13 reflexivity  @ leq(X,X) <=> true.
14 antisymmetry @ leq(X,Y), leq(Y,X) <=> X = Y.
15 idempotence  @ leq(X,Y) \ leq(X,Y) <=> true.
16 transitivity @ leq(X,Y), leq(Y,Z) ==> leq(X,Z).
18 leq :-
19         circle(X, Y, Z),
20         \+ attvar(X),
21         X == Y,
22         Y == Z.
24 circle(X, Y, Z) :-
25         leq(X, Y),
26         leq(Y, Z),
27         leq(Z, X).