THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

# BooleanFunction

 BooleanFunction[k, n]represents the k Boolean function in n variables. BooleanFunction[values]represents the Boolean function corresponding to the specified vector of truth values. BooleanFunction[{{i11, i12, ...}->o1, ...}]represents the Boolean function defined by the specified mapping from inputs to outputs. BooleanFunction[spec, {a1, a2, ...}]gives the Boolean expression in variables ai corresponding to the Boolean function specified by spec. BooleanFunction[spec, {a1, a2, ...}, form]gives the Boolean expression in the form specified by form.
• BooleanFunction[spec][a1, a2, ...] gives an implicit representation equivalent to the explicit Boolean expression BooleanFunction[spec, {a1, a2, ...}].
• In BooleanFunction[values], the values are specified in binary order starting with 111....
• In BooleanFunction[values], each value can be a list, representing a vector-valued Boolean function.
• In BooleanFunction[{{i11, i12, ...}->o1, ...}] the oi can be lists, representing vector-valued Boolean functions.
• Elements of both inputs and outputs can be specified either as True and False or as 1 and 0.
• Elements of inputs and outputs can also include any number of _, representing "don't cares".
• They can also include up to one __, representing a sequence of "don't cares".
• BooleanFunction[spec, {a1, a2, ...}] by default gives an expression in DNF.
• gives the k Boolean function in n variables, where n has the smallest value for which .
• BooleanFunction objects can be applied to variables just like other Boolean functions such as And, Or, etc.
• In StandardForm and related formats, BooleanFunction objects are printed in elided form, with only their number of variables displayed.
Generate the 30 Boolean function of 3 variables:
Use f like any other Boolean operator:
Convert to a DNF expression:
Generate the formula directly:
Specify a Boolean function based on a table of truth rules:
Use an incompletely specified truth table:
Convert a Boolean expression to a BooleanFunction:
Test that they represent the same function:
Generate the 30 Boolean function of 3 variables:
 Out[1]=
Use f like any other Boolean operator:
 Out[2]=
Convert to a DNF expression:
 Out[3]=
Generate the formula directly:
 Out[4]=

Specify a Boolean function based on a table of truth rules:
 Out[1]=
Use an incompletely specified truth table:
 Out[2]=

Convert a Boolean expression to a BooleanFunction:
 Out[1]=
Test that they represent the same function:
 Out[2]=
 Scope   (13)
Create a BooleanFunction with two arguments by indexing:
Compute its value for particular arguments:
The function remains unevaluated for symbolic arguments:
BooleanFunction can be used just like any other Boolean operator:
Any Boolean expression can be converted to a BooleanFunction expression:
Including combinations of BooleanFunction expressions:
A BooleanFunction expression that is equivalent to True or False automatically simplifies:
BooleanFunction is a canonical representation, and equivalence can be tested using SameQ:
Create a truth table in standard order:
Create an equivalent BooleanFunction expression:
Show that they are equivalent:
Alternatively show that the resulting truth tables are the same:
Create a complete list of truth rules:
Create the corresponding BooleanFunction expression:
The ordering of truth rules for complete lists has no effect:
Use _ to indicate "don't cares" in a truth table:
Create a BooleanFunction:
The resulting truth table matches the original specification:
Use _ and __ to indicate "don't cares" in truth rules:
Create a BooleanFunction:
The original rules completely specify the function and the resulting truth tables are identical:
Use lists of lists to indicate a vector-valued truth table:
Create a BooleanFunction:
The resulting output matches the original specification:
Use vector-valued truth rules:
Create a BooleanFunction:
The resulting truth rules match the original specification:
Truth tables can also be given using 0 in place of False and 1 in place of True:
The resulting truth tables are identical:
Convert any Boolean expression to a BooleanFunction expression:
Show that they are equivalent:
Convert expressions involving any Boolean operators:
Show that they are equivalent:
Convert a BooleanFunction expression to other standard forms:
A number of different standard forms:
As well as a truth table:
Or truth rules:
 Applications   (4)
Enumerate all 2 variable Boolean functions:
All 3 variable Boolean functions:
Randomly sample 50 functions of 4 variables:
Compare the sizes of Boolean functions in their standard and minimized forms:
Three variables:
Four variables, the first functions:
Create new Boolean primitives corresponding to ≤, ≥, < and >:
These are closely related:
Implies is equivalent to x<=y:
Define a relation for Boolean functions fg iff :
Here we have xxy as reflected in the truth tables:
Using standard inequalities:
We have fgffg for all Boolean functions f and g:
We prove that fg iff fgf:
And similarly fg iff fgg:
Or that fg and gh implies fh:
Generate the rule-30 elementary cellular automaton rule:
Simulate it:
Compare to the standard encoding:
BooleanFunction displays in an elided form indicating the number of arguments:
It is an atomic object:
The InputForm gives an encoding that can be used to reconstruct the object:
Use the encoding to construct a BooleanFunction:
The result is identical to the original:
The order of values for BooleanFunction is the same as BooleanTable:
The corresponding BooleanFunction has an identical truth table:
The ordering is consistent with Tuples:
Indexing of BooleanFunction is consistent with IntegerDigits:
Convert from a BooleanFunction to its index:
Convert from any Boolean expression to its index:
Show that it is equivalent with the indexed BooleanFunction expression:
The indexing of Boolean functions agrees with the indexing of cellular automata:
BooleanMinterms can also represent any BooleanFunction:
The mapping from minterms to index:
The mapping from index to minterms:
Using bit vectors:
Use BooleanConvert to convert to BooleanFunction from other forms:
Also use BooleanConvert to convert from BooleanFunction to other forms:
Show that they are all equivalent:
Use BooleanTable to convert BooleanFunction to truth tables:
Or convert to truth rules:
New in 7
 Site Index Choose Language