Skip to content
The Lumenary
First-year graduateGraduate 150 min

Model theory

Structures and the sentences true in them — and how ultraproducts, quantifier elimination and back-and-forth turn logic into a tool for algebra, geometry and number theory.

Formally verified · 12 LeanComputationally tested · 2 PythonAI-drafted · awaiting human reviewMathematically reviewed: Awaiting human review
MotivationH

One sentence, many worlds

Here is a theorem about complex polynomials:

Ax–Grothendieck. If a polynomial map f:Cn→Cnf : \C^n \to \C^n is injective, then it is surjective.

For n=1n = 1 this is easy (a non-constant polynomial in one variable takes every value). For n≥2n \ge 2 it is not at all obvious. Yet over a finite set it is trivial: an injective map from a finite set to itself is surjective, by counting. The proof we will give runs: the statement, for maps of bounded degree, is a single first-order sentence; it is true over the algebraic closure of every finite field because those are unions of finite fields; and any first-order sentence in the language of rings that is true in algebraically closed fields of every prime characteristic is true in C\C. Each step is a theorem of model theory.

Or take two familiar orders, the rationals (Q,<)(\Q, <) and the reals (R,<)(\R, <). They are not isomorphic — one is countable, the other is not — and R\R is complete while Q\Q is full of gaps. Yet no sentence of first-order logic that talks only about << can tell them apart. Model theory explains why, and turns that blindness into a powerful method.

Model theory studies the relationship between theories (sets of sentences) and their models (structures in which the sentences are true): what a theory determines about its models, which sets are definable in a structure, and how structures that satisfy the same sentences can be built and compared. This lesson assumes first-order logic and the completeness, compactness and Löwenheim–Skolem theorems.

IntuitionH

Sentences cut out classes of structures

Fix a language LL — a list of function, relation and constant symbols. For a set TT of LL-sentences and a class KK of LL-structures put

Mod(T)={ M∣M⊨φ for all φ∈T },Th(K)={ φ∣M⊨φ for all M∈K }.\mathrm{Mod}(T) = \{\, M \mid M \models \varphi \text{ for all } \varphi \in T \,\}, \qquad \mathrm{Th}(K) = \{\, \varphi \mid M \models \varphi \text{ for all } M \in K \,\}.

Both maps reverse inclusions, and K⊆Mod(T)  ⟺  T⊆Th(K)K \subseteq \mathrm{Mod}(T) \iff T \subseteq \mathrm{Th}(K): they form an antitone Galois connection. By the completeness theorem, Th(Mod(T))\mathrm{Th}(\mathrm{Mod}(T)) is exactly the set of consequences of TT. A single structure MM has a complete theory Th(M)\mathrm{Th}(M): for each sentence φ\varphi, exactly one of φ\varphi, ¬φ\neg\varphi belongs to it.

Analogy, not a formal construction

In algebraic geometry, polynomial equations cut out varieties, and a set of points determines the ideal of polynomials vanishing on it; the maps I↦V(I)I \mapsto V(I) and X↦I(X)X \mapsto I(X) form a Galois connection of exactly the same shape. Model theory's "geometry" is the study of definable sets: subsets of MnM^n of the form {aˉ∣M⊨φ(aˉ,bˉ)}\{\bar a \mid M \models \varphi(\bar a, \bar b)\}. For algebraically closed fields the analogy becomes literal — the definable sets are the constructible sets of algebraic geometry. In general it is only an analogy: definable sets need not look like varieties at all.

Three tools do most of the work in a first course:

  1. Ultraproducts average a family of structures; Łoś's theorem says a sentence holds in the average iff it holds in "most" of the factors.
  2. Quantifier elimination shows that, in a good theory, every definable set is defined without quantifiers — so definable sets can be understood concretely.
  3. Back and forth builds isomorphisms, and its finite version — Ehrenfeucht–Fraïssé games — shows exactly what first-order logic can and cannot see.
DefinitionsH

Definitions

Throughout, structures are nonempty, and aˉ\bar a denotes a finite tuple.

Definition— elementary equivalence

LL-structures MM and NN are elementarily equivalent, written M≡NM \equiv N, if they satisfy the same LL-sentences: Th(M)=Th(N)\mathrm{Th}(M) = \mathrm{Th}(N).

Definition— elementary embedding and elementary substructure

A map j:M→Nj : M \to N is an elementary embedding if for every formula φ(x1,…,xn)\varphi(x_1, \dots, x_n) and every aˉ∈Mn\bar a \in M^n,

M⊨φ(aˉ)  ⟺  N⊨φ(jaˉ).M \models \varphi(\bar a) \iff N \models \varphi(j\bar a).

If M⊆NM \subseteq N and the inclusion is elementary, MM is an elementary substructure of NN and NN an elementary extension of MM, written M⪯NM \preceq N.

Taking n=0n = 0 shows that M⪯NM \preceq N implies M≡NM \equiv N. The converse fails, and the difference is parameters: (N≥1,<)(\N_{\ge 1}, <) is a substructure of (N,<)(\N, <) isomorphic to it, hence elementarily equivalent, but the formula ∀y (x≤y)\forall y\,(x \le y) holds of x=1x = 1 in the substructure and not in N\N.

Theorem— Tarski–Vaught test

Let MM be a substructure of NN. Then M⪯NM \preceq N if and only if for every formula φ(x,yˉ)\varphi(x, \bar y) and every aˉ\bar a from MM: if N⊨∃x φ(x,aˉ)N \models \exists x\, \varphi(x, \bar a), then N⊨φ(b,aˉ)N \models \varphi(b, \bar a) for some b∈Mb \in M.

Proof

(⇒\Rightarrow) If N⊨∃x φ(x,aˉ)N \models \exists x\,\varphi(x, \bar a) then M⊨∃x φ(x,aˉ)M \models \exists x\,\varphi(x, \bar a) by elementarity; pick b∈Mb \in M with M⊨φ(b,aˉ)M \models \varphi(b, \bar a); by elementarity again N⊨φ(b,aˉ)N \models \varphi(b, \bar a).

(⇐\Leftarrow) We show M⊨ψ(aˉ)  ⟺  N⊨ψ(aˉ)M \models \psi(\bar a) \iff N \models \psi(\bar a) for all formulas ψ\psi and tuples aˉ\bar a from MM, by induction on ψ\psi (built from atomic formulas with ¬\neg, ∧\wedge, ∃\exists). Atomic formulas are preserved because MM is a substructure: terms are evaluated the same way in MM and NN. The cases ¬\neg and ∧\wedge are immediate from the induction hypothesis. If M⊨∃x φ(x,aˉ)M \models \exists x\,\varphi(x, \bar a), choose a witness b∈Mb \in M; by induction N⊨φ(b,aˉ)N \models \varphi(b, \bar a), so N⊨∃x φ(x,aˉ)N \models \exists x\,\varphi(x, \bar a). Conversely, if N⊨∃x φ(x,aˉ)N \models \exists x\, \varphi(x, \bar a), the hypothesis gives b∈Mb \in M with N⊨φ(b,aˉ)N \models \varphi(b, \bar a), and by induction M⊨φ(b,aˉ)M \models \varphi(b, \bar a).

∎

Note that the test only ever evaluates formulas in NN: it asks whether MM contains enough witnesses.

Definition— complete theory, categoricity

A consistent theory TT is complete if for every sentence φ\varphi, either T⊨φT \models \varphi or T⊨¬φT \models \neg \varphi. For an infinite cardinal κ\kappa, TT is κ\kappa-categorical if any two models of TT of cardinality κ\kappa are isomorphic.

Definition— quantifier elimination

A theory TT has quantifier elimination (QE) if every formula φ(xˉ)\varphi(\bar x) is TT-equivalent to a quantifier-free formula ψ(xˉ)\psi(\bar x) with the same free variables: T⊨∀xˉ (φ↔ψ)T \models \forall \bar x\,(\varphi \leftrightarrow \psi). (We count ⊤\top and ⊥\bot as quantifier-free, so that sentences can be equivalent to quantifier-free sentences even in a language without constants.)

Definition— ultrafilter and ultraproduct

An ultrafilter on a set II is a family UU of subsets of II with ∅∉U\emptyset \notin U, closed under finite intersections and supersets, and such that for every A⊆IA \subseteq I exactly one of AA and I∖AI \setminus A is in UU. It is principal if it consists of all sets containing a fixed i0i_0. Every family of subsets with the finite intersection property extends to an ultrafilter (by Zorn's lemma); in particular, non-principal ultrafilters on N\N exist (extend the cofinite sets).

Given LL-structures (Mi)i∈I(M_i)_{i \in I} and an ultrafilter UU on II, the ultraproduct ∏iMi/U\prod_i M_i / U is the set ∏iMi\prod_i M_i modulo f∼g  ⟺  {i∣f(i)=g(i)}∈Uf \sim g \iff \{i \mid f(i) = g(i)\} \in U, with functions and constants interpreted coordinatewise and

R([f1],…,[fn])  ⟺  { i∣Mi⊨R(f1(i),…,fn(i)) }∈U.R([f_1], \dots, [f_n]) \iff \{\, i \mid M_i \models R(f_1(i), \dots, f_n(i)) \,\} \in U .

If all Mi=MM_i = M, this is the ultrapower MI/UM^I / U, and d(a)=[i↦a]d(a) = [i \mapsto a] is the diagonal map M→MI/UM \to M^I/U.

Closure of UU under intersections and supersets makes ∼\sim an equivalence relation and makes the interpretations independent of representatives. Think of UU as deciding which sets of indices are "large": a property holds in the ultraproduct when it holds on a large set of coordinates.

Definition— types

Let MM be a structure and A⊆MA \subseteq M. A complete nn-type over AA is a set p(xˉ)p(\bar x) of formulas in nn free variables with parameters from AA that is maximal subject to p∪Th(MA)p \cup \mathrm{Th}(M_A) being satisfiable, where MAM_A is MM with names for the elements of AA. The set of these is SnM(A)S_n^M(A). A type is realised in an elementary extension N⪰MN \succeq M by bˉ\bar b if N⊨φ(bˉ)N \models \varphi(\bar b) for all φ∈p\varphi \in p.

Worked examplesH

Examples and non-examples

Example— Elementarily equivalent, not isomorphic

(Q,<)≡(R,<)(\Q, <) \equiv (\R, <), and in fact (Q,<)⪯(R,<)(\Q, <) \preceq (\R, <); both statements are proved below, from quantifier elimination for dense linear orders. They are not isomorphic, since Q\Q is countable and R\R is not. "Every bounded nonempty set has a supremum" is not first-order: it quantifies over sets.

Example— Distinguished by one sentence

  • (N,<)≢(Z,<)(\N, <) \not\equiv (\Z, <): the sentence ∃x ∀y (x≤y)\exists x\, \forall y\, (x \le y) ("there is a least element") separates them.
  • (Z,<)≢(Q,<)(\Z, <) \not\equiv (\Q, <): density, ∀x ∀y (x<y→∃z (x<z∧z<y))\forall x\,\forall y\,(x < y \to \exists z\,(x < z \wedge z < y)), separates them. So (Z,<)⊆(Q,<)(\Z, <) \subseteq (\Q, <) is a substructure that is not elementary.
  • Finite structures of different sizes are never elementarily equivalent: "there are exactly nn elements" is a sentence. But sentences of bounded quantifier depth see only a bounded amount: the computation section shows that sentences with at most kk nested quantifiers cannot tell a linear order with 2k−12^k - 1 elements from one with 2k2^k.

Example— A theory without quantifier elimination

In (Z,<)(\Z, <) the formula φ(a,b)=∃x (a<x∧x<b)\varphi(a, b) = \exists x\,(a < x \wedge x < b) is not equivalent to a quantifier-free formula in a,ba, b. A quantifier-free formula in two variables is a Boolean combination of a<ba < b, a=ba = b, b<ab < a, so it has the same truth value at (0,1)(0, 1) and (0,2)(0, 2); but φ(0,1)\varphi(0, 1) is false and φ(0,2)\varphi(0, 2) is true. (Enlarging the language by successor and predecessor functions restores quantifier elimination for Th(Z,<)\mathrm{Th}(\Z, <).)

Similarly, the ordered field R\R has QE in the language {+,−,⋅,0,1,<}\{+, -, \cdot, 0, 1, <\} (Tarski), but not in the ring language {+,−,⋅,0,1}\{+, -, \cdot, 0, 1\}: there ∃y (y⋅y=x)\exists y\,(y \cdot y = x) defines [0,∞)[0, \infty), while a quantifier-free formula in one variable defines a finite or cofinite set.

Example— Hyperreals and nonstandard natural numbers

Let UU be a non-principal ultrafilter on N\N. In ∗R=RN/U{}^*\R = \R^\N/U, the element ε=[(1,12,13,… )]\varepsilon = [(1, \tfrac12, \tfrac13, \dots)] satisfies 0<ε<r0 < \varepsilon < r for every real r>0r > 0: the set {n∣1/n<r}\{n \mid 1/n < r\} is cofinite, hence in UU. Likewise in NN/U\N^\N/U the class of (0,1,2,… )(0, 1, 2, \dots) lies above every standard natural number — proved in Lean below. By Łoś's theorem the diagonal maps R→∗R\R \to {}^*\R and N→NN/U\N \to \N^\N/U are elementary, so these new elements live in structures with exactly the same first-order theory as the old ones.

ProofH

Łoś's theorem and compactness

Theorem— Łoś's theorem

Let (Mi)i∈I(M_i)_{i\in I} be nonempty LL-structures, UU an ultrafilter on II and M=∏iMi/UM = \prod_i M_i / U. For every formula φ(x1,…,xn)\varphi(x_1, \dots, x_n) and f1,…,fn∈∏iMif_1, \dots, f_n \in \prod_i M_i,

M⊨φ([f1],…,[fn])  ⟺  { i∈I∣Mi⊨φ(f1(i),…,fn(i)) }∈U.M \models \varphi([f_1], \dots, [f_n]) \iff \{\, i \in I \mid M_i \models \varphi(f_1(i), \dots, f_n(i)) \,\} \in U.

Proof

Write ∥φ(fˉ)∥={i∣Mi⊨φ(fˉ(i))}\|\varphi(\bar f)\| = \{i \mid M_i \models \varphi(\bar f(i))\}. First, for every term tt, the value tM([f1],…,[fn])t^M([f_1], \dots, [f_n]) is the class of i↦tMi(f1(i),…,fn(i))i \mapsto t^{M_i}(f_1(i), \dots, f_n(i)): this is an induction on tt, using that functions are interpreted coordinatewise. Now induct on φ\varphi, built from atomic formulas by ¬\neg, ∧\wedge and ∃\exists.

  • Atomic. For t1=t2t_1 = t_2 this is the definition of ∼\sim, and for R(t1,…,tk)R(t_1, \dots, t_k) the definition of RMR^M, combined with the statement about terms.
  • Negation. M⊨¬φ(fˉ)M \models \neg\varphi(\bar f) iff ∥φ(fˉ)∥∉U\|\varphi(\bar f)\| \notin U (induction) iff I∖∥φ(fˉ)∥=∥¬φ(fˉ)∥∈UI \setminus \|\varphi(\bar f)\| = \|\neg\varphi(\bar f)\| \in U. This is the only step that uses that UU is an ultrafilter.
  • Conjunction. ∥φ∧ψ∥=∥φ∥∩∥ψ∥\|\varphi \wedge \psi\| = \|\varphi\| \cap \|\psi\|, and a filter contains A∩BA \cap B iff it contains both AA and BB.
  • Existential. Suppose M⊨∃x φ(x,fˉ)M \models \exists x\, \varphi(x, \bar f), witnessed by [g][g]. By induction ∥φ(g,fˉ)∥∈U\|\varphi(g, \bar f)\| \in U, and this set is contained in ∥∃x φ(x,fˉ)∥\|\exists x\,\varphi(x, \bar f)\|, which is therefore in UU. Conversely, suppose B=∥∃x φ(x,fˉ)∥∈UB = \|\exists x\,\varphi(x, \bar f)\| \in U. For i∈Bi \in B choose g(i)∈Mig(i) \in M_i with Mi⊨φ(g(i),fˉ(i))M_i \models \varphi(g(i), \bar f(i)), and for i∉Bi \notin B let g(i)g(i) be any element of MiM_i (nonempty). Then ∥φ(g,fˉ)∥⊇B\|\varphi(g, \bar f)\| \supseteq B is in UU, so by induction M⊨φ([g],fˉ)M \models \varphi([g], \bar f), hence M⊨∃x φ(x,fˉ)M \models \exists x\,\varphi(x, \bar f).

∎

The existential step uses the axiom of choice to pick gg — this is where all the witnesses are assembled into one element.

Theorem— Corollary — the diagonal embedding is elementary

For every structure MM and ultrafilter UU on II, the diagonal map d:M→MI/Ud : M \to M^I/U is an elementary embedding.

Proof

For aˉ∈Mn\bar a \in M^n, Łoś gives MI/U⊨φ(daˉ)M^I/U \models \varphi(d\bar a) iff {i∣M⊨φ(aˉ)}∈U\{i \mid M \models \varphi(\bar a)\} \in U. That set is II or ∅\emptyset according as M⊨φ(aˉ)M \models \varphi(\bar a) or not, and I∈UI \in U, ∅∉U\emptyset \notin U.

∎

Theorem— Compactness theorem — second proof

If every finite subset of a theory TT has a model, then TT has a model.

Proof

Let II be the set of finite subsets of TT, and for each Δ∈I\Delta \in I choose a model MΔ⊨ΔM_\Delta \models \Delta. For φ∈T\varphi \in T let Aφ={Δ∈I∣φ∈Δ}A_\varphi = \{\Delta \in I \mid \varphi \in \Delta\}. These sets have the finite intersection property, since {φ1,…,φk}∈Aφ1∩⋯∩Aφk\{\varphi_1, \dots, \varphi_k\} \in A_{\varphi_1} \cap \dots \cap A_{\varphi_k}. Extend them to an ultrafilter UU on II, and let M=∏ΔMΔ/UM = \prod_\Delta M_\Delta / U. For φ∈T\varphi \in T, every Δ∈Aφ\Delta \in A_\varphi has MΔ⊨φM_\Delta \models \varphi, so {Δ∣MΔ⊨φ}⊇Aφ\{\Delta \mid M_\Delta \models \varphi\} \supseteq A_\varphi belongs to UU, and M⊨φM \models \varphi by Łoś.

∎

This proof is purely semantic: it does not pass through the completeness theorem or any proof system. It is the proof Mathlib formalises.

M for Δ₁M for Δ₂M for Δ₃M for Δ₄…∏ M / U ⊨ T
An ultraproduct of models of finite fragments. Coordinate Δ satisfies the sentences in Δ; each φ ∈ T holds on the large set of Δ containing φ, so Łoś's theorem makes φ true in the ultraproduct.
ProofH

Dense linear orders: quantifier elimination and back and forth

Let DLO\mathrm{DLO} be the theory, in the language {<}\{<\}, of dense linear orders without endpoints: the axioms of a strict linear order, together with ∀x ∃y (x<y)\forall x\,\exists y\,(x < y), ∀x ∃y (y<x)\forall x\,\exists y\,(y < x) and ∀x ∀y (x<y→∃z (x<z∧z<y))\forall x\,\forall y\,(x < y \to \exists z\,(x < z \wedge z < y)). Its models include Q\Q, R\R, Q∩(0,1)\Q \cap (0, 1) and the real algebraic numbers.

We first reduce QE in general to a single quantifier applied to a conjunction.

Theorem— Lemma — reduction to primitive formulas

Suppose that for every conjunction θ(x,yˉ)\theta(x, \bar y) of atomic and negated atomic formulas, ∃x θ\exists x\,\theta is TT-equivalent to a quantifier-free formula in yˉ\bar y. Then TT has quantifier elimination.

Proof

By induction on formulas we show each is TT-equivalent to a quantifier-free one. Atomic formulas are quantifier-free, and the class of formulas with quantifier-free equivalents is closed under ¬\neg and ∧\wedge. For ∃x φ\exists x\,\varphi, replace φ\varphi by a quantifier-free equivalent and put it in disjunctive normal form θ1∨⋯∨θm\theta_1 \vee \dots \vee \theta_m, each θj\theta_j a conjunction of literals. Since ∃x (θ1∨⋯∨θm)\exists x\,(\theta_1 \vee \dots \vee \theta_m) is logically equivalent to ∃x θ1∨⋯∨∃x θm\exists x\,\theta_1 \vee \dots \vee \exists x\,\theta_m, the hypothesis applies to each disjunct.

∎

The heart of the matter is the following lemma, formalised in Lean below as dlo_elim_core.

Theorem— Key lemma

Let M⊨DLOM \models \mathrm{DLO} and let A,B⊆MA, B \subseteq M be finite. There is x∈Mx \in M with a<xa < x for all a∈Aa \in A and x<bx < b for all b∈Bb \in B if and only if a<ba < b for all a∈Aa \in A, b∈Bb \in B.

Proof

The forward direction is transitivity. Conversely, assume a<ba < b for all a∈Aa \in A, b∈Bb \in B. If AA and BB are both nonempty, then max⁡A<min⁡B\max A < \min B, and density gives xx with max⁡A<x<min⁡B\max A < x < \min B. If only BB is nonempty, take x<min⁡Bx < \min B (no least element); if only AA is nonempty, take x>max⁡Ax > \max A (no greatest element); if both are empty, take any xx (MM is nonempty).

∎

Theorem— Theorem — DLO has quantifier elimination

Every formula in the language {<}\{<\} is DLO\mathrm{DLO}-equivalent to a quantifier-free formula.

Proof

By the reduction lemma it suffices to treat ∃x θ\exists x\,\theta with θ\theta a conjunction of literals. In a linear order, ¬(s<t)↔(t<s∨s=t)\neg(s < t) \leftrightarrow (t < s \vee s = t) and ¬(s=t)↔(s<t∨t<s)\neg(s = t) \leftrightarrow (s < t \vee t < s); substituting and redistributing, θ\theta becomes a disjunction of conjunctions of atomic formulas, and ∃\exists distributes over ∨\vee. So let θ\theta be a conjunction of atomic formulas. Conjuncts not mentioning xx can be moved outside the quantifier. A conjunct x<xx < x makes θ\theta equivalent to ⊥\bot; a conjunct x=xx = x can be dropped. If some conjunct is x=cx = c (or c=xc = x) with cc a variable other than xx, then ∃x (x=c∧θ′(x))↔θ′(c)\exists x\,(x = c \wedge \theta'(x)) \leftrightarrow \theta'(c). Otherwise θ\theta has the form ⋀a∈Aa<x∧⋀b∈Bx<b\bigwedge_{a \in A} a < x \wedge \bigwedge_{b \in B} x < b for finite sets of variables AA and BB, and by the key lemma ∃x θ\exists x\,\theta is equivalent to ⋀a∈A,b∈Ba<b\bigwedge_{a \in A, b \in B} a < b — the empty conjunction being ⊤\top.

∎

Theorem— Corollary — completeness and model completeness

(1) DLO\mathrm{DLO} is complete; in particular (Q,<)≡(R,<)(\Q, <) \equiv (\R, <). (2) Every embedding between models of DLO\mathrm{DLO} is elementary; in particular (Q,<)⪯(R,<)(\Q, <) \preceq (\R, <).

Proof

(1) The language has no constant symbols, so a quantifier-free sentence is a Boolean combination of ⊤\top and ⊥\bot. By QE every sentence is DLO\mathrm{DLO}-equivalent to ⊤\top or to ⊥\bot, so DLO\mathrm{DLO} decides it; and DLO\mathrm{DLO} is consistent because Q\Q is a model. (2) Embeddings preserve quantifier-free formulas, and every formula is DLO\mathrm{DLO}-equivalent to a quantifier-free one.

∎

There is a second, older route to completeness, through categoricity.

Theorem— Cantor's theorem — DLO is ℵ₀-categorical

Any two countable models of DLO\mathrm{DLO} are isomorphic.

Proof

Let AA, BB be countable models of DLO; they are infinite (a finite nonempty linear order has a greatest element). Enumerate A={a0,a1,… }A = \{a_0, a_1, \dots\} and B={b0,b1,… }B = \{b_0, b_1, \dots\}. Call a finite order-preserving bijection pp between a finite subset of AA and a finite subset of BB a partial isomorphism.

Extension property: if pp is a partial isomorphism and a∈Aa \in A, there is b∈Bb \in B with p∪{(a,b)}p \cup \{(a, b)\} a partial isomorphism. If a∈dom pa \in \mathrm{dom}\,p take b=p(a)b = p(a). Otherwise let A−={a′∈dom p∣a′<a}A_- = \{a' \in \mathrm{dom}\,p \mid a' < a\} and A+={a′∈dom p∣a<a′}A_+ = \{a' \in \mathrm{dom}\,p \mid a < a'\}. Every element of p(A−)p(A_-) is below every element of p(A+)p(A_+), since pp preserves order, so the key lemma (applied in BB) gives bb above p(A−)p(A_-) and below p(A+)p(A_+); then b∉ran pb \notin \mathrm{ran}\,p and p∪{(a,b)}p \cup \{(a, b)\} preserves order. By symmetry, for every b∈Bb \in B there is a matching a∈Aa \in A.

Start with p0=∅p_0 = \emptyset. At step 2n+12n + 1 extend so that ana_n is in the domain ("forth"); at step 2n+22n + 2 extend so that bnb_n is in the range ("back"). The union ⋃npn\bigcup_n p_n is an order-preserving map defined on all of AA and onto all of BB: an isomorphism.

∎

AB1234
Back and forth: alternately add the next point of A (forth) and the next point of B (back), each time choosing a partner in the same position relative to the points already matched. Density and the absence of endpoints guarantee a partner always exists.

Theorem— Łoś–Vaught test

Let TT be a consistent theory in a language LL with no finite models, and suppose TT is κ\kappa-categorical for some infinite cardinal κ≥∣L∣\kappa \ge |L|. Then TT is complete.

Proof

If TT decided neither φ\varphi nor ¬φ\neg\varphi, both T∪{φ}T \cup \{\varphi\} and T∪{¬φ}T \cup \{\neg \varphi\} would have models, necessarily infinite. By the upward and downward Löwenheim–Skolem theorems each has a model of cardinality κ\kappa. These two models of TT are isomorphic by categoricity, yet one satisfies φ\varphi and the other ¬φ\neg\varphi — a contradiction.

∎

With Cantor's theorem (κ=ℵ0\kappa = \aleph_0, LL finite) this gives a second proof that DLO is complete. Mathlib proves completeness exactly this way.

ProofH

Algebraically closed fields, Lefschetz and Ax–Grothendieck

Work in the language of rings {+,−,⋅,0,1}\{+, -, \cdot, 0, 1\}. Let ACF\mathrm{ACF} be the theory of algebraically closed fields — the field axioms plus, for each n≥1n \ge 1, the sentence ∀a0…∀an−1 ∃x (xn+an−1xn−1+⋯+a0=0)\forall a_0 \dots \forall a_{n-1}\, \exists x\, (x^n + a_{n-1}x^{n-1} + \dots + a_0 = 0). For pp prime, ACFp\mathrm{ACF}_p adds p⋅1=0p \cdot 1 = 0; and ACF0\mathrm{ACF}_0 adds p⋅1≠0p \cdot 1 \neq 0 for every prime pp.

Theorem— Theorem (Tarski) — ACF has quantifier elimination

Every formula in the language of rings is ACF\mathrm{ACF}-equivalent to a quantifier-free formula.

We do not prove this here; a complete proof (by the same reduction lemma, with a careful elimination of ∃x\exists x from systems f1(x)=⋯=fk(x)=0∧g(x)≠0f_1(x) = \dots = f_k(x) = 0 \wedge g(x) \neq 0 using polynomial division) is in Marker, Model Theory: An Introduction, Theorem 3.2.2. Its consequences are what matter for us.

  • Constructible sets. In K⊨ACFK \models \mathrm{ACF}, a quantifier-free formula with parameters defines a finite Boolean combination of zero sets of polynomials — a constructible set. So the definable subsets of KnK^n are exactly the constructible ones. Since an existential quantifier is a coordinate projection, QE implies that the projection Kn+1→KnK^{n+1} \to K^n of a constructible set is constructible: this is Chevalley's theorem for affine space over KK. (Conversely, a sufficiently uniform form of Chevalley's theorem yields QE; the two are closely related rather than literally the same statement.)
  • Completeness of ACFp\mathrm{ACF}_p. A quantifier-free sentence is a Boolean combination of atomic sentences t1=t2t_1 = t_2 between closed terms, that is, of statements n⋅1=m⋅1n \cdot 1 = m \cdot 1 with n,m∈Zn, m \in \Z. These are decided by the characteristic. Hence ACFp\mathrm{ACF}_p is complete for p=0p = 0 and for every prime pp. In particular Q‾≡C\overline{\Q} \equiv \C, and by QE again Q‾⪯C\overline{\Q} \preceq \C.

Theorem— Lefschetz principle

For a sentence φ\varphi in the language of rings, the following are equivalent:

  1. C⊨φ\C \models \varphi;
  2. ACF0⊨φ\mathrm{ACF}_0 \models \varphi;
  3. ACFp⊨φ\mathrm{ACF}_p \models \varphi for all sufficiently large primes pp;
  4. ACFp⊨φ\mathrm{ACF}_p \models \varphi for infinitely many primes pp.

Proof

(1)⇔(2): C⊨ACF0\C \models \mathrm{ACF}_0, which is complete. (2)⇒(3): ACF0∪{¬φ}\mathrm{ACF}_0 \cup \{\neg\varphi\} has no model, so by compactness some finite subset has none; such a subset lies in ACF∪{p⋅1≠0∣p<N}∪{¬φ}\mathrm{ACF} \cup \{p \cdot 1 \ne 0 \mid p < N\} \cup \{\neg\varphi\} for some NN, so every algebraically closed field of characteristic at least NN satisfies φ\varphi. (3)⇒(4) is trivial. (4)⇒(2): if ACF0⊭φ\mathrm{ACF}_0 \not\models \varphi, completeness gives ACF0⊨¬φ\mathrm{ACF}_0 \models \neg\varphi, so by (2)⇒(3) ACFp⊨¬φ\mathrm{ACF}_p \models \neg\varphi for all large pp; since each ACFp\mathrm{ACF}_p is consistent, φ\varphi fails in ACFp\mathrm{ACF}_p for all large pp, contradicting (4).

∎

Theorem— Ax–Grothendieck theorem

Let KK be an algebraically closed field. Every injective polynomial map f:Kn→Knf : K^n \to K^n is surjective.

Proof

Fix nn and a degree bound dd. "Every polynomial map Kn→KnK^n \to K^n whose coordinates have degree at most dd and which is injective is surjective" is a single first-order sentence Φn,d\Phi_{n,d}: quantify universally over the finitely many coefficients cˉ\bar c of nn polynomials of degree ≤d\le d, and write

∀cˉ [∀xˉ ∀yˉ (fcˉ(xˉ)=fcˉ(yˉ)→xˉ=yˉ)  →  ∀zˉ ∃xˉ  fcˉ(xˉ)=zˉ].\forall \bar c\, \Big[ \forall \bar x\, \forall \bar y\, \big(f_{\bar c}(\bar x) = f_{\bar c}(\bar y) \to \bar x = \bar y\big) \;\to\; \forall \bar z\, \exists \bar x\; f_{\bar c}(\bar x) = \bar z \Big].

Step 1: Φn,d\Phi_{n,d} holds in F‾p\overline{\mathbb F}_p for every prime pp. Let ff have coefficients in F‾p\overline{\mathbb F}_p, be injective, and let zˉ∈F‾p n\bar z \in \overline{\mathbb F}_p^{\,n}. The finitely many coefficients of ff and coordinates of zˉ\bar z are algebraic over Fp\mathbb F_p, so they generate a finite subfield FF. Then ff maps FnF^n to FnF^n and is injective there; as FnF^n is finite, f∣Fnf|_{F^n} is surjective, so zˉ=f(xˉ)\bar z = f(\bar x) for some xˉ∈Fn\bar x \in F^n.

Step 2: transfer. As ACFp\mathrm{ACF}_p is complete and F‾p⊨ACFp\overline{\mathbb F}_p \models \mathrm{ACF}_p, Step 1 gives ACFp⊨Φn,d\mathrm{ACF}_p \models \Phi_{n,d} for every prime pp. By the Lefschetz principle ACF0⊨Φn,d\mathrm{ACF}_0 \models \Phi_{n,d}. So every algebraically closed field, of any characteristic, satisfies Φn,d\Phi_{n,d}. Every polynomial map has some degree dd.

∎

The algebraic closure matters: over Q\Q, the map x↦x3x \mapsto x^3 is injective but 22 is not a cube; over Fp(t)\mathbb F_p(t), the Frobenius x↦xpx \mapsto x^p is injective but tt is not a pp-th power.

Note

Ultraproducts give another view of the Lefschetz principle. If UU is a non-principal ultrafilter on the set of primes, then ∏pF‾p/U\prod_p \overline{\mathbb F}_p / U is algebraically closed (Łoś, axiom by axiom) of characteristic 00 (each sentence q⋅1≠0q \cdot 1 \ne 0 holds in all factors with p≠qp \ne q), and it has cardinality 2ℵ02^{\aleph_0}. Since ACF0\mathrm{ACF}_0 is categorical in every uncountable cardinal (an algebraically closed field is determined by its characteristic and transcendence degree — Steinitz), this ultraproduct is isomorphic to C\C.

ExplanationH

Types and the Stone space

Types record how a new element could sit over a set of parameters. For DLO\mathrm{DLO}, quantifier elimination says a complete 1-type over A⊆MA \subseteq M is determined by which atomic formulas x<ax < a, x=ax = a, a<xa < x (a∈Aa \in A) it contains. Over A=QA = \Q inside (Q,<)(\Q, <), the complete 1-types are therefore:

  • x=qx = q for each q∈Qq \in \Q (realised in Q\Q);
  • for each irrational rr, the type {q<x∣q∈Q, q<r}∪{x<q∣q∈Q, q>r}\{q < x \mid q \in \Q,\ q < r\} \cup \{x < q \mid q \in \Q,\ q > r\} (not realised in Q\Q, realised in R\R by rr);
  • for each q∈Qq \in \Q, a type q+q^+ "infinitely close to qq from above" (q<xq < x and x<rx < r for all rationals r>qr > q), and similarly q−q^-;
  • +∞+\infty (q<xq < x for all qq) and −∞-\infty.

So ∣S1(Q)∣=2ℵ0|S_1(\Q)| = 2^{\aleph_0}. The types q±q^\pm and ±∞\pm\infty are realised in neither Q\Q nor R\R. All of these types are realised in the ultrapower QN/U\Q^\N/U, an elementary extension of Q\Q by Łoś's theorem: q+q^+ by [(q+1/n)n][(q + 1/n)_n], q−q^- by [(q−1/n)n][(q - 1/n)_n], ±∞\pm\infty by [(±n)n][(\pm n)_n], and the cut of an irrational rr by the class of any sequence of rationals converging to rr.

The set Sn(T)S_n(T) of complete nn-types of a complete theory TT (over ∅\emptyset) carries the Stone topology, with basic open sets [φ]={p∣φ∈p}[\varphi] = \{p \mid \varphi \in p\}. These sets are also closed (their complements are [¬φ][\neg\varphi]), so Sn(T)S_n(T) is totally disconnected and Hausdorff; and it is compact precisely because of the compactness theorem: a cover by basic open sets with no finite subcover would give a set of formulas {¬φj}\{\neg\varphi_j\}, finitely satisfiable with TT but not satisfiable. A type is an isolated point iff it is generated by a single formula modulo TT.

Formal mathematicsF

Model theory in Lean and Mathlib

Mathlib has a substantial model theory library: languages, structures, terms and formulas whose bound variables are indexed by Fin n (FirstOrder.Language.BoundedFormula), satisfaction M ⊨ φ, theories, elementary embeddings and substructures, ultraproducts, compactness, Löwenheim–Skolem, Fraïssé limits, and the theories of orders and algebraically closed fields. Here is what this lesson proves and what it applies.

The key lemma of quantifier elimination, proved here, following the proof above case by case. The statement uses finite sets of parameters L and U:

dlo_elim_coreLean 4Proved here from basic factsFormally verified
/-- **The key lemma of quantifier elimination for DLO.** In a nonempty dense linear order
without endpoints, a point `x` strictly above every element of the finite set `L` and strictly
below every element of the finite set `U` exists **if and only if** every element of `L` is
below every element of `U`. So the formula `∃x (⋀ aᵢ < x ∧ ⋀ x < bⱼ)` is equivalent to the
quantifier-free formula `⋀ᵢⱼ aᵢ < bⱼ`.

The proof follows the lesson: if both sets are nonempty, density gives a point between
`max L < min U`; if one is empty, "no endpoints" gives a point beyond the other; if both are
empty, nonemptiness gives any point. -/
theorem dlo_elim_core {α : Type*} [LinearOrder α] [DenselyOrdered α] [NoMinOrder α]
    [NoMaxOrder α] [Nonempty α] (L U : Finset α) :
    (∃ x, (∀ a ∈ L, a < x) ∧ ∀ b ∈ U, x < b) ↔ ∀ a ∈ L, ∀ b ∈ U, a < b := by
  constructor
  · rintro ⟨x, hL, hU⟩ a ha b hb
    exact (hL a ha).trans (hU b hb)
  · intro h
    rcases L.eq_empty_or_nonempty with rfl | hL
    · rcases U.eq_empty_or_nonempty with rfl | hU
      · -- no constraints at all: any point will do
        obtain ⟨x⟩ := ‹Nonempty α›
        exact ⟨x, by simp, by simp⟩
      · -- only upper bounds: go below the least of them (no least element)
        obtain ⟨x, hx⟩ := exists_lt (U.min' hU)
        exact ⟨x, by simp, fun b hb => hx.trans_le (U.min'_le b hb)⟩
    · rcases U.eq_empty_or_nonempty with rfl | hU
      · -- only lower bounds: go above the greatest of them (no greatest element)
        obtain ⟨x, hx⟩ := exists_gt (L.max' hL)
        exact ⟨x, fun a ha => (L.le_max' a ha).trans_lt hx, by simp⟩
      · -- both: `max L < min U` by hypothesis, and density puts a point in between
        have hlt : L.max' hL < U.min' hU := h _ (L.max'_mem hL) _ (U.min'_mem hU)
        obtain ⟨x, hx₁, hx₂⟩ := exists_between hlt
        exact ⟨x, fun a ha => (L.le_max' a ha).trans_lt hx₁,
          fun b hb => hx₂.trans_le (U.min'_le b hb)⟩
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

Density is genuinely needed — the elimination is false in the integers:

dlo_elim_core_fails_discreteLean 4Proved here from basic factsFormally verified
/-- **Density is needed.** In the integers (a linear order without endpoints, but *not* dense)
the elimination of `model_theory.dlo_elim_core` fails: `0 < 1` holds, yet nothing lies strictly
between `0` and `1`. So `∃x (0 < x ∧ x < 1)` is not equivalent to `0 < 1` in `(ℤ, <)`. -/
theorem dlo_elim_core_fails_discrete :
    (∀ a ∈ ({0} : Finset ℤ), ∀ b ∈ ({1} : Finset ℤ), a < b) ∧
      ¬ ∃ x : ℤ, (∀ a ∈ ({0} : Finset ℤ), a < x) ∧ ∀ b ∈ ({1} : Finset ℤ), x < b := by
  refine ⟨by simp, ?_⟩
  rintro ⟨x, h0, h1⟩
  have hx0 : 0 < x := h0 0 (by simp)
  have hx1 : x < 1 := h1 1 (by simp)
  omega
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

Mathlib does not (yet) state quantifier elimination for DLO as a theorem about all formulas; the lemma above is the mathematical heart of it, and the reduction from arbitrary formulas is the syntactic induction in the human proof.

(Q,≤)≡(R,≤)(\Q, \le) \equiv (\R, \le) but (Q,≤)≇(R,≤)(\Q, \le) \not\cong (\R, \le). Mathlib's language of orders uses ≤\le rather than <<; the two are interdefinable. The structures are given by Mathlib's orderStructure. Elementary equivalence applies Mathlib's completeness of dlo (proved there by the Łoś–Vaught test); non-isomorphism is proved here from Cantor's uncountability of R\R:

rat_elem_equiv_realLean 4Applies a library theoremFormally verified
/-- **`(ℚ, ≤) ≡ (ℝ, ≤)`**: the rationals and the reals satisfy exactly the same first-order
sentences in the language `{≤}`. Both are models of the theory `dlo` of dense linear orders
without endpoints, and `dlo` is complete (Mathlib's `FirstOrder.Language.dlo_isComplete`, proved
by the Łoś–Vaught test from `ℵ₀`-categoricity); in a complete theory every sentence is decided,
so each model satisfies `φ` iff `dlo ⊨ φ` (`Theory.IsComplete.realize_sentence_iff`). -/
theorem rat_elem_equiv_real :
    letI := orderStructure ℚ
    letI := orderStructure ℝ
    ℚ ≅[Language.order] ℝ := by
  let := orderStructure ℚ
  let := orderStructure ℝ
  have : Language.order.OrderedStructure ℚ := ⟨fun _ => Iff.rfl⟩
  have : Language.order.OrderedStructure ℝ := ⟨fun _ => Iff.rfl⟩
  rw [elementarilyEquivalent_iff]
  intro φ
  rw [dlo_isComplete.realize_sentence_iff φ ℚ, dlo_isComplete.realize_sentence_iff φ ℝ]
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor
rat_not_equiv_realLean 4Proved here from basic factsFormally verified
/-- **…but not isomorphic.** There is no isomorphism of `{≤}`-structures between `ℚ` and `ℝ`:
an isomorphism is in particular a bijection, which would make `ℝ` countable, contradicting
Cantor's theorem (`Cardinal.not_countable_real`). Elementary equivalence is much weaker than
isomorphism: first-order logic cannot express "countable" or "complete". -/
theorem rat_not_equiv_real :
    letI := orderStructure ℚ
    letI := orderStructure ℝ
    ¬ Nonempty (ℚ ≃[Language.order] ℝ) := by
  let := orderStructure ℚ
  let := orderStructure ℝ
  rintro ⟨e⟩
  -- `e⁻¹ : ℝ → ℚ` is injective and `ℚ` is countable, so `ℝ` would be countable.
  have hinj : Function.Injective e.symm := e.symm.injective
  have : Countable ℝ := hinj.countable
  exact Cardinal.not_countable_real Set.countable_univ
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

Back and forth and categoricity, from Mathlib:

cantor_back_and_forthLean 4Applies a library theoremFormally verified
/-- **Cantor's theorem (back and forth).** Any two countable, nonempty, dense linear orders
without endpoints are order-isomorphic. This applies Mathlib's `Order.iso_of_countable_dense`,
whose proof is the back-and-forth construction of the lesson. -/
theorem cantor_back_and_forth (α : Type u) (β : Type v) [LinearOrder α] [LinearOrder β]
    [Countable α] [DenselyOrdered α] [NoMinOrder α] [NoMaxOrder α] [Nonempty α]
    [Countable β] [DenselyOrdered β] [NoMinOrder β] [NoMaxOrder β] [Nonempty β] :
    Nonempty (α ≃o β) :=
  Order.iso_of_countable_dense α β
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor
dlo_aleph0_categoricalLean 4Applies a library theoremFormally verified
/-- **`DLO` is `ℵ₀`-categorical**: all countably infinite models of the theory of dense linear
orders without endpoints are isomorphic as first-order structures. This applies Mathlib's
`FirstOrder.Language.aleph0_categorical_dlo` (proved there via Fraïssé limits, a model-theoretic
packaging of back and forth). -/
theorem dlo_aleph0_categorical : Cardinal.Categorical.{0, 0, w} Cardinal.aleph0 Language.order.dlo :=
  aleph0_categorical_dlo
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

Łoś and compactness. Mathlib's Filter.Product M U is the ultraproduct. Note the hypothesis that the factors are nonempty, used in the existential step of the proof:

losLean 4Applies a library theoremFormally verified
/-- **Łoś's theorem.** For nonempty structures `M a` (indexed by `a : α`) and an ultrafilter `U`
on `α`, a sentence holds in the ultraproduct `∏ M a / U` if and only if the set of indices `a` at which
it holds in `M a` belongs to `U`. This applies Mathlib's
`FirstOrder.Language.Ultraproduct.sentence_realize`, proved by induction on formulas exactly as
in the lesson. -/
theorem los {L : Language.{u, v}} {α : Type*} (M : α → Type*) (U : Ultrafilter α)
    [∀ a, L.Structure (M a)] [∀ a, Nonempty (M a)] (φ : L.Sentence) :
    (U : Filter α).Product M ⊨ φ ↔ ∀ᶠ a in (U : Filter α), M a ⊨ φ :=
  Ultraproduct.sentence_realize φ
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor
compactnessLean 4Applies a library theoremFormally verified
/-- **The compactness theorem.** A first-order theory has a model if and only if every finite
subset of it has a model. This applies Mathlib's `Theory.isSatisfiable_iff_isFinitelySatisfiable`,
whose proof is the lesson's second proof: take an ultraproduct of models of the finite subsets,
indexed by the finite subsets, along an ultrafilter extending the "eventually" filter, and apply
Łoś's theorem. -/
theorem compactness {L : Language.{u, v}} (T : L.Theory) :
    T.IsSatisfiable ↔ T.IsFinitelySatisfiable :=
  Theory.isSatisfiable_iff_isFinitelySatisfiable
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

A nonstandard natural number, proved here. Filter.hyperfilter ℕ is a non-principal ultrafilter on N\N and (hyperfilter ℕ).Germ ℕ is the ultrapower NN/U\N^\N/U. The order on germs is "eventually less" — the atomic case of Łoś's theorem:

nonstandard_naturalLean 4Proved here from basic factsFormally verified
/-- **A nonstandard natural number.** Let `U` be a non-principal ultrafilter on `ℕ` (Mathlib's
`hyperfilter ℕ`). In the ultrapower `ℕ^ℕ/U`, the class of the identity sequence `(0, 1, 2, …)`
is strictly greater than (the class of) every constant sequence `n`. Indeed, by the definition of
the order on the ultrapower (`Filter.Germ.coe_lt`, the atomic case of Łoś) we need
`{i | n < i} ∈ U`; this set is cofinite, and a non-principal ultrafilter contains every cofinite
set (`Filter.hyperfilter_le_cofinite`). By Łoś, `ℕ^ℕ/U` satisfies the same sentences as `ℕ`,
yet it has an element above all the standard ones. -/
theorem nonstandard_natural (n : ℕ) :
    (↑(fun _ : ℕ => n) : (Filter.hyperfilter ℕ : Filter ℕ).Germ ℕ) < ↑(id : ℕ → ℕ) := by
  rw [Filter.Germ.coe_lt]
  have h : ∀ᶠ i in (Filter.cofinite : Filter ℕ), n < i := by
    rw [Nat.cofinite_eq_atTop]
    exact Filter.eventually_gt_atTop n
  exact Filter.hyperfilter_le_cofinite h
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor
nonstandard_ne_standardLean 4Proved here from basic factsFormally verified
/-- The nonstandard element `[id]` of `ℕ^ℕ/U` is different from every standard element `[n]`:
a direct consequence of `nonstandard_natural`. So the diagonal embedding `ℕ → ℕ^ℕ/U`, which is
elementary by Łoś's theorem, is not surjective. -/
theorem nonstandard_ne_standard (n : ℕ) :
    (↑(fun _ : ℕ => n) : (Filter.hyperfilter ℕ : Filter ℕ).Germ ℕ) ≠ ↑(id : ℕ → ℕ) :=
  (nonstandard_natural n).ne
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

Lefschetz and Ax–Grothendieck, from Mathlib, whose proof of Ax–Grothendieck follows exactly the route of this lesson (Mathlib/FieldTheory/AxGrothendieck.lean). At the version used here, Mathlib does not prove quantifier elimination for ACF; it obtains completeness of ACFp\mathrm{ACF}_p from uncountable categoricity and the Łoś–Vaught test instead.

lefschetzLean 4Applies a library theoremFormally verified
/-- **The Lefschetz principle.** A first-order sentence in the language of rings follows from
the theory `ACF₀` of algebraically closed fields of characteristic `0` if and only if it follows
from `ACF_p` for infinitely many primes `p`. This applies Mathlib's
`FirstOrder.Field.ACF_zero_realize_iff_infinite_ACF_prime_realize`, proved from compactness and
the completeness of each `ACF_p`. -/
theorem lefschetz (φ : Language.ring.Sentence) :
    Theory.ACF 0 ⊨ᵇ φ ↔ Set.Infinite {p : Nat.Primes | Theory.ACF p ⊨ᵇ φ} :=
  Field.ACF_zero_realize_iff_infinite_ACF_prime_realize
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor
ax_grothendieckLean 4Applies a library theoremFormally verified
/-- **The Ax–Grothendieck theorem.** If `K` is an algebraically closed field and `ι` is finite,
every injective polynomial map `K^ι → K^ι` is surjective. This applies Mathlib's
`ax_grothendieck_univ`, which is proved by the model-theoretic argument of the lesson: the
statement for polynomials of bounded degree is a first-order sentence; it holds in the
algebraic closure of each finite field (a union of finite fields, where injective implies
surjective by counting); so it holds in every algebraically closed field by the Lefschetz
principle and completeness of `ACF_p`. -/
theorem ax_grothendieck {K ι : Type*} [Field K] [IsAlgClosed K] [Finite ι]
    (p : ι → MvPolynomial ι K) :
    Function.Injective (fun v i => MvPolynomial.eval v (p i)) →
      Function.Surjective (fun v i => MvPolynomial.eval v (p i)) :=
  ax_grothendieck_univ p
Axioms used: propext, Classical.choice, Quot.soundformal/Lumenary/ModelTheory.leanTry it in the Lean web editor

What is not formalised here: Łoś's theorem and compactness are applied, not re-proved; quantifier elimination is formalised only in its key step; the Ehrenfeucht–Fraïssé theorem and the theory of types are not formalised in this lesson.

ComputationC

Games that measure what logic can see

The quantifier rank of a formula counts nested quantifiers: atomic formulas have rank 00, ¬\neg and ∧\wedge take the maximum, and ∃x φ\exists x\,\varphi has rank one more than φ\varphi. Write M≡kNM \equiv_k N if MM and NN satisfy the same sentences of rank at most kk.

In the Ehrenfeucht–Fraïssé game Gk(M,N)G_k(M, N), Spoiler and Duplicator play kk rounds; in each round Spoiler picks an element of either structure and Duplicator answers with an element of the other. Duplicator wins if the chosen pairs (a1,b1),…,(ak,bk)(a_1, b_1), \dots, (a_k, b_k) form a partial isomorphism. The Ehrenfeucht–Fraïssé theorem (Fraïssé 1954, Ehrenfeucht 1961) says that, for a finite relational language, M≡kNM \equiv_k N if and only if Duplicator has a winning strategy in Gk(M,N)G_k(M, N). For finite linear orders LmL_m and LnL_n there is an exact rule: Duplicator wins GkG_k iff m=nm = n or m,n≥2k−1m, n \ge 2^k - 1. Duplicator's strategy keeps the invariant that, with rr rounds left, corresponding gaps between chosen points (and the ends) either have equal length or both have length at least 2r−12^r - 1; chapter 3 of Libkin's Elements of Finite Model Theory proves this kind of bound in detail.

The program below solves these games by brute-force search over the game tree and compares the answers with the rule.

Ehrenfeucht-Fraisse games on finite linear ordersPythonExact computationExhaustive finite checkComputationally tested
"""Ehrenfeucht-Fraisse games on finite linear orders, solved exhaustively.

Two players play k rounds on the linear orders {0 < 1 < ... < m-1} and
{0 < 1 < ... < n-1}. In each round Spoiler picks an element of either order and
Duplicator answers with an element of the other; Duplicator wins if the chosen
pairs always form a partial isomorphism (same order and equality pattern). By
the Ehrenfeucht-Fraisse theorem, Duplicator has a winning strategy for k rounds
exactly when the two orders satisfy the same sentences of quantifier rank <= k.
The program solves every game in a finite range by brute-force search and
compares the result with the classical rule: Duplicator wins iff m = n or
both m, n >= 2^k - 1. Evidence: exact and exhaustive over the range searched.
"""

from functools import lru_cache

def sign(x):
    """Return -1, 0 or 1 according to the sign of x."""
    return (x > 0) - (x < 0)

def consistent(pairs, new):
    """True if adding the pair ``new`` keeps ``pairs`` a partial isomorphism."""
    a, b = new
    return all(sign(a - c) == sign(b - d) for c, d in pairs)

def duplicator_wins(m, n, k):
    """Solve the k-round EF game on linear orders of sizes m and n exactly."""
    if min(m, n, k) < 0:
        raise ValueError("sizes and rounds must be non-negative")

    @lru_cache(maxsize=None)
    def win(rounds, pairs):
        if rounds == 0:
            return True
        for side, size, other in ((0, m, n), (1, n, m)):
            for x in range(size):
                answers = ((x, y) if side == 0 else (y, x) for y in range(other))
                if not any(consistent(pairs, p)
                           and win(rounds - 1, tuple(sorted(pairs + (p,))))
                           for p in answers):
                    return False
        return True

    return win(k, ())

def predicted(m, n, k):
    """The classical rule for linear orders: m = n, or both are >= 2^k - 1."""
    return m == n or (m >= 2 ** k - 1 and n >= 2 ** k - 1)

def check_range(k, sizes):
    """Compare the search with the rule on all pairs m <= n from ``sizes``."""
    pairs = [(m, n) for m in sizes for n in sizes if m <= n]
    wrong = [(m, n) for m, n in pairs
             if duplicator_wins(m, n, k) != predicted(m, n, k)]
    return len(pairs), wrong

def smallest_equivalent_pair(k, limit):
    """Least m with sizes m and m + 1 indistinguishable in k rounds."""
    for m in range(1, limit):
        if duplicator_wins(m, m + 1, k):
            return m
    return None

def main():
    print("k-round EF games on linear orders of sizes m <= n (D = Duplicator)")
    for k, sizes in [(1, range(1, 9)), (2, range(1, 9)), (3, range(1, 11))]:
        total, wrong = check_range(k, list(sizes))
        least = smallest_equivalent_pair(k, 10)
        print(f"k = {k}: {total} games solved, sizes {sizes.start}..{sizes.stop - 1}; "
              f"disagreements with the 2^k - 1 rule: {len(wrong)}")
        print(f"       least m such that m, m + 1 are k-equivalent: {least} "
              f"(rule predicts {2 ** k - 1})")
    print("Row k = 2 (sizes 1..6), entry for (m, n):")
    for m in range(1, 7):
        row = " ".join("D" if duplicator_wins(m, n, 2) else "." for n in range(1, 7))
        print(f"   m = {m}: {row}")
    print("So 'the order has an even number of elements' is not expressible by")
    print("one first-order sentence: a sentence of rank k cannot tell 2^k - 1")
    print("elements from 2^k (one even, one odd size).")
    print()
    print("Epistemic status: exact, exhaustive game-tree search for the listed")
    print("sizes and k <= 3. It confirms the 2^k - 1 rule there and nowhere else;")
    print("the rule for all m, n, k and the link between games and sentences")
    print("(the Ehrenfeucht-Fraisse theorem) are theorems, cited in the lesson.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

A consequence: no first-order sentence φ\varphi in {<}\{<\} holds in exactly the finite linear orders of even size, because if φ\varphi has rank kk it cannot separate L2k−1L_{2^k - 1} from L2kL_{2^k}. The search confirms the rule only for the sizes listed; the theorem covers all of them.

The second program implements the quantifier-elimination step of the DLO proof and tests it against a direct search for witnesses in Q\Q — and then runs the same elimination in Z\Z, where it fails.

Eliminating a quantifier in dense linear ordersPythonExact computationExperimental evidenceCounterexampleComputationally tested
"""Quantifier elimination for dense linear orders, tested against search.

A primitive formula Ex (conjunction of atoms a < x, x < b, x = c, with
parameters a, b, c) is replaced by a quantifier-free formula in the
parameters alone, following the lesson's proof: substitute if there is an
equation x = c; otherwise require every lower bound to be below every upper
bound. For random formulas and random rational parameters the program checks
the eliminated formula against a direct search for a witness x in Q, and then
shows the same elimination going wrong in the integers, which are not dense.
Evidence: exact rational arithmetic; random sampling, so it is a test, not a
proof.
"""

import random
from fractions import Fraction

def eliminate(atoms):
    """Quantifier-free equivalent of Ex /\\ atoms, as a list of (s, rel, t).

    Atoms are ('lt', a, 'x'), ('lt', 'x', b) or ('eq', 'x', c); parameters are
    names. The result is a conjunction of atoms between parameters.
    """
    eqs = [c for kind, s, c in atoms if kind == "eq"]
    if eqs:
        c = eqs[0]
        out = [("eq", c, d) for d in eqs[1:]]
        out += [("lt", c if s == "x" else s, c if t == "x" else t)
                for kind, s, t in atoms if kind == "lt"]
        return list(dict.fromkeys(out))
    lows = [s for kind, s, t in atoms if t == "x"]
    highs = [t for kind, s, t in atoms if s == "x"]
    return list(dict.fromkeys(("lt", a, b) for a in lows for b in highs))

def holds(formula, values):
    """Truth of a conjunction of parameter atoms under ``values``."""
    rel = {"lt": lambda u, v: u < v, "eq": lambda u, v: u == v}
    return all(rel[k](values[s], values[t]) for k, s, t in formula)

def candidates(values, integers=False):
    """Finitely many x that suffice to find a witness, if there is one."""
    pts = sorted(set(values.values()))
    if integers:
        return range(int(min(pts)) - 1, int(max(pts)) + 2)
    mids = [(p + q) / 2 for p, q in zip(pts, pts[1:])]
    return pts + mids + [pts[0] - 1, pts[-1] + 1]

def witness_exists(atoms, values, integers=False):
    """Search directly for x making every atom true."""
    def ok(x):
        env = dict(values, x=x)
        return holds(atoms, env)
    return any(ok(x) for x in candidates(values, integers))

def random_case(rng, names, integers=False):
    """A random primitive formula and random parameter values."""
    atoms = []
    for _ in range(rng.randint(1, 4)):
        p = rng.choice(names)
        kind = rng.choice(["lt", "lt", "lt", "eq"])
        atoms.append((kind, "x", p) if kind == "eq" or rng.random() < 0.5
                     else ("lt", p, "x"))
    pick = (lambda: rng.randint(0, 3)) if integers else (
        lambda: Fraction(rng.randint(0, 6), rng.randint(1, 3)))
    return list(dict.fromkeys(atoms)), {p: pick() for p in names}

def compare(trials, integers=False, seed=2024):
    """Count agreements and collect disagreements on random cases."""
    rng = random.Random(seed)
    agree, bad = 0, []
    for _ in range(trials):
        atoms, values = random_case(rng, ["a", "b", "c"], integers)
        if holds(eliminate(atoms), values) == witness_exists(
                atoms, values, integers):
            agree += 1
        else:
            bad.append((atoms, values))
    return agree, bad

def show(formula):
    """Pretty-print a conjunction of atoms."""
    sym = {"lt": "<", "eq": "="}
    return " and ".join(f"{s} {sym[k]} {t}" for k, s, t in formula) or "true"

def main():
    example = [("lt", "a", "x"), ("lt", "b", "x"), ("lt", "x", "c")]
    print(f"Ex ({show(example)})")
    print(f"   is equivalent in a DLO to: {show(eliminate(example))}")
    example2 = [("eq", "x", "c"), ("lt", "a", "x")]
    print(f"Ex ({show(example2)})  ~>  {show(eliminate(example2))}")
    print()
    agree, bad = compare(2000)
    print(f"In Q: 2000 random formulas, {agree} agreements, {len(bad)} failures")
    agree_z, bad_z = compare(2000, integers=True)
    print(f"In Z: 2000 random formulas, {agree_z} agreements, "
          f"{len(bad_z)} failures")
    atoms, values = min(bad_z, key=lambda case: len(case[0]))
    nice = ", ".join(f"{p} = {v}" for p, v in sorted(values.items()))
    print(f"   e.g. Ex ({show(atoms)}) with {nice}:")
    print(f"   the eliminated formula '{show(eliminate(atoms))}' is true,")
    print("   but no integer x works - Z is not dense.")
    print()
    print("Epistemic status: exact arithmetic on 2000 random formulas per order.")
    print("Agreement in Q is evidence that the elimination is implemented")
    print("correctly, not a proof; the proof is the lesson's key lemma (also")
    print("checked in Lean). The failures in Z are genuine counterexamples.")

if __name__ == "__main__":
    main()
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Agreement on two thousand random formulas is evidence that the implementation is right, not a proof that the elimination is valid; the proof is the key lemma (checked in Lean). The failures in Z\Z, by contrast, are genuine counterexamples: density is necessary.

Explore

A square of elementary embeddings

Diagonal embeddings into ultrapowers and the inclusion Q⊆R\Q \subseteq \R fit into a commutative square. Every arrow is an elementary embedding: the vertical ones by Łoś's theorem, and the horizontal ones because every embedding between models of DLO\mathrm{DLO} is elementary.

(Q,<)(\mathbb{Q},<)
(R,<)(\mathbb{R},<)
QN/U\mathbb{Q}^{\mathbb{N}}/U
RN/U\mathbb{R}^{\mathbb{N}}/U
⪯\preceq
dd
dd
⪯\preceq
Both paths send q∈Qq \in \mathbb{Q} to the class of the constant sequence (q,q,… )(q, q, \dots). The ultrapowers contain infinitesimals and infinite elements, yet all four orders satisfy the same sentences.

Things to check for yourself: why is the bottom map well defined and injective (a rational sequence is a real sequence, and two sequences agree on a set in UU in Q\Q iff they do in R\R)? Why is QN/U\Q^\N/U a model of DLO\mathrm{DLO}, so that the bottom map is elementary? And which complete 1-types over Q\Q from the previous section does QN/U\Q^\N/U realise? (Answer: all of them — ultrapowers by non-principal ultrafilters on N\N are ℵ1\aleph_1-saturated, a theorem of Keisler.)

Exercises

Exercises

1. Model theory

Warm-upHuman

Which pairs of structures (each in the language {<}\{<\}) are elementarily equivalent? Choose all that apply.

Choose all that apply

2. Model theory

CoreComputational

Using the rule for Ehrenfeucht–Fraïssé games on finite linear orders, what is the least mm such that the linear orders with mm and m+1m + 1 elements satisfy the same sentences of quantifier rank at most 44?

3. Model theory

CoreHuman

In the inductive proof of Łoś's theorem, which step is the only one that uses that UU is an ultrafilter (and not merely a filter)?

Choose one

4. Model theory

CoreHuman

The key lemma says: in a DLO, ∃x (⋀a∈Aa<x∧⋀b∈Bx<b)\exists x\,(\bigwedge_{a \in A} a < x \wedge \bigwedge_{b \in B} x < b) is equivalent to ⋀a∈A,b∈Ba<b\bigwedge_{a \in A, b \in B} a < b. In (Z,<)(\mathbb{Z}, <) the equivalence fails for A={0}A = \{0\}, B={1}B = \{1\}. Which axiom of DLO does Z\mathbb{Z} violate that the proof used here?

Choose one

5. Model theory

StretchHuman

To show that φ(a,b)=∃x (a<x∧x<b)\varphi(a, b) = \exists x\,(a < x \wedge x < b) is not equivalent in (Z,<)(\mathbb{Z},<) to any quantifier-free formula in a,ba, b, which pair of inputs works?

Choose one

6. Model theory

CoreFormal

With orderStructure ℚ and orderStructure ℝ as the structures, which Lean statement correctly formalises “(Q,≤)(\mathbb{Q}, \le) and (R,≤)(\mathbb{R}, \le) are elementarily equivalent but not isomorphic”?

Choose one

7. Model theory

CoreHuman

The Ax–Grothendieck theorem says injective polynomial maps Kn→KnK^n \to K^n are surjective when KK is algebraically closed. Which of these are counterexamples over a field that is not algebraically closed? Choose all that apply.

Choose all that apply

8. Model theory

Warm-upHuman

How many complete 22-types over ∅\emptyset does the theory DLO have? (Use quantifier elimination: a type in variables x,yx, y is determined by the atomic formulas it contains.)

9. Model theory

StretchComputational

Make the key lemma constructive in Q\mathbb{Q}. Write witness(lows, highs) that takes two lists of Fractions and returns a Fraction xx with a<xa < x for every aa in lows and x<bx < b for every bb in highs, or None if no such xx exists. Follow the four cases of the proof.

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.
Common misconceptionsH

Common misconceptions

Misconception

"Elementarily equivalent structures must be isomorphic." (Q,<)(\Q, <) and (R,<)(\R, <) are elementarily equivalent and not isomorphic. By the Löwenheim–Skolem theorems, every infinite structure in a countable language has elementarily equivalent structures of every infinite cardinality, so elementary equivalence can never pin down an infinite structure up to isomorphism. Only for finite structures does M≡NM \equiv N imply M≅NM \cong N.

Misconception

"A theory with many models is vague." Having non-isomorphic models of different cardinalities is forced on every first-order theory with an infinite model. It does not mean the theory fails to decide questions: DLO and ACFp\mathrm{ACF}_p have models of every infinite cardinality and are complete. Completeness (deciding every sentence) and categoricity (one model per cardinality) are different properties.

Misconception

"M⊆NM \subseteq N and M≡NM \equiv N imply M⪯NM \preceq N." Elementarity involves formulas with parameters. (N≥1,<)⊆(N,<)(\N_{\ge 1}, <) \subseteq (\N, <) is isomorphic to (N,<)(\N, <), but 11 is least in the substructure and not in N\N.

Misconception

"Łoś's theorem needs a non-principal ultrafilter." It holds for every ultrafilter. For a principal ultrafilter at i0i_0 the ultraproduct is just (isomorphic to) Mi0M_{i_0}, so the theorem is true but uninteresting; non-principal ultrafilters are needed to produce new structures such as the hyperreals.

Misconception

"Quantifier elimination means the theory is decidable." QE reduces sentences to quantifier-free sentences. Decidability also needs the elimination to be effective, the axioms to be computably enumerable, and the quantifier-free sentences to be decidable — true for DLO, ACF and real closed fields, but not automatic.

ViewpointsH

Many ways of seeing

Algebra— Nullstellensatz and constructible sets

For algebraically closed fields, quantifier elimination is algebra. Abraham Robinson's proof of the weak Nullstellensatz runs as follows. Let KK be algebraically closed and I⊊K[x1,…,xn]I \subsetneq K[x_1, \dots, x_n] a proper ideal, generated (by the Hilbert basis theorem) by f1,…,fmf_1, \dots, f_m. Choose a maximal ideal m⊇I\mathfrak m \supseteq I and let LL be an algebraic closure of K[xˉ]/mK[\bar x]/\mathfrak m. In LL the sentence ∃xˉ ⋀jfj(xˉ)=0\exists \bar x\, \bigwedge_j f_j(\bar x) = 0, with parameters from KK, is true (take the images of the xix_i). The embedding K⊆LK \subseteq L is elementary (model completeness of ACF, from QE), so the sentence is true in KK: the variety V(I)V(I) has a KK-point. Projections of constructible sets are constructible (Chevalley) — the same theorem seen from the geometric side. See algebraic geometry and fields and Galois theory.

Geometry— Tame geometry: o-minimality

An expansion (R,<,… )(R, <, \dots) of a dense linear order is o-minimal if every definable subset of RR (with parameters) is a finite union of points and open intervals. By Tarski's quantifier elimination for real closed fields, (R,<,+,⋅)(\R, <, +, \cdot) is o-minimal, and its definable sets are the semialgebraic sets; Wilkie (1996) proved that (R,<,+,⋅,exp⁡)(\R, <, +, \cdot, \exp) is o-minimal too. The cell decomposition theorem (Pillay–Steinhorn, Knight–Pillay–Steinhorn, 1986) says that in an o-minimal structure every definable subset of RnR^n is a finite disjoint union of "cells" (graphs and bands between definable continuous functions, built up coordinate by coordinate). Consequences: definable sets have finitely many connected components, a well-behaved dimension, and no pathologies such as space-filling curves. This is the "tame topology" Grothendieck asked for, developed in van den Dries's book; o-minimal counting (Pila–Wilkie, 2006) became a key tool in Pila's 2011 proof of the André–Oort conjecture for products of modular curves.

Number theory— Ax–Kochen: p-adic fields through ultraproducts

Artin conjectured that every homogeneous form of degree dd over Qp\Q_p in more than d2d^2 variables has a nontrivial zero. Over Fp((t))\mathbb F_p((t)) the analogue is a theorem (Lang, 1952: Fp((t))\mathbb F_p((t)) is a C2C_2 field). Ax and Kochen (1965), and independently Ershov, proved that for a non-principal ultrafilter UU on the primes, ∏pQp/U≡∏pFp((t))/U\prod_p \Q_p / U \equiv \prod_p \mathbb F_p((t))/U as valued fields. For each fixed dd, "every form of degree dd in d2+1d^2 + 1 variables has a nontrivial zero" is a single first-order sentence; it holds in every Fp((t))\mathbb F_p((t)), hence in the second ultraproduct, hence in the first, hence (Łoś) in Qp\Q_p for UU-almost all pp — and since UU was arbitrary, for all but finitely many primes pp. The finite exceptional set depends on dd, and the original argument gives no bound for it. The exceptions are real: Terjanian (1966) found a quartic form in 18>4218 > 4^2 variables over Q2\Q_2 with no nontrivial zero, so Artin's conjecture is false as stated. See algebraic number theory.

Analysis— Nonstandard analysis

Robinson (1961, book 1966) used ultrapowers to make infinitesimals rigorous. In ∗R=RN/U{}^*\R = \R^\N/U there is ε>0\varepsilon > 0 smaller than every positive real. Every function f:R→Rf : \R \to \R extends to ∗f{}^*f coordinatewise, and the transfer principle — Łoś's theorem for R\R expanded by symbols for all the functions and relations one cares about — says a first-order statement about these holds in R\R iff it holds in ∗R{}^*\R. One then proves, for standard ff and aa: ff is continuous at aa iff ∗f(a+δ)−f(a){}^*f(a + \delta) - f(a) is infinitesimal for every infinitesimal δ\delta. Derivatives become standard parts of difference quotients with infinitesimal increments. The method has produced new results — for instance Bernstein and Robinson's 1966 invariant subspace theorem for polynomially compact operators (later given a standard proof by Halmos). Compare with ε\varepsilon–δ\delta real analysis: the two are interchangeable by transfer, but the nonstandard proofs are often shorter.

Topology— Compactness is compactness

The compactness theorem is literally the compactness of a space. The Lindenbaum algebra Bn(T)B_n(T) of formulas in nn variables modulo TT-equivalence is a Boolean algebra, and its Stone space — the space of ultrafilters of Bn(T)B_n(T) — is Sn(T)S_n(T), a compact, Hausdorff, totally disconnected space. Isolated points are the principal types. The omitting types theorem (for countable languages: a countable complete theory has a countable model omitting any given non-isolated type) is proved with the Baire category theorem, and countable models of countable theories are studied through the topology of Sn(T)S_n(T) — for example, a complete theory in a countable language with infinite models is ℵ0\aleph_0-categorical iff every Sn(T)S_n(T) is finite (Engeler, Ryll-Nardzewski, Svenonius, 1959). See point-set topology.

Category theory— Ultraproducts as colimits

An ultraproduct is a colimit of products: ∏iMi/U≅colim⁡A∈U∏i∈AMi\prod_i M_i / U \cong \operatorname{colim}_{A \in U} \prod_{i \in A} M_i, the colimit taken over UU ordered by reverse inclusion along the restriction maps. Since UU is closed under intersections, this is a filtered colimit. That much works for any filter and produces the reduced product, which preserves Horn sentences such as the axioms of groups and rings; maximality of UU is what lets negations, and hence all first-order sentences, pass through. The pair (Th,Mod)(\mathrm{Th}, \mathrm{Mod}) is a Galois connection — an adjunction between posets — and categorical logic generalises models from structures in Set\mathbf{Set} to structures in other categories (see categorical logic).

History & global context

History and global context

  • Foundations (1915–1936). Leopold Löwenheim (1915) and Thoralf Skolem (1920, 1922) proved the first downward Löwenheim–Skolem theorems. Kurt Gödel's completeness theorem (1929 thesis, published 1930) included compactness for countable languages; Anatolii Malcev extended compactness to arbitrary languages (1936) and applied it to group theory (1941). Alfred Tarski gave the mathematical definition of truth in a structure (1933).
  • Quantifier elimination (1930s–1950s). Tarski found quantifier elimination for real closed fields around 1930; his decision method was published by the RAND Corporation in 1948 (revised 1951). Abraham Robinson introduced model completeness and applied it to algebra in the 1950s. Robert Vaught and Jerzy Łoś independently found the Łoś–Vaught test (1954).
  • Ultraproducts and games. Jerzy Łoś proved his theorem in 1955 in Poland; ultraproducts became a central tool through work of Frayne, Morel, Scott, Keisler and Kochen. Roland Fraïssé (1954) and Andrzej Ehrenfeucht (1961) introduced back-and-forth systems and games.
  • Applications (1960s). Robinson created nonstandard analysis (1961; book 1966). James Ax and Simon Kochen (1965), and independently Yuri Ershov in Novosibirsk, proved the transfer theorem for pp-adic fields. Ax proved the Ax–Grothendieck theorem by model theory (1968–69); Alexander Grothendieck proved it independently in EGA IV (1966).
  • Stability and beyond. Michael Morley's categoricity theorem (1965) — a countable theory categorical in one uncountable cardinal is categorical in all — launched Saharon Shelah's classification theory (book 1978). Later geometric model theory, through Boris Zilber, Ehud Hrushovski (whose 1996 proof of the function-field Mordell–Lang conjecture used model theory), Anand Pillay and many others, made model theory a working tool in algebraic and arithmetic geometry.
Further reading

Further reading

  • David Marker, Model Theory: An Introduction (2002) — the standard graduate text; QE for ACF and DLO in chapter 3, ultraproducts in chapter 2 exercises and in many applications.
  • Katrin Tent and Martin Ziegler, A Course in Model Theory (2012) — concise and modern.
  • Wilfrid Hodges, Model Theory (1993), and its abridgement A Shorter Model Theory (1997).
  • C. C. Chang and H. J. Keisler, Model Theory (1973; 3rd edition 1990) — the classic reference, especially for ultraproducts.
  • Lou van den Dries, Tame Topology and o-minimal Structures (1998).
  • Leonid Libkin, Elements of Finite Model Theory (2004) — Ehrenfeucht–Fraïssé games and their limits.
  • Robert Goldblatt, Lectures on the Hyperreals (1998) — nonstandard analysis via ultrapowers.

Next steps in the Lumenary: forcing and independence, which builds new models of set theory; Gödel's incompleteness theorems; and algebraic geometry.