Logic, Sets and Infinity

Predicate Logic and How It Extends Propositional Logic

Understand predicates, variables and quantifiers, why order matters, and what first-order logic can and cannot express or decide.

Key takeaways

  • A predicate is a property or relation with blanks in it, and it becomes true or false once the blanks are filled or quantified.
  • The universal quantifier ∀ means "for all" and the existential quantifier ∃ means "there exists at least one".
  • Swapping the order of different quantifiers can turn a true statement into a false one.
  • First-order logic has a complete proof system, but no algorithm can decide validity for all of its formulas.

Predicate logic opens up the simple statements that propositional logic treats as sealed boxes. It names the objects being talked about, the properties and relations they have, and how many of them you mean, using "for all" and "there exists".

That extra detail is what you need to write down almost any mathematical statement precisely. It also changes what can be checked mechanically.

The argument propositional logic misses

Consider a classic pattern. Every human is mortal. Socrates is human. Therefore Socrates is mortal.

In propositional logic these are three unrelated letters P, Q and R. A truth table has a row with P and Q true and R false, so the argument looks invalid. The connection runs through the shared words "human", "mortal" and "Socrates", which propositional letters cannot see.

Predicate logic writes it like this, with H(x) for "x is human", M(x) for "x is mortal" and s for Socrates.

∀x (H(x) → M(x))     premise: every human is mortal
H(s)                 premise: Socrates is human
H(s) → M(s)          apply the first line to s
M(s)                 modus ponens

The new pieces of the language

  • Constants name particular objects, such as 0, 2 or s.
  • Variables such as x and y stand for unspecified objects.
  • Function symbols build new names from old ones, as in x + y or "the successor of x".
  • Predicates say something about objects. P(x) might mean "x is prime". R(x, y) might mean "x is less than y".
  • Quantifiers say how widely a claim applies.

Every formula is read against a domain of discourse, the collection of objects the variables range over. The sentence ∃x (x + 5 = 2) is false if the domain is the natural numbers (with or without 0) and true if it is the integers, because x = −3 works.

A variable that is governed by a quantifier is bound. One that is not is free. The formula ∃y (y² = x) has x free and y bound. It describes a property of x. Only formulas with no free variables, called sentences, have a truth value once the symbols are interpreted.

The two quantifiers

The universal quantifier ∀x P(x) says that P holds for every object in the domain. The existential quantifier ∃x P(x) says it holds for at least one. For a gentle treatment of both, see quantifiers in plain English.

Two pairings come up constantly.

  • "All A are B" is ∀x (A(x) → B(x)).
  • "Some A are B" is ∃x (A(x) ∧ B(x)).

Mixing these up is the most common beginner error. The formula ∀x (A(x) ∧ B(x)) claims that everything in the domain is both. The formula ∃x (A(x) → B(x)) is nearly always true for a silly reason: any object that is not an A makes the conditional true.

Negation swaps the quantifiers. ¬∀x P(x) is equivalent to ∃x ¬P(x), and ¬∃x P(x) is equivalent to ∀x ¬P(x). These are the quantified cousins of De Morgan's laws.

Why quantifier order matters

Take the domain of integers and the relation x < y.

Formula Reading Truth in the integers
∀x ∃y (x < y) every integer has some larger one true: take y = x + 1
∃y ∀x (x < y) some integer is larger than every integer false: x = y is not less than y

The symbols are the same; only the order changed. In the first, y is chosen after x and may depend on it. In the second, one y must be fixed in advance and work for all x at once.

You can picture a game. For each ∀ a skeptic picks the value, for each ∃ you pick it, and the turns go from left to right. The sentence is true when you have a strategy that always wins.

Same symbols, different order
For all x, some y: x < y Skeptic picks x first You answer with y = x + 1 True in the integers Some y, for all x: x < y You must pick y first Skeptic answers with x = y False in the integers VS For all x, some y: x < y Skeptic picks x first You answer with y = x + 1 True in the integers Some y, for all x: x < y You must pick y first Skeptic answers with x = y False in the integers

The definition of a limit relies on exactly this: for every ε > 0 there exists δ > 0 such that a condition holds for all x. Epsilon arguments are largely exercises in respecting that order.

Interpretations and logical truth

In propositional logic an interpretation is just a row of a truth table. In predicate logic an interpretation, also called a structure, must supply a domain and a meaning for each constant, function symbol and predicate.

A sentence is logically valid if it is true in every structure. For example, ∃y ∀x R(x, y) → ∀x ∃y R(x, y) is valid whatever R means. The reverse implication is not valid, as the integer example shows.

To show that something is not valid, you need only one structure where it fails. A tiny domain often does the job. With two objects a and b, let R relate each object only to itself. Then ∀x ∃y R(x, y) is true, but no single y is related to both, so ∃y ∀x R(x, y) is false.

Since there are infinitely many structures, you cannot check them all in a table. You need proofs.

First-order and higher-order logic

The usual system is called first-order logic because the quantifiers range over objects only. Second-order logic also lets you quantify over properties or sets of objects, as in "every nonempty set of natural numbers has a least element".

Second-order logic can say more, and with the standard meaning of its quantifiers it can pin down the natural numbers up to a change of names. The price is that no effective proof system can derive all of its logical truths.

First-order logic behaves better. Its completeness theorem, proved by Kurt Gödel, says that every logically valid first-order sentence has a formal proof. This is a different result from the famous incompleteness theorems, which concern what particular axiom systems about arithmetic can prove.

The same good behavior means first-order axioms often fail to describe a unique structure. Any such axioms for the natural numbers also have unusual models containing extra elements, a theme of model theory.

What can be decided

Truth tables decide propositional validity every time. Nothing comparable exists for full first-order logic. Alonzo Church and Alan Turing showed independently in the 1930s that no algorithm can take an arbitrary first-order sentence and always correctly answer whether it is valid.

There is a one-sided method: a program can search through all possible proofs, so if a sentence is valid the search eventually finds a proof. If it is not valid, the search may run forever. Some restricted fragments are decidable, such as formulas using only predicates with a single blank. For how these notions differ, see consistency, completeness and decidability.

Writing mathematics with it

Here are three definitions written fully, with the natural numbers 1, 2, 3 and so on as the domain.

Even(n):        ∃k (n = 2·k)
Divides(a, b):  ∃k (b = a·k)
Prime(p):   p > 1 ∧ ∀d (Divides(d, p) → (d = 1 ∨ d = p))

Test the last one on 6. The number 2 divides 6 and equals neither 1 nor 6, so the conditional fails for d = 2 and 6 is not prime. Test it on 7: the only divisors are 1 and 7, so every d passes. The condition p > 1 keeps 1 out.

Most of set theory is written this way, using a single two-place predicate, "is a member of". That is the language of the Zermelo-Fraenkel axioms.

Saying "how many"

The two quantifiers, together with the equality sign =, can express exact counts. To say there are at least two objects with property P, you must insist that the two are different.

at least two:   ∃x ∃y (P(x) ∧ P(y) ∧ x ≠ y)
at most one:    ∀x ∀y ((P(x) ∧ P(y)) → x = y)
exactly one:    ∃x (P(x) ∧ ∀y (P(y) → y = x))

Without the clause x ≠ y, the first line would be satisfied by a single object counted twice, since different variables are allowed to name the same thing.

"Exactly one" is often abbreviated ∃!x P(x). Proving such a claim has two halves, existence and uniqueness. Over the integers, ∃!x (x + 3 = 5) is true, with x = 2. The statement ∃!x (x² = 4) is false, because both 2 and −2 work.

Some counting ideas do not fit. No single first-order sentence, or even collection of sentences, can say "there are only finitely many objects" without also fixing an upper limit on their number.

Habits that prevent errors

  1. State the domain before you interpret anything.
  2. Give each quantifier its own variable name, even when reuse would be legal.
  3. Read the quantifiers aloud from left to right and ask who chooses each value.
  4. After translating from English, test the formula on a small domain where you know the answer.

Written for 4Mathematics with AI writing tools and not reviewed line by line by a person. Check anything you rely on against a textbook or primary source. Report an error.

Keep reading

All 41 articles in Logic, Sets and Infinity →

Latest news on this topic