Course contentsShow
← Computer Science
Lesson 39 of 2,8722. Discrete Mathematics for CSFree lesson

Compound Propositions and Precedence

Learn to build complex logical expressions using multiple operators and understand operator precedence rules.

Compound Propositions and Precedence

What you'll learn: How to combine multiple logical operators in a single statement and understand which operations happen first.

The Core Idea

Just like arithmetic has order of operations (multiplication before addition), logical expressions follow precedence rules that determine which operators apply first when you build complex statements.

A compound proposition combines simple propositions using multiple logical operators. For example: "It is raining AND (it is cold OR windy)" uses both AND and OR in one statement.

Operator Precedence Rules

When you see an expression like p ∧ q ∨ r, which operation happens first? Here's the standard precedence from highest to lowest:

  1. ¬ (NOT) — highest priority, happens first
  2. ∧ (AND) — second priority
  3. ∨ (OR) — third priority
  4. → (implication) — fourth priority
  5. ↔ (biconditional) — lowest priority, happens last

This means ¬p ∧ q is read as (¬p) ∧ q, not ¬(p ∧ q).

Similarly, p ∧ q ∨ r means (p ∧ q) ∨ r.

Why This Matters

Analogy: Think of it like reading "2 + 3 × 4". You know to multiply first (giving 14), not add first. Logic works the same way—without precedence rules, p ∧ q ∨ r would be ambiguous.

When in doubt, use parentheses to make your meaning crystal clear: (p ∧ q) ∨ r versus p ∧ (q ∨ r) can yield different truth values!

Example

Expression: ¬p ∨ q ∧ r

Reading with precedence: (¬p) ∨ (q ∧ r)

First negate p, then evaluate q ∧ r, finally apply OR.

Key Takeaway: Compound propositions let you build complex logical statements, and understanding operator precedence ensures you evaluate them correctly—just like order of operations in arithmetic.