And - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

Calling Sequence

convert(expr, boolean_function)

convert(expr, boolean_function, `or`, `and`, ...)

Parameters

expr

-

Maple expression possibly containing boolean statements constructed using the operators and, or, xor, implies, not

Description

• 

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.

Examples

aandb

aandb

(1)

convert,boolean_function

ab

(2)

aorb

aorb

(3)

convert,boolean_function

ab

(4)

aorbandc

aorbandc

(5)

convert,boolean_function

abc

(6)

To reverse these conversions use convert, boolean_operator

convert,boolean_operator

aorbandc

(7)

To restrict the application of the conversion only to one (or some) type of boolean operators use for instance

convert,boolean_function,`and`

aorbc

(8)

convert,boolean_function,`or`

abandc

(9)

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

axorb

(10)

convert,boolean_function

a¬b¬ab

(11)

ab

ab

(12)

convert,boolean_function

¬ab

(13)

Boolean statements constructed with operators have some simplifications performed automatically.

z0andb2a2=0orb2a=0

false

(14)

The equivalent boolean function statement is not automatically simplified (quotes around the boolean operator statement are required).

convertz0andb2a2=0orb2a=0,boolean_function

z0b2a2=0b2a=0

(15)

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

aandborcanddore

(16)

convert,boolean_function

abcde

(17)

axorbcandd

axorbcandd

(18)

convert,boolean_function

¬a¬b¬abcd

(19)

To reverse this conversion use

convert,boolean_operator

notaandnotbornotaandborcandd

(20)

For information on manipulating and simplifying these expressions, see the Logic package.

See Also

convert

convert/and

convert/boolean_operator

Logic

type/And