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 7 8:- module(leq,[leq/0]). 9:- use_module(library(chr)). 10 11:- chr_constraint leq/2. 12 13reflexivity @ leq(X,X) <=> true. 14antisymmetry @ leq(X,Y), leq(Y,X) <=> X = Y. 15idempotence @ leq(X,Y) \ leq(X,Y) <=> true. 16transitivity @ leq(X,Y), leq(Y,Z) ==> leq(X,Z). 17 18leq :- 19 circle(X, Y, Z), 20 \+ attvar(X), 21 X == Y, 22 Y == Z. 23 24circle(X, Y, Z) :- 25 leq(X, Y), 26 leq(Y, Z), 27 leq(Z, X). 28