A finite domain is a set of ground terms that is given as a list. The special notation Begin..Step..End denotes the set of integers
, where B1=Begin,
Bi = Bi-1+Step for i=2,...,k, , and Bk+Step>End. When the increment Step is 1, the notation can be abbreviated as Begin..End. For example, the notation 1..2..10 refers to the list [1,3,5,7,9], and 1..3 refers to the list [1,2,3].
- Vars in D: The variables in Vars take on values from the finite domain D, where Vars can be a single variable or a list of variables. For example, the call X in 1..3 states that the domain of X is [1,2,3], the call X in 1..2..5 states that the domain is [1,3,5], and the call X in [a,b,c] states that the domain is [a,b,c].
- Vars :: D: This is the same as Vars in D.
- domain(Vars,L,U): This is the same as Vars in L..U.
- Vars notin D: Vars does not reside in D.
The following primitives are available for integer domain variables. As domain variables are also suspension variables, primitives on suspension variables, such as frozen/1, can also be applied to domain variables.
V is a domain variable.
Creates a new domain variable V, whose domain is -268435455 .. 268435455.
The maximum element in the domain of V is N. V must be an integer domain variable or an integer.
The minimum element in the domain of V is N. V must be an integer domain variable or an integer.
The minimum and maximum elements in the domain of V are
Min and Max, respectively. V must be an integer domain variable or an integer.
The size of the domain of V is N.
L is the list of elements in the domain of V.
E is an element in the domain of V.
Excludes the element E from the domain of V. If this operation results in a hole in the domain of V, then the domain changes from an interval representation into a bit-vector representation, however big it is.
NextE is the element that follows E in V's domain.
PrevE is the element that precedes E in V's domain.
This succeeds if V1's domain includes V2's domain as a set.
This succeeds if V1's domain and V2's domain are disjoint.
The number of variables that are connected with V in the constraint network is N.
Specifies the range of bit vectors. Domain variables, when being created, are usually represented internally by using intervals. An
interval turns to a bit vector when a hole occurs in the interval. The default values for Min and Max are -3200 and 3200, respectively.