Predicate Logic & Quantifiers
Discrete Mathematics Fundamentals
Chapter 3 · Predicate Logic & Quantifiers
Chapter 2 flagged x > 3 as not a proposition — its truth depends on a variable that hasn't been given a value yet. This chapter covers exactly that case properly: predicates, and the two quantifiers that turn a predicate into an actual, honest-to-goodness proposition.
What a Predicate Actually Is
A predicate is a statement containing one or more variables, which becomes a genuine proposition — true or false — the moment those variables are given specific values. Written P(x), a predicate is a template for a proposition, not a proposition itself.
| Expression | What it is |
|---|---|
P(x): x > 3 | A predicate — no fixed truth value yet |
P(5) | A proposition — true |
P(2) | A proposition — false |
This is already exactly what a boolean-returning function is in code — a predicate, parameterized truth, written in a different notation:
The Universal Quantifier — ∀ ("for all")
∀x P(x) means P(x) is true for every value of x in whatever domain you're considering. This is exactly what Python's all() computes.
The Existential Quantifier — ∃ ("there exists")
∃x P(x) means P(x) is true for at least one value of x in the domain — not necessarily all, just one is enough. This is exactly what Python's any() computes.
∀x P(x) only makes sense once you've said what x ranges over — "for all x" in what set, exactly? In code, the domain is simply whatever you're iterating over — ages in the examples above. Leaving the domain unstated (in math or in code) is a genuine, common source of confusion.
Combining Quantifiers: "Every P Is a Q" vs. "Some P Is a Q"
In practice, quantifiers almost always pair with a specific second connective, and the pairing is easy to get backwards:
| English | Correct translation | Why this connective |
|---|---|---|
| "Every P is a Q" | ∀x (P(x) → Q(x)) | For any x, if it's a P, then it must also be a Q |
| "Some P is a Q" | ∃x (P(x) ∧ Q(x)) | There's an x that is both a P and a Q, at the same time |
∀x (P(x) ∧ Q(x)) for "every P is a Q" is a genuine, common error — it actually claims that every single x in the entire domain is both a P and a Q, which is a far stronger (and usually false) statement. "Every student who submitted on time gets full marks" does not mean every person in existence submitted on time and got full marks — it means if someone submitted on time, then they got full marks. ∀ pairs with →; ∃ pairs with ∧ — mixing these up is the single most common predicate-logic translation mistake.
Negating Quantified Statements
Predicate logic has its own version of Chapter 2's De Morgan's Laws — negating a quantifier flips it to the other quantifier:
| Statement | Negation | Plain English |
|---|---|---|
| ¬(∀x P(x)) | ≡ ∃x ¬P(x) | "Not all" means "at least one fails" |
| ¬(∃x P(x)) | ≡ ∀x ¬P(x) | "None exist" means "all fail" |