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

all_union(+SetVars, ?Union)

Union constraint of a list of sets
SetVars
A list of variables.
Union
A variable or a ground set.

Description

Constraint: Union is the set union of SetVars.

Any variable in SetVars that is not yet a set domain variable, is declared as such using Union's lub.

Fail Conditions

Fails if Union can not be the union of SetVars.

Resatisfiable

No.

Examples

?- all_union([[8,a,9],[i,8,o],[],[a,8,5]], U).
U = [5,8,9,a,i,o].

?- all_union([X,Z,S,Y,T], [8,9]), glb_poss(X,GX,PX), glb_poss(Y,GY,PY).
GX = [], PX = [8,9], GY = [], PY = [8,9]

?- X `:: [a]+[b,c], all_union([X,[b,n],X], U), glb_poss(X,GX,PX), glb_poss(U,GU,PU).
GX = [a], PX = [b,c], GU = [a,b,n], PU = [c]

?- sets([X,Y,Z],[a,b],[d,g,h,j],[cardinality:4]), all_union([X,Y,Z],U), #(U,C), fd:dom(C,DomC).
DomC = [4,5,6]

?- sets([X,Y,Z],[a,b],[d,g,h,j],[]), all_union([X,Y,Z],U), #(U,4), #(Y,C), fd:dom(C,DomC).
DomC = [2,3,4]

See Also

`= / 2, all_disjoint / 1