maths.free › Discrete Math & Logic › Predicate logic and quantifiers
Predicate logic and quantifiers
Predicates, "for all" and "there exists", negating quantified statements, and why the order of quantifiers matters.
A proposition is a sentence that is simply true or false. Most mathematical sentences are not like that on their own: "\( n \) is even" depends on \( n \). A predicate is such a sentence with a variable in it, written \( P(n) \), and it becomes a proposition once we substitute a value or quantify the variable. The universal quantifier \( \forall n\, P(n) \) says \( P(n) \) holds for every \( n \) in the domain; the existential quantifier \( \exists n\, P(n) \) says it holds for at least one. The domain is part of the statement: \( \exists x\,(x^2 = 2) \) is false over the rationals and true over the reals.
On a finite domain the quantifiers are just long conjunctions and disjunctions. Over the domain \( \{a, b\} \), \( \forall x\,P(x) \) means \( P(a) \land P(b) \) and \( \exists x\,P(x) \) means \( P(a) \lor P(b) \). That is why the rules for negating quantifiers are De Morgan's laws in disguise: \[ \lnot\,\forall x\,P(x) \equiv \exists x\,\lnot P(x), \qquad \lnot\,\exists x\,P(x) \equiv \forall x\,\lnot P(x). \] The example checks the two-element case, \( \lnot(p \land q) \leftrightarrow (\lnot p \lor \lnot q) \), and finds a tautology. To negate a statement with several quantifiers, push the negation inwards one quantifier at a time, flipping each one as it passes.
The order of different quantifiers changes the meaning. Over the integers, \( \forall n\,\exists m\,(m > n) \) says every integer has a larger one, which is true: the \( m \) may depend on \( n \). But \( \exists m\,\forall n\,(m > n) \) says one integer is larger than all of them, which is false. Quantifiers of the same kind commute: \( \forall x\,\forall y \) is the same as \( \forall y\,\forall x \). The definition of a limit, \( \forall \varepsilon > 0\ \exists \delta > 0\ \forall x \dots \), is the standard example of a statement whose whole content lies in its quantifier order.
Picture it: draw the domain as a row of boxes, one per element, each lit if \( P \) holds there. "For all" asks whether every box is lit; "there exists" asks whether at least one is. Negating "every box is lit" does not give "no box is lit"; it gives "some box is dark".
Think it: read \( \forall\exists \) statements as a game. An opponent picks the universally quantified value, you answer with the existential one, and the statement is true when you have a winning strategy. In \( \forall n\,\exists m\,(m > n) \) you win by answering \( m = n + 1 \). Swapping the quantifiers makes you move first, and then the opponent always wins.
Worked example · truth table of not (p and q) iff (not p or not q)
Truth table of not (p and q) iff (not p or not q)
Step by step
- \neg \left(p \wedge q\right) \Leftrightarrow \left(\neg p \vee \neg q\right)
2 variable(s) → 4 rows. Fill in every combination.
- \
A tautology (always true).
Reveal the answer
Now you Pick a problem, or type or draw your own. Every step, a picture, the answer hidden until you ask.
Symbols used here
Tap any symbol for the full definition, a picture, and what every letter in it means.
How to: Predicate logic and quantifiers
- Name the domain and write each predicate with its variables.
- Translate "every", "all", "any" as a universal quantifier and "some", "there is", "at least one" as an existential one.
- To negate, move the negation inwards past each quantifier, swapping for all and there exists.
- Negate the innermost statement last: not (P implies Q) is P and not Q.
- Check the meaning by testing a small domain or a specific counterexample.
Questions people ask
Is "for all x, P(x)" true when the domain is empty?
Yes, vacuously: there is no element to be a counterexample. Correspondingly "there exists x with P(x)" is false over an empty domain.
How do I disprove a "for all" statement?
Give one counterexample. Its negation is an existence statement, and a single witness proves an existence statement.
What makes mathematics "discrete"?
It deals with separate, countable objects (integers, graphs, statements) rather than continuous quantities. No limits, no infinitesimals; instead induction, counting and logic.
How does a proof by induction work?
Show the statement for the first case, then show that whenever it holds for n it holds for n + 1. Like dominoes: the first falls, and each knocks over the next.
What order should I take these lessons in?
Logic and proof first, because every later lesson proves things. Then induction, sets, relations and functions, counting, recurrences, graphs, Boolean algebra and automata, and finally algorithms and complexity, which use nearly everything before them.
Is discrete mathematics the same as the maths of computer science?
Largely. Data structures are graphs and trees, correctness arguments are induction, running times are recurrences and sums, circuits are Boolean algebra, and what a computer can do efficiently is the subject of the last lessons. It is also ordinary mathematics in its own right.
Do I need calculus for this course?
No. School algebra is enough. A little familiarity with limits helps when comparing growth rates, and the lesson on asymptotic analysis explains the one limit fact it uses.
More in Discrete Math & Logic
Truth tablesSums and inductionProof by inductionAlgorithms and growth of functionsDirect proof, contrapositive and contradictionStrong induction and the well-ordering principleRelations: equivalence relations and partial ordersFunctions and cardinalityCounting: rules, choices and bijectionsThe pigeonhole principleSolving linear recurrence relationsGraphs: degrees, paths and connectivityTrees and spanning treesEuler and Hamilton paths