Predicates and Quantifiers
A statement with a variable in it, like "x > 3," isn't true or false until you say which x you mean. "For all" (∀) and "there exists" (∃) settle that, and negating one turns it into the other: "not every x works" means "some x fails."
What the symbols mean
- For all
The statement holds for every element of the domain.
- There exists
The statement holds for at least one element.
- Predicate
A statement about x that is true or false once x is chosen.
Explanation
A quantifier is simply a phrase that says how many things a claim is about: "for all" (every single one) or "there exists" (at least one). The name fits once you see it, since it states the quantity. Quantifiers let you say things like "every request gets a response" precisely, and they tell you exactly what it takes to break such a claim. The formula looks scary, but read it piece by piece: (for every x), (there's at least one x), (some claim about x) and (not). Put together it says "not everyone passed" means "someone failed." That's the whole idea, so bear with the upside-down letters.
Back in the first lesson, "x > 3" didn't count as a proposition, because its truth depends on x. Statements like that are called predicates, written . There are two ways to turn one into an honest true-or-false statement: plug in a specific , or say how many 's you're talking about. That second option is what quantifiers do.
- is true when holds for every in the domain. One counterexample makes it false.
- is true when holds for at least one . It's false only if fails everywhere.
The answer also depends on the domain, the set ranges over. "" is true over the real numbers, where works, and false over the integers.
Negation pushes through a quantifier and flips it. To see why, picture a small domain . Then is just , a giant "and," and is , a giant "or." Negating them is De Morgan's laws all over again: "not all of them work" becomes "at least one fails."
A common mistake. It's tempting to think you can swap the order of quantifiers freely, since the same words appear either way. You can't. Over the integers, says "every number has a bigger one," which is true, because is allowed to depend on . But says "one single number is bigger than all of them," which is false.
See it
Worked examples
Negate "every bug report gets a reply within a day."
- 1
In symbols it's , where is " gets a reply within a day."
Practice
Type your answer and check it. Solve them all to complete the lesson.
Which is the negation of ?
On the domain , is true?
Over the integers, is true?
How many counterexamples does it take to disprove a "for all" statement?
A service promises that every request gets a response within 200 ms. Which log entry disproves the promise?
Which statement is the negation of ?
The hardest one here. Get it, and you've got this lesson.
In calculus, means . Which statement says the limit is not ?
Where it's used
Database queries ("find customers such that every order has shipped") and program specifications are written with quantifiers, and their negations are the test cases that break them.