As a convenience the finite domain solver provides a couple of
comparisons between integers. The following features are provided
in connection with integer comparison:
Our finite domain solver is probably unique in that it allows posting element hood for arbitrary expressions. This feature is used to internally implement integer comparison. We find the usual comparisons such as #\=/2, #</2, #>/2, #=</2 and #>=/2. Comparisons are reconstructed from element hood when displaying constraints.Example:
?- Y - X in 0..sup.
X #=< Y
The constraint solver also attempts to combine element hood constraints. Element hood constraints over the same expression are intersected similarly to domain constraints. Consequently comparisons can be contracted, subsumed or conflict. Also interaction with equations is possible, which are then treated as singleton element hood constraints.
?- X #> Y, X #= Y.
The integer comparisons can be used to define more complex conditions. A recurring problem is stating the inequality of a couple of value expressions. The predicate all_different/2 has been defined as a corresponding convenience.
The following integer comparison predicates are provided: