Introduction to Logic

 Operator Precedence

Operator precedence is an ordering of logical operators designed to allow the dropping of parentheses in logical expressions. The following table gives a hierarchy of precedences for the operators of propositional logic. The ¬ operator has higher precedence than ∧; ∧ has higher precedence than ∨; and ∨ has higher precedence than ⇒ and ⇔.

¬

⇒ ⇔

In unparenthesized sentences, it is often the case that an expression is flanked by operators, one on either side. In interpreting such sentences, the question is whether the expression associates with the operator on its left or the one on its right. We can use precedence to make this determination. In particular, we agree that an operand in such a situation always associates with the operator of higher precedence. When an operand is surrounded by operators of equal precedence, the operand associates to the right. The following examples show how these rules work in various cases. The expressions on the right are the fully parenthesized versions of the expressions on the left.

 ¬ p ∧ q ((¬ p) ∧ q) p ∧ ¬q (p ∧ (¬ q)) p ∧ q ∨ r ((p ∧ q) ∨ r) p ∨ q ∧ r (p ∨ (q ∧ r) p ⇒ q ⇒ r (p ⇒ (q ⇒ r)) p ⇒ q ⇔ r (p ⇒ (q ⇔ r))

 Text Section 2.2