Table of supported interval relations:
+ - * / | arithmetic |
** | includes real exponent, odd/even integer |
abs | absolute value |
sqrt | positive square root |
min max | binary min/max |
== is <> =\= =< >= < > | comparison (is and =\= synonyms for == and <> ) |
<= | included (one way narrowing) |
and or nand nor xor -> , | boolean (`,` synonym for and ) |
- ~ | unary negate and not (boolean) |
exp log | exp/ln |
sin asin cos acos tan atan | trig functions |
integer | must be an integer value |
clpBNR
defines the following additional operators for use in constraint expressions:
op(200, fy, ~) | boolean 'not' |
op(500, yfx, and) | boolean 'and' |
op(500, yfx, or) | boolean 'or' |
op(500, yfx, nand) | boolean 'nand' |
op(500, yfx, nor) | boolean 'nor' |
Note that the comparison operators <>
, =\=
, '<' and '>' are unsound (due to incompleteness) over the real
domain but sound over the integer
domain. Strict inequality (<>
and =\=
) is disallowed for type real
(will be converted to type integer
) but <
and >
are supported for reals since they may be useful for things like branch and bound searches (with caution). The boolean functions are restricted to type 'boolean', constraining their argument types accordingly. Some examples:
?- {X == Y+1, Y >= 1}. X::real(2, 1.0Inf), Y::real(1, 1.0Inf). ?- {X == cos(X)}. X:: 0.73908513321516... . ?- X::real, {X**4-4*X**3+4*X**2-4*X+3==0}. X::real(-1.509169756145379, 4.18727500493995). ?- {A or B, C and D}. C = D, D = 1, A::boolean, B::boolean.
Note that any variable in a constraint expression with no domain will be assigned the most general value consistent with the operator types, e.g., real(-1.0Inf,1.0Inf)
, boolean
, etc.