DM 02 Predicates and quantifiers
Previous: DM 01 Logic and Propositions | DM 00 Course Map | Next: DM 03 Proof Techniques
A predicate is a statement with a blank in it, and the quantifiers “for all” and “there exists” turn it into a definite claim; the order of quantifiers changes the meaning, and negation swaps them.
Predicates
"" is neither true nor false until has a value. It is a predicate: a statement containing variables that becomes a proposition once values are substituted.
Write for "". Then is true and is false. A predicate can have several variables: for "".
The domain is the set of values the variable may take. It must be stated or clear from context, because the truth of a quantified statement depends on it.
The two quantifiers
Universal: (“for all”, “for every”).
True when holds for every in the domain. A single failure makes it false.
Existential: (“there exists”, “for some”).
True when holds for at least one in the domain.
Examples with domain :
- : true.
- : false. Counterexample: .
- : true ().
- : false.
Change the domain to the integers and becomes false. The domain is part of the statement.
On a finite domain , is a big “and” and is a big “or”:
In Python: all(P(x) for x in domain) and any(P(x) for x in domain).
How to prove or disprove
| Statement | To prove it | To disprove it |
|---|---|---|
| argue for an arbitrary | exhibit one counterexample | |
| exhibit one example | argue that every fails |
Examples never prove a universal statement. Checking that is prime for does not prove it for all ; it fails at , which gives .
Negating quantifiers
Negation flips the quantifier and negates the inside:
These are De Morgan’s laws stretched over a whole domain.
- “Not everyone passed” “Someone did not pass.”
- “Nobody passed” (there does not exist someone who passed) “Everyone failed.”
The negation of “all swans are white” is “at least one swan is not white”, not “no swans are white”.
Restricted quantifiers
“Every positive number has a positive square root” restricts the domain. The translations differ for the two quantifiers:
“All” pairs with implies; “some” pairs with and. Mixing them up is a classic error: is true as soon as any non-positive number exists, which says nothing useful.
Nested quantifiers: order matters
With two variables, the order of different quantifiers changes the meaning. Let the domain be the real numbers.
“For every there is a (which may depend on ) with .” True: take .
“There is one single that works for every .” False: no number is the negative of all numbers.
Read left to right, as a game. For , an opponent picks first and then you pick knowing their choice. For , you must commit to first, and then the opponent picks to defeat you. Going first is harder, so is the stronger claim: it implies but not the reverse.
Everyday example. “Everyone has a mother” is : true. “There is someone who is everyone’s mother” is : false.
Two quantifiers of the same kind can be swapped freely: .
Negating nested quantifiers
Work from the outside in, flipping each quantifier, and negate the innermost statement.
Worked example: the definition of a limit. ” as ” means
Its negation (” does not tend to ”):
Each quantifier flipped, and the implication became “hypothesis and not conclusion” (DM 01 Logic and Propositions). In words: there is some tolerance that cannot be met, however close you look.
Translating English
| English | Logic |
|---|---|
| Every student passed. | |
| Some student passed. | |
| No student passed. | |
| Not every student passed. | |
| Exactly one satisfies . |
English is often ambiguous. “Every robot has a sensor that failed” could mean each has its own failed sensor () or one shared sensor failed on all (). Writing the quantifiers forces you to decide.
Common mistakes
- Swapping with .
- Using with or with when restricting the domain.
- Negating only the predicate and forgetting to flip the quantifier.
- Proving a universal claim with examples.
Learn by doing
- Domain: integers. True or false? (a) (b) (c) .
- Negate: “Every robot in the lab has at least one working camera.”
- Translate using predicates “x is a robot” and “x has a camera”: “Some robots do not have a camera.”
- Find a counterexample to .
- (a) True, . (b) False, there is no largest integer. (c) False: has no integer inverse (and has none at all).
- “Some robot in the lab has no working camera.”
- .
- : .
Where this shows up
Every definition and theorem in the LA 00 Course Map and PS 00 Course Map courses is a quantified statement: “linearly independent” hides a over coefficients, and “there is a solution” is an . Specifications such as “for every start state, the controller eventually reaches the goal” are nested quantifiers.