Compactness Theorem (FOL)

lean4-proofset-theory-logicvisualization
T satisfiable    T0finT, T0 satisfiableT \text{ satisfiable} \iff \forall T_0 \subseteq_\text{fin} T,\ T_0 \text{ satisfiable}

Statement

Let LL be a first-order language and TT an LL-theory (a set of LL-sentences). Then:

T is satisfiable    every finite T0T is satisfiableT \text{ is satisfiable} \iff \text{every finite } T_0 \subseteq T \text{ is satisfiable}

Visualization

Define Φn\Phi_n = "there exist at least nn distinct elements" (for each n1n \ge 1):

Φn  =  x1xnij¬(xi=xj)\Phi_n \;=\; \exists x_1 \cdots \exists x_n \bigwedge_{i \neq j} \neg(x_i = x_j)

Consider T={Φ1,Φ2,Φ3,}T = \{\Phi_1, \Phi_2, \Phi_3, \ldots\}.

Finite subset       Satisfying model
-----------         ---------------
{Φ₁}               Any nonempty set, e.g. {a}
{Φ₁, Φ₂}           Any set with ≥ 2 elements, e.g. {a, b}
{Φ₁, Φ₂, Φ₃}       Any set with ≥ 3 elements, e.g. {a, b, c}
{Φ₁, …, Φ_n}       Any set with ≥ n elements

Every finite subset {Φ1,,Φn}\{Φ_1, \ldots, \Phi_n\} is satisfied by a set of size nn. By compactness, the full theory TT is satisfiable — and any model must be infinite. This gives a purely logical proof that "infinite" is not first-order definable by a finite set of axioms.

Proof Sketch

The Mathlib proof uses an ultraproduct construction:

  1. For each finite T0TT_0 \subseteq T, let MT0M_{T_0} be a model of T0T_0.
  2. Form the product T0MT0\prod_{T_0} M_{T_0} and choose a non-principal ultrafilter U\mathcal{U} on the directed set of finite subsets.
  3. The ultraproduct T0MT0/U\prod_{T_0} M_{T_0} / \mathcal{U} satisfies every sentence ϕT\phi \in T: for ϕT\phi \in T, all large enough T0T_0 contain ϕ\phi, so almost-all MT0M_{T_0} satisfy ϕ\phi, so the ultraproduct does by Łoś's theorem.

Connections

Compactness is one of the two central meta-theorems of first-order logic (the other is Gödel's Completeness TheoremGödel's Completeness TheoremTϕ    TϕT \vdash \phi \iff T \models \phiA first-order sentence is provable from a theory iff it holds in every model of that theory.Read more →). Together they entail that syntactic provability and semantic truth coincide. The Löwenheim–Skolem TheoremLöwenheim–Skolem Theoremκmax(L,0)     model of size κ\kappa \ge \max(|L|, \aleph_0) \implies \exists \text{ model of size } \kappaA first-order theory with an infinite model has models of every infinite cardinality.Read more → is a standard corollary: a theory with an infinite model has models of every infinite cardinality.

Lean4 Proof

import Mathlib.ModelTheory.Satisfiability

open FirstOrder Language Theory

/-- The Compactness Theorem: a first-order theory is satisfiable iff finitely satisfiable.
    Mathlib: `FirstOrder.Language.Theory.isSatisfiable_iff_isFinitelySatisfiable`. -/
theorem fol_compactness {L : Language} {T : L.Theory} :
    T.IsSatisfiable  T.IsFinitelySatisfiable :=
  isSatisfiable_iff_isFinitelySatisfiable