# Truth table (truth_table)

The truth table of a condition: a row for each choice of values.

## How to write it

### truth_table(p)

**p**

A condition. Takes a condition, true or false.

## Examples

- $\displaystyle \operatorname{truth\_table}(p \land q) = \begin{pmatrix} \operatorname{false} & \operatorname{false} & \operatorname{false} \\ \operatorname{true} & \operatorname{false} & \operatorname{false} \\ \operatorname{false} & \operatorname{true} & \operatorname{false} \\ \operatorname{true} & \operatorname{true} & \operatorname{true} \end{pmatrix}$

  `truth_table(p and q)`

  In the solver, `truth_table(p and q)` gives `[[false, false, false], [true, false, false], [false, true, false], [true, true, true]]`.

  [Open in the solver](https://hilberon.com/?q=truth_table%28p%20and%20q%29)

## Related functions

- [unequal](https://hilberon.com/library/unequal)

  True when two values differ: the function form of !=.
- [satisfiability_instances](https://hilberon.com/library/satisfiability_instances)

  The assignments of its variables that make a condition true.
- [xor](https://hilberon.com/library/xor)

  True when an odd number of conditions are true.
- [satisfiability_count](https://hilberon.com/library/satisfiability_count)

  How many assignments of its variables make a condition true.
- [boolean_minimize](https://hilberon.com/library/boolean_minimize)

  A shortest equivalent form of a condition.
- [nor](https://hilberon.com/library/nor)

  True when every condition is false.

---
Source: https://hilberon.com/library/truth_table
