4.2.3.2. Bool FlatZinc builtins

In this section: array_bool_and, array_bool_element, array_bool_xor, array_var_bool_element, bool2int, bool_and, bool_clause, bool_eq, bool_eq_reif, bool_le, bool_le_reif, bool_lin_eq, bool_lin_le, bool_lt, bool_lt_reif, bool_not, bool_or, bool_xor.

array_bool_and

predicate array_bool_and(array [int] of var bool: xs, var bool: b)

Constrains \({\bf b} \leftrightarrow \bigwedge_i {\bf xs}[i]\)

array_bool_element

predicate array_bool_element(var int: idx,
                             array [int] of bool: xs,
                             var bool: y)

Constrains xs[idx] = y

array_bool_xor

predicate array_bool_xor(array [int] of var bool: xs)

Constrains \(\oplus_i\ {\bf xs}[i]\)

array_var_bool_element

predicate array_var_bool_element(var int: idx,
                                 array [int] of var bool: xs,
                                 var bool: y)

Constrains xs[idx] = y

bool2int

predicate bool2int(var bool: x, var int: y)

Constrains \({\bf y} \in \{0,1\}\) and \({\bf x} \leftrightarrow {\bf y}=1\)

bool_and

predicate bool_and(var bool: x, var bool: y, var bool: b)

Constrains \({\bf b} \leftrightarrow {\bf x} \land {\bf y}\)

bool_clause

predicate bool_clause(array [int] of var bool: xs,
                      array [int] of var bool: ys)

Constrains \(\bigvee_i {\bf xs}[i] \lor \bigvee_j \lnot {\bf ys}[j]\)

bool_eq

predicate bool_eq(var bool: x, var bool: y)

Constrains x = y

bool_eq_reif

predicate bool_eq_reif(var bool: x, var bool: y, var bool: b)

Constrains b \(\leftrightarrow\) (x = y)

bool_le

predicate bool_le(var bool: x, var bool: y)

Constrains xy

bool_le_reif

predicate bool_le_reif(var bool: x, var bool: y, var bool: b)

Constrains b \(\leftrightarrow\) (xy)

bool_lin_eq

predicate bool_lin_eq(array [int] of int: as,
                      array [int] of var bool: xs,
                      var int: y)

Constrains \({\bf y} = \sum_i {\bf as}[i]*{\bf xs}[i]\)

bool_lin_le

predicate bool_lin_le(array [int] of int: as,
                      array [int] of var bool: xs,
                      int: y)

Constrains \(\sum_i {\bf as}[i]*{\bf xs}[i] \leq {\bf y}\)

bool_lt

predicate bool_lt(var bool: x, var bool: y)

Constrains x < y

bool_lt_reif

predicate bool_lt_reif(var bool: x, var bool: y, var bool: b)

Constrains b \(\leftrightarrow\) (x < y)

bool_not

predicate bool_not(var bool: x, var bool: y)

Constrains xy

bool_or

predicate bool_or(var bool: x, var bool: y, var bool: b)

Constrains \({\bf b} \leftrightarrow {\bf x} \lor {\bf y}\)

bool_xor

predicate bool_xor(var bool: x, var bool: y, var bool: b)

Constrains \({\bf b} \leftrightarrow {\bf x} \oplus {\bf y}\)