first order logic
Predicate Logic
You should know: propositional logic
Overview
Predicate logic (also called first-order logic, predicate calculus, or quantificational logic) is a formal system used across mathematics, philosophy, linguistics, and computer science. Unlike propositional logic, which treats statements like 'all humans are mortal' as indivisible units, predicate logic looks inside them: it introduces variables, predicates, and quantifiers, so the same statement becomes 'for all x, if x is a human, then x is mortal' — where 'for all x' is a quantifier, x is a variable, and 'is a human' / 'is mortal' are predicates. This extra structure makes predicate logic strictly more expressive than propositional logic, while still building on its connectives.
Intuition
Propositional logic can only say 'Socrates is mortal' as one blob of true/false — it can't express 'everyone like Socrates is mortal' without a new blob for every person. Predicate logic fixes this by introducing variables (x, y, ...) and predicates (functions like Human(x) or Mortal(x)) that take those variables as arguments, plus two quantifiers: ∀ ('for all') and ∃ ('there exists'). Now one formula, ∀x(Human(x) → Mortal(x)), captures the general claim, and you can plug in any specific object for x to get a specific instance.
Formal Definition
A first-order language consists of variables, predicate symbols, function symbols, constants, the propositional connectives, and the two quantifiers ∀ (universal) and ∃ (existential). ∀x P(x) asserts P(x) holds for every object x in the domain of discourse; ∃x P(x) asserts P(x) holds for at least one x. The quantifiers are dual to each other through negation.
Notation
| Notation | Meaning |
|---|---|
| Universal quantifier — 'for all x' | |
| Existential quantifier — 'there exists an x such that' | |
| A predicate — a property that x may or may not satisfy | |
| Unique existential quantifier — 'there exists exactly one x such that' | |
| Equality between two terms, usually built into first-order logic |
Properties
Quantifier negation duality
Quantifier commutativity (same kind)
Non-commutativity across kinds
Condition: The converse implication does not hold in general
Distribution of ∀ over ∧
Applications
Worked Examples
For every integer x, there exists some y that is its successor.
Answer: ∀x (Int(x) → ∃y Succ(x,y))
Practice Problems
Negate ∃x P(x) using quantifier duality.
Which statement is generally NOT equivalent to the other order of quantifiers ∃x∀y P(x,y)?
A database query 'return every student who has taken ALL required courses' uses which quantifier structure, and how do you negate 'the student took all required courses'?
Common Mistakes
Freely swapping ∀ and ∃ when they appear in sequence, e.g. treating ∃x∀y P(x,y) as equivalent to ∀y∃x P(x,y).
∃x∀y P(x,y) → ∀y∃x P(x,y) is valid, but the reverse implication is not. Example: P(x,y) = 'x < y' over integers: ∀y∃x(x<y) is true (always a smaller number), but ∃x∀y(x<y) is false (no smallest integer).
Forgetting to flip the quantifier when negating.
Negation flips ∀ to ∃ and vice versa: ¬∀x P(x) ⟺ ∃x ¬P(x), not ∀x ¬P(x).
Quiz
Summary
- Predicate logic extends propositional logic with variables, predicates, and quantifiers (∀, ∃).
- ∀x P(x) means P holds for every x in the domain; ∃x P(x) means P holds for at least one x.
- Negating a quantifier flips it: ¬∀x P(x) ⟺ ∃x ¬P(x), and ¬∃x P(x) ⟺ ∀x ¬P(x).
- Quantifiers of the same kind commute; mixed quantifiers (∃∀ vs ∀∃) generally do not.
- Predicate logic underlies databases, program verification, and automated reasoning systems.
References
- BookEnderton, H. A Mathematical Introduction to Logic, 2nd ed., Ch. 2.
Mathematics