In mathematical logic, the compactness theorem states that a set of first-order sentences has a model if and only if every finite subset of it has a model. This theorem is an important tool in model theory, as it provides a useful method for constructing models of any set of sentences that is finitely consistent.
The compactness theorem for the propositional calculus is a consequence of Tychonoff's theorem (which says that the product of compact spaces is compact) applied to compact Stone spaces; hence, the theorem's name. Likewise, it is analogous to the finite intersection property characterization of compactness in topological spaces: a collection of closed sets in a compact space has a non-empty intersection if every finite subcollection has a non-empty intersection.
The compactness theorem is one of the two key properties, along with the downward Löwenheim–Skolem theorem, that is used in Lindström's theorem to characterize first-order logic. Although there are some generalizations of the compactness theorem to non-first-order logics, the compactness theorem itself does not hold in them.
Kurt Gödel proved the countable compactness theorem in 1930. Anatoly Maltsev proved the uncountable case in 1936.
The compactness theorem has many applications in model theory; a few typical results are sketched here.
The compactness theorem implies Robinson's principle: If a first-order sentence holds in every field of characteristic zero, then there exists a constant p such that the sentence holds for every field of characteristic larger than p. This can be seen as follows: suppose φ is a sentence that holds in every field of characteristic zero. Then its negation ¬φ, together with the field axioms and the infinite sequence of sentences 1+1 ≠ 0, 1+1+1 ≠ 0, …, is not satisfiable (because there is no field of characteristic 0 in which ¬φ holds, and the infinite sequence of sentences ensures any model would be a field of characteristic 0). Therefore, there is a finite subset A of these sentences that is not satisfiable. We can assume that A contains ¬φ, the field axioms, and, for some k, the first k sentences of the form 1+1+...+1 ≠ 0 (because adding more sentences doesn't change unsatisfiability). Let B contain all the sentences of A except ¬φ. Then any field with a characteristic greater than k is a model of B, and ¬φ together with B is not satisfiable. This means that φ must hold in every model of B, which means precisely that φ holds in every field of characteristic greater than k.