|
SOLUTIONS
|
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
corresponding to the Boolean function specified by spec.
BooleanFunction[spec, {a1, a2, ...}, form]
gives the Boolean expression in the form specified by form.
DetailsDetails
- 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
and
. - The functions represented by BooleanFunction always return True or False.
- In BooleanFunction[values], the values are specified in binary order starting with
, .... - 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
can be lists, representing vector-valued Boolean functions. - Elements of both inputs and outputs can be specified either as True and False or as
and
. - 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.
- 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.
ExamplesExamplesopen allclose all
Basic Examples (3)Basic Examples (3)
Generate the 30
Boolean function of 3 variables:
| In[1]:= |
| Out[1]= |
Use f like any other Boolean operator:
| In[2]:= |
| Out[2]= |
| In[3]:= |
| Out[3]= |
Generate the formula directly:
| In[4]:= |
| Out[4]= |
Specify a Boolean function based on a table of truth rules:
| In[1]:= |
| Out[1]= |
Use an incompletely specified truth table:
| In[2]:= |
| Out[2]= |
Convert a Boolean expression to a BooleanFunction:
| In[1]:= |
| Out[1]= |
Test that they represent the same function:
| In[2]:= |
| Out[2]= |
