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 ⇒ has higher precedence that ⇔.

¬



In sentences without parentheses, 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. 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.

¬ pq((¬ p) ∧ q)
p ∧ ¬q(p ∧ (¬ q))
pqr((pq) ∨ r)
pqr(p ∨ (qr))
pqr((pq) ⇔ r))
pqr(p ⇔ (qr))

When an operand is surrounded by two ∧ operators or by two ∨ operators, the operand associates to the left. When an operand is surrounded by two ⇒ operators or by two ⇔ operators, the operand associates to the right.

pqr((pq) ∧ r))
pqr((pq) ∨ r))
pqr(p ⇒ (qr))
pqr(p ⇔ (qr))