extended AI observation analysis to disjunction
[chr.git] / Benchmarks / leq.chr
bloba1ae4b9aaa95e8f43987482b343ceb2e4b033159
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,[main/0,main/1]).
10 :- constraints leq/2.
11 reflexivity  @ leq(X,X) <=> true.
12 antisymmetry @ leq(X,Y), leq(Y,X) <=> X = Y.
13 idempotence  @ leq(X,Y) \ leq(X,Y) <=> true.
14 transitivity @ leq(X,Y), leq(Y,Z) ==> leq(X,Z).
16 main :-
17         main(60).
19 main(N):-
20         cputime(X),
21         length(L,N),
22         genleq(L,Last),
23         L=[First|_],
24         leq(Last,First),
25         cputime( Now),
26         Time is Now-X,
27         write(bench(leq ,N,Time,0,hprolog)), write('.'),nl.
29 genleq([Last],Last) :- ! .
30 genleq([X,Y|Xs],Last):-
31         leq(X,Y),
32         genleq([Y|Xs],Last).