convert/boolean_function
convert boolean statements involving {and,or,xor,implies,not} into equivalent boolean functions using {And,Or,Not}
Calling Sequence
Parameters
Description
Examples
convert(expr, boolean_function)
convert(expr, boolean_function, `or`, `and`, ...)
expr
-
Maple expression possibly containing boolean statements constructed using the operators and, or, xor, implies, not
The convert(expr, boolean_function) command converts, in a given expression, all boolean statements constructed using the operators {and, or, xor, implies, not} into equivalent boolean function constructions using the functions {And, Or, Not}. If the given expression contains no such boolean operators, it is returned unchanged. To perform the opposite conversion, that is, from the functions {And, Or, Xor, Implies, Not} to the corresponding boolean operators {and, or, xor, implies, not}, see convert,boolean_operator.
To restrict the application of the conversion to boolean operators of only certain type, for instance only to `and` operators, give the name of these operators, surrounded by `` after the keyword boolean_function - see the Examples.
The conversion of boolean statements constructed with operators into boolean statements constructed with functions is of use, among others things, for:
- avoiding the automatic simplification which happens with boolean operators;
- allowing the read of the boolean statement with the ordering of execution and precedence of the operations made explicit with parenthesis.
aandb
convert⁡,boolean_function
a∧b
aorb
a∨b
aorbandc
a∨b∧c
To reverse these conversions use convert, boolean_operator
convert⁡,boolean_operator
To restrict the application of the conversion only to one (or some) type of boolean operators use for instance
convert⁡,boolean_function,`and`
aorb∧c
convert⁡,boolean_function,`or`
a∨bandc
Note that, convert, boolean_function returns using only {And,Or,Not}, so statements using {xor, implies} will not result in statements with {Xor, Implies} in the output (even when convert, boolean_operator knows about them)
axorb
a∧¬b∨¬a∧b
a⇒b
¬a∨b
Boolean statements constructed with operators have some simplifications performed automatically.
z≠0andb−2⁢a−2=0orb−2⁢a=0
false
The equivalent boolean function statement is not automatically simplified (quotes around the boolean operator statement are required).
convert⁡z≠0andb−2⁢a−2=0orb−2⁢a=0,boolean_function
z≠0∧b−2⁢a−2=0∨b−2⁢a=0
The function representation above permits further manipulations of the boolean statement without having it simplified to 'false'.
The order and precedence of the operations becomes explicit:
aandborcanddore
a∧b∨c∧d∨e
axorb⇒candd
¬a∧¬b∨¬a∧b∨c∧d
To reverse this conversion use
notaandnotbornotaandborcandd
For information on manipulating and simplifying these expressions, see the Logic package.
See Also
convert
convert/and
convert/boolean_operator
Logic
type/And
Download Help Document