Constraints

## 5.3 Constraints

- Membership
- Cardinality
- Set Relations
- N-ary Set Relations
- Set Weights

### 5.3.1 Membership

?X in ?Set
  The integer X is member of the integer set Set
?X notin ?Set
  The integer X is not a member of the integer set Set
membership_booleans(?Set, ?BoolArr)
  BoolArr is an array of booleans describing Set

### 5.3.2 Cardinality

#(?Set, ?Card)
  Card is the cardinality of the integer set Set

### 5.3.3 Set Relations

difference(?Set1, ?Set2, ?Set3)
  Set3 is the difference of the integer sets Set1 and Set2
?Set1 disjoint ?Set2
  The integer sets Set1 and Set2 are disjoint
?Set1 includes ?Set2
  Set1 includes (is a superset) of the integer set Set2
intersection(?Set1, ?Set2, ?Set3)
  Set3 is the intersection of the integer sets Set1 and Set2
?Set1 sameset ?Set2
  The sets Set1 and Set2 are equal
?Set1 subset ?Set2
  Set1 is a subset of the integer set Set2
symdiff(?Set1, ?Set2, ?Set3)
  Set3 is the symmetric difference of the integer sets Set1 and Set2
union(?Set1, ?Set2, ?Set3)
  Set3 is the union of the integer sets Set1 and Set2

### 5.3.4 N-ary Set Relations

all_disjoint(+Sets)
  Sets is a list of integers sets which are all disjoint
all_union(+Sets, ?SetUnion)
  SetUnion is the union of all the sets in the list Sets
all_intersection(+Sets, ?SetIntersection)
  SetIntersection is the intersection of all the sets in the list Sets

### 5.3.5 Set Weights

weight(?Set, ++ElementWeights, ?Weight)
  According to the array of element weights, the weight of set Set1 is Weight