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

?Element `@ ?SetVariable

Set membership constraint
SetVariable
A set variable.
Element
A ground term or a variable.

Description

Constrain SetVariable to include Element.

If Element is a variable then if SetVariable is a ground singleton, then Element is unified with its single element, otherwise the constraint is suspended until Element or SetVariable is ground.

Fail Conditions

Fails if Element can not be a member of SetVariable.

Resatisfiable

No.

Examples

?- S `:: []..[a,b], a `@ S, glb_poss(S,G,P).
G = [a], P = [b]

?- S `:: []+[a,b], c `@ S.
no

?- S `:: [a]+[b,c], a `@ S, glb_poss(S,G,P).
G = [a], P = [b,c]

?- S `:: []..[a,b], X `@ S, glb_poss(S,G,P).
G = [], P = [a,b]

?- S `:: []..[a,b], X `@ S, X=b, glb_poss(S,G,P).
G = [b], P = [a]

?- S `:: [a]+[b,c]:C, X `@ S, C=1.
X = a

See Also

in / 2, `-@ / 2, notin / 2, `:: / 2