These functions implement the basic operations on sets.

Functions and Predicates
function set of int: '..'(int: a, int: b)

Usage: a..b

Return the set \(\{{\bf a},\ldots,{\bf b}\}\)

function set of float: '..'(float: a, float: b)

Usage: a..b

Return the set \(\{{\bf a},\ldots,{\bf b}\}\)

function set of $T: 'diff'(set of $T: x, set of $T: y)

Usage: x diff y

Return the set difference of sets xy

function var set of int: 'diff'(var set of int: x, var set of int: y)

Usage: x diff y

Return the set difference of sets xy

test 'in'(int: x, set of int: y)

Usage: x in y

Test if x is an element of the set y

predicate 'in'(var int: x, var set of int: y)

Usage: x in y

x is an element of the set y

function set of $T: 'intersect'(set of $T: x, set of $T: y)

Usage: x intersect y

Return the intersection of sets x and y

function var set of int: 'intersect'(var set of int: x, var set of int: y)

Usage: x intersect y

Return the intersection of sets x and y

test 'subset'(set of $T: x, set of $T: y)

Usage: x subset y

Test if x is a subset of y

predicate 'subset'(var set of int: x, var set of int: y)

Usage: x subset y

x is a subset of y

test 'superset'(set of $T: x, set of $T: y)

Usage: x superset y

Test if x is a superset of y

predicate 'superset'(var set of int: x, var set of int: y)

Usage: x superset y

x is a superset of y

function set of $T: 'symdiff'(set of $T: x, set of $T: y)

Usage: x symdiff y

Return the symmetric set difference of sets x and y

function var set of int: 'symdiff'(var set of int: x, var set of int: y)

Usage: x symdiff y

Return the symmetric set difference of sets x and y

function set of $T: 'union'(set of $T: x, set of $T: y)

Usage: x union y

Return the union of sets x and y

function var set of int: 'union'(var set of int: x, var set of int: y)

Usage: x union y

Return the union of sets x and y

function set of $U: array_intersect(array [$T] of set of $U: x)

Return the intersection of the sets in array x

function set of $U: array_union(array [$T] of set of $U: x)

Return the union of the sets in array x

function var set of int: array_union(array [$T] of var set of int: x) =
array_union_rec(array1d(x))
(standard decomposition from builtins.mzn:651)

Return the union of the sets in array x

function int: card(set of $T: x)

Return the cardinality of the set x

function var int: card(var set of int: x)

Return the cardinality of the set x