TruthTable - Maple Help

Logic

 TruthTable
 construct the truth table of a Boolean expression

 Calling Sequence TruthTable(expr, L, opt)

Parameters

 expr - Boolean expression L - (optional) list of identifiers appearing in the expression opt - (optional) equation(s) of the form option=value, where option is one of 'output' or 'form'; specify options for the TruthTable command

Description

 • TruthTable(expr) returns the truth table corresponding to the Boolean expression expr.
 • The optional parameter L, which can only be used with output=table, specifies a list of identifiers appearing in the expression. This list determines the ordering used for table indices.  That is, if T is the table returned and L= $[\mathrm{x1},...,\mathrm{xn}]$, where $\mathrm{x1},...,\mathrm{xn}$, are identifiers in the expression, then $T[\mathrm{v1},...,\mathrm{vn}]$ is equivalent to eval( expr, [x1=v1, ..., xn=vn] ).
 If L is omitted, the identifiers appearing in the expression are listed in the resulting truth table in lexicographical order.
 • The optional parameter output=returnform specifies the form of the returned truth table: table, Matrix, or 'DataFrame'.  The default is 'DataFrame'.
 • The optional parameter form=tblform specifies the type of the inputs and output; by default, this is boolean.  If form=MOD2 is specified, then the indices and entries will be zeroes and ones.

Examples

 > $\mathrm{with}\left(\mathrm{Logic}\right):$
 > $\mathrm{T1}≔\mathrm{TruthTable}\left(a&xorb\right)$
 ${\mathrm{T1}}{≔}\left[\begin{array}{cccc}{}& {a}& {b}& {\mathrm{value}}\\ {1}& {\mathrm{false}}& {\mathrm{false}}& {\mathrm{false}}\\ {2}& {\mathrm{false}}& {\mathrm{true}}& {\mathrm{true}}\\ {3}& {\mathrm{true}}& {\mathrm{false}}& {\mathrm{true}}\\ {4}& {\mathrm{true}}& {\mathrm{true}}& {\mathrm{false}}\end{array}\right]$ (1)
 > $\mathrm{TruthTable}\left(a&xorb,\mathrm{output}=\mathrm{Matrix}\right)$
 $\left[\begin{array}{ccc}{\mathrm{false}}& {\mathrm{false}}& {\mathrm{false}}\\ {\mathrm{false}}& {\mathrm{true}}& {\mathrm{true}}\\ {\mathrm{true}}& {\mathrm{false}}& {\mathrm{true}}\\ {\mathrm{true}}& {\mathrm{true}}& {\mathrm{false}}\end{array}\right]$ (2)
 > $\mathrm{TruthTable}\left(a&xorb,\mathrm{output}=\mathrm{table}\right)$
 ${table}{}\left(\left[\left({\mathrm{false}}{,}{\mathrm{false}}\right){=}{\mathrm{false}}{,}\left({\mathrm{true}}{,}{\mathrm{true}}\right){=}{\mathrm{false}}{,}\left({\mathrm{false}}{,}{\mathrm{true}}\right){=}{\mathrm{true}}{,}\left({\mathrm{true}}{,}{\mathrm{false}}\right){=}{\mathrm{true}}\right]\right)$ (3)
 > $\mathrm{T2}≔\mathrm{TruthTable}\left(\mathrm{¬}\left(a\right)&norb&iffc,\left[a,b,c\right],\mathrm{output}=\mathrm{table}\right):$
 > ${\mathrm{T2}}_{\mathrm{true},\mathrm{false},\mathrm{false}}$
 ${\mathrm{false}}$ (4)
 > $\mathrm{T3}≔\mathrm{TruthTable}\left(a&xorb,\left[a,b\right],\mathrm{form}=\mathrm{MOD2},\mathrm{output}=\mathrm{table}\right):$
 > ${\mathrm{T3}}_{1,0}$
 ${1}$ (5)

Compatibility

 • The Logic[TruthTable] command was updated in Maple 2016.