[ library(cardinal) | Reference Manual | Alphabetic Index ]
Union of a set of sets
- A Set (variable or ground) of sets.
- A Set (variable or ground).
UnionVar is the union of sets in SetVariable. If UnionVar is given
(as a ground set or a set variable), then SetVariable is constrained to have such union.
If UnionVar is a free variable, then it is unified with the set's union as
a set variable or a ground set (if it is already known).
union_var/2 can thus be used either to declare (or constrain) a union
function or to retrieve it.
Fails if UnionVar can not be the union of SetVariable.
?- S `::..[[a],[b]], union_var(S,U).
?- S `::..[[a],[b],[a,b]], union_var(S,[a,b]).
?- union_var([[a,b],[b,c]], U).
U = [a,b,c]
set / 4, sets / 4, cardinality / 2