[ library(suspend) | Reference Manual | Alphabetic Index ]
?Expr1 => ?Expr2
If Expr1 arithmetically evaluates to 1, so does Expr2 (implication)
- Expr1
- A boolean expression
- Expr2
- A boolean expression
Description
Suspends until both Expr1 and Expr2 are ground, and then both arguments
are evaluated. Succeeds if the truth of Expr1 implies Expr2, i.e. if Expr1
evaluates to 1, Expr2 must evaluate to 1, otherwise Expr2 can evaluate to
1 or 0. Logically equivalent to
neg(Expr1) or Expr2.
Typically, the expressions contains reifiable constraints, in which case
a corresponding reified constraint is set up, and the expression is
replaced by the resulting boolean variable.
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Fail Conditions
Expr1 evaluates to 1 and Expr2 evaluates to 0
Exceptions
- (24) number expected
- Expr1 or Expr2 is not an arithmetic expression.
Examples
?- 0 => B, B = 0.
B = 0
Yes (0.00s cpu)
?- 0 => B, B = 1.
B = 1
Yes (0.00s cpu)
?- 1 => B, B = 0.
No (0.00s cpu)
?- 1 => B, B = 1.
B = 1
Yes (0.00s cpu)
% arguments are typically reifiable expressions:
?- X > Y => X > Y+10, X = 5, Y = 3.
No (0.00s cpu)
% the previous example is equivalent to:
?- >(X,Y,B1), >(X,Y+10,B2), B1 => B2, X = 5, Y = 3.
No (0.00s cpu)
% and/or/=>/neg are themselves reifiable:
?- neg(A => B) or (C => D), A=1, B=0, C=0, D=1.
A = 1
B = 0
C = 0
D = 1
Yes (0.00s cpu)
See Also
=> / 3, and / 2, or / 2, neg / 1, ic : => / 2, gfd : => / 2, eplex : => / 2