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: as, var bool: r)

Constrains \({\bf r} \leftrightarrow \bigwedge_i {\bf as}[i]\)

array_bool_element

predicate array_bool_element(var int: b,
                             array [int] of bool: as,
                             var bool: c)

Constrains as[b] = c

array_bool_xor

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

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

array_var_bool_element

predicate array_var_bool_element(var int: b,
                                 array [int] of var bool: as,
                                 var bool: c)

Constrains as[b] = c

bool2int

predicate bool2int(var bool: a, var int: b)

Constrains \({\bf b} \in \{0,1\}\) and \({\bf a} \leftrightarrow {\bf b}=1\)

bool_and

predicate bool_and(var bool: a, var bool: b, var bool: r)

Constrains \({\bf r} \leftrightarrow {\bf a} \land {\bf b}\)

bool_clause

predicate bool_clause(array [int] of var bool: as,
                      array [int] of var bool: bs)

Constrains \(\bigvee_i {\bf as}[i] \lor \bigvee_j \lnot {\bf bs}[j]\)

bool_eq

predicate bool_eq(var bool: a, var bool: b)

Constrains a = b

bool_eq_reif

predicate bool_eq_reif(var bool: a, var bool: b, var bool: r)

Constrains r \(\leftrightarrow\) (a = b)

bool_le

predicate bool_le(var bool: a, var bool: b)

Constrains ab

bool_le_reif

predicate bool_le_reif(var bool: a, var bool: b, var bool: r)

Constrains r \(\leftrightarrow\) (ab)

bool_lin_eq

predicate bool_lin_eq(array [int] of int: as,
                      array [int] of var bool: bs,
                      var int: c)

Constrains \({\bf c} = \sum_i {\bf as}[i]*{\bf bs}[i]\)

bool_lin_le

predicate bool_lin_le(array [int] of int: as,
                      array [int] of var bool: bs,
                      int: c)

Constrains \(\sum_i {\bf as}[i]*{\bf bs}[i] \leq {\bf c}\)

bool_lt

predicate bool_lt(var bool: a, var bool: b)

Constrains a < b

bool_lt_reif

predicate bool_lt_reif(var bool: a, var bool: b, var bool: r)

Constrains r \(\leftrightarrow\) (a < b)

bool_not

predicate bool_not(var bool: a, var bool: b)

Constrains ab

bool_or

predicate bool_or(var bool: a, var bool: b, var bool: r)

Constrains \({\bf r} \leftrightarrow {\bf a} \lor {\bf b}\)

bool_xor

1.  predicate bool_xor(var bool: a, var bool: b, var bool: r)

2.  predicate bool_xor(var bool: a, var bool: b)
  1. Constrains \({\bf r} \leftrightarrow {\bf a} \oplus {\bf b}\)

  2. Constrains a \(\oplus\) b