Combined and Negated Combined Condition

A combined condition results from connecting conditions with one of the logical operators "AND" or "OR".

General Format


*

Syntax Rules

  1. Condition may be:
    • A simple condition
    • A negated simple condition
    • A combined condition
    • A negated combined condition; that is, the "NOT" logical operator followed by a combined condition enclosed within parentheses
    • Combinations of the above, specified according to the rules summarized in the table in the Comments section below.
  2. Although parentheses need never be used when either "AND" or "OR" (but not both) is used exclusively in a combined condition, parentheses can be used to effect a final truth value when a mixture of "AND", "OR" and "NOT" is used.

General Rules

  1. In the absence of the relevant parentheses in a complex condition, the precedence (that is, binding power) of the logical operators determines the conditions to which the specified logical operators apply and implies the equivalent parentheses. The order of precedence is "NOT", "AND" , "OR". Thus, specifying "condition-1 OR NOT condition-2 AND condition-3" implies and is equivalent to specifying "condition-1 OR ((NOT condition-2) AND condition-3)".
  2. Where parentheses are used in a complex condition, precedence is used to determine the binding of conditions to logical operator. Parentheses can, therefore, be used to depart from the normal precedence of logical operators as specified above. Thus, the example complex condition above can be given a different meaning by specifying it as a "(condition-1 OR (NOT condition-2)) AND condition-3". (See the topic Condition Evaluation Rules.)

Comments:

The table below indicates the ways in which conditions and logical operators can be combined and parenthesized. There must be a one-to-one correspondence between left and right parentheses such that each left parenthesis is to the left of its corresponding right parenthesis.

Table 1. Combinations of Conditions, Logical Operators, and Parentheses
Element Permitted location in conditional expression Element can be preceded by only: Element can be followed by only:
simple-condition Any OR, NOT, AND, ( OR, AND, )
OR or AND Not first or last simple-condition, ) simple-condition, NOT, (
NOT Not last OR, AND, ( simple-condition, (
( Not last OR, NOT, AND, ( simple-condition, NOT, (
) Not first simple-condition, ) OR, AND, )

Thus, the element pair "OR NOT" is permissible while the pair "NOT OR" is not permissible; "NOT ( " is permissible while "NOT NOT" is not permissible.