[ library(cardinal) | Reference Manual | Alphabetic Index ]

union_var(?SetVariable, ?UnionVar)

Union of a set of sets
SetVariable
A Set (variable or ground) of sets.
UnionVar
A Set (variable or ground).

Description

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.

Fail Conditions

Fails if UnionVar can not be the union of SetVariable.

Resatisfiable

No.

Examples

?- 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]

See Also

set / 4, sets / 4, cardinality / 2