Lectures onType Theory
Chapter 146
Chapter 146Core route

Algebraic Syntax, CwFs, and Initiality

Every binder forces the same substitution calculation: variables shift, successive replacements compose, and extending a context adds one final component. As long as substitution remains an operation outside the syntax, each new type former requires those facts to be proved again. Put the replacement operations into the language itself and impose the equations that the repeated calculations establish. The construction succeeds if assigning meanings to the primitive operations then determines the meaning of every well-formed expression, with no choice left over.

The substitution calculus

We replace named variables by two combinators (p for weakening, q for the last variable) and close substitutions under composition; every equation that definition 26.22 proves about the calculus becomes a rule of the calculus.

For example, if Γa:A and Δγ:Γ, the new syntax contains a[γ] at type A[γ]. A further substitution Ξδ:Δ must satisfy a[γ][δ]a[γδ]. This equation is the reason composition belongs to the syntax.

Definition 54.2 — The substitution calculus

Fix a finitary dependent signature S. It consists of disjoint sets Sty and Stm of type and term operation symbols. Each symbol comes with a finite metavariable telescope. Every metavariable is a type or term judgment in a context formed by finitely many explicit extensions, and each classifier may mention only earlier metavariables. A type symbol has a type-judgment schema as output; a term symbol has a term-judgment schema whose classifier is built from the preceding inputs. These data fix the arity, binding depth, sorts, and output boundary of every operation before any raw expression is formed. Equations are additional rules and are not part of the grammar.

The substitution calculus over S is the explicit multi-sorted algebraic syntax whose operations make substitution uniform for contexts, types, terms, and substitutions.

Convention 54.1 — Scope of the algebraic notation

In this definition, A[γ] is an explicit algebraic constructor, together with id, , p, q, γ,a, and γ+. In the named syntax of definition 26.1, A[a/x] remains the capture-avoiding meta-operation. No judgment uses both forms.

Raw syntax. Contexts, substitutions, types and terms are generated by the grammar Γ,Δ::=Γ.Aγ,δ::=idγδpγ,aA,B::=A[γ]F(A;a)a,b,f::=qa[γ]g(A;a). Here F ranges over Sty and g over Stm. The metavectors contain exactly the input telescope prescribed by the selected symbol, so the language is fixed by S rather than extended by metavariable choice. No particular type former is present in the generic calculus. The first concrete instance, with Π, is specified in definition 54.9; the full Π/Σ/Id/U instance is fixed only after definition 54.24, by definition 116.28. There are no variable names and no binders: λ(A,b) binds nothing; A is its raw domain annotation, and the body b lives in an extended context. This is the algebraic counterpart of λ(x:A).b.

Judgment forms. Besides the five judgment forms of the named theory (cf. definition 26.22), there is a judgment Δγ:Γ (“γ is a substitution from Δ to Γ”), presupposing Δ ctx and Γ ctx, and its equality form Δγγ:Γ, presupposing that both sides are substitutions from Δ to Γ (convention 26.14 applies verbatim). There is no context-equality judgment (remark 54.4).

Rules. Premises are compressed according to convention 26.14.

(a) Contexts.

 ctx
Ctx-Emp
Γ ctxΓA type
Γ.A ctx
Ctx-Ext

(b) Action on types and terms. A substitution moves types and terms from its codomain to its domain:

Δγ:ΓΓA type
ΔA[γ] type
Sb-Ty
Δγ:ΓΓa:A
Δa[γ]:A[γ]
Sb-Tm

(c) Category structure.

Γ ctx
Γid:Γ
Sb-Id
Γ2γ1:Γ1Γ1γ0:Γ0
Γ2γ0γ1:Γ0
Sb-Comp
Δγ:Γ
Δidγγ:Γ
Sb-IdL
Δγ:Γ
Δγidγ:Γ
Sb-IdR
Γ3γ2:Γ2Γ2γ1:Γ1Γ1γ0:Γ0
Γ3(γ0γ1)γ2γ0(γ1γ2):Γ0
Sb-Assoc

(d) Functoriality of the action. Substituting by id is the identity, and substituting by a composite is iterated substitution:

ΓA type
ΓA[id]A type
Ty-Id
Γa:A
Γa[id]a:A
Tm-Id
Γ2γ1:Γ1Γ1γ0:Γ0Γ0A type
Γ2A[γ0γ1]A[γ0][γ1] type
Ty-Comp
Γ2γ1:Γ1Γ1γ0:Γ0Γ0a:A
Γ2a[γ0γ1]a[γ0][γ1]:A[γ0γ1]
Tm-Comp

The conclusion of Tm-Id is meta-well-typed only because of Ty-Id: a priori a[id] has type A[id], and the type equality allows it to be compared with a at type A via the conversion rule of definition 26.22. Equations and typing rules cannot be disentangled in dependent type theory.

(e) Weakening and the zeroth variable.

ΓA type
Γ.Ap:Γ
Sb-Wk
ΓA type
Γ.Aq:A[p]
Tm-Vz

A variable is a term of the form q[pk], where pk is the k-fold composite (p0:=id); the number k is its de Bruijn index.

(f) The empty context is terminal.

Γ ctx
Γ:
Sb-Emp
Γδ:
Γδ:
Sb-Emp-Uniq

(g) Substitution extension. A substitution into Γ.A is a substitution into Γ together with a term of the instantiated type A:

Δγ:ΓΓA typeΔa:A[γ]
Δγ,a:Γ.A
Sb-Ext
Δγ:ΓΓA typeΔa:A[γ]
Δpγ,aγ:Γ
Ext-Wk
Δγ:ΓΓA typeΔa:A[γ]
Δq[γ,a]a:A[γ]
Ext-Vz
ΓA typeΔγ:Γ.A
Δγpγ,q[γ]:Γ.A
Ext-Uniq

Convention 54.3 — Equality closure

As in definition 26.22, each equality judgment of definition 54.2 is closed under reflexivity, symmetry and transitivity; every operation of the calculus is a congruence; and typing is closed under conversion: from Γa:A and ΓAB type infer Γa:B, and judgmentally equal contexts may be exchanged in any judgment. We use these closure rules whenever a displayed equality changes the type of a term.

Remark 54.4

No context-equality judgment is postulated because none is needed: two contexts can only be equal by having pairwise judgmentally equal types, and this relation is generated by the congruence closure of convention 54.3. If AA type then .A and .A are interchangeable in every judgment.

Remark 54.5 — Direction of substitutions

A substitution Δγ:Γ points from Δ to Γ, while types and terms travel the other way, from Γ to Δ (Sb-Ty, Sb-Tm). Logically: γ proves every hypothesis of Γ from the hypotheses of Δ, so whatever holds under Γ holds under Δ. The action AA[γ] is contravariant, as with preimages.

Remark 54.6 — Derivable, not admissible

In this calculus substitution is derivable: the rules Sb-Ty and Sb-Tm belong to the system, and the group (d), (g) equations say how substitution computes. Under the named presentation, stability under substitution is admissible: it is a theorem proved by rule induction (the pattern of theorem 2.16) and can break when rules are added. Here an added former admits substitution only when its signature includes an equation commuting that former with [γ]. For dependent products the required type equation is Π(A,B)[γ]Π(A[γ],B[γ+]).

Example 54.7 — A derivation tree

Let A type and .AB type. The variable of type A in the context .A.B is q[p]:

.AB type
.A.Bp:.A
Sb-Wk
A type
.Aq:A[p]
Tm-Vz
.A.Bq[p]:A[p][p]
Sb-Tm

Definition 54.8 — Lifting

For Δγ:Γ and ΓA type, the lift of γ by A is γ+:=γp,q,Δ.A[γ]γ+:Γ.A. Well-typedness: Δ.A[γ]q:A[γ][p] by Tm-Vz, and A[γ][p]A[γp] by Ty-Comp, as Sb-Ext requires. The lift leaves the zeroth variable alone and applies γ to the rest of the context; it is what “capture-avoiding” becomes when there is nothing to capture.

Type formers in algebraic dress

A Π-structure on the substitution calculus consists of formation, abstraction, application, computation, and uniqueness operations together with their substitution equations. The same pattern defines the Σ, identity, and universe structures used by theorem 54.27. We first give the Π-operations in full (convention 27.1).

Definition 54.9 — Π in the substitution calculus

The rules of definition 27.2, transposed:

ΓA typeΓ.AB type
ΓΠ(A,B) type
Pi-Form
Γ.Ab:B
Γλ(A,b):Π(A,B)
Pi-Intro
Γf:Π(A,B)Γa:A
Γapp(f,a):B[id,a]
Pi-Elim
Γ.Ab:BΓa:A
Γapp(λ(A,b),a)b[id,a]:B[id,a]
Pi-Beta
Γf:Π(A,B)
Γfλ(A,app(f[p],q)):Π(A,B)
Pi-Eta
Δγ:ΓΓA typeΓ.AB type
ΔΠ(A,B)[γ]Π(A[γ],B[γ+]) type
Pi-Sb
Δγ:ΓΓ.Ab:B
Δλ(A,b)[γ]λ(A[γ],b[γ+]):Π(A,B)[γ]
Lam-Sb
Δγ:ΓΓf:Π(A,B)Γa:A
Δapp(f,a)[γ]app(f[γ],a[γ]):B[γ,a[γ]]
App-Sb

The substitution id,a in Pi-Elim instantiates the zeroth variable of B by a and leaves Γ fixed: it is the algebraic form of B[a/x]. The right-hand side of Lam-Sb is well-typed by Pi-Sb — the same intertwining as in group (d) of definition 54.2.

Lemma 116.10 — Extension commutes with substitution

Suppose Ξδ:Δ, Δγ:Γ, and Δa:A[γ]. Then Ξγ,aδγδ,a[δ]:Γ.A.

Proof of Lemma 116.10 — Extension commutes with substitution

Proof. Apply Ext-Uniq to the left-hand side. Its weakening component is p(γ,aδ)=SbAssoc(pγ,a)δ=ExtWkγδ. Its variable component is q[γ,aδ]TmCompq[γ,a][δ]ExtVza[δ]. The extension reconstructed from these two components is the right-hand side of the asserted equality. ◻

Exercise 54.1

★★☆ Reconstruct lemma 116.10 without reading its proof. In particular, identify the one category equation and the one term equation needed to simplify the two components given by Ext-Uniq.

Exercise 54.2

★★☆ Show Γ.Aid+id:Γ.A and, for composable γ, δ, that (γδ)+γ+δ+, where the lifts are taken at the appropriate instances of A. (Use lemma 116.10.)

Exercise 54.3

★★☆ Verify that App-Sb is meta-well-typed: show that both sides are terms of type B[γ,a[γ]], exhibiting each rule and equation used. In particular show γ+id,a[γ]γ,a[γ].

Exercise 54.4

★★☆ Show that the general variable rule is derivable: if ΓA type and B1,,Bk successively extend Γ.A, then Γ.A.B1.Bkq[pk]:A[pk+1], generalizing example 54.7.

Translation between named and algebraic syntax

Let TΠΣIdU denote the finitary named fragment of chapter 26chapter 30 generated by the structural rules, Π-, Σ-, and intensional identity types, and the displayed predicative universe hierarchy. Its algebraic presentation has the same signature SΠΣIdU as theorem 54.27. We give a forward translation covering that whole signature. Its converse is proved only for the structural-plus-Π subsignature, whose substitution-normalization proof is fully displayed; the larger converse is not used for soundness or initiality.

Construction 54.10 — Desugaring

Define a translation () from the named raw syntax of definition 26.1 to the algebraic raw syntax, by recursion:

named algebraic
x1:A1,,xn:An (context) .A1..An
xnk (declared k entries from the right) q[pk]
x:AB Π(A,B)
x:AB Σ(A,B)
λ(x:A).b λ(A,b)
fa app(f,a)
B[a/x] (x the last variable) B[id,a]
weakening by x:A [p]

The variable clause is relative to the ambient context: (xi) in the context x1:A1,,xn:An is q[pni]. The type clause for Ai is computed in the context x1:A1,,xi1:Ai1; the body B of a Π-type in the context extended by x:A. The same extended-context clause is used for Σ: if Γ,x:AB type, then Σ(A,B) is formed from ΓA type and Γ.AB type. Identity types translate by IdA(a,b)IdA(a,b); the remaining nonbinding constructors translate recursively. The named domain annotation becomes the first argument of the algebraic abstraction. Conversely, reconstruction copies that argument back into λ(x:A).b, normally printed λx.b.

Example 54.11

In the empty context, with U a universe (definition 29.1) and El its decoding, (λx.λy.y)=λ(U,λ(El(q),q)):Π(U,Π(El(q),El(q[p]))). the algebraic type of the polymorphic identity function. The inner occurrence of x costs one weakening because a declaration (y) has intervened; the named syntax hides exactly this bookkeeping.

Lemma 54.12 — Substitution elimination

In the structural substitution calculus extended by exactly the Π operations and equations of definition 54.9, every derivable algebraic context, substitution, type, and term is judgmentally equal to one in substitution-normal form: substitutions are extension lists, and the action [γ] in a type or term occurs only in subterms of the shape q[pk].

Proof of Lemma 54.12 — Substitution elimination

Proof. Put vk:=q[pk]. A normalized substitution from Δ to x1:A1,,xm:Am is the typed extension list [a1,,am]:=,a1,a2,am. Let varsΓ=[vm1,,v0] for a context of length m, and let shift increment every free de Bruijn index in a normal expression.

Define normalizers NΓ,NS,NT,Nt on derivable contexts, substitutions, types, and terms by NΓ()=,NΓ(Γ.A)=NΓ(Γ).NT(A),NS()=[],NS(idΓ)=varsΓ,NS(pΓ,A)=shift(varsΓ),NS(γ,a)=NS(γ),Nt(a),NS(γδ)=C[NS(γ),NS(δ)],NT(A[γ])=ET[NT(A),NS(γ)],Nt(a[γ])=Et[Nt(a),NS(γ)]. They preserve all other constructors recursively. In particular, NT(Π(A,B))=Π(NT(A),NT(B)),Nt(λ(A,b))=λ(NT(A),Nt(b)),Nt(app(f,a))=app(Nt(f),Nt(a)).

The hereditary action E looks up variables and distributes through constructors. For γ=[a1,,am], Et[vk,γ]=amk(0k<m),lift(γ)=[shift(a1),,shift(am),v0]. Its binding clauses are ET[Π(A,B),γ]=Π(ET[A,γ],ET[B,lift(γ)]),Et[λ(A,b),γ]=λ(ET[A,γ],Et[b,lift(γ)]),Et[app(f,a),γ]=app(Et[f,γ],Et[a,γ]). Atomic constants are fixed and every nonbinding argument is acted on recursively. Composition is pointwise hereditary action: C[[a1,,am],δ]=[Et[a1,δ],,Et[am,δ]],C[[],δ]=[]. The lookup equations are Ext-Vz and iterated Ext-Wk; list composition is lemma 116.10; and the normal form of the algebraic lift γ+=pγ,q is the displayed lift(γ).

This mutual recursion is well founded. In E[e,γ] use the proper-subexpression order on e, followed at a variable by its index and the list length. In C[γ,δ] use the length of γ; each entry calls E on its own proper expression tree. The fusion equation E[E[a,γ],δ]=E[a,C[γ,δ]] is then proved, rather than used as a recursive clause, by induction on a. The variable case is list lookup; the binder case uses lift(C[γ,δ])=C[lift(γ),lift(δ)]; application uses its two induction hypotheses.

Simultaneous induction on a derivation proves that N preserves all presupposed indices, that every input is judgmentally equal to its normal form, and that judgmentally equal inputs have the same normal form. For substitutions, identity and weakening use vars and shifted vars; the empty substitution is []; extension appends one term; and composition uses C. The category equations become equality of lists by fusion. The extension equations become last-entry lookup, prefix lookup, empty-list uniqueness, and reconstruction from a prefix and final entry. The type and term action equations are the defining clauses of E; Pi-Sb, Lam-Sb, and App-Sb are its three constructor cases. For every equality-closure rule, its premise identifies inputs with the same normal form, so its conclusion does as well.

Thus every derivable object is equal to its normal form. Its substitutions are extension lists, and every remaining action in a type or term lies in a variable vk, as required. ◻

Theorem 54.13 — Equivalence of the presentations

The translation of construction 54.10 has the following exact scope:

  1. if the judgments Γ ctx,ΓA type,Γa:A are derivable in TΠΣIdU, then their translations are derivable in the substitution calculus, and judgmental equalities are preserved;

  2. in the structural-plus-Π subsignature, every algebraic context, type, term, or equality judgment is, up to judgmental equality, the translation of a named one; and if two named judgments have judgmentally equal translations, then after α-renaming their named expressions are judgmentally equal;

  3. in that same subsignature, meta-substitution becomes composition: (b[a/x])b[id,a] whenever Γ,x:Ab:B and Γa:A.

Proof of Theorem 54.13 — Equivalence of the presentations

Proof. Translation preserves judgments. Induct on the named derivation. The structural cases use the action, weakening, and extension rules of definition 54.2. For the binder case, a premise Γ,x:Ab:B translates to Γ.Ab:B, so Pi-Intro gives Γλ(A,b):Π(A,B), the translation of Γλ(x:A).b:x:AB. The Σ binder uses the same extended-context premise, while identity cases translate their arguments recursively. The same induction carries the substitution invariant used in clause (3): translating a named substitution into the last variable agrees judgmentally with algebraic substitution extension. Thus it proves clause (1). No normalization or reconstruction theorem is used in this direction.

Reconstruction. By lemma 54.12, every algebraic object has a substitution-normal representative. Reconstruct named syntax simultaneously for contexts, substitutions, types, and terms. Choose fresh context names from left to right. The variable q[pk] becomes the variable declared k places from the right. In particular, λ(A,b):=λ(x:A).b, where x is fresh and b is reconstructed in Γ,x:A. An extension-list substitution becomes the corresponding simultaneous named substitution. Call the resulting operation ().

Induction on normal syntax gives ((e))=αe,(d)d. The variable round trips are Ext-Vz and Ext-Wk. For an abstraction, the fresh name chosen in reconstruction may differ from the original name, but lifting leaves the new last variable fixed; hence the first equation holds up to α-equivalence and the second holds judgmentally. Induction on an algebraic derivation now gives the reconstructed context, type, or term judgment for every premise and conclusion. Applying () to an equality between two translations proves faithfulness. This establishes clause (2).

Meta-substitution becomes composition. Put σ:=id,a. Simultaneous induction on b and its type proves (b[a/x])b[σ]. The variable cases are Ext-Vz and Ext-Wk. If b=λ(y:C).c, with y fresh for a, the induction hypothesis in the extended context gives (c[a/x])c[σ+]. Therefore Lam-Sb gives ((λ(y:C).c)[a/x])λ(C[σ],c[σ+])λ(C,c)[σ]. The nonbinding former cases use their displayed substitution equations. This proves clause (3) and completes the simultaneous argument required in clause (1). ◻

Remark 54.14

The full named signature translates soundly to the algebraic presentation; the converse equivalence established here is the structural-plus-Π case of theorem 54.13. The named syntax remains the default presentation. The algebraic presentation is needed here because quotienting its explicit substitution equations makes contexts, substitutions, types, and terms into CwF data by construction. Nothing below uses a converse translation for Σ, identity, or universe syntax.

Exercise 54.5

★☆☆ Compute (λx.λy.x) and its algebraic type, for ΓA type and ΓB type with λx.λy.x:x:Ay:BA (B not depending on x). Where do the weakenings appear?

Exercise 54.6

★★☆ Prove clause (3) of theorem 54.13 for the fragment generated by variables, λ and application, by induction on b.

Exercise 54.7

★☆☆ Let Γ=(f:AB,x:A) and let σ=[g,a]:ΔΓ, with g:AB and a:A in Δ. Use the clauses in lemma 54.12 to normalize app(v1,v0)[σ]. Then lift σ under a fresh y:C and compute the images of v0,v1,v2 separately.

Categories with families

The substitution rules have the shape of functions between collections of judgments. Their identity and composition equations require the following small semantic interface.

Convention 116.16 — Categorical interface used in this chapter

A category has objects, identity arrows, associative composition, and the two unit laws. A functor preserves those data and equations; the opposite category Cop reverses arrows. An object 1 is terminal when every object has exactly one arrow to it. A commuting square is a pullback when every pair of arrows into its lower-left and upper-right corners with equal composites factors through its upper-left corner in exactly one way. An isomorphism is an arrow with a two-sided inverse. These descriptions are the complete interface used below; no result from a separate category-theory chapter is needed.

Convention 116.17 — Ambient semantic metatheory

The syntax quotients and categories from this point through the initiality theorem are external sets in the ambient ZFC metatheory of convention 48.28. Their construction uses no inaccessible cardinal, and no soundness or underivability claim is internal to the object theory.

Read definition 54.2 semantically — sets for judgments, functions for rules, equality for judgmental equality — and the result is a piece of category theory.

Definition 54.15 — Families of sets

The category Fam has as objects pairs (X,(Ux)xX) of a set X and an X-indexed family of sets, and as morphisms (X,U)(Y,V) pairs (f,g) of a function f:XY and a family of functions gx:UxVf(x).

Definition 54.16 — Category with families

A category with families (CwF) consists of:

  1. a category C with a chosen terminal object 1; its objects are called contexts (Γ,Δ,) and its morphisms substitutions;

  2. for each context Γ a set Ty(Γ) of types, and for each γ:ΔΓ a function [γ]:Ty(Γ)Ty(Δ), functorially: A[id]=A and A[γδ]=A[γ][δ];

  3. for each Γ and ATy(Γ) a set Tm(Γ,A) of terms, and for each γ:ΔΓ a function [γ]:Tm(Γ,A)Tm(Δ,A[γ]), functorially: a[id]=a and a[γδ]=a[γ][δ];

  4. comprehension: for each Γ and ATy(Γ), a context Γ.A, a substitution pA:Γ.AΓ and a term qATm(Γ.A,A[pA]), universal: for every γ:ΔΓ and aTm(Δ,A[γ]) there is a unique γ,a:ΔΓ.A with pAγ,a=γ,qA[γ,a]=a.

Equivalently (and this is Dybjer’s original formulation), items 2–3 are a functor T:CopFam. It sends Γ to (Ty(Γ),ATm(Γ,A)) and γ to reindexing by γ; identity and composition in Fam unfold exactly to the four displayed substitution equations.

The first model is already concrete. Given a set Γ, take Ty(Γ) to be set-valued families on Γ, take Tm(Γ,A) to be sections x:ΓA(x), and reindex both families and sections by precomposition. Comprehension is the dependent sum x:ΓA(x), with first projection and second component. The two displayed equations of definition 54.16 are then ordinary equations of functions; proposition 54.31 verifies the full structure.

The definition is definition 54.2 read backwards. The dictionary is exact, rule by rule:

datum of a CwF judgment form / rule
ΓC Γ ctx
γC(Δ,Γ) Δγ:Γ
ATy(Γ) ΓA type
aTm(Γ,A) Γa:A
equality of the above the four equality judgments
composition, identities Sb-Comp, Sb-Id, Sb-IdL/R, Sb-Assoc
functoriality of T Ty-Id, Ty-Comp, Tm-Id, Tm-Comp
terminal object 1 Ctx-Emp, Sb-Emp, Sb-Emp-Uniq
comprehension Γ.A Ctx-Ext
pA, qA Sb-Wk, Tm-Vz
existence of γ,a Sb-Ext
its two equations Ext-Wk, Ext-Vz
its uniqueness Ext-Uniq

Remark 54.17

Judgmental equality is modeled by equality of sets’ elements, not by isomorphism. All equations of definition 54.16 (and of the type-former structures below) are strict. This is what makes CwFs match syntax on the nose; the price is paid when connecting them to naturally occurring categorical structures, where everything holds only up to isomorphism and a coherence theorem is needed (cf. the biequivalence theorems of Clairambault–Dybjer [CCD21] and the local-universes construction [AG26]). For example, if reindexing is implemented by chosen pullbacks, the two objects representing (A[γ])[δ] and A[γδ] come with a canonical isomorphism from the pullback universal property, but need not be literally the same chosen object. A strict CwF requires this comparison to be equality and requires the identity and associativity comparisons to cohere.

Lemma 54.18 — Terms are sections

In any CwF there is a bijection between Tm(Γ,A) and the set of sections of pA, i.e. substitutions γ:ΓΓ.A with pAγ=id, given by aa:=id,a.

Proof of Lemma 54.18 — Terms are sections

Proof. If aTm(Γ,A)=Tm(Γ,A[id]) then a:ΓΓ.A is defined, and pAa=id by the first comprehension equation. Conversely a section γ yields qA[γ]Tm(Γ,A[pA][γ])=Tm(Γ,A[pAγ])=Tm(Γ,A) by functoriality. The composites are the identities: qA[a]=a is the second comprehension equation, and qA[γ]=pAγ,qA[γ]=γ by uniqueness of ,. ◻

Definition 54.19 — Semantic lifting

For γ:ΔΓ and ATy(Γ), set γ+:=γpA[γ],qA[γ]:Δ.A[γ]Γ.A, exactly as in definition 54.8.

Lemma 54.20 — Comprehension is a pullback

For every γ:ΔΓ and ATy(Γ) the square Mathematical diagramDiagram commutes and is a pullback in C.

Proof of Lemma 54.20 — Comprehension is a pullback

Proof. By the first comprehension equation and associativity, pAγ+=pAγpA[γ],qA[γ]=γpA[γ], so the square commutes.

Let δ:ΞΔ and σ:ΞΓ.A satisfy γδ=pAσ. Functoriality gives qA[σ]Tm(Ξ,A[γ][δ]), because A[pA][σ]=A[pAσ]=A[γδ]. Hence the candidate mediator is h:=δ,qA[σ]:ΞΔ.A[γ]. The first triangle is the first comprehension equation. For the second, lemma 116.10 and the two comprehension equations give γ+h=γδ,qA[σ]=pAσ,qA[σ]=σ.

If h satisfies the same triangles, comprehension uniqueness first gives h=δ,q[h]. Reindexing qA along γ+h=σ and using Tm-Comp and the second comprehension equation gives q[h]=qA[σ]. Thus h=h. ◻

The pullback calculation shows the fact used below: comprehension represents terms after reindexing. A map into Γ.A is uniquely a map γ into Γ together with a term of A[γ].

Exercise 54.8

★★☆ Spell out the equivalence between items 2–3 of definition 54.16 and a functor T:CopFam: define T on objects and morphisms and show that the functor laws are exactly the four displayed equations.

Exercise 54.9

★★☆ Show that comprehensions are unique up to unique isomorphism: if (Γ.A,p,q) and (E,p,q) both satisfy item 4 of definition 54.16 for the same Γ, A, there is a unique isomorphism Γ.AE commuting with the projections and generic terms.

Exercise 54.10

★★☆ Reconstruct lemma 54.20 from the CwF equations. Given δ:ΞΔ and σ:ΞΓ.A with γδ=pAσ, start from δ,qA[σ] and check the two triangles before proving uniqueness.

Type-former structure on a CwF

A CwF models only the backbone of type theory. Each selected former becomes an extra structure on a CwF: the same operations as the rules, the same equations, plus strict stability under substitution. We give Π, Σ, Id and universes. Adding an inductive former requires a separately displayed algebraic operation and all of its equations.

Definition 54.21 — Π -structure

A CwF supports Π-types if for all Γ, ATy(Γ) and BTy(Γ.A) there are a type Π(A,B)Ty(Γ), an operation λ:Tm(Γ.A,B)Tm(Γ,Π(A,B)), and an operation assigning to fTm(Γ,Π(A,B)) and aTm(Γ,A) a term app(f,a)Tm(Γ,B[id,a]), subject to, for all γ:ΔΓ and appropriately typed arguments, app(λ(b),a)=b[id,a],f=λ(app(f[pA],qA)),Π(A,B)[γ]=Π(A[γ],B[γ+]),λ(b)[γ]=λ(b[γ+]),app(f,a)[γ]=app(f[γ],a[γ]). The η-equation typechecks because the comprehension equations give (pA)+id,qA=id: the weakening component is pA, the variable component is qA, and comprehension uniqueness identifies the resulting extension with id. Here λ is a typed CwF operation: its source already records A. Only the raw substitution-calculus constructor needs the explicit notation λ(A,b).

Definition 54.22 — Σ -structure

A CwF supports Σ-types if for all Γ, ATy(Γ), BTy(Γ.A) there are a type Σ(A,B)Ty(Γ) and operations (a,b)Tm(Γ,Σ(A,B)),pr1(c)Tm(Γ,A),pr2(c)Tm(Γ,B[id,pr1(c)]). Here aTm(Γ,A), bTm(Γ,B[id,a]), cTm(Γ,Σ(A,B)), subject to pr1(a,b)=a, pr2(a,b)=b, (pr1(c),pr2(c))=c, and strict stability: Σ(A,B)[γ]=Σ(A[γ],B[γ+]), (a,b)[γ]=(a[γ],b[γ]), pri(c)[γ]=pri(c[γ]).

Definition 54.23 — Id-structure

A CwF supports intensional identity types if:

  1. for all Γ, ATy(Γ) and a,bTm(Γ,A) there is a type IdA(a,b)Ty(Γ) with IdA(a,b)[γ]=IdA[γ](a[γ],b[γ]);

  2. for each a there is reflaTm(Γ,IdA(a,a)) with refla[γ]=refla[γ];

  3. writing ΓA:=Γ.A.A[p] for the context of pairs, IA:=IdA[pp](q[p],q)Ty(ΓA) for the generic identity type, δA:=id,q:Γ.AΓA for the diagonal, and rA:=δA,reflq:Γ.AΓA.IA. This is well typed because IA[δA]=IdA[p](q,q). For every CTy(ΓA.IA) and dTm(Γ.A,C[rA]) there is a term J(C,d)Tm(ΓA.IA,C),J(C,d)[rA]=d, stable under substitution. For γ:ΔΓ, let γA[2]:ΔA[γ]ΓA be the two successive lifts through the two copies of A, and let γA[3]:ΔA[γ].IA[γ]ΓA.IA be its lift through the identity type. Then J(C,d)[γA[3]]=J(C[γA[3]],d[γ+]).

The pointwise eliminator of definition 30.1 is recovered by substituting the concrete triple (a,b,p) into J(C,d) with id,a,b,p. In particular, J(C,d)[id,a,b,p]Tm(Γ,C[id,a,b,p]). Reindexing the displayed stability equation gives its substitution law, and J(C,d)[rA]=d gives the reflexive computation rule.

Definition 54.24 — Universe structure

A CwF supports the selected predicative hierarchy when, for every i and context Γ, it has a stable type UiTy(Γ) and a stable decoding operation El()i(c)Ty(Γ)(cTm(Γ,Ui)),Ui[γ]=Ui,El()i(c)[γ]=El()i(c[γ]). The exact code operations required by SΠΣIdU are Πi(c,d), Σi(c,d):Uic:Ui,d:Ui over Γ.El()i(c),Idi(c,a,b):Uic:Ui,a,b:El()i(c),Ui:Ui+1. Their decoding equations are respectively El()i(Πi(c,d))=Π(El()i(c),El()i(d)),El()i(Σi(c,d))=Σ(El()i(c),El()i(d)),El()i(Idi(c,a,b))=IdEl()i(c)(a,b),El()i+1(Ui)=Ui. Every code is strictly stable under substitution: for Π and Σ, substitute c by γ and d by γ+; for identity, substitute c,a,b by γ; Ui is constant. These are Tarski-style semantic data. The official Russell hierarchy of definition 29.1 is interpreted by the displayed decoding equations and its stated cumulative lifts; no further code former is implicit here.

Definition 116.28 — Models of the fixed signature

An SΠΣIdU-model is a CwF with exactly the Π-, Σ-, intensional-identity-, and predicative universe structures of definition 54.21, definition 54.22, definition 54.23, definition 54.24, including every displayed strict substitution and computation equation. A morphism of such models must preserve all those operations and equations; the exact strict notion is displayed in definition 54.26 immediately before it is used. Adding another type former changes the signature and hence changes the category of models; no initiality or soundness result below silently ranges over such additions.

Remark 54.25

Π, Σ and Id above are specified by operations and equations, in bijection with the rules of definition 27.2, definition 27.9, definition 30.1: the point of the CwF language is that nothing else is needed. The structures can be repackaged as universal properties — e.g. Π-structure is a family of bijections Tm(Γ.A,B)Tm(Γ,Π(A,B)) natural in Γ, and Id-structure with judgmental J-computation is weak orthogonality of rA. The initiality theorem uses only the operation-and-equation presentation; universal-property formulations are developed in [AG26, CCD21].

Exercise 54.11

★★☆ In definition 54.21, verify the η-equation’s well-typedness: show f[pA]Tm(Γ.A,Π(A[pA],B[(pA)+])), that app(f[pA],qA) has type B[(pA)+id,qA], and that this substitution equals id.

Exercise 54.12

★★☆ In a CwF supporting Σ-types, construct an isomorphism Γ.A.BΓ.Σ(A,B) over Γ, and show it commutes with the projections.

Exercise 54.13

★★★ Derive from definition 54.23 the pointwise rule: for a,bTm(Γ,A), pTm(Γ,IdA(a,b)), and C, d as in definition 30.1, a term Ja,b,p(C,d)Tm(Γ,C[id,a,b,p]) satisfying the computation rule at b:=a, p:=refla. Conversely, show that pointwise J with its stability equations yields the generic J of definition 54.23.

The term model, initiality, and soundness

Initiality means that for every model of the fixed signature there is exactly one strict morphism from the syntactic model to that model. The dictionary of section 54.3 has such a fixed point: syntax itself.

Remark 54.29 — Why use algebraic syntax first

A tempting definition recurses directly on a named typing derivation: interpret its final rule from the interpretations of its premises. It is not yet a function on judgments. The same judgment may end with an inserted conversion, or with conversion pushed into a premise, and the two recursion trees need not be syntactically identical. One would first have to prove the coherence equation [[D1]]raw=[[D2]]rawwhenever D1,D2 derive the same judgment. For the algebraic syntax, the repair is an indexed rule induction. It first interprets every derivable context, substitution, type, and term with all ambient indices present; simultaneously it proves that a different derivation of the same judgment gives the same result. Only then does the interpretation descend to judgmental-equality classes. Streicher’s alternative for named syntax is a partial interpretation followed by a definedness and coherence proof [Hof97, Str93].

Definition 54.26 — Strict CwF-morphism

Let C, D be CwFs. A strict morphism F:CD is a functor of underlying categories together with functions F:TyC(Γ)TyD(FΓ) and F:TmC(Γ,A)TmD(FΓ,FA) such that F1=1, F(A[γ])=FA[Fγ], F(a[γ])=Fa[Fγ], F(Γ.A)=FΓ.FA, FpA=pFA, FqA=qFA (hence Fγ,a=Fγ,Fa). When both CwFs carry type-former structure, F is required to preserve it on the nose: F(Π(A,B))=Π(FA,FB), F(λ(b))=λ(Fb), and so on for each former.

Lemma 116.32 — Indexed interpretation and derivation independence

Fix an SΠΣIdU-model C. Restore in every compressed rule of definition 54.2 the derivations of all presuppositions required by convention 26.14. There are simultaneous assignments DΓ:Γ ctxhas value [[Γ]]DΓC,(DΔ,Dγ,DΓ):Δγ:Γhas value [[γ]]DΔ,Dγ,DΓ:[[Δ]]DΔ[[Γ]]DΓ,(DΓ,DA):ΓA typehas value [[A]]DΓ,DATy([[Γ]]DΓ),(DΓ,DA,Da):Γa:Ahas value [[a]]DΓ,DA,DaTm([[Γ]]DΓ,[[A]]DΓ,DA). They have the following two properties.

  1. Every derivation of a substitution, type, or term equality is sent to literal equality of the corresponding arrows, types, or terms. Pairwise context equality from remark 54.4 is sent to literal equality of context objects.

  2. If D and D derive the same one of the four formation judgments, then their displayed interpretations are equal. More generally, this remains true when the two conclusions differ only by admissible context exchange or type conversion. In the substitution, type, and term cases, the equality is read after rewriting the domain, codomain, and ambient type by the equalities for those converted indices.

Thus the assignments depend on the derivable judgment, not on its derivation.

Proof of Lemma 116.32 — Indexed interpretation and derivation independence

Proof. Use simultaneous well-founded induction on derivation height; for the comparison claim use the sum of the two heights. The three claims are: formation derivations produce the four displayed, correctly sorted values; equality derivations produce literal semantic equalities; and two formation derivations of the same raw object at judgmentally equal indices produce equal values after those indices are rewritten. A conversion or context-exchange conclusion is administrative: its formation premise and its equality premise have smaller height. Interpret both by the induction hypotheses, rewrite by the equality obtained from the second premise, and keep the value obtained from the first. This deals in particular with a term whose final type has been changed by conversion.

After administrative conclusions have been removed, the outer constructor of the raw conclusion determines the final formation rule. Two derivations of the same raw object therefore have corresponding premises whose indices are judgmentally equal; the strengthened comparison induction identifies their interpretations after rewriting those indices. The representative dependent cases are as follows.

Context extension. From DΓ:Γ ctx and DA:ΓA type, put [[Γ.A]]CtxExt(DΓ,DA):=[[Γ]]DΓ.[[A]]DΓ,DA. Both indices on the right are supplied by the displayed premises. If the two premise derivations change, their induction equalities make the two comprehensions literally equal. Pairwise context equality is handled by the same clause: equal interpretations of the shorter contexts and semantic soundness of the final type equality give equal context comprehensions.

Substitution extension. For premises Dγ:Δγ:Γ, DA:ΓA type, and Da:Δa:A[γ], define [[γ,a]]:=[[γ]],[[a]]:[[Δ]][[Γ]].[[A]]. The semantic type of [[a]] is [[A]][[[γ]]] by the induction hypothesis for Da; hence the semantic pairing operation has exactly this domain and codomain.

Reindexing. The conclusions of Sb-Ty and Sb-Tm are interpreted by [[A[γ]]]:=[[A]][[[γ]]],[[a[γ]]]:=[[a]][[[γ]]]. Their source context is the codomain of [[γ]], and their resulting ambient context is its domain. This records the indices that an unindexed recursion on raw trees would have omitted.

Dependent-product constructors. For DA:ΓA type and DB:Γ.AB type, define [[Π(A,B)]]:=Π([[A]],[[B]]). The context-extension case makes [[B]] a type over [[Γ]].[[A]], as the semantic operation requires. For Db:Γ.Ab:B, Df:Γf:Π(A,B), and Da:Γa:A, the term constructors are [[λ(A,b)]]:=λ([[b]]),[[app(f,a)]]:=app([[f]],[[a]]). The application has semantic type [[B]][id,[[a]]], the interpretation of its syntactic result type. The Σ, identity, and universe constructors use the operations with those exact indices in definition 54.22definition 54.24. Each premise is a shorter formation derivation, so the comparison cases decrease the same induction measure.

Equations. For Tm-Comp, the equality induction goal is exactly [[a]][[[γ]]][[[δ]]]=[[a]][[[γ]][[δ]]], the term-reindexing equation of a CwF. The identity, category, and comprehension generators are proved by the corresponding equations in definition 54.16; the Π, Σ, identity, and universe generators are proved by the equations in definition 54.21, definition 54.22, definition 54.23, definition 54.24. Reflexivity, symmetry, and transitivity use the same properties of literal equality, and a congruence rule applies the relevant semantic operation to equal arguments.

These cases cover every possible final rule family: context formation; category and comprehension formation; reindexing; the four fixed type-former structures; equality closure; and conversion or context exchange. In each constructor case every premise derivation is shorter, while in each administrative case both the formation and equality premises are shorter. The simultaneous induction therefore proves correct sorting, equality soundness, and derivation independence together. ◻

Theorem 54.27 — The term model and initiality

Let T be the following data, built from the substitution calculus of definition 54.2 extended by the countable finitary signature SΠΣIdU consisting exactly of the operations and equations in definition 54.9, definition 54.22, definition 54.23, definition 54.24:

  • contexts [Γ]: derivable contexts Γ ctx, modulo the pairwise judgmental equality of their types (remark 54.4);

  • substitutions [Δ][Γ]: derivable judgments Δγ:Γ with [Δ]=[Δ] and [Γ]=[Γ], modulo substitution equality after exchanging those endpoint representatives;

  • Ty([Γ]): derivable ΓA type with [Γ]=[Γ], modulo type equality after context exchange;

  • Tm([Γ],[A]): derivable Γa:A with [Γ]=[Γ] and [A]=[A], modulo term equality after context exchange and type conversion;

  • all operations induced by the syntactic constructors.

Then: (1) T is a CwF supporting Π, Σ, intensional identity types, and the displayed universe hierarchy; (2) T is initial: for every SΠΣIdU-model C (definition 116.28) there is exactly one strict structure-preserving morphism [[]]:TC.

Proof of Theorem 54.27 — The term model and initiality

Proof. (1) Context exchange and conversion make the three indexed carriers independent of the endpoint, context, and type representatives chosen in the statement. Congruence then makes every constructor well-defined on their judgmental-equality classes. If [Γ] is a context and [A]Ty([Γ]), define [Γ].[A]:=[Γ.A],p[A]:=[p],q[A]:=[q]. For [γ]:[Δ][Γ] and [a]Tm([Δ],[A[γ]]), define their pairing by [γ],[a]:=[γ,a]. The rules Ext-Wk, Ext-Vz, and Ext-Uniq give the three comprehension equations. The category and reindexing equations are the corresponding identity, composition, and functoriality rules of definition 54.2. Finally, the operations of definition 54.9, definition 54.22, definition 54.23, definition 54.24 descend by congruence and satisfy their displayed substitution equations. Thus T has the asserted CwF and type-former structure.

(2) Existence. Apply lemma 116.32. Its four assignments are independent of the chosen formation derivations, and its equality clause identifies judgmentally equal representatives. They therefore descend to functions on the four quotient carriers defining T. The clauses for identity, composition, comprehension, reindexing, and every fixed type former are the corresponding operations of C, so the resulting map is a strict SΠΣIdU-morphism.

Uniqueness. Let F:TC be another strict structure-preserving morphism. Simultaneous induction on well-sorted formation derivations gives F[Γ]=[[Γ]], F[γ]=[[γ]], F[A]=[[A]], and F[a]=[[a]]. In the context-extension case, strict preservation of comprehension and the induction hypotheses give F[Γ.A]=F[Γ].F[A]=[[Γ]].[[A]]=[[Γ.A]]. Strict preservation of pairing proves the substitution-extension case, and strict preservation of reindexing proves the explicit-action case. For Π, for instance, F[Π(A,B)]=Π(F[A],F[B])=Π([[A]],[[B]])=[[Π(A,B)]]; the other formers follow from their preservation equations. Hence F=[[]]. ◻

Remark 116.34 — Which initiality problem is solved

Theorem 54.27 is strict algebraic initiality for syntax in which substitutions and all stability equations are constructors of the signature. It is not the stronger claim that an arbitrary named presentation, with substitution only a metalevel operation, is initial without a coherence proof. For comparison, de Boer’s formalization proves initiality for a fully annotated de Bruijn syntax with Π, Σ, identity, natural numbers, binary sums, empty and unit types, and an infinite universe hierarchy, using contextual categories and a partial interpretation followed by separate totality, substitution, and weakening theorems [dB20]. That source supports its own stated signature; we do not transfer it silently to ours. The named-to-algebraic soundness below uses only the forward translation in theorem 54.13; the unproved larger converse recorded there is not a hidden premise.

Theorem 54.28 — Soundness of the interpretation

Let C be a CwF supporting Π, Σ, intensional identity types, and the displayed universe hierarchy. There is an interpretation [[]] of every derivable judgment of TΠΣIdU in the named syntax of definition 26.1 such that:

  1. if Γ ctx then [[Γ]]C is defined;

  2. if ΓA type then [[Γ;A]]Ty([[Γ]]) is defined;

  3. if Γa:A then [[Γ;a]]Tm([[Γ]],[[Γ;A]]) is defined;

  4. if ΓAB type then [[Γ;A]]=[[Γ;B]];

  5. if Γab:A then [[Γ;a]]=[[Γ;b]].

Proof of Theorem 54.28 — Soundness of the interpretation

Proof. Translate a named judgment by () from construction 54.10. By theorem 54.13 its translation is a derivable algebraic judgment and named judgmental equality is preserved. Let F:TC be the unique strict morphism of theorem 54.27, and define [[Γ]]:=F[Γ],[[Γ;A]]:=F[A],[[Γ;a]]:=F[a]. The sort assertions in clauses (1)–(3) are exactly the context, type, and term components of the strict morphism. If AB or ab in the named calculus, theorem 54.13(1) makes their translations equal in T; applying the function F proves (4) or (5). This also proves independence of the chosen named derivation, since T was quotiented by judgmental equality before F was applied.

To identify this construction with the usual direct clauses, observe that strictness gives [[Γ,x:A;x]]=q and [[Γ,y:B;x]]=[[Γ;x]][p]; preservation of abstraction gives [[Γ;λx.b]]=λ([[Γ,x:A;b]]). Likewise, preservation of the identity structure sends J to the operation of definition 54.23; its computation equation is therefore the strict CwF equation. Hence middle-of-context weakening, substitution, and J are interpreted by the same strict morphism as the remaining clauses. ◻

Corollary 54.30 — Equivalence of structural presentations

The two named presentations of definition 26.22 — structural rules primitive, versus substitution and weakening admissible — derive exactly the same judgments.

Proof of Corollary 54.30 — Equivalence of structural presentations

Proof. By theorem 26.43, simultaneous admissibility transforms a derivation using primitive weakening, substitution, equal-term substitution, or context conversion into a derivation in the presentation where those rules are admissible. Conversely, every admissible use expands to the corresponding primitive rule instance. Thus a judgment is derivable in the first named presentation if and only if the same judgment is derivable in the second. ◻

Exercise 54.14

★☆☆ Verify directly that T satisfies item 4 of definition 54.16: the universal property of comprehension holds with γ,a the syntactic extension, uniqueness being Ext-Uniq.

Exercise 54.15

★★☆ For the Π-only fragment, write out the uniqueness argument of theorem 54.27(2). Let two strict morphisms be given: F,G:TC Show by induction on a chosen representative that they agree on every equivalence class.

Two models: sets and groupoids

Initiality pays off only if there are models other than syntax. The set model validates everything of chapter 26chapter 30 including definition 35.1; the groupoid model separates J from uniqueness of identity proofs and closes the earlier external-model boundary.

Convention 116.37 — Size of the concrete models

Choose a hierarchy of strongly inaccessible cardinals κi and one outer Grothendieck universe Vω containing every Vi=Vκi. These assumptions keep the set and groupoid universe models small; they were not used in the syntactic initiality argument.

Proposition 54.31 — The set model as a CwF

In the metatheory of convention 116.17, convention 116.37, let Vi=Vκi and use the outer Grothendieck universe Vω. There is a CwF Set: contexts are the sets in Vω, substitutions are functions, Ty(Γ) is the set of functions A:ΓVω, Tm(Γ,A)=γΓA(γ), reindexing is precomposition, 1 is a singleton, and Γ.A:={(γ,x)γΓ,xA(γ)} with p(γ,x)=γ and q(γ,x)=x. It supports all the structure of section 54.4, with Π(A,B)(γ)=xA(γ)B(γ,x), Σ(A,B)(γ)=xA(γ)B(γ,x), IdA(a,b)(γ)={a(γ)=b(γ)}, and Ui(γ)=Vi. The CwF itself is regarded as an object of a larger ambient collection; every context and comprehension it constructs remains in Vω.

Proof of Proposition 54.31 — The set model as a CwF

Proof. The comprehension property is direct: given γ:ΔΓ and aTm(Δ,A[γ]), the unique mediating function is δ(γ(δ),a(δ)). The former-wise equations were verified in definition 48.30; they hold on the nose. Note that this Id interprets even the extensional Eq-rules of definition 35.1. Consequently the corresponding object theory is consistent relative to the ZFC plus inaccessible-cardinal assumptions of convention 116.37; this does not remove those metatheoretic hypotheses from corollary 90.7. ◻

Definition 54.32 — Groupoids and families

A groupoid is a category all of whose morphisms are invertible. Here “small” means that its object set, arrow set, and structure maps belong to Vω of convention 116.37; Gpdω denotes the resulting set-sized-in-the-next-universe category of groupoids and functors. For a groupoid Γ, a family of groupoids A over Γ is a functor A:ΓGpdω; for a functor F:ΔΓ, reindexing is composition, A[F]:=AF. A section a of A assigns to each object γΓ an object a(γ)A(γ) and to each morphism p:γγ a morphism a(p):A(p)(a(γ))a(γ) in A(γ), functorially: a(idγ)=id and a(qp)=a(q)A(q)(a(p)).

Definition 116.40 — Vertical transformations of dependent sections

Let A:ΓGpdω be a family and let a,b be sections of A. A vertical natural transformation α:ab consists of arrows αγ:a(γ)b(γ)in A(γ) such that, for every p:γγ in Γ, (VNat)b(p)A(p)(αγ)=αγa(p). The identity has component ida(γ), and vertical composition is componentwise: (βα)γ:=βγαγ. Functoriality of A proves naturality of the identity, and composing the two instances of (VNat) proves naturality of βα. Every component is invertible because A(γ) is a groupoid. The inverse family (α1)γ:=(αγ)1 is natural because a(p)A(p)(αγ1)=VNatαγ1b(p)A(p)(αγ)A(p)(αγ1)=inverseαγ1b(p). Thus sections of A and vertical natural transformations form a groupoid, denoted Sect(A).

Definition 54.33 — The groupoid CwF

The CwF G has: contexts the groupoids, substitutions the functors, Ty(Γ) the families of definition 54.32, Tm(Γ,A) the sections, both reindexed by composition; 1 the one-object one-morphism groupoid; and comprehension the Grothendieck construction: Γ.A has objects the pairs (γ,x) with xA(γ) and morphisms (γ,x)(γ,x) the pairs (p,φ) with p:γγ and φ:A(p)(x)x; p is the projection functor p(γ,x):=γ,p(p,φ):=p, and q is the section (γ,x)x, (p,φ)φ.

Theorem 54.34 — The groupoid model

Let TG be the intensional fragment with the structural rules, Π, Σ, intensional identity types, 0, 1, 2, N, and a predicative universe hierarchy, but without coproduct or W-types. Then G is a CwF supporting every former of TG and validates every rule of that fragment. The key clauses are:

  1. Identity types are hom-sets: IdA(a,b)(γ) is the discrete groupoid on the set homA(γ)(a(γ),b(γ)), with reindexing along p:γγ given by hb(p)A(p)(h)a(p)1; refla(γ)=ida(γ); and J(C,d) transports d along the morphism (id,id,h):(γ,x,x,id)(γ,x,x,h) of ΓA.IA, so that J(C,d)[rA]=d holds on the nose.

  2. Base types are discrete: 0, 1, 2, N are the discrete groupoids on , {}, {0,1}, N.

  3. Universes: for each chosen inaccessible κi, Ui is the discrete groupoid on the set of groupoid structures whose data belong to Vκi, with El(c)(γ):=c(γ).

  4. Write Bγ:A(γ)Gpdω for the restriction of B along x(γ,x) and h(idγ,h). Then Π(A,B)(γ):=Sect(Bγ), with arrows exactly the vertical natural transformations of definition 116.40; Σ(A,B)(γ) is the Grothendieck construction of Bγ over A(γ).

Proof of Theorem 54.34 — The groupoid model

Proof. We construct the operations and check their equations. The resulting derivation invariant says that a context is sent to a groupoid, a type over it to a groupoid-valued functor, a term to a section, and a judgmental equality to literal equality of the corresponding functors or sections. Induction on the last rule preserves this invariant by the construction named in the matching paragraph below; the displayed strict reindexing and computation equations handle conversion and computation rules.

The CwF. The terminal context is the terminal groupoid. Reindexing a family A or a section a along F:ΔΓ is composition with F, so identity and composition are strict. Given F:ΔΓ and a section a of A[F], define F,a(δ):=(Fδ,aδ),F,a(r):=(Fr,a(r)). The section laws make this a functor ΔΓ.A. Projection composed with it is F, and the generic term reindexed along it is a. Conversely, these two components determine its value on every object and arrow, so the mediating functor is unique. This proves the comprehension universal property.

Sums and products. At γ, let Σ(A,B)(γ) be the Grothendieck construction of the restriction of B to the fiber A(γ). Thus an object is (x,y) and an arrow is (h,k) with h:xx,k:B(idγ,h)(y)y. For p:γγ, apply A(p) to the first component and apply B(p,id) to the second; functoriality of A and B proves the family laws. Pairing and the two projections act componentwise. Their two β-equations and the Σ-η equation are therefore literal equalities of objects and arrows, and all three operations commute with reindexing.

For products, use the section groupoid Sect(Bγ) of definition 116.40. Let p:γγ and xA(γ), and write up,x:=(p,idx):(γ,A(p1)(x))(γ,x) in Γ.A. Transport a section s of Bγ by (ps)(x):=B(up,x)(s(A(p1)(x))). For h:xy, its section arrow is (ps)(h):=B(up,y)(s(A(p1)(h))). Its domain has first been rewritten by the commuting equation (idγ,h)up,x=up,y(idγ,A(p1)(h)) and functoriality of B. For a vertical transformation α:st, put (pα)x:=B(up,x)(αA(p1)(x)). Equation (VNat) for pα is the image under B of the same commuting square, followed by the naturality equation for α. Hence p is a functor between section groupoids. The equations (qp)=qp and (id)=id follow by expanding the definition and using (qp)1=p1q1.

If t is a section of B over Γ.A, define λ(t)(γ) by λ(t)(γ)(x):=t(γ,x),λ(t)(γ)(h):=t(idγ,h); its action on p:γγ is the vertical transformation whose x-component is t(up,x). Its naturality equation is the section law for t applied to the commuting square used above.

At a fixed γ, evaluation sends (s,x) to s(x). An arrow (α,h):(s,x)(t,y), where α:st and h:xy, is sent to t(h)Bγ(h)(αx)=αys(h); the equality is precisely (VNat). This fiberwise evaluation commutes with the transports p by their displayed definitions. Consequently it is the application operation of the CwF. Hence app(λ(t),x)=t(γ,x) and λ(x.app(s,x))=s, on objects and arrows. These are the Π-β and Π-η equations. The definitions also show strict stability under reindexing.

Identity. Over an object (γ,x,y) of the context Γ,x:A,y:A, put IA(γ,x,y):=disc(homA(γ)(x,y)). On a context arrow (p,q,r):(γ,x,y)(γ,x,y) set IA(p,q,r)(h):=rA(p)(h)q1. Identity and composition follow from cancellation and functoriality of A. The reflexivity section chooses idx; the displayed conjugation sends it to idx, so reflexivity is natural.

It remains to verify J, including its morphism component. Let D be the context of quadruples z=(γ,x,y,h) and let rA:Γ.AD be the reflexivity functor. Given a family C over D and a section d of C[rA], define z:=(idγ,idx,h,):rA(γ,x)z,J(C,d)(z):=C(z)(d(γ,x)). For an arrow m=(p,q,r,):zz in D, discreteness of IA says exactly h=rA(p)(h)q1. Consequently the following two arrows in D are equal: mz=zrA(p,q). Apply C to this equality and then to the naturality arrow d(p,q); this defines the arrow component of J(C,d) from C(m)(J(C,d)(z)) to J(C,d)(z). Its identity and composition laws are those of C and d. On the reflexivity locus rA(γ,x) is an identity, on objects and arrows, so J(C,d)[rA]=d strictly. This proves every identity-type rule and not merely the object part of the eliminator.

Base types and universes. Interpret 0,1,2,N by the constant discrete groupoids on ,{},{0,1},N. Empty elimination is the unique section from an empty comprehension. Unit elimination, Boolean case analysis, and natural-number induction are defined fiberwise; their naturality follows respectively by uniqueness, by the two cases, and by meta-level induction on n. Their constructor equations are literal equalities. The singleton interpretation also validates the judgmental Unit-η rule.

Finally choose inaccessible cardinals κ0<κ1<. Let Ui be the constant discrete groupoid of κi-small groupoids and let the family El over it have fiber El(X)=X. Discreteness makes its action on a universe arrow the identity functor. The constructions above preserve κi-smallness, and κj-small groupoids form an object of Ui when j<i; hence all stated universe formation and closure rules are validated. Therefore every derivable judgment of TG has an interpretation in G, and every judgmental equality is sent to literal equality of the interpreted data.

The construction is due to Hofmann and Streicher [Hof95]. Its scope restriction is essential: Hofmann explicitly says in §5.2.2.5 that arbitrary parameterized inductive definitions were not checked. The argument above therefore covers the stated fragment but not W-types. ◻

Proposition 54.35

In G, let B denote the groupoid with one object and hom(,)=Z/2Z={id,g}. Interpret the context Γ0:=(X:U, x:El(X), p:IdEl(X)(x,x)). Then the interpretation of the type Γ0IdIdEl(X)(x,x)(p,reflx) type has empty fiber over the object (B,,g)[[Γ0]]; consequently the type has no section, and the corresponding K-type (definition 30.28) is uninhabited in G. Likewise the UIP-type over (X:U, x,y:El(X), p,q:IdEl(X)(x,y)) is uninhabited.

Proof of Proposition 54.35

Proof. Unfolding theorem 54.34: over the object (B,,g), the type IdEl(X)(x,x) is interpreted as the discrete groupoid on homB(,)={id,g}, and the displayed identity type as the discrete groupoid on the morphisms from g to id therein — the empty set, since in a discrete groupoid distinct objects have no morphisms between them and gid. A section would pick an element of every fiber. For UIP, evaluate at (B,,,id,g). ◻

Corollary 54.36 — K and UIP are underivable

In the fragment TG of theorem 54.34 there is no term of type X:Ux:El(X)p:IdEl(X)(x,x)IdIdEl(X)(x,x)(p,reflx), nor of the UIP type. Thus, relative to the ambient ZFC plus inaccessible hierarchy used to construct G, the eliminator K is not derivable from J in that fragment.

Proof of Corollary 54.36 — K and UIP are underivable

Proof. The derivation induction in the proof of theorem 54.34 would turn such a term into a section of its interpreted type. Evaluating the Π-clauses at the objects listed in proposition 54.35 would then produce an element of an empty set. ◻

Remark 54.37

The groupoid model validates function extensionality: two sections of a Π-family that are pointwise equal are equal, and the Id-fibers of Π(A,B) compute accordingly. Hence G cannot establish remark 111.89; that boundary is recorded there as an open exact-signature transfer obligation rather than as a consequence of this model.

The groupoid model is the germ of homotopy type theory: it interprets types as 1-truncated homotopy types and suggests — as Hofmann and Streicher already noted — both that types could be interpreted as higher groupoids and that propositional equality of the universe could be isomorphism, a rule they proved sound in G. The stronger univalence axiom asks that the canonical map from equality of universe elements to equivalence of decoded types be an equivalence for every pair of universe elements; that axiom is not part of the fragment interpreted here [Hof95, Uni13].

Exercise 54.16

★★☆ Verify in Set (proposition 54.31) the four equations of comprehension — the two triangle equations, naturality γ,aδ=γδ,a[δ], and p,q=id — and the Σ-structure equations of definition 54.22.

Exercise 54.17

★★☆ Prove the universal property of comprehension in G: functors ΔΓ.A correspond bijectively to pairs of a functor γ:ΔΓ and a section of A[γ].

Exercise 54.18

★★★ Define the Σ-structure of G in full (pairing, projections, their morphism parts) and verify the η-equation and strict stability.

Exercise 54.19

★★★ Show that every type of the fragment generated by 0, 1, 2, N, Π, Σ, Id (no universes) is interpreted in G, over any discrete context, by a discrete groupoid. Conclude that UIP holds for these types in G, so universes are essential to proposition 54.35.

Bibliographic notes

The substitution calculus is Martin-Löf’s, from his unpublished 1992 Göteborg lectures “Substitution calculus” [ML92], with roots in the theory of expressions of [ML84] and in the context-morphism presentations of [NPS90, NPS00]. Categories with families were distilled from it by Dybjer [Dyb96], explicitly as an “internal type theory”: a generalized algebraic theory whose models are the semantic counterpart of the general rules. The survey [CCD21] develops the unityped–simply-typed–dependently-typed progression, the free (bi-)initial CwFs, and the biequivalences with Lawvere theories, cartesian closed categories and locally cartesian closed categories; its Theorems 6, 7 and 10 motivate the strict algebraic viewpoint but are not cited as an exact-signature proof of theorem 54.27. De Boer’s thesis and companion Agda development give the separate exact initiality result described in remark 116.34 [dB20]. Hofmann’s chapter [Hof97] remains the most careful elementary account of the interpretation of named syntax (theorem 54.28), including the weakening and substitution lemmas and the partial-interpretation device, which is due to Streicher’s monograph on contextual categories; Streicher’s habilitation [Str93] initiated the study of intensionality criteria and the eliminator K. Alternative packagings of the same semantic data — categories with attributes, comprehension categories, display-map categories — are surveyed in [Jac99]; Angiuli–Gratzer [AG26] develop the natural-model formulation (representability of TmTy) and the coherence problem for locally cartesian closed categories. The groupoid model (theorem 54.34) is Hofmann–Streicher’s; our elementary description follows [Hof95], ch. 5, where proposition 54.35 appears as the non-definability of uniqueness of identity and the isomorphism-as-equality rule for the universe is proved sound — the observation that, a decade later, grew into univalence [Uni13]. For the use of CwFs as the backbone of modern metatheory — gluing, canonicity, normalization — see the proved Π/2 closed-canonicity case in theorem 49.2 and the separately scoped normalization imports recorded in chapter 49; for fuller developments, see the theses [Ang19, Ste21, Gra23].

Suggested first pass.

None of these problems is a prerequisite for a later chapter. Begin with exercise 116.20, then complete exercise 116.21.

Exercise 116.20

★★★ For the CwF of set-valued families, write the interpretation morphism from the term CwF on contexts, substitutions, types, and terms. Verify the comprehension square and prove uniqueness by induction over the four sorts.

Exercise 116.21

★★★ Practical project.explicit-substitution-normalizer Implement in Agda or Kappa the rewrite system of definition 54.2. Maintain well-scoped de Bruijn indices and a strictly decreasing rule measure. Normalize identity, associativity, and lift-after-extension examples to the forms predicted by lemma 54.12; reject an ill-scoped lift. Mutation test: reversing one composition rule must be detected as a cycle.

Search the book

Type to search the local edition.