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

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

a∧b

(2)
> 

aorb

aorb

(3)
> 

convert⁡,boolean_function

a∨b

(4)
> 

aorbandc

aorbandc

(5)
> 

convert⁡,boolean_function

a∨b∧c

(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`

aorb∧c

(8)
> 

convert⁡,boolean_function,`or`

a∨bandc

(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∨¬a∧b

(11)
> 

a⇒b

a⇒b

(12)
> 

convert⁡,boolean_function

¬a∨b

(13)

Boolean statements constructed with operators have some simplifications performed automatically.

> 

z≠0andb−2⁢a−2=0orb−2⁢a=0

false

(14)

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

(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

a∧b∨c∧d∨e

(17)
> 

axorb⇒candd

axorb⇒candd

(18)
> 

convert⁡,boolean_function

¬a∧¬b∨¬a∧b∨c∧d

(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