:- module(leq,[cycle/3, leq/2]). :- use_module(library(chr)). :- constraints leq/2. reflexivity @ leq(X,X) <=> true. antisymmetry @ leq(X,Y), leq(Y,X) <=> X = Y. idempotence @ leq(X,Y) \ leq(X,Y) <=> true. transitivity @ leq(X,Y), leq(Y,Z) ==> leq(X,Z). cycle(X,Y,Z):- leq(X,Y), leq(Y,Z), leq(Z,X). |
:- module(dom,[dom/2]). :- use_module(library(chr)). :- constraints dom/2. dom(X,[]) <=> fail. dom(X,[Y]) <=> X = Y. dom(X,L1), dom(X,L2) <=> intersection(L1,L2,L3), dom(X,L3). intersection([],_,[]). intersection([H|T],L2,[H|L3]) :- member(H,L2), !, intersection(T,L2,L3). intersection([_|T],L2,L3) :- intersection(T,L2,L3). |