Logic Package Operators - Maple Programming Help

Home : Support : Online Help : Programming : Logic : Boolean : Logic Package : Logic/operators

Logic Package Operators

Description

 • The Logic package uses a two-valued logic system, while standard Maple logic is three-valued.  For this reason, all Boolean expressions used in the Logic package must be expressed in terms of the operators &and, &iff, &implies, &nand, &nor, ¬, &or, and &xor.
 • You may either enter expressions in terms of these operators directly into Maple, or transform expressions of type logical into expressions in terms of these operators with the Logic[Import] command.

Precedence

 • Note that the Logic package operators do not have the same precedence as corresponding three-valued operators.  In particular, all operators have the same precedence, so $a&\mathbf{or}b&\mathbf{and}c$ is equivalent to $\left(a&orb\right)&andc$, not $a&or\left(b&andc\right)$. Parentheses should be used to correctly specify the precedence.

Examples

 > $\mathrm{with}\left(\mathrm{Logic}\right):$
 > $\mathrm{Export}\left(a&orb,\mathrm{form}=\mathrm{MOD2}\right)$
 ${1}{+}\left({a}{+}{1}\right){}\left({b}{+}{1}\right)$ (1)
 > $\mathrm{Export}\left(\left(a&norb\right)&andc&orb\right)$
 ${\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left({a}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{or}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{c}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{or}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}$ (2)
 > $\mathrm{Import}\left(a⇒b\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{or}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}c\right)$
 ${\mathrm{Logic:-&implies}}{}\left({a}{,}{b}{\vee }{c}\right)$ (3)
 > $\mathrm{Export}\left(\left(\left(\mathrm{¬}\left(a\right)&orb\right)&xorc\right)&nandb,\mathrm{form}=\mathrm{boolean}\right)$
 ${\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\left(\left({\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{a}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{or}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{xor}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{c}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{b}\right)$ (4)