[ library(cardinal) | Reference Manual | Alphabetic Index ]
# lub(?SetVariable, -Glb, -Poss, -Lub)

Obtaining a set's lub, together with its glb and poss (lub\glb)
*SetVariable*
- A set variable.
*Glb*
- A set.
*Poss*
- A set.
*Lub*
- A set.

## Description

Lub is unified with the (least) upper bound of SetVariable.
Glb is unified with the (greatest) lower bound of SetVariable.

Poss is unified with the set of still possible elements of SetVariable
(i.e. its lub\glb).

If SetVariable is a set of sets and a union function attribute has been set,
then each element of Poss comes annotated with its respective length.

### Fail Conditions

Fails if Lub can not be unified with the current lub of SetVariable or
if Glb can not be unified with the current glb of SetVariable or
if Poss can not be unified with the current poss (lub\glb) of SetVariable.
### Resatisfiable

No.
## Examples

?- S `::[c]+[a,b], lub(S,G,P,L).
G = [c]
P = [a,b]
L = [a,b,c]
?- set(S, [],[[a,b],[b,c],[a,c],[b]],[union:[a,b,c]]), lub(S,G,P,L).
G = []
P = [[a, b] : 2, [a, c] : 2, [b] : 1, [b, c] : 2]
L = [[a, b], [a, c], [b], [b, c]]

## See Also

lub / 2, glb_poss / 3, glb / 2, poss / 2, domain / 2, domain / 3