BooleanTable[bf]
gives a list of truth values for all possible combinations of variable values supplied to the Boolean function bf.
BooleanTable[expr,{a1,a2,…}]
gives a list of the truth values of the Boolean expression expr for all possible combinations of values of the ai.
BooleanTable[expr,{a1,a2,…},{b1,…},…]
gives a nested table of truth values of expr with the outermost level giving possible combinations of the ai.
BooleanTable
BooleanTable[bf]
gives a list of truth values for all possible combinations of variable values supplied to the Boolean function bf.
BooleanTable[expr,{a1,a2,…}]
gives a list of the truth values of the Boolean expression expr for all possible combinations of values of the ai.
BooleanTable[expr,{a1,a2,…},{b1,…},…]
gives a nested table of truth values of expr with the outermost level giving possible combinations of the ai.
Details
- The possible combinations of variable values are given in the order Tuples[{True,False},n].
- BooleanTable gives a list or array of True, False values.
- Boole[BooleanTable[…]] gives 1, 0 values.
- In BooleanTable[expr,{a1,a2,…}] etc. any of the variables in expr that are not explicitly among the ai etc. are left in symbolic form.
- BooleanTable[expr,vars1,…,varss] is equivalent to Fold[BooleanTable,expr,{varss,…,vars1}]. »
- BooleanTable[bf,{r1,r2,…}] gives a list of truth values corresponding to possible values of the r1
, r2
, … variables for the Boolean function bf. - BooleanTable[bf,{r1,…},{s1,…},…] gives a nested table of truth values with the outermost level giving combinations of the ri
variables. »
Examples
open all close allBasic Examples (2)
Scope (6)
Generate a truth table for a Boolean expression:
BooleanTable[And[a, b], {a, b}]BooleanTable[And[a, b, c], {a, b, c}]A truth table with arguments and values:
BooleanTable[{a, b, And[a, b]}, {a, b}]//TableFormVector-valued Boolean expression:
BooleanTable[{And[a, b], Or[a, b], Xor[a, b], Xnor[a, b]}, {a, b}]//TableFormBooleanTable[And[a, b], {a}, {b}]BooleanTable[And[a, b, c], {a}, {b}, {c}]Generate a truth table for a pure Boolean function:
BooleanTable[BooleanFunction[30, 3]]BooleanTable[BooleanCountingFunction[2, 3]]BooleanTable[And[#1, #2, #3]&]Specify the position of arguments to use:
BooleanTable[BooleanFunction[30, 3], {3, 1, 2}]BooleanTable[BooleanFunction[30, 3][a, b, c], {c, a, b}]Position and grouping of arguments to use:
BooleanTable[BooleanFunction[30, 3], {1, 2}, {3}]Expressions do not need to produce Boolean values:
BooleanTable[f[a, b], {a, b}]BooleanTable[{a, b} -> And[a, b], {a, b}]BooleanTable[Xor[a, b, c], {a, b}]BooleanTable[Graphics[{If[a, Red, Green], If[b, EdgeForm[Yellow], EdgeForm[Blue]], If[c, Disk[], Rectangle[]]}, ImageSize -> 30], {a, b, c}]Generalizations & Extensions (1)
Generate a truth table without explicitly giving a variable list:
t1 = BooleanTable[And[c, Or[a, b]]]The variables and ordering used are given by BooleanVariables:
v = BooleanVariables[And[c, Or[a, b]]]t2 = BooleanTable[And[c, Or[a, b]], v]t1 === t2Applications (3)
Probability (2)
Compute the probability for an event as the ratio of true cases to total cases:
BooleanProbability[e_, v_] := Count[BooleanTable[e, v], True] / 2 ^ Length[v]The probabilities for some events:
BooleanProbability[x∧y, {x, y}]BooleanProbability[Xor[x, y, z, w], {x, y, z, w}]The probability that exactly three variables are true:
BooleanProbability[BooleanCountingFunction[{3}, {x, y, z, u, v}], {x, y, z, u, v}]BooleanProbability[x∨y, {x, y}]BooleanProbability[x, {x, y}] + BooleanProbability[y, {x, y}] - BooleanProbability[x∧y, {x, y}]Assume that you pay 2 units when
and that you earn 1 unit when
:
BooleanTable[-2 Boole[x∧y] + Boole[Xor[x, y, z]], {x, y, z}]The expected earning when it is equally probable that x,y,z are true or false:
Mean[%]Variance[%%]Cellular Automata (1)
Generate the truth rules for a Boolean expression:
BooleanTable[{a, b, c} -> BooleanFunction[30, {a, b, c}], {a, b, c}]Use the rules to evolve a cellular automaton:
CellularAutomaton[%, {{True}, False}, 2]CellularAutomaton[30, {{1}, 0}, 2]Boole[%%]Properties & Relations (6)
A BooleanTable with n variables has
elements:
X[n_] := Array[x, n]Table[Length@BooleanTable[Xor@@X[n], X[n]], {n, 10}]With n and m variables the resulting matrix has
values:
Y[n_] := Array[y, n]Table[Dimensions@BooleanTable[Xor@@Join[X[n], Y[m]], X[n], Y[m]], {n, 5}, {m, 5}];Apply[Times, %, {2}]//MatrixFormBooleanTable with several variable iterators evaluates the outermost iterator first:
f = BooleanFunction[12345, 5][a, b, c, d, e]t1 = BooleanTable[f, {a, b}, {c, d, e}]t2 = Fold[BooleanTable, f, {{c, d, e}, {a, b}}]t1 === t2BooleanTable enumerates values in the same order as Tuples[{True,False},n]:
BooleanTable[Xor[a, b], {a, b}]Xor@@@Tuples[{True, False}, 2]BooleanTable[Xnor[a, b, c], {a, b, c}]Xnor@@@Tuples[{True, False}, 3]SatisfiabilityCount efficiently counts the number of True elements in BooleanTable:
Count[BooleanTable[BooleanFunction[200!, 10]], True]SatisfiabilityCount[BooleanFunction[200!, 10]]In this case the BooleanTable would have
elements:
SatisfiabilityCount[BooleanCountingFunction[500, 1000]]Give an enumerated BooleanFunction:
BooleanFunction[30, 3]Boole[BooleanTable[%]]The order of enumeration is consistent with FromDigits:
FromDigits[%, 2]Use BooleanFunction to convert a truth table to a function or expression:
t = BooleanTable[Implies[a, b], {a, b}]Convert to a Boolean function:
f = BooleanFunction[t]BooleanTable[f[a, b], {a, b}]Convert to a disjunctive normal form:
BooleanFunction[t, {a, b}]BooleanFunction[t, {a, b}, "NAND"]Neat Examples (1)
The truth table for BooleanCountingFunction:
f = BooleanCountingFunction[8, 16]@@Array[x, 16];ArrayPlot[Boole@BooleanTable[f, Array[x, 8], Array[x, 8, 9]]]See Also
Boole BooleanFunction SatisfiabilityInstances Table Array CellularAutomaton RulePlot
Function Repository: TruthTable
Related Guides
History
Text
Wolfram Research (2008), BooleanTable, Wolfram Language function, https://reference.wolfram.com/language/ref/BooleanTable.html.
CMS
Wolfram Language. 2008. "BooleanTable." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BooleanTable.html.
APA
Wolfram Language. (2008). BooleanTable. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BooleanTable.html
BibTeX
@misc{reference.wolfram_2026_booleantable, author="Wolfram Research", title="{BooleanTable}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/BooleanTable.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_booleantable, organization={Wolfram Research}, title={BooleanTable}, year={2008}, url={https://reference.wolfram.com/language/ref/BooleanTable.html}, note=[Accessed: 13-June-2026]}