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 allclose allScope (6)
Generalizations & Extensions (1)
Generate a truth table without explicitly giving a variable list:
The variables and ordering used are given by BooleanVariables:
Applications (3)
Probability (2)
Compute the probability for an event as the ratio of true cases to total cases:
The probabilities for some events:
The probability that exactly three variables are true:
Assume that you pay 2 units when and that you earn 1 unit when :
The expected earning when it is equally probable that x,y,z are true or false:
Properties & Relations (6)
A BooleanTable with n variables has elements:
With n and m variables the resulting matrix has values:
BooleanTable with several variable iterators evaluates the outermost iterator first:
BooleanTable enumerates values in the same order as Tuples[{True,False},n]:
SatisfiabilityCount efficiently counts the number of True elements in BooleanTable:
In this case the BooleanTable would have elements:
Give an enumerated BooleanFunction:
The order of enumeration is consistent with FromDigits:
Use BooleanFunction to convert a truth table to a function or expression:
Convert to a Boolean function:
Neat Examples (1)
The truth table for BooleanCountingFunction:
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