Beta. Content is under active construction and has not been peer-reviewed. Report errors on GitHub.Disclaimer

Foundations

Model Theory Basics

Model theory separates syntax (formulas, proofs) from semantics (structures, truth). Soundness: provable implies true. Completeness: true in all models implies provable. Compactness and Lowenheim-Skolem reveal that first-order logic cannot pin down infinite structures uniquely.

AdvancedTier 3Stable~50 min
0

Why This Matters

Model theory makes precise the distinction between what you can say and what is true. A formula is a syntactic object; a structure (model) is a mathematical object. A formula is true in a structure if the structure satisfies it. A formula is provable if it can be derived from axioms using inference rules.

These are different concepts, and understanding their relationship is the subject of model theory. The two central results are soundness (provable implies true in all models) and completeness (true in all models implies provable, for first-order logic). The compactness and Lowenheim-Skolem theorems reveal surprising limitations of first-order logic: you cannot use first-order sentences to uniquely characterize the natural numbers or to distinguish countable from uncountable structures.

This discipline trains a habit that matters throughout mathematics and ML: always distinguish the representation (your formula, your model class, your loss function) from the thing it represents (the underlying mathematical structure, the true data distribution).

Core Definitions

Definition

First-Order Language

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

  • Constant symbols: c1,c2,c_1, c_2, \ldots (names for specific elements)
  • Function symbols: f1,f2,f_1, f_2, \ldots (each with a fixed arity)
  • Relation symbols: R1,R2,R_1, R_2, \ldots (each with a fixed arity)
  • Logical symbols: ,,¬,,,,=\land, \lor, \neg, \to, \forall, \exists, =
  • Variables: x1,x2,x_1, x_2, \ldots

Formulas are built from atomic formulas (R(t1,,tn)R(t_1, \ldots, t_n) and t1=t2t_1 = t_2) using logical connectives and quantifiers.

Definition

Structure (Model)

An L\mathcal{L}-structure M\mathcal{M} consists of:

  • A nonempty set MM called the domain (or universe)
  • For each constant symbol cc, an element cMMc^\mathcal{M} \in M
  • For each nn-ary function symbol ff, a function fM:MnMf^\mathcal{M}: M^n \to M
  • For each nn-ary relation symbol RR, a relation RMMnR^\mathcal{M} \subseteq M^n

A structure gives meaning to the symbols in the language.

Definition

Satisfaction

A structure M\mathcal{M} satisfies (or models) a sentence ϕ\phi, written Mϕ\mathcal{M} \models \phi, if ϕ\phi is true when interpreted in M\mathcal{M}. The definition is recursive:

  • MR(a1,,an)\mathcal{M} \models R(a_1, \ldots, a_n) iff (a1,,an)RM(a_1, \ldots, a_n) \in R^\mathcal{M}
  • Mϕψ\mathcal{M} \models \phi \land \psi iff Mϕ\mathcal{M} \models \phi and Mψ\mathcal{M} \models \psi
  • Mx.ϕ(x)\mathcal{M} \models \forall x.\, \phi(x) iff for every aMa \in M, Mϕ(a)\mathcal{M} \models \phi(a)
  • And so on for other connectives and quantifiers.
Definition

Theory

A theory TT is a set of sentences. A structure M\mathcal{M} is a model of TT if Mϕ\mathcal{M} \models \phi for every ϕT\phi \in T. A sentence ϕ\phi is a logical consequence of TT, written TϕT \models \phi, if every model of TT satisfies ϕ\phi.

Definition

Soundness and Completeness

A proof system is sound if every provable sentence is true in all models: TϕT \vdash \phi implies TϕT \models \phi. A proof system is complete if every sentence true in all models is provable: TϕT \models \phi implies TϕT \vdash \phi.

Main Theorems

Theorem

Godel's Completeness Theorem

Statement

For any first-order theory TT and sentence ϕ\phi:

Tϕ    TϕT \models \phi \iff T \vdash \phi

A first-order sentence is provable from TT if and only if it is true in every model of TT. Equivalently: a theory TT has a model if and only if it is consistent (no contradiction is derivable from TT).

Intuition

The proof system for first-order logic is strong enough to derive every semantic consequence. Nothing is "lost" by working syntactically instead of semantically. If a sentence is true in every possible interpretation of the axioms, then there is a finite proof of it.

Proof Sketch

Soundness (\vdash implies \models) is a routine induction on proof length: verify that each axiom is valid in every structure and that each inference rule preserves truth under every interpretation.

Completeness (\models implies \vdash) is the hard direction. The standard proof (Henkin's method): given a consistent theory TT, extend it to a maximally consistent theory TT^* (using Zorn's lemma or a direct construction). Add "Henkin witnesses": for each existential sentence x.ϕ(x)\exists x.\, \phi(x), add a new constant cc and the sentence ϕ(c)\phi(c). The resulting theory TT^* describes a structure directly: the domain is the set of constant terms, and the interpretation is read off from TT^*.

Why It Matters

Completeness justifies the syntactic approach to logic. You do not need to reason about all possible structures (infinitely many, of all sizes). You can instead search for a finite proof. This is the theoretical foundation of automated theorem proving: proof search is complete for first-order logic.

Note: this completeness theorem is distinct from Godel's incompleteness theorems. The completeness theorem says first-order logic is complete as a proof system. The incompleteness theorems say specific first-order theories (like arithmetic) are incomplete: they have true sentences that are not provable within the theory.

Failure Mode

Completeness fails for second-order logic: there are second-order validities that have no proof in any recursively enumerable proof system. Completeness also fails for logics with generalized quantifiers or fixed-point operators. First-order logic occupies a sweet spot: expressive enough to be useful, but weak enough that a complete proof system exists.

Theorem

Compactness Theorem

Statement

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

Equivalently: if TϕT \models \phi, then there is a finite subset T0TT_0 \subseteq T such that T0ϕT_0 \models \phi.

Intuition

Inconsistency is a finite phenomenon. If a theory is contradictory, the contradiction can be derived from finitely many axioms. You cannot create an inconsistency that requires infinitely many axioms simultaneously.

Proof Sketch

From the completeness theorem: TT is consistent iff TT has a model. If every finite subset of TT is consistent (has a model), then TT itself is consistent (because a proof of contradiction would use only finitely many axioms, contradicting the assumption). So TT has a model.

Why It Matters

Compactness has striking consequences. It implies that first-order logic cannot express "the domain is finite" or "the domain is countable." Any first-order theory with arbitrarily large finite models has an infinite model (add constants c1,c2,c_1, c_2, \ldots with axioms cicjc_i \neq c_j for all iji \neq j; every finite subset is satisfiable, so by compactness the whole set is). This is a fundamental limitation of first-order expressiveness.

Failure Mode

Compactness fails for many extensions of first-order logic. It fails for second-order logic, for first-order logic with the quantifier "there exist infinitely many," and for logics with fixed-point operators. The compactness theorem is closely tied to first-order logic specifically.

Lowenheim-Skolem Theorem

Theorem

Lowenheim-Skolem Theorem

Statement

Downward: if a first-order theory TT in a countable language has an infinite model, then it has a countable model.

Upward: if TT has an infinite model of cardinality κ\kappa, then for every λκ\lambda \geq \kappa, TT has a model of cardinality λ\lambda.

Intuition

First-order logic cannot control the size of its models. If a theory has any infinite model, it has models of every infinite cardinality. This means you cannot write a first-order theory whose only model is R\mathbb{R} (uncountable): any such theory also has countable models ("Skolem's paradox").

Proof Sketch

Downward: given a model M\mathcal{M}, start with any countable subset A0MA_0 \subseteq M. Close under all functions and Skolem functions (witnesses for existential statements). The resulting countable set A=nAnA = \bigcup_n A_n forms the domain of a countable elementary submodel.

Upward: use compactness. Add λ\lambda many new constant symbols {cα:α<λ}\{c_\alpha : \alpha < \lambda\} with axioms cαcβc_\alpha \neq c_\beta for αβ\alpha \neq \beta. Every finite subset of these axioms is satisfiable (in the given infinite model), so by compactness, the whole set is satisfiable. The model has cardinality at least λ\lambda.

Why It Matters

Lowenheim-Skolem combined with compactness shows that first-order logic has a limited ability to distinguish structures. This is a feature, not a bug: it is precisely this limitation that makes first-order logic amenable to complete proof systems and decidable fragments.

Failure Mode

The theorem does not apply to second-order logic. In second-order logic, you can characterize N\mathbb{N} uniquely (up to isomorphism) using the second-order induction axiom. But second-order logic loses completeness and compactness.

Syntax vs. Semantics: The Core Discipline

Model theory trains a specific mental habit: always distinguish what you wrote from what it means.

Syntactic sideSemantic side
Formula ϕ\phiTruth value of ϕ\phi in M\mathcal{M}
Theory TT (set of axioms)Class of models satisfying TT
Proof of ϕ\phi from TTϕ\phi true in every model of TT
Consistency of TTTT has at least one model

In ML, this distinction appears as: the loss function (syntax) vs. the generalization behavior (semantics), the hypothesis class (syntax) vs. the realizable functions (semantics), the training objective (what you optimize) vs. the actual risk (what you want to minimize).

Common Confusions

Watch Out

Completeness theorem is not the incompleteness theorem

Godel proved both, and the names are confusing. The completeness theorem says first-order logic (as a proof system) is complete: everything true in all models is provable. The incompleteness theorems say specific theories (like Peano Arithmetic) are incomplete: there exist sentences true in the standard model that are not provable from the axioms. These are compatible: the unprovable sentence of PA is true in N\mathbb{N} but not in all models of PA (there are nonstandard models where it is false).

Watch Out

Skolem's paradox is not a real paradox

ZFC proves uncountable sets exist, yet Lowenheim-Skolem says ZFC has a countable model. This is not a contradiction. Inside the countable model, the set that "is uncountable" has no bijection with N\mathbb{N} as seen from within the model. But from outside, the entire model is countable. The notion of uncountability is relative to the model. This illustrates that first-order logic cannot capture absolute cardinality.

Exercises

ExerciseCore

Problem

Give an example of a set of first-order sentences that is finitely satisfiable (every finite subset has a model) but whose only models are infinite. Explain why this does not contradict compactness.

ExerciseAdvanced

Problem

Explain why there is no first-order sentence (or set of sentences) whose models are exactly the finite structures. Use compactness.

ExerciseAdvanced

Problem

State precisely the difference between Godel's completeness theorem and Godel's first incompleteness theorem. Are they contradictory?

References

Canonical:

  • Enderton, A Mathematical Introduction to Logic (2001), Chapters 2-3
  • Marker, Model Theory: An Introduction (2002), Chapters 1-2
  • Chang & Keisler, Model Theory (3rd ed., 1990)

Accessible:

  • Hodges, A Shorter Model Theory (1997)

  • Munkres, Topology (2000), Chapter 1 (set theory review)

Next Topics

  • Proof theory and cut-elimination: the syntactic side of logic, complementary to model theory
  • SAT/SMT and automated reasoning: where these metatheorems become practical

Last reviewed: April 2026

Prerequisites

Foundations this topic depends on.