The compactness theorem
Statement
Let \(L\) be a first-order language and let \(T\) be a set of \(L\)-sentences. Then \(T\) is satisfiable (i.e. there exists an \(L\)-structure \(\mathcal{M}\) with \(\mathcal{M}\models\varphi\) for every \(\varphi\in T\)) if and only if every finite subset \(T_0\subseteq T\) is satisfiable. Equivalently, in contrapositive form: if \(T\) is unsatisfiable then some finite \(T_0\subseteq T\) is already unsatisfiable.
Why it matters
The compactness theorem converts a question about a possibly infinite set of first-order constraints into a question about finite fragments of it. This single fact underlies almost all existence proofs in model theory: constructing nonstandard models of arithmetic and analysis, proving the existence of models of arbitrary infinite cardinality (Löwenheim–Skolem), and showing that many natural classes of structures — finite groups, well-orderings, connected graphs — are not axiomatizable by any set of first-order sentences.
Its power is almost paradoxical: it says that first-order logic, despite quantifying over potentially infinite domains, is controlled entirely by finite information, because a proof of a contradiction (like any formal proof) can only ever use finitely many premises.
Hypotheses
Proof
Result
Reading. An infinite list of first-order requirements can be jointly met by some single structure exactly when every finite sub-list can be met (possibly by different structures for different sub-lists) — satisfiability is a "finite character" property.
Scope. Applies to any set of sentences in any first-order language (arbitrary cardinality of the signature and of \(T\) itself). It does not apply to second-order logic with full semantics, nor to infinitary logics such as \(L_{\omega_1,\omega}\) or \(L_{\infty,\omega}\), nor to logics with generalized quantifiers like "there exist uncountably many" that break finitary proof theory.
Corollaries & converses
- The direction "\(T\) satisfiable \(\Rightarrow\) every finite subset satisfiable" is itself already the converse of the substantive half of the theorem, and it is the trivial half (Step 1) — so compactness is genuinely a biconditional with one easy and one deep direction, not a one-way implication awaiting a converse.
- Upward Löwenheim–Skolem: if \(T\) has an infinite model, it has models of every infinite cardinality \(\ge|L|\); proved by adding \(\kappa\)-many fresh constants with pairwise-distinctness axioms and applying compactness (finite subsets only mention finitely many new constants, satisfiable in the original infinite model).
- Nonstandard models of \(\mathrm{Th}(\mathbb{N})\), \(\mathrm{Th}(\mathbb{R})\) (hyperreals), and any theory with an infinite model exist, by adjoining a constant declared larger than every numeral/standard element.
- Compactness for propositional logic is the analogous statement for a (possibly infinite) set of propositional formulas and is proved the same way (or directly via König's Lemma on finitely-branching trees of partial truth assignments); first-order compactness as proved above reduces to it via the completeness theorem, but a direct semantic (ultrafilter/ultraproduct) proof of first-order compactness exists too and does not route through provability at all.
- Compactness is strictly weaker than the full Axiom of Choice: it is equivalent to the Boolean Prime Ideal Theorem (equivalently, the existence of nonprincipal ultrafilters), a strictly weaker choice principle.
Fails without
- Dropping first-order restriction (infinitary logic \(L_{\omega_1,\omega}\)): as in the Hypotheses box, \(T=\{\exists x_1\cdots\exists x_n\bigwedge_{i\lt j}x_i\ne x_j : n\in\mathbb{N}\}\cup\{\varphi_{\mathrm{fin}}\}\) has every finite subset satisfiable but \(T\) itself is not, since it demands the domain be both infinite (arbitrarily many elements) and finite (\(\varphi_{\mathrm{fin}}\)).
- Dropping classical/finitary proof theory (full second-order logic): \(T=\mathrm{PA}_2\cup\{c\ne \underline{n} : n\in\mathbb{N}\}\) has every finite subset satisfiable (interpret \(c\) as a large enough standard numeral) but \(T\) is unsatisfiable, because categoricity of \(\mathrm{PA}_2\) leaves no room for a nonstandard witness for \(c\).
- Dropping "finite" in "every finite subset satisfiable" and asking about arbitrary infinite subsets instead: trivial degeneracy — if we only demanded that some fixed infinite \(T_1\subsetneq T\) be satisfiable, this says nothing about \(T\setminus T_1\), so \(T\) can certainly still be unsatisfiable (e.g. \(T=T_1\cup\{\lnot\psi\}\) for \(\psi\in T_1\)); the theorem specifically needs the "finite" quantifier to range over all finite subsets, which is what makes syntactic derivations (finite by nature) the right tool.
Common errors
- Believing compactness gives a single uniform bound "\(n\)" such that satisfiability of the first \(n\) sentences implies satisfiability of all of \(T\); in fact the theorem only guarantees that each finite subset is separately satisfiable, possibly by wildly different structures, and existence of a single common model for all of \(T\) is exactly the (nontrivial) conclusion, not an intermediate bound.
- Assuming the models witnessing finite subsets converge or embed into the eventual model of \(T\); the proof (via completeness/consistency, or via ultraproducts) generally produces the model of \(T\) abstractly, with no direct structural relationship to the finite-subset models.
- Applying compactness to conclude a property is first-order axiomatizable, when the correct use is the reverse: compactness is used to show classes are not axiomatizable (finiteness, connectedness, well-foundedness) by exhibiting a theory whose finite subsets are satisfiable but which forces a structure with none of the target property.
- Forgetting the hypothesis that \(T\) consists of sentences (no free variables) and conflating "\(T\) is satisfiable" with "\(T\) is satisfiable by every assignment", which silently changes the semantics being compactified.
- Trying to prove compactness "directly" by taking a limit or union of the finite-subset models; there is in general no way to form such a union (different finite-subset models can have incompatible domains), which is precisely why the proof must go through an indirect device (provability, or an ultrafilter/ultraproduct).
Discussion
The compactness theorem is named by analogy with topological compactness: give \(2^{L}\) (or the Stone space of complete theories) a suitable topology in which basic open sets correspond to single sentences, and satisfiability of \(T\) corresponds to a family of closed sets having the finite intersection property; the theorem is then literally the statement that this space is compact. This is not just decoration — the standard alternative proof of compactness constructs an ultrafilter \(U\) on the index set of finite subtheories (or, in the ultraproduct formulation, takes an ultraproduct \(\prod_{T_0} \mathcal{M}_{T_0}/U\) of the witnessing finite-subset models) and shows via Łoś's Theorem that the resulting structure models all of \(T\).
Historically the result is due to Gödel (1930, as a corollary of his completeness theorem for countable languages) with the uncountable case established by Anatoly Mal'tsev (1936); Alfred Tarski coined "compactness" and connected it explicitly to the topological picture in the 1950s. The theorem became one of the two pillars (with Löwenheim–Skolem) on which classical model theory of the 1950s–60s was built.
The theorem's chief service is negative: it is the standard tool for proving non-definability results. To show a class \(K\) of structures is not axiomatizable by any first-order theory, one exhibits sentences \(\theta_n\) true throughout \(K\) but forming, together with a further sentence, a theory whose finite parts are satisfiable in \(K\)-structures while the whole forces something outside \(K\) (e.g. an infinite element, an infinite path, a nonstandard integer). This is the source of the classical results that "finite", "well-ordered", "connected", and "torsion" are not first-order expressible.
A subtlety worth flagging: because the syntactic proof above routes through Gödel's completeness theorem, and completeness itself is usually proved (via the Henkin construction) without presupposing compactness, there is no circularity — but one should not casually assume completeness "is" compactness in disguise; they coincide in strength only via this specific pair of implications, and the semantic (ultraproduct) proof of compactness is fully independent of any proof calculus, giving a genuinely different route to the same fact and clarifying that compactness is fundamentally a fact about ultrafilters, not about provability.
Worked examples
Problems
- Show that the class of finite \(L\)-structures (for \(L=\varnothing\), say) is not axiomatizable by any set of first-order sentences: there is no set \(\Sigma\) such that "\(\mathcal{M}\models\Sigma\)" is equivalent to "\(\mathcal{M}\) is finite".
Solution
Suppose toward contradiction such \(\Sigma\) exists. Let \(T=\Sigma\cup\{\theta_n : n\ge 2\}\), where \(\theta_n\) says "there exist \(n\) pairwise distinct elements" (a first-order sentence: \(\exists x_1\cdots\exists x_n\bigwedge_{i\lt j}x_i\ne x_j\)). Every finite subset of \(T\) mentions only finitely many \(\theta_n\), say up to \(\theta_N\); any finite structure with \(\ge N\) elements models \(\Sigma\) (it's finite) and this finite subset. So every finite subset of \(T\) is satisfiable. By Compactness, \(T\) has a model \(\mathcal{M}\). But \(\mathcal{M}\models\Sigma\) means \(\mathcal{M}\) is finite, while \(\mathcal{M}\models\theta_n\) for all \(n\) means \(\mathcal{M}\) has at least \(n\) elements for every \(n\), i.e. \(\mathcal{M}\) is infinite. Contradiction. So no such \(\Sigma\) exists. - Let \(L=\{E\}\) with \(E\) a binary relation symbol (graph edge relation). Show "\(G\) is connected" is not expressible by any first-order theory, i.e. there is no \(\Sigma\) such that \(\mathcal{M}\models\Sigma \iff \mathcal{M}\) is a connected graph.
Solution
Suppose \(\Sigma\) works. Add two new constants \(a,b\) and let \(\delta_n\) say "there is no path of length \(\le n\) from \(a\) to \(b\)" (expressible: \(\lnot\bigvee_{m\le n}\exists x_1\cdots x_{m-1}(E(a,x_1)\land E(x_1,x_2)\land\cdots\land E(x_{m-1},b))\), a finite first-order sentence for each fixed \(n\)). Let \(T=\Sigma\cup\{\delta_n : n\in\mathbb{N}\}\). A finite subset of \(T\) only involves \(\delta_n\) for \(n\le N\); take a long path graph (a "ray" of length \(\gt N\)) with \(a,b\) at the two ends more than \(N\) apart — this is connected (models \(\Sigma\)) and satisfies \(\delta_n\) for \(n\le N\). So finite subsets of \(T\) are satisfiable, and by Compactness \(T\) has a model \(\mathcal{M}\). Then \(\mathcal{M}\models\Sigma\) so \(\mathcal{M}\) is connected, meaning some finite path connects \(a^{\mathcal M}\) and \(b^{\mathcal M}\), yet \(\mathcal{M}\models\delta_n\) for every \(n\) says no path of any finite length connects them — contradiction. So connectivity is not first-order axiomatizable. - Prove the Upward Löwenheim–Skolem theorem using compactness: if \(T\) has an infinite model and \(\kappa\ge|L|\) is an infinite cardinal, then \(T\) has a model of cardinality exactly \(\kappa\).
Solution
Add a set \(C=\{c_\alpha : \alpha\lt\kappa\}\) of \(\kappa\)-many new constant symbols and let \(T'=T\cup\{c_\alpha\ne c_\beta : \alpha\ne\beta\lt\kappa\}\). Any finite subset \(T_0'\subseteq T'\) mentions only finitely many of the new inequalities, say among \(c_{\alpha_1},\dots,c_{\alpha_m}\); since \(T\) has an infinite model \(\mathcal{M}\), pick \(m\) distinct elements of \(\mathcal{M}\) to interpret \(c_{\alpha_1},\dots,c_{\alpha_m}\) (possible as \(\mathcal M\) is infinite) and interpret the rest of \(C\) arbitrarily; this expanded structure models \(T_0'\). So every finite subset of \(T'\) is satisfiable, and by Compactness \(T'\) has a model \(\mathcal{N}\), which has \(\ge\kappa\) elements (the interpretations of the \(c_\alpha\) are pairwise distinct) and models \(T\) (as \(T\subseteq T'\)). If \(|\mathcal N|\gt\kappa\), pass to an elementary substructure of size \(\kappa\) containing the \(c_\alpha^{\mathcal N}\) via the (downward) Löwenheim–Skolem theorem, using \(\kappa\ge|L|\) to have room for the required Skolem witnesses; this substructure still has exactly \(\kappa\) elements and models \(T\). - Use compactness to construct a nonstandard, non-Archimedean ordered field extending \(\mathbb{R}\) with an infinitesimal element (the starting point of nonstandard analysis).
Solution
Let \(L\) be the language of ordered rings expanded with a constant \(\underline r\) for every \(r\in\mathbb{R}\) (so \(\mathbb{R}\) is an \(L\)-structure with obvious interpretations), let \(\mathrm{Th}(\mathbb{R})\) be the set of all \(L\)-sentences true in this structure, add a new constant \(\varepsilon\), and set \(T=\mathrm{Th}(\mathbb{R})\cup\{0\lt\varepsilon\lt\underline r : r\in\mathbb{R}, r\gt0\}\). Any finite subset only restricts \(\varepsilon\) below finitely many positive reals \(r_1,\dots,r_m\); interpreting \(\varepsilon\) as \(\min(r_1,\dots,r_m)/2\) inside \(\mathbb{R}\) itself satisfies that finite subset together with \(\mathrm{Th}(\mathbb{R})\). By Compactness, \(T\) has a model \({}^*\mathbb{R}\). Since \({}^*\mathbb{R}\models\mathrm{Th}(\mathbb{R})\), it is an ordered field elementarily equivalent to \(\mathbb{R}\) (so inherits every first-order property of \(\mathbb{R}\), e.g. the intermediate value theorem for definable functions), yet \(\varepsilon^{{}^*\mathbb{R}}\) is positive and smaller than every standard positive real, i.e. an infinitesimal — so \({}^*\mathbb{R}\) is non-Archimedean and \({}^*\mathbb{R}\ne\mathbb{R}\). - (Harder.) Prove the propositional compactness theorem directly via König's Lemma (every finitely branching infinite tree has an infinite branch), for a countable set of propositional variables \(\{p_n : n\in\mathbb{N}\}\) and a set \(\Sigma\) of propositional formulas such that every finite subset is satisfiable. Then explain why this gives an independent proof not relying on Gödel's completeness theorem.
Solution
Build a tree \(\mathcal{T}\) whose level-\(n\) nodes are the truth assignments to \(p_1,\dots,p_n\) (functions \(\{1,\dots,n\}\to\{0,1\}\)) that satisfy every formula of \(\Sigma\) mentioning only \(p_1,\dots,p_n\), with the tree order given by extension of assignments. Each node has at most \(2\) children (extend by \(p_{n+1}=0\) or \(1\)), so \(\mathcal T\) is finitely branching. Level \(n\) is nonempty: the finite subset of \(\Sigma\) mentioning only \(p_1,\ldots,p_n\) is satisfiable by hypothesis, and any satisfying assignment restricted to \(\{p_1,\dots,p_n\}\) gives a node at level \(n\) — actually more carefully, one shows by induction that every level is nonempty, using that a satisfying assignment for the (finite) set of \(\Sigma\)-formulas mentioning only \(p_1,\ldots,p_n\) extends the previous level's assignment for such formulas restricted to \(n-1\) variables. Since \(\mathcal T\) is finitely branching and has nodes at every level, it is infinite, so by König's Lemma \(\mathcal T\) has an infinite branch \(b\), which defines a full assignment \(v:\{p_n\}\to\{0,1\}\). Any \(\varphi\in\Sigma\) mentions finitely many variables, say up to \(p_N\); the level-\(N\) node on \(b\) already satisfies every formula of \(\Sigma\) mentioning only \(p_1,\dots,p_N\), including \(\varphi\), and \(v\) agrees with that node on \(p_1,\dots,p_N\), so \(v\models\varphi\). Hence \(v\models\Sigma\). This proof uses only König's Lemma (itself a compactness-flavoured combinatorial fact about trees, provable directly by König's original "always choose a branch with infinitely many descendants" argument, which needs only countable choice) and never mentions provability or a proof calculus, so it is genuinely independent of Gödel's completeness theorem — giving a second, purely combinatorial/semantic route to compactness (which generalizes to the ultrafilter/ultraproduct proof for uncountable languages).