Boolean Expressions

Boolean expressions are expressions that return logical values by applying specified operations to designated Boolean primaries.

<Boolean expression>

──┬─<simple Boolean expression>──────┬─────────────────────────────────┤
  ├─<conditional Boolean expression>─┤
  └─<try Boolean expression>─────────┘

<simple Boolean expression>

  ┌◄─ <Boolean operator> ─┐
──┴─<Boolean primary>─────┴────────────────────────────────────────────┤

<Boolean operator>

──┬─ AND ──────────────────┬───────────────────────────────────────────┤
  ├─ OR ───────────────────┤
  ├─ IMP ──────────────────┤
  ├─ EQV ──────────────────┤
  ├─ ! ────────────────────┤
  └─<conditional operator>─┘

<conditional operator>

──┬─ CAND ─┬───────────────────────────────────────────────────────────┤
  └─ COR ──┘

Explanation

Conditional operators are similar to their corresponding standard Boolean operators. However, when a conditional operator is used, the second operand is not evaluated if the value of the first operand is sufficient to determine the value of the expressions. The value returned is either 1 (TRUE) or 0 (FALSE) in the low-order bit of the resulting operand; the remaining 47 bits of the operand are undefined.

The following table illustrates the functions of these conditional operators:

Operands Operations  

L

R

L CAND R

L COR R

TRUE

bool

bool

 

TRUE

FALSE

bool

FALSE

 

bool

CAND has the same precedence as AND, while COR has the same precedence as OR.

Following are examples of Boolean operators:

B:= R1 NEQ 0 CAND R2/R1 EQL R3; 
B:= R1 GEQ 0 AND R1 LSS SIZE(A) COR R2 NEQ A[R1];

The evaluation of a conditional Boolean expression is described in Conditional Expressions.

<try Boolean expression>

── TRY ─┬─<try limited form>────────┬──────────────────────────────────┤
        └─<try Boolean normal form>─┘

<try Boolean normal form>

                       ┌◄─────────────────────────────┐
──<Boolean expression>─┴─ ELSE ──<Boolean expression>─┴────────────────┤

An explanation of <try Boolean expression> is given in TRY Expression.

Operators in Boolean Expressions

The following table lists the operators that can be used in Boolean expressions, along with their meanings. When two operators are listed on the same line, they are equivalent to each other.

Operator

 

Meaning

NOT

^

Logical NOT

AND

 

Logical AND

CAND

 

Conditional logical AND

OR

!

Logical inclusive OR

COR

 

Conditional logical inclusive OR

IMP

 

Logical implication

EQV

 

Logical equivalence

IS

 

Identical to

ISNT

 

Not identical to

EQL

=

Equal to

NEQ

^=

Not equal to

GTR

>

Greater than

GEQ

>=

Greater than or equal to

LSS

<

Less than

LEQ

<=

Less than or equal to