Set variables are variables which can eventually take a ground integer set as their value. They are characterized by a lower bound (the set of elements that are definitely in the set) and an upper bound (the set of elements that may be in the set). A set variable can be declared as follows:
SetVar :: []..[1,2,3,4,5,6,7]
If the lower bound is the empty set and the upper bound is a set of consecutive integers, one can also declare it like
intset(SetVar, 1, 7)
which is equivalent to the above.
- ?Set :: ++Lwb..++Upb
- Set is an integer set within the given bounds
- intset(?Set, +Min, +Max)
- Set is a set containing numbers between Min and Max
- intsets(?Sets, ?N, +Min, +Max)
- Sets is a list of N sets containing numbers between Min and Max
The system prints set variables in a particular way, for instance:
?- lib(ic_sets). ?- X :: [2,3]..[1,2,3,4]. X = X{[2, 3] \/ ([] .. [1, 4]) : _308{[2 .. 4]}}
The curly brackets contain the description of the current domain of the set variable in the form of
\/