next up previous index
Next: Global Constraints Up: The Symbolic Domain Library Previous: Domains and Domain Variables   Index

Basic Constraints

The following constraints implement the basic relationships between two domain values. The constraints require their arguments to come from identical domains, otherwise an error is raised.
?X &= ?Y
X is the same as Y
?X &\= ?Y
X is different from Y
?X &> ?Y
X is strictly before Y in the domain order
?X &< ?Y
X is strictly after Y in the domain order
?X &=< ?Y
X is the same as Y, or before Y in the domain order
?X &>= ?Y
X is the same as Y, or after Y in the domain order
shift(?X,?C,?Y)
Y is C places above X in the domain order. X and Y have symbolic domains, C has an integer domain.
rotate(?X,?C,?Y)
like shift/3 but wraps at domain boundary.
element(?Index,++List,?Value)
Value occurs List at position Index. Value has a symbolic domain, Index has an integer domain. List is a number of symbolic domain values.
For example
?- [X, Y] &:: weekday, X &< Y.
X = X{[mo, tu, we, th, fr, sa]}
Y = Y{[tu, we, th, fr, sa, su]}
Yes (0.00s cpu)

?- X &:: weekday, X &=< we.
X = X{[mo, tu, we]}
Yes (0.00s cpu)


next up previous index
Next: Global Constraints Up: The Symbolic Domain Library Previous: Domains and Domain Variables   Index
Warwick Harvey
2004-08-07