The domains of variables are internally represented compactly as FD set terms. The details of this representation are subject to change and should not be relied on. Therefore, a number of operations on FD sets are provided, as such terms play an important role in the interface. Under no circumstances should you try to construct FD sets with other operations such as unification. The following operations are the primitive ones:
Set is a valid FD set.
Set is the empty FD set.
fdset_parts(?Set, ?Min, ?Max, ?Rest)
Set is an FD set, which is a union of the non-empty interval
[Min,Max] and the FD set Rest, and all elements of
Rest are greater than Max+1. Min and Max are
both integers or the atoms
sup, denoting minus and
plus infinity, respectively. Either Set or all the other
arguments must be ground.
The following operations can all be defined in terms of the primitive ones, but in most cases, a more efficient implementation is used:
[Min,Max] is an empty interval.
fdset_interval(?Set, ?Min, ?Max)
Set is an FD set, which is the non-empty interval [Min,Max].
Set is an FD set containing Elt only. At least one of the arguments must be ground.
Min is the lower bound of Set.
Max is the upper bound of Set. This operation is linear in the number of intervals of Set.
Size is the cardinality of Set, represented as
if Set is infinite.
This operation is linear in the number of intervals of Set.
Set is the FD set containing the elements of List. Slightly more efficient if List is ordered.
List is an ordered list of the elements of Set, which must be finite.
Set is the FD set containing the elements of the ConstantRange (see Syntax of Indexicals) Range.
Range is a constant interval, a singleton constant set, or a union of such, denoting the same set as Set.
fdset_add_element(+Set1, +Elt -Set2)
Set2 is Set1 with Elt inserted in it.
fdset_del_element(+Set1, +Elt, -Set2)
Set2 is like Set1 but with Elt removed.
The two FD sets have no elements in common.
The two FD sets have at least one element in common.
fdset_intersection(+Set1, +Set2, -Intersection)
Intersection is the intersection between Set1 and Set2.
Intersection is the intersection of all the sets in Sets.
is true when Elt is a member of Set. If Elt is unbound, then Set must be finite.
is true when the two arguments represent the same set i.e. they are identical.
Every element of Set1 appears in Set2.
fdset_subtract(+Set1, +Set2, -Difference)
Difference contains all and only the elements of Set1 that are not also in Set2.
fdset_union(+Set1, +Set2, -Union)
Union is the union of Set1 and Set2.
Union is the union of all the sets in Sets.
Complement is the complement of Set wrt.