Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write/define boolean predicates ?

Status
Not open for further replies.

h1b2c3

Programmer
Dec 5, 2008
1
US
If we can define boolean and as

and(X, Y, Z) :- Z #=< X, Z #=< Y, X + Y #=< Z + 1.

How can we define predicates not(X,Y),
and(X,Y,Z), or(X,Y,Z), if(X,Y,Z), and iff(X,Y,Z) which model the Boolean constraints Y = ¬X, Z = X & Y , Z = X _ Y , Z = X ! Y and Z = X $ Y respectively using integer constraints ?

Anyone there??
 
Can't you do
and(X, Y, Z) :- Z #= X * Y.
or(X,Y,Z ) :- Z #= (X + Y) mod 2.
not(X, Y) :- Y #= 1 - X.

where X,and Y are bound to 0 / 1 ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top