convert/boolean_operator - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Conversion : convert/boolean_operator

convert/boolean_operator

convert boolean statements involving {And, Or, Xor, Implies, Not} into equivalent boolean operators using {and, or, xor, implies, not}

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

convert(expr, boolean_operator)

convert(expr, boolean_operator, Or, And, ...)

Parameters

expr

-

Maple expression possibly containing boolean statements constructed using the operators {And, Or, Xor, Implies, Not}

Description

• 

The convert(expr, boolean_operator) command converts, in a given expression, all boolean statements constructed using the functions {And, Or, Xor, Implies, Not} into equivalent boolean constructions using {and, or, xor, implies, not}. If the given expression contains no such boolean functions, it is returned unchanged. To perform the opposite conversion, that is, from the operators {and, or, xor, implies, not} to the corresponding boolean functions expressed using only {And, Or, Not} see convert,boolean_function.

• 

To restrict the application of the conversion to boolean functions of only certain type, for instance only to And functions, give the name of these functions after the keyword boolean_operator - see the Examples section.

• 

Each of the operator or function representations for boolean statements has its own features, which represent advantages or disadvantages depending on the framework these statements are used. Boolean operators are evaluated inside the Maple kernel and have automatic simplifications carried out; boolean functions are evaluated outside the kernel and no automatic simplifications are performed on them - see details in convert,boolean_function.

Examples

Anda,b

ab

(1)

convert,boolean_operator

aandb

(2)

Ora,Andb,c

abc

(3)

convert,boolean_operator

aorbandc

(4)

To reverse these conversions use convert, boolean_function

convert,boolean_function

abc

(5)

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

convert,boolean_operator,And

abandc

(6)

convert,boolean_operator,Or

aorbc

(7)

Note that, convert, boolean_operator also converts {Xor, Implies}

Xora,Impliesb,c

abc

(8)

convert,boolean_operator

axorbc

(9)

On the other hand, convert, boolean_function only returns results involving {And, Or, Not}

convert,boolean_function

a¬¬bc¬a¬bc

(10)

To express boolean statements constructed with {xor, implies} using only the operators {and, or, not} you can convert to boolean_function then back to boolean_operator; for instance, the example above involving {xor, implies} is equivalent to the following one that involves only {and, or, not}.

convert,boolean_operator

aandnotnotborcornotaandnotborc

(11)

Note also that Or and And constructions, regardless of the number of operands, can be respectively expressed in terms of each other by using Not and this happens automatically when converting to boolean operators

Ora,b,c=NotAndNota,Notb,Notb

abc=¬¬a¬b¬b

(12)

convert,boolean_operator

aorborc=aorborb

(13)

Anda,b,c=NotOrNota,Notb,Notb

abc=¬¬a¬b¬b

(14)

convert,boolean_operator

aandbandc=aandbandb

(15)

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

See Also

convert

convert/and

convert/boolean_function

Logic

type/And