Mathematical Logic

⚡ Key Takeaways

Mathematical logic is the rigorous study of formal systems, proof, and truth using mathematical methods. Its central achievements show that any sufficiently expressive consistent formal system is incomplete (Gödel), that first-order logic is complete and compact, and that the notions of "computable" and "provable" have precise mathematical definitions. It underlies the foundations of mathematics, computer science, and the theory of computation. Pioneered by Frege, Russell, Hilbert, Gödel, Tarski, Church, and Turing (c. 1879–1940s).

💡 The Core Insight

The same symbolic strings can be viewed in two utterly different ways: as purely formal marks manipulated by mechanical rules (syntax / provability, written ⊢\vdash), or as descriptions of structures that are true or false (semantics / truth, written ⊨\models). Mathematical logic is the systematic comparison of these two perspectives. When they coincide — provable iff true in all models — we have soundness and completeness. When they diverge — true but unprovable — we have incompleteness. The entire field lives in the gap and the bridge between ⊢\vdash and ⊨\models.

Formal Statement

A logical system has three ingredients: a formal language (symbols and grammar), a deductive system (axioms and inference rules), and a semantics (interpretations giving meaning).

DefinitionFirst-Order Language

A first-order language L\mathcal{L} consists of:

  • Logical symbols: variables x,y,z,…x, y, z, \dots; connectives ¬,∧,∨,→,↔\neg, \wedge, \vee, \to, \leftrightarrow; quantifiers ∀,∃\forall, \exists; equality ==; parentheses.
  • Non-logical symbols (the signature): a set of constant symbols cic_i, function symbols fif_i (each with an arity), and relation/predicate symbols RiR_i (each with an arity).

Terms are built from variables and constants by applying function symbols. Formulas are built from atomic formulas (R(t1,…,tn)R(t_1,\dots,t_n) and t1=t2t_1 = t_2) using connectives and quantifiers. A sentence is a formula with no free variables.

DefinitionStructure and Satisfaction

An L\mathcal{L}-structure M=(M,⋅M)\mathcal{M} = (M, \cdot^{\mathcal{M}}) consists of a nonempty domain MM together with interpretations: each constant cc becomes an element cM∈Mc^{\mathcal{M}} \in M, each nn-ary function ff becomes fM:Mn→Mf^{\mathcal{M}}: M^n \to M, each nn-ary relation RR becomes RM⊆MnR^{\mathcal{M}} \subseteq M^n. The satisfaction relation M⊨φ[s]\mathcal{M} \models \varphi[s] ("M\mathcal{M} satisfies φ\varphi under variable assignment ss") is defined by recursion on formula structure (Tarski's definition of truth):

1
M⊨(φ∧ψ)[s]  ⟺  M⊨φ[s] and M⊨ψ[s]\quad \mathcal{M} \models (\varphi \wedge \psi)[s] \iff \mathcal{M}\models\varphi[s] \text{ and } \mathcal{M}\models\psi[s]

Derivation hint: connectives are interpreted by the corresponding Boolean truth-functions on the truth values of subformulas.

2
M⊨(∀x φ)[s]  ⟺  for every a∈M, M⊨φ[s(x↦a)]\quad \mathcal{M} \models (\forall x\,\varphi)[s] \iff \text{for every } a \in M,\ \mathcal{M}\models\varphi[s(x\mapsto a)]

Derivation hint: the universal quantifier ranges over the domain; s(x↦a)s(x\mapsto a) is ss modified to send xx to aa. Here Σ⊨φ\Sigma \models \varphi means every model of the set of sentences Σ\Sigma also models φ\varphi (semantic consequence), while Σ⊢φ\Sigma \vdash \varphi means there is a finite formal derivation of φ\varphi from Σ\Sigma using the axioms and inference rules (syntactic consequence).

TheoremGödel's Completeness Theorem (1929)

For first-order logic, syntactic and semantic consequence coincide:

3
Σ⊢φ⟺Σ⊨φ\quad \Sigma \vdash \varphi \quad\Longleftrightarrow\quad \Sigma \models \varphi

Derivation hint: ⇐\Leftarrow (the hard direction, completeness) is proved by Henkin's method — a consistent theory is extended to a maximal consistent set with witnesses, from which a "term model" is built whose domain is the equivalence classes of closed terms.

TheoremCompactness Theorem

A set of first-order sentences Σ\Sigma has a model if and only if every finite subset of Σ\Sigma has a model.

4
Σ satisfiable  ⟺  every finite Σ0⊆Σ is satisfiable\quad \Sigma \text{ satisfiable} \iff \text{every finite } \Sigma_0 \subseteq \Sigma \text{ is satisfiable}

Derivation hint: immediate from completeness — if Σ\Sigma were unsatisfiable, then Σ⊢⊥\Sigma \vdash \bot, but a derivation is finite, so some finite Σ0⊢⊥\Sigma_0 \vdash \bot.

TheoremGödel's First Incompleteness Theorem (1931)

Let TT be any consistent, effectively axiomatized theory that interprets a modest fragment of arithmetic (Robinson arithmetic QQ). Then there is a sentence GTG_T (the Gödel sentence) such that neither GTG_T nor ¬GT\neg G_T is provable in TT:

5
T⊬GTandT⊬¬GT,yetN⊨GT\quad T \nvdash G_T \quad\text{and}\quad T \nvdash \neg G_T, \qquad\text{yet}\qquad \mathbb{N} \models G_T

Derivation hint: via arithmetization (Gödel numbering) construct GTG_T asserting "GTG_T is not provable in TT"; if TT proved it, TT would be inconsistent; if TT proved its negation, TT would prove a false provability claim (assuming ω\omega-consistency, weakened to plain consistency by Rosser).

TheoremGödel's Second Incompleteness Theorem

For a theory TT as above, let Con(T)\mathrm{Con}(T) be the arithmetical sentence expressing the consistency of TT. Then:

6
If T is consistent, then T⊬Con(T)\quad \text{If } T \text{ is consistent, then } T \nvdash \mathrm{Con}(T)

Derivation hint: formalize the proof of the First Theorem inside TT itself; TT proves "Con(T)→GT\mathrm{Con}(T) \to G_T", so if TT proved Con(T)\mathrm{Con}(T) it would prove GTG_T, contradicting the First Theorem.

Why It Holds

ProofSketch of the First Incompleteness Theorem

1. Arithmetization (Gödel numbering). Assign to every symbol, formula, and finite sequence of formulas a distinct natural number. Syntactic properties ("is an axiom", "is a valid inference") become arithmetical properties of these numbers. 2. Representability. Because TT interprets arithmetic, every computable relation is representable in TT: there is a formula PrfT(p,x)\mathrm{Prf}_T(p, x) that is provable exactly when pp codes a TT-proof of the formula coded by xx. Define the provability predicate ProvT(x):=∃p PrfT(p,x)\mathrm{Prov}_T(x) := \exists p\,\mathrm{Prf}_T(p,x). 3. The Diagonal (Fixed-Point) Lemma. For any formula ψ(x)\psi(x) with one free variable, there is a sentence σ\sigma such that

T⊢σ↔ψ(σ),T \vdash \sigma \leftrightarrow \psi(\ulcorner\sigma\urcorner),

where σ\ulcorner\sigma\urcorner is the numeral for the Gödel number of σ\sigma. The sentence "talks about itself." 4. Construct the Gödel sentence. Apply diagonalization to ψ(x):=¬ ProvT(x)\psi(x) := \neg\,\mathrm{Prov}_T(x), obtaining GTG_T with T⊢GT↔¬ProvT(GT)T \vdash G_T \leftrightarrow \neg\mathrm{Prov}_T(\ulcorner G_T\urcorner). Thus GTG_T says "I am not provable." 5. Unprovability of GTG_T. Suppose T⊢GTT \vdash G_T. Then there is a proof, so ProvT(GT)\mathrm{Prov}_T(\ulcorner G_T\urcorner) holds and is provable, hence T⊢ProvT(GT)T \vdash \mathrm{Prov}_T(\ulcorner G_T\urcorner). But T⊢GT→¬ProvT(GT)T \vdash G_T \to \neg\mathrm{Prov}_T(\ulcorner G_T\urcorner). Together these give T⊢¬ProvT(GT)T \vdash \neg\mathrm{Prov}_T(\ulcorner G_T\urcorner) and its negation — contradiction with consistency. 6. Unprovability of ¬GT\neg G_T. Symmetric argument using ω\omega-consistency (Rosser's trick replaces this with plain consistency). ■\blacksquare

∎
mathematician · Kurt Gödel | 1906–1978

Born in Brünn (Brno), Gödel was the most consequential logician of the twentieth century. His 1929 doctoral thesis proved the completeness theorem; in 1931, aged 25, he published Über formal unentscheidbare Sätze, the incompleteness theorems that dismantled Hilbert's program of finding a complete, provably consistent foundation for all mathematics. He later proved the relative consistency of the Axiom of Choice and the Continuum Hypothesis with ZF set theory via the constructible universe LL. Emigrating to Princeton's Institute for Advanced Study, he became a close friend of Einstein. Plagued by paranoia in later life, he died of self-starvation. His work demonstrated, with mathematical certainty, the inherent limits of formal axiomatic reasoning.

Building Intuition

🧠 Intuition

Think of a formal theory as a game with tokens. The axioms are starting positions; the inference rules are legal moves; a "theorem" is any position reachable by legal play. Soundness says you can never reach a false position. Completeness (for FOL) says every valid position is reachable. Now Gödel's insight: because the rules of the game are mechanical, the game can describe itself — you can write down, inside arithmetic, a statement of the form "this very statement has no winning line." If the game could reach it, that would prove it false (it claims unreachability); if the game could reach its denial, the game proves a falsehood. So the statement is true but stranded — outside the reach of the rules. There is no contradiction, only an inherent horizon: every consistent rule-system rich enough to do arithmetic can see truths it cannot grasp. Compactness has a different flavor: it says infinitely many constraints can be satisfied as long as no finite clump of them clashes. This is the engine behind nonstandard models — e.g., a structure satisfying every true statement of arithmetic plus "there is a number bigger than 0,1,2,…0, 1, 2, \dots", yielding infinite natural numbers.

Figure
The bridge and the gap between syntax (⊢\vdash) and semantics (⊨\models)

```svg

Syntax vs. Semantics SYNTAX axioms + rules Σ ⊢ φ "φ is provable" finite derivations mechanical / formal SEMANTICS structures + truth Σ ⊨ φ "φ true in all models" possibly infinite meaning / Tarskian Soundness Completeness FOL: bridge is perfect (Completeness Thm) Arithmetic truth: gap reopens (Incompleteness)

```

Worked Examples

ExampleUsing Compactness to Build a Nonstandard Model

Given: Let Th(N)\mathrm{Th}(\mathbb{N}) be the set of all first-order sentences true in the standard natural numbers (N,+,×,<,0,1)(\mathbb{N}, +, \times, <, 0, 1). Add a new constant symbol cc and the infinite set of sentences

Σ=Th(N)∪{ c>0, c>1, c>2, … }.\Sigma = \mathrm{Th}(\mathbb{N}) \cup \{\, c > 0,\ c > 1,\ c > 2,\ \dots \,\}.

Goal: Show Σ\Sigma has a model, and describe it.

Steps: 1. Take any finite subset Σ0⊆Σ\Sigma_0 \subseteq \Sigma. It mentions only finitely many constraints c>nc > n, the largest being c>Nc > N for some NN. 2. Interpret cc as the standard number N+1N+1 in N\mathbb{N}. Then N\mathbb{N} (with this interpretation) satisfies Th(N)\mathrm{Th}(\mathbb{N}) and all of c>0,…,c>Nc > 0, \dots, c > N. So Σ0\Sigma_0 is satisfiable. 3. Since every finite subset is satisfiable, by Compactness ([4]) the whole set Σ\Sigma is satisfiable. 4. A model M⊨Σ\mathcal{M} \models \Sigma satisfies every truth of N\mathbb{N} yet contains an element cMc^{\mathcal{M}} exceeding every standard numeral.

Answer: A nonstandard model of arithmetic exists, containing "infinite" natural numbers.\boxed{\text{A nonstandard model of arithmetic exists, containing "infinite" natural numbers.}} This shows first-order logic cannot pin down N\mathbb{N} uniquely (it is not categorical).

ExampleCounting Models via Truth Tables — Propositional Satisfiability

Given: The propositional formula φ=(p→q)∧(q→r)∧(p∨r)\varphi = (p \to q) \wedge (q \to r) \wedge (p \vee r) over atoms p,q,rp, q, r.

Goal: Determine whether φ\varphi is satisfiable and count its satisfying assignments (models).

Steps: Enumerate all 23=82^3 = 8 truth assignments. Recall a→ba \to b is false only when aa is true and bb is false.

ppqqrrp→qp\to qq→rq\to rp∨rp\vee rφ\varphi
TTTTTTT
TTFTFTF
TFTFTTF
TFFFTTF
FTTTTTT
FTFTFFF
FFTTTTT
FFFTTFF

Three rows make φ\varphi true.

Answer: φ is satisfiable with exactly 3 models\boxed{\varphi \text{ is satisfiable with exactly } 3 \text{ models}} — namely (T,T,T)(T,T,T), (F,T,T)(F,T,T), (F,F,T)(F,F,T). Note all three have r=Tr = T; indeed φ⊨r\varphi \models r (one can check φ∧¬r\varphi \wedge \neg r is unsatisfiable).

Common Misconceptions

⚠️ Common mistake

"Incompleteness means mathematics is broken / arbitrary / unknowable." False. Incompleteness is a precise relative statement: a given consistent, effectively axiomatized theory TT cannot prove certain truths expressible in its language. It does not say there are absolutely unknowable mathematical facts, nor that any particular theorem of ordinary mathematics is in doubt. We can always extend TT (e.g., add GTG_T as a new axiom) — but the new system has its own, new Gödel sentence. The lesson is about formal systems, not about truth itself.

"Gödel proved you can't trust mathematics." No — Gödel's theorems are themselves theorems of mathematics, proved with complete rigor. They presuppose, not undermine, the reliability of finitary reasoning.

"Completeness and Incompleteness contradict each other." They concern different things. Completeness (FOL) is about logical validity: provable = true-in-all-models. Incompleteness is about a fixed theory TT failing to settle every sentence: there are sentences true in the standard model N\mathbb{N} but not provable from TT's axioms. Both hold simultaneously.

CounterexampleSecond-Order Logic Lacks Completeness and Compactness

The completeness ([3]) and compactness ([4]) theorems are special to first-order logic. In second-order logic (where quantifiers range over sets/relations, not just individuals), one can write a single sentence whose only model (up to isomorphism) is (N,+,×)(\mathbb{N}, +, \times) — second-order arithmetic is categorical. If second-order logic had compactness, the nonstandard-model construction above would apply, contradicting categoricity. Hence second-order logic is not compact and has no sound, complete, effective proof system. This trade-off — first-order logic's weakness in expressive power buys it completeness and compactness — is one of the deepest structural facts of the subject.

Connections

connection

Mathematical logic is the connective tissue of foundational mathematics and theoretical computer science.

  • <span class="wiki-link-missing">Set Theory</span> supplies the universe in which all of mathematics is interpreted; the ZFC axioms, the Axiom of Choice, and the Continuum Hypothesis are studied with logical tools (forcing, inner models).
  • <span class="wiki-link-missing">Computability Theory</span> and the <span class="wiki-link-missing">Church–Turing Thesis</span> make "effectively axiomatized" and "computable" precise; the unsolvability of the Halting Problem is a recursion-theoretic twin of incompleteness.
  • <span class="wiki-link-missing">Proof Theory</span> analyzes derivations as combinatorial objects (Gentzen's Sequent Calculus, cut-elimination, ordinal analysis measuring a theory's strength).
  • <span class="wiki-link-missing">Model Theory</span> studies the structures satisfying theories — compactness, Löwenheim–Skolem Theorem, elimination of quantifiers, and stability theory.
  • <a class="wiki-link" href="/wiki/cs-arch-boolean-algebra">Boolean Algebra</a> and <span class="wiki-link-missing">Lambda Calculus</span> link propositional logic and proof to algebra and programming; the <span class="wiki-link-missing">Curry–Howard Correspondence</span> identifies proofs with programs and propositions with types.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1854 — George Boole, The Laws of Thought, algebraizes propositional logic, founding Boolean Algebra.
- 1879 — Gottlob Frege's Begriffsschrift introduces quantifiers and a full formal language; the birth of modern predicate logic.
- 1889–1895 — Peano axiomatizes arithmetic; Cantor and Dedekind develop set theory and the theory of the infinite.
- 1901 — Russell's paradox ({x:x∉x}\{x : x \notin x\}) exposes a contradiction in naive set theory, triggering the foundational crisis.
- 1910–1913 — Whitehead & Russell's Principia Mathematica attempts to derive all mathematics from logic (logicism).
- 1920s — Hilbert's program seeks a complete, consistent, decidable axiomatization of mathematics, provable by finitary means.
- 1929–1931 — Gödel proves completeness (thesis) and then the two incompleteness theorems, refuting Hilbert's program in its original form.
- 1933–1936 — Tarski gives the formal semantic definition of truth; Church (lambda calculus) and Turing (Turing machines) independently define computability and prove the undecidability of the Entscheidungsproblem.
- 1938–1963 — Gödel proves Con(ZF)→Con(ZFC+CH)\mathrm{Con}(ZF)\to\mathrm{Con}(ZFC + CH) via LL; Cohen invents forcing (1963) to prove the independence of CH and AC, completing the picture that CH is undecidable in ZFC.

Subtleties & Limits

open-problem

The boundary of provability remains an active frontier.

  • Concrete independence. Beyond the self-referential Gödel sentence, are there natural, mathematically interesting statements independent of strong theories? Yes — the Paris–Harrington theorem (a Ramsey-type statement) and Goodstein's theorem are true but unprovable in Peano Arithmetic, requiring transfinite induction up to ε0\varepsilon_0. Identifying the precise proof-theoretic strength (ordinal analysis) of strong theories like full second-order arithmetic and ZF is open.
  • The Continuum Hypothesis. Shown undecidable in ZFC (Gödel + Cohen). Whether there is a correct answer — and what new axioms (large cardinals, forcing axioms, Woodin's Ω\Omega-logic) might settle it — is a deep open philosophical and mathematical question.
  • P\mathbf{P} vs NP\mathbf{NP}. Whether there is a tractable algorithm for satisfiability is the central open problem of computer science, with logical content (descriptive complexity characterizes complexity classes by logical expressibility).
  • Reverse mathematics asks which axioms are necessary to prove ordinary theorems, calibrating them against a hierarchy of subsystems of second-order arithmetic — a program far from complete.

See Also

Gödel's Incompleteness Theorems · Model Theory · Proof Theory · Computability Theory · Set Theory · Propositional Logic · First-Order Logic · Compactness Theorem · Löwenheim–Skolem Theorem · Church–Turing Thesis · Curry–Howard Correspondence · Halting Problem