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

# ?SetVar1 `$ ?SetVar2

Set disjointness constraint

SetVar1
  A set variable.
SetVar2
  A set variable.

## Description

Constrain sets SetVar1 and SetVar2 to be disjoint. I.e. SetVar1 and SetVar2 should have no common elements (empty intersection).

### Fail Conditions

Fails if SetVar1 and SetVar2 can not be disjoint.

### Resatisfiable

No.

## Examples

    ?- [] `$ [8], [7] `$ [8], [] `$ [].
    yes

    ?- [7,8] `$ [8]  ; [7] `$ [7,8] ; [a] `$ [a] ; [a,b] `$ [b,a].
    no

    ?- sets([X,Y], [],[8,9], [cardinality:1]), X `$ Y, set_labeling([X,Y]).
    X = [8], Y = [9] ;
    X = [9], Y = [8] ;
    no

    ?- S `:: []+[a,b], X=S, X `$ S.
    S = [], X = []

    ?- sets([X,Y], [],[7,8,9], [cardinality:2]), X `$ Y.
    no

    ?- sets([X,Y], [],[7,8,9], [cardinality:[1,2]]), X `$ Y, #(X,2), #(Y,C).
    C = 1

    ?- X `:: [a]+[b,c,d], Y `:: []+[a,b,c,d,e,f], X `$ Y, c `@ Y, poss(X,PX), poss(Y,PY).
    PX = [b,d], PY = [b,d,e,f]

## See Also

all_disjoint / 1, `<> / 2, complement / 2, complement / 3, `/= / 2, `>= / 2