Nested quantifiers and rules of inference
The difference between ∀x∃y and ∃y∀x, truth values of nested quantifiers, their negation, and showing with rules that an argument is valid.
Last week you saw statements with a single quantifier. Real mathematical sentences usually contain two or three quantifiers: “every number has an inverse”, “there is no number greater than everything”. The first half of this page explains how to read these statements, how to find their truth value and how to negate them. The second half covers rules of inference: going from premises to a conclusion step by step, writing a rule name next to each step. Both come up on the midterm; the truth value of a quantified statement is almost certain, and “is the argument valid” is also common.
Golden rules:
- Quantifiers are read and chosen from left to right. The one that comes first is chosen first; the next one can be chosen looking at it.
- In , may depend on . In it may not.
- When negating, every quantifier flips and the order does not change.
- Valid argument = if the premises are true, the conclusion is certainly true. To show invalidity, a single row with premises T and conclusion F is enough.
Nested quantifiers
Let be a predicate of two variables. Think of as two nested loops:
∀x ∃y P(x,y): for each x: (outer loop, all must pass)
search some y (inner loop, finding one is enough)
with P(x,y) true
∃y ∀x P(x,y): find ONE y such that
for each x: P(x,y) (the same y must work with all x)
From a programmer’s point of view: means all items in a for loop return true, and means break as soon as one true is found in the loop. Changing the order means swapping the loops, and it changes the result.
Everyday example. Domain: the players and coaches on a team. : ” is the coach of ”.
- : “Every player has a coach.” The striker’s coach can be one person and the defender’s another.
- : “There is a single person who is everyone’s coach.” A much stronger claim.
If the second is true, the first is also true (you choose that single person for everyone). The converse is generally not true.
The four basic statements with two variables
Domain: the integers, : "".
| Statement | Reading | Truth | Why |
|---|---|---|---|
| for every pair | F | breaks it | |
| for every number there is a greater number | T | ||
| there is a number greater than everything | F | once is chosen, breaks it | |
| there is a pair | T |
On the exam you write the truth value of a statement like this:
- If you say True: for give the concrete value (“take ”), for argue with an arbitrary element (“for any integer …”).
- If you say False: for give a concrete counterexample, for show that no element satisfies it.
Worked examples
The domain is the integers.
. False. Counterexample : if then . (If the domain were the reals it would be true with .)
. True. Take : for every integer .
. False. Counterexample : has no integer solution. also breaks it.
PITFALL · Thinking “the order doesn’t matter”. and can swap places only when the quantifiers are of the same kind ( or ). With mixed quantifiers the order changes the meaning.
Translation
The domain is the students in a class, : ” and are friends”.
| Sentence | Logic |
|---|---|
| Everyone has a friend. | |
| Someone is a friend of everyone. | |
| Nobody is friends with everyone. | |
| Every student has a friend other than themselves. |
Pattern: for “every” and “all”, for “some”, “a”, “at least one”. The connective inside again follows last week’s rule: if there is a condition under use , under use .
Negating nested quantifiers
The rule is the same as last week’s, just applied several times: as you push the from left to right, you flip each quantifier.
¬ ∀x ∃y (P(x,y) ∧ Q(x))
≡ ∃x ¬∃y (P(x,y) ∧ Q(x))
≡ ∃x ∀y ¬(P(x,y) ∧ Q(x))
≡ ∃x ∀y (¬P(x,y) ∨ ¬Q(x)) De Morgan
With restricted quantifiers the restriction stays as it is: . If “every positive number satisfies it” is false, there is a positive number that does not satisfy it.
Rules of inference
An argument consists of premises and a conclusion. An argument is valid if the conclusion is certainly true whenever all the premises are true. That is, is a tautology. Validity is about the form, not the content.
Instead of building a long truth table, you chain known valid patterns:
| Rule | Premises | Conclusion |
|---|---|---|
| Modus ponens | , | |
| Modus tollens | , | |
| Hypothetical syllogism | , | |
| Disjunctive syllogism | , | |
| Addition | ||
| Simplification | ||
| Conjunction | , | |
| Resolution | , |
Rules with quantifiers:
| Rule | Premise | Conclusion |
|---|---|---|
| Universal instantiation | , for any | |
| Universal generalization | for arbitrary | |
| Existential instantiation | for some (unnamed) | |
| Existential generalization | for a specific | |
| Universal modus ponens | , |
Two classic fallacies
- Affirming the conclusion: , . Invalid. “Whoever studies hard passes. Ali passed. So Ali studied hard.” Maybe he was lucky.
- Denying the hypothesis: , . Invalid. “Whoever studies hard passes. Ali did not study. So Ali failed.” Maybe he passed anyway.
In both, the row that breaks it is , : the premises are true and the conclusion is false.
Worked example: solving an argument with rules
Premises: “If I wake up early and I am not tired, I go to the gym.” “I did not go to the gym.” “I woke up early.” Conclusion: “I was tired.”
First assign letters: : wake up early, : tired, : go to the gym. The premises are , , . The conclusion is .
1. (w ∧ ¬h) → g premise
2. ¬g premise
3. ¬(w ∧ ¬h) modus tollens, 1, 2
4. ¬w ∨ h De Morgan + double negation, 3
5. w premise
6. h disjunctive syllogism, 4, 5 (¬w is false, so h remains)
The argument is valid. Step 4 is not a rule of inference but an equivalence law; it is enough to write its name too.
Worked example: resolution
Premises , , . Conclusion .
1. p ∨ q premise
2. ¬p ∨ r premise
3. q ∨ r resolution, 1, 2
4. ¬q ∨ r premise
5. r ∨ r resolution, 3, 4
6. r idempotent law, 5
In everyday terms: “I will go either by bus () or by train (). If I go by bus I will be late. If I go by train I will also be late. So I will be late.” This pattern is also called proof by cases; you will see it again on the proof page.
TIP · Write the letters first. The line “Let : …, : …” is part of your marks on the exam. Then go on with numbered lines; to the right of each line write “premise” or the rule name and the line numbers you used.
Common mistakes
| Wrong idea | The truth |
|---|---|
| and are the same | With mixed quantifiers the order changes the meaning |
| For , choosing a separate for each | A single is chosen and must work with all |
| In negation, flipping only the first quantifier | All of them flip, the order is kept |
| The restriction stays: | |
| Skipping the word “other” | You need the condition |
| , is valid | Affirming the conclusion, invalid |
| , is valid | Denying the hypothesis, invalid |
| Explaining invalidity with “I don’t think so” | Write down the concrete row with premises T and conclusion F |
| Adding a line without writing the rule name | The justification of every line is worth marks |
Test yourself
Exam-style questions. Solve them on paper first, then reveal the answer.
The domain of all variables is the integers. Determine the truth values of (a) and (b) .
Show answer
(a) For each choose ; this is an integer and . is allowed to depend on , so there is no problem.
(b) We need a SINGLE that works for all . Once is fixed, holds only for ; for example breaks it. False.
The domain is the integers. Is true? Justify.
Show answer
With in front, you first pick a single , and then that must work with all . If you pick , then for every . True.
The domain is the real numbers. Determine the truth values of (a) and (b) .
Show answer
(a) Counterexample : no real gives , because .
(b) For every real , is a real number and . The cube root is defined for negatives too. True.
The domain is the positive integers. Is true?
Show answer
One counterexample is enough for . For there is no positive integer with . If the domain were the integers it would be true ().
Let the domain of and be . Find the truth values of (a) , (b) , (c) .
Show answer
(a) , , . Every has a partner: T.
(b) is greater than or equal to everyone: T.
(c) For , is false: F. With you check every pair, and one of them fails.
Let mean " has chatted with ", the domain being the students in a class. Express in logic: "Every student has chatted with at least one other student in the class."
Show answer
"Every student" is the outer . "At least one" is the inner . The word "other" brings the condition ; if you forget it, a student chatting with themselves would also count. Because it is , the connective is .
Write the negation of so that no negation sign is in front of a quantifier.
Show answer
Flip each quantifier from left to right: , . The order stays the same. Then the inside: .
Negate the statement so that no negation sign is in front of a quantifier.
Show answer
The three quantifiers flip in turn: , , . The restrictions (, ) stay as they are, because they give the range of the quantifier. In the innermost part, .
Which rule of inference is used? "If the code compiles, the tests run. The tests did not run. Therefore the code did not compile."
Show answer
: compiles, : tests run. The premises are and , the conclusion is . This pattern is called modus tollens. It is valid, because is a tautology.
Is the following argument valid? "If the server is down, the website is offline. The website is offline. Therefore the server is down." Justify.
Show answer
: server down, : website offline. The pattern is , . To show it is invalid, find a row where all premises are T and the conclusion is F: , . In this row and but . The site could be offline for another reason.
Show that the premises "If it rains, practice is cancelled", "If practice is cancelled, I study", "It rains or I am injured" and "I am not injured" imply "I study". Name each rule.
Show answer
: rains, : cancelled, : I study, : injured. The premises are , , , .
1. (premise), 2. (premise), 3. (disjunctive syllogism, 1, 2)
4. , 5. (premises), 6. (hypothetical syllogism, 4, 5)
7. (modus ponens, 3, 6). Write a number and a rule name on every line.
"Every computer engineering student takes MAT2033. Selin is a computer engineering student. Therefore Selin takes MAT2033." Write the argument in logic and name the rule that justifies it.
Show answer
: computer engineering student, : takes MAT2033. First, universal instantiation gives , then modus ponens gives . The combination of the two is called universal modus ponens.
Verification: Quantifier truth values were checked by brute force over finite domains and over the integer window -200..200, nested negations over random finite models, and all arguments with truth tables (is the conclusion T whenever the premises are T) using node (verify/MAT2033/02.mjs).