[ library(cardinal) | Third Party Libraries | Reference Manual | Alphabetic Index ]

# complement(?SetVar, ?Complement)

Set complement constraint

SetVar
  A variable.
Complement
  A variable

## Description

Constrain sets so that Complement is the complement set of SetVar. (The universe is taken as the union of their LUBs.).

### Fail Conditions

Fails if Complement can not be the set complement of SetVar (in their universe).

### Resatisfiable

No.

## Examples

    ?- complement([8,9], []), complement([8,9], [t]).
    yes

    ?- complement([8,9], [8]).
    no

    ?- complement([8,9], N).
    N = []

    ?- sets([X,Y], [],[7,8,9], []), complement(X,Y), 8 `@ Y, glb_poss(X,GX,PX), glb_poss(Y,GY,PY).
    GX = [], PX = [7,9], GY = [8], PY = [7,9]

    ?- sets([X,Y], [],[7,8,9], [cardinality:C]), complement(X,Y), card_labeling([X]).
    no

    ?- sets([X,Y], [],[7,8,9], []), complement(X,Y), X `>= Y, set_labeling(up,[Y]).
    Y = [], X = [7,8,9] ;
    no

    ?- sets([X,Y], [],[7,8,9], [minimum:Min]), complement(X,Y), refine(up,X).
    no

    ?- sets([X,Y], [],[7,8,9], []), complement(X,Y), #(X,1), #(Y,CY).
    CY = 2

## See Also

complement / 3, `$ / 2, `= / 2