Boolean expressions are formed by using the logical operators and, or, not, implies, and xor (exclusive disjunction), and the relational operators <, <=, >, >=, =, and <>.
In 2-D math, the relational operators <=, >=, and <> display as ≤, ≥, and ≠.
For information on the order of precedence of these operators, see operators[precedence].
Maple uses three-valued logic for all of its Boolean operations. The special names true and false are used to represent logical truth and logical falsity. A third special name FAIL is used to represent an expression whose truth is unknown.
The evalb function evaluates its argument as a Boolean expression. For example, x = x is an algebraic equation in Maple and normally it is not evaluated to a truth value (one of true, false, or FAIL). However, evalb(x = x) evaluates to true.
Evaluation as a Boolean expression takes place automatically if the expression:
contains a logical operator,
is in the if clause of a conditional statement, or
is in the while clause of a repetition statement.
The evaluation of expressions involving the logical operators uses the McCarthy evaluation rules (also called short-circuit evaluation). Namely, the left operand of the four operators and, or, xor, implies is always evaluated first, and the evaluation of the right operand is avoided if the truth value of the expression can be deduced from the value of the left operand alone. For example, the construct
does not cause a division by zero error when d=0, because when that condition holds, then the left operand of and becomes false and the right operand of and will not be evaluated.
Truth Table for Logical Operators
The evaluation of a logical expression yields true, false, or FAIL according to the following table.
An expression is of type boolean if it is of type logical, type relation or one of the Boolean constants true, false, or FAIL.
An expression is of type logical if it is of type `and`, `or`, `xor`, `implies`, or `not`.
An expression is of type relation if it is of type `=`, `<>`, `<`, or `<=`.
Note: Expressions formed using the operators > and >= are automatically converted to expressions using `<` and `<=`, respectively.
The boolean operators are thread safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Download Help Document
What kind of issue would you like to report? (Optional)