Proof of Birkhoff's completeness theorem with the term model full
This proof shows: statement.
Fix a signature Σ, a set of variables V and a set E of equations between terms of T(Σ,V). Algebras have non-empty carriers. For a Σ-algebra A with carrier A and an assignment α:V→A, the value [[t]]α of a term is defined by [[x]]α=α(x) and [[f(t1,…,tn)]]α=fA([[t1]]α,…,[[tn]]α). A satisfies s≈t if [[s]]α=[[t]]α for every α, and E⊨s≈t means that every algebra that satisfies all equations of E satisfies s≈t. The relation ≈E is the least relation that contains E and is closed under reflexivity, symmetry, transitivity, congruence and substitution; see equational theory, where it is also shown that ≈E is the conversion ↔E∗.
Theorem. E⊨s≈t iff s≈Et.
Substitution lemma
Lemma 1. For every algebra, assignment α, substitution σ and term t: [[tσ]]α=[[t]]β, where β(x)=[[xσ]]α.
Proof. Induction on t. For a variable x, both sides are [[xσ]]α. For t=f(t1,…,tn), [[tσ]]α=fA([[t1σ]]α,…)=fA([[t1]]β,…)=[[t]]β by the induction hypothesis. ■
Soundness
Lemma 2. If s≈Et, then E⊨s≈t.
Proof. Let A satisfy E. We show by induction on a derivation of s≈Et that A satisfies s≈t. Equations of E hold by assumption. Reflexivity, symmetry and transitivity hold because equality of values is an equivalence relation, for each fixed α. For congruence, if [[si]]α=[[ti]]α for all i, then applying fA to both lists gives equal values. For substitution, assume A satisfies s≈t, and let α be an assignment. With β(x)=[[xσ]]α, Lemma 1 gives [[sσ]]α=[[s]]β=[[t]]β=[[tσ]]α. ■
Completeness
Write ∼ for ≈E and [t] for the class of t in T(Σ,V)/∼.
The term model. Let Q have carrier T(Σ,V)/∼ and operations fQ([t1],…,[tn])=[f(t1,…,tn)]. This is well-defined: if ti∼ti′ for all i, then f(t1,…,tn)∼f(t1′,…,tn′) by congruence. The carrier is not empty when V is not empty or Σ has a constant; we assume one of these, which holds whenever s and t exist.
Lemma 3. Let α be an assignment into Q and let σ be a substitution with [xσ]=α(x) for every variable x of a term t. Then [[t]]α=[tσ].
Proof. Induction on t. For a variable x, [[x]]α=α(x)=[xσ]. For t=f(t1,…,tn), [[t]]α=fQ([t1σ],…,[tnσ])=[f(t1σ,…,tnσ)]=[tσ]. ■
Lemma 4. Q satisfies every equation of E.
Proof. Let l≈r∈E and let α be an assignment into Q. Pick a representative xσ∈α(x) for each of the finitely many variables of l and r, and xσ=x elsewhere. By Lemma 3, [[l]]α=[lσ] and [[r]]α=[rσ]. Since l∼r, the substitution rule gives lσ∼rσ, so the two values are equal. ■
Lemma 5. If E⊨s≈t, then s≈Et.
Proof. By Lemma 4, Q is a model of E, so it satisfies s≈t. Take the assignment α(x)=[x] and the identity substitution, which satisfies the condition of Lemma 3. Then [s]=[[s]]α=[[t]]α=[t], that is, s∼t. ■
Lemmas 2 and 5 prove the theorem. ■
Remarks. The proof shows more: Q alone decides all consequences of E, since E⊨s≈t iff Q satisfies s≈t under the assignment x↦[x]. Q is the free algebra of the class of models of E over the generators V. The substitution rule was used in Lemma 4 to make Q a model of E; a relation closed only under the first four rules gives a quotient in which the equations of E may fail for some assignments. In many-sorted equational logic, where a sort may have no elements, transitivity through a middle term with a variable of an empty sort is unsound, so there the rules must record the variables in use.