projog

3.15. CLP predicates for comparing boolean values.

Integer values are used to represent boolean values. 1 repesents true and 0 represents false.

Examples

?- X #/\ Y.
X = 1
Y = 1

yes

?- X #\/ Y, label([X,Y]).
X = 0
Y = 1

yes;
X = 1
Y = 0

yes;
X = 1
Y = 1

yes;

no

?- X #\ Y, label([X,Y]).
X = 0
Y = 1

yes;
X = 1
Y = 0

yes;

no

?- #\ X.
X = 0

yes

?- X #<==> Y, label([X,Y]).
X = 0
Y = 0

yes;
X = 1
Y = 1

yes;

no

?- X #==> Y, label([X,Y]).
X = 0
Y = 0

yes;
X = 0
Y = 1

yes;
X = 1
Y = 1

yes;

no

?- X #<== Y, label([X,Y]).
X = 0
Y = 0

yes;
X = 1
Y = 0

yes;
X = 1
Y = 1

yes;

no

?- X in 4..5, Y in 5..6, Z#<==> X#<Y, label([X,Y,Z]).
X = 4
Y = 5
Z = 1

yes;
X = 4
Y = 6
Z = 1

yes;
X = 5
Y = 5
Z = 0

yes;
X = 5
Y = 6
Z = 1

yes;

no

?- X in 2..3, X#<==>Y.

no

?- X #<==> append(_,_,_).

Cannot create CLP constraint from term: append(_, _, _)