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.
Details


- BooleanFunction[spec] gives a Boolean function object that works like Function.
- BooleanFunction[spec][a1,a2,…] gives an implicit representation equivalent to the explicit Boolean expression BooleanFunction[spec,{a1,a2,…}].
- BooleanConvert converts BooleanFunction[spec][vars] to an explicit Boolean expression.
- In BooleanFunction[values] etc., values can be specified either as True and False or as 1 and 0.
- The functions represented by BooleanFunction always return True or False.
- In BooleanFunction[values], the values are specified in binary order starting with 111, ….
- BooleanFunction[k,n] is equivalent to BooleanFunction[IntegerDigits[k,2,2^n]].
- 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".
- In BooleanFunction[spec,{a1,a2,…},form], the possible forms are as given for BooleanConvert.
- BooleanFunction[spec,{a1,a2,…}] by default gives an expression in DNF.
- BooleanFunction[k] gives the k
Boolean function in n variables, where n has the smallest value for which
.
- The numbering of Boolean functions in BooleanFunction[k,…] is consistent with CellularAutomaton.
- BooleanFunction[CellularAutomaton[n]] is equivalent to BooleanFunction[n,3].
- BooleanFunction[CellularAutomaton[{n,2,r}]] is equivalent to BooleanFunction[n,2r+1].
- Operations such as BooleanMinimize, BooleanTable, etc. can operate directly on BooleanFunction objects.
- 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.
- BooleanVariables gives the number of variables of a BooleanFunction object.
Examples
open all close allBasic Examples (3)
Generate the 30 Boolean function of 3 variables:
Use f like any other Boolean operator:
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: