Lectures onType Theory
Chapter 77
Chapter 77Core route

Identity Types

Addition on the natural numbers (construction 28.23) already poses the problem. Its defining equations make n+0n, but for a variable n no computation rule turns 0+n into n. Nevertheless induction proves that the two terms agree. To state that proof inside the theory we need a type whose elements are evidence that two terms are equal.

Judgmental equality is a judgment, not a type: it licenses conversion, but there is no context declaration p:ab and no eliminator for such a declaration inside the theory. The intensional identity type IdA(a,b) internalizes equality as such a type. Its sole constructor is reflexivity. The target IdN(0+n,n) is inhabited by natural-number induction; the successor case must turn evidence for 0+n=n into evidence after applying successor to both endpoints.

The rules of the identity type

The identity family is the family (IdA(a,b))a,b:A generated over the diagonal by the single constructor reflexivity; its eliminator J is induction over that family.

Definition 30.1 — Identity types

An identification of a with b is an element of IdA(a,b). Reflexivity introduces an identification, and J eliminates one by proving the reflexivity case of a family over both endpoints and the identification. Premises recoverable by convention 26.14 are omitted.

Γa:AΓb:A
ΓIdA(a,b) type
Id-form
ΓA:UiΓa:AΓb:A
ΓIdA(a,b):Ui
Id-form-
Γa:A
Γrefla:IdA(a,a)
Id-intro
Γ,x:A,y:A,p:IdA(x,y)C typeΓ,z:Ac:C[z/x,z/y,reflz/p]Γq:IdA(a,b)
ΓJ(x.y.p.C;z.c;q):C[a/x,b/y,q/p]
Id-elim
Γ,x:A,y:A,p:IdA(x,y)C typeΓ,z:Ac:C[z/x,z/y,reflz/p]Γa:A
ΓJ(x.y.p.C;z.c;refla)c[a/z]:C[a/x,a/y,refla/p]
Id-comp

The closure rule Id-form-U is available only with the universe hierarchy of definition 29.1; Id-form, Id-intro, Id-elim, and Id-comp do not presuppose universes. There is no uniqueness (η) rule; cf. remark 30.8. As required by convention 27.1, each operator also respects judgmental equality in all its classified arguments. The dependent instance for J is stated explicitly in remark 30.2.

In the raw binding signature, IdA(a,b) has arity (0,0,0), refla has arity (0), and the fully annotated eliminator is JA;a;b(x.y.p.C;z.c;q). It has arity (0,0,0,3,1,0): the first three arguments record A,a,b; it binds x,y,p in C and z in c. The notation in definition 30.1 suppresses A,a,b when its typing judgment determines them.

When the optional lifting package of definition 29.10 is present, extend its strict code equations by

ΓA:UiΓa:AΓb:A
ΓLifti(IdA(a,b))IdLiftiA(a,b):Ui+1
Lift-Id

The endpoints on the right are well typed by conversion along Lift-El.

Remark 30.2 — The congruence instances

Identity formation has the rule

ΓAA typeΓaa:AΓbb:A
ΓIdA(a,b)IdA(a,b) type
Id-form-eq

For elimination, put Δ:=Γ,x:A,y:A,p:IdA(x,y). After context conversion has placed all primed data in the same displayed contexts, the rule is

ΓAA typeΔCC typeΓ,z:Acc:C[z/x,z/y,reflz/p]Γaa:AΓbb:AΓqq:IdA(a,b)
ΓJ(x.y.p.C;z.c;q)J(x.y.p.C;z.c;q):C[a/x,b/y,q/p]
Id-elim-eq

In the conclusion, the left printed term abbreviates the raw constructor JA;a;b and the right one abbreviates JA;a;b. Thus the first premise and the two endpoint premises also compare the three newly explicit raw annotations; they are not discarded by the notation. Applying Id-elim-eq to the six displayed equality premises first gives the right-hand eliminator at its naturally formed classifier C[a/x,b/y,q/p]. Use the following two local equations:

  1. symmetry of equal substitution in a,b,q;

  2. symmetry of the substituted motive equality.

They give the classifier chain C[a/x,b/y,q/p](1)C[a/x,b/y,q/p](2)C[a/x,b/y,q/p]. Conversion along this chain places the right-hand J term at the result type used in the conclusion. The congruence rule for refl is the unary special case. These are the exact instances used below.

Convention 30.3 — Notation

Elements of IdA(a,b) are called identifications of a with b. We suppress annotations that are determined by the judgment: in particular, the printed term J(x.y.p.C;z.c;q) abbreviates the raw term JA;a;b(x.y.p.C;z.c;q) when q:IdA(a,b). We also write refl for refla, and J(z.c;q) when the expected type determines the motive. Throughout this part we retain the fully typed notation IdA(a,b).

Lemma 30.4 — Judgmental equality yields identifications

If Γab:A, then Γrefla:IdA(a,b).

Proof of Lemma 30.4 — Judgmental equality yields identifications

Proof. By Id-intro, Γrefla:IdA(a,a). From Γab:A the congruence rule Idformeq of remark 30.2 gives ΓIdA(a,a)IdA(a,b) type, and the conversion rule concludes Γrefla:IdA(a,b). ◻

Remark 30.5

The converse of lemma 30.4 — from Γq:IdA(a,b) conclude Γab:A — is the equality reflection rule. It is not a rule of this theory; adding it changes an identification hypothesis into a judgmental equality. Here an identification may be used only through J; it does not silently become a conversion.

Convention 30.6 — The path-induction pattern

The path-induction pattern is the admissible use of J specified by the genericity and computation obligations below. Suppose the context has three pairwise distinct variables a:A, b:A, and q:IdA(a,b). Move any independent later hypotheses to the left by exchange, and abstract into Π-types every remaining later hypothesis. The resulting goal must be an instance C[a/x,b/y,q/p] of a well-formed motive Γ,x:A,y:A,p:IdA(x,y)C type, where x,y,p are pairwise distinct and {x,y,p}dom(Γ)=. Thus the endpoint variables x,y and identification variable p must all be generic in the displayed motive. Under these conditions, Id-elim reduces the construction to an element of C[z/x,z/y,reflz/p] for zdom(Γ){x,y,p}. We abbreviate this step by the phrase

“by identity induction on q, we may assume b is a and q is refla.”

Using the phrase carries two obligations. (i) Genericity. The displayed motive is the test: if it is not well formed, the phrase cannot be used. One must first generalize the fixed hypotheses that obstruct it. In particular, from x:A,p:IdA(x,x) one cannot manufacture two independent endpoint variables merely by calling both of them x; doing so would falsely derive that every loop is reflexivity. More precisely, that apparent conclusion comes from an ill-formed motive, not from an instance of Id-elim. When only the left or only the right endpoint can be generalized, the corresponding based induction orientation applies. If neither a left-based nor a right-based motive is well formed, identity induction is unavailable. (ii) Computation. The term so constructed computes by Id-comp when q is refl; we record this judgmental equality with each construction, since later well-typedness frequently depends on it. Inferring C from a concrete goal is a higher-order matching problem, not a primitive kernel operation. Tactics named induction, destruct, or cases automate that search; a motive is not type correct failure usually means that the genericity obligation in (i) was not met and more hypotheses must be generalized.

Remark 30.7 — The family is inductive, not the type

The rule Id-elim does not make every identification a reflexivity. It says instead that the family (IdA(x,y))x,y:A, considered over the whole context x:A,y:A, is generated by the diagonal elements reflx. A map out of the total family is determined by its values on the diagonal; about a single fiber IdA(a,b) with fixed endpoints, the rule says nothing. The laws relating identifications are themselves inhabited identity types, not additional judgmental equations.

Remark 30.8 — No η -rule

For Σ-types the uniqueness rule is u(pr1(u),pr2(u)), so every element is judgmentally a pair (definition 27.9). There is no uniformly well-typed expression of the form qrefl: when q:IdA(a,b), the term refla naturally has type IdA(a,a), and the two types need not be judgmentally equal. The intensional identity type therefore has a mapping-out principle but no judgmental uniqueness principle.

Exercise 30.1

★☆☆ Using definition 26.22 and Id-intro, write the full derivation tree of the judgment x:Areflx:IdA(x,x) from the premise A type, displaying every application of the variable and context-formation rules.

Exercise 30.2

★★☆

Formulate the based variant of the formation rule: from Γa:A conclude Γ,y:AIdA(a,y) type. Show that in the presence of the structural rules (definition 26.22) it follows from Id-form, and recover Id-form from it by substituting an arbitrary b:A for y. Finally explain why reflexivity already has the single based rule Γa:AΓrefla:IdA(a,a), so there is no second introduction variant to compare.

Transport and the derived operations

For q:IdA(a,b) and u:B[a/x], transport carries u along q, giving trqx.B(u):B[b/x]. Inverse, concatenation, and congruence are likewise defined by identity induction, and each computes at reflexivity.

Construction 30.9 — Transport

Let Γ,x:AB type and Γq:IdA(a,b). There is a term Γtrqx.B:B[a/x]B[b/x]withΓtrreflax.B(u)u:B[a/x] for every Γu:B[a/x]. We omit the binder and write trqB when B has exactly one displayed free variable to abstract.

Proof of Construction 30.9 — Transport

Construction. Apply Id-elim with the motive Γ,x:A,y:A,p:IdA(x,y)BB[y/x] type (the motive does not mention p) and the reflexivity clause z.λu.u, whose required type is (BB[y/x])[z/x,z/y,reflz/p]B[z/x]B[z/x]. Set trqx.B:=J(x.y.p.BB[y/x];z.λu.u;q). Formation of B[y/x] while retaining the declaration x:A first uses lemma 26.30 to rename the family binder from x to the fresh y. Two applications of weakening then insert the original declaration x:A before y and the path declaration p after it. No capture-prone raw replacement or ill-ordered substitution is implicit. The computation rule is an instance of Id-comp followed by β-reduction (definition 27.2). ◻

Example 30.10 — A blocked open transport

Given x:NB type, work in the context n:N,m:N,p:IdN(n+m,m+n),u:B[n+m/x]. The term trpB(u) is well typed in B[m+n/x], but its defining computation does not fire: the identification is the variable p, not a displayed reflexivity. This is why calculations with transport require proofs of the groupoid laws.

Proposition 30.11 — Indiscernibility of identicals

For every family Γ,x:AB type and elements Γa:A, Γb:A, the type IdA(a,b)B[a/x]B[b/x] is inhabited, namely by λq.trqx.B. Under propositions-as-types this is Leibniz’s principle: identified elements are indiscernible by every property expressible in the theory.

Proof of Proposition 30.11 — Indiscernibility of identicals

Proof. For q:IdA(a,b), construction 30.9 gives trqx.B:B[a/x]B[b/x]. Therefore λq.trqx.B inhabits the displayed dependent function type; at q=refla, its application to u is judgmentally u by the transport computation rule. ◻

Example 30.12 — Boolean constructors are internally disjoint

Assume the universe and large Boolean elimination of construction 29.12. Put P:=λb.If0(1,0,b):2U0. The two computation rules give Ptt1 and Pff0. Hence, for q:Id2(tt,ff), transport gives trqb.Pb():Pff, which converts to a term of 0. Thus λq.trqb.Pb():Id2(tt,ff)0. Unlike the metatheoretic separation in theorem 29.14, this is an internal negation: an assumed identification itself transports the unit element into the empty type.

Proposition 30.13 — Least reflexive relation

Let Γ,x:A,y:AR type be a binary family equipped with a proof of reflexivity, Γρ:z:AR[z/x,z/y]. Then there is a term Γe:x:Ay:AIdA(x,y)R and, in context Γ,z:A, its reflexivity computation is Γ,z:Aezzreflzρz:R[z/x,z/y]. Thus IdA(,) maps into every reflexive relation on A: it is the least reflexive relation, which was Martin-Löf’s original specification of the identity type [ML98, ML84].

Proof of Proposition 30.13 — Least reflexive relation

Proof. Apply Id-elim with the p-independent motive R (weakened to the context Γ,x:A,y:A,p:IdA(x,y)) and clause z.ρz; the computation rule is Id-comp. ◻

Construction 30.14 — Inverse

For Γq:IdA(a,b) there is a term Γq1:IdA(b,a) with Γ(refla)1refla:IdA(a,a): set q1:=J(x.y.p.IdA(y,x);z.reflz;q).

Construction 30.15 — Concatenation

For Γp:IdA(a,b) and Γq:IdA(b,c) there is a term Γpq:IdA(a,c) with Γpreflbp:IdA(a,b): transport p in the family of identifications out of a, pq:=trqw.IdA(a,w)(p). The computation rule is that of construction 30.9.

Remark 30.16 — Asymmetry of concatenation

Construction 30.15 proceeds by induction on the second argument, so the right unit law preflbp is judgmental while the left unit law holds only up to an identification (theorem 30.20(i)). Inducting on the first argument instead yields an operation with reflaqq; inducting on both (as in the HoTT Book [Uni13]) yields one computing only on reflrefl. All three agree up to identifications. Indeed, compare either alternative with by identity induction on both inputs: after they have reduced to reflexivity, both concatenations compute to reflexivity, so reflexivity inhabits the comparison type. Exercise 30.4 asks for one such comparison with every motive made explicit. Such choices are harmless when one asks only for an identification, but differ when one tracks which unit equation is judgmental.

Construction 30.17 — Action on identifications

For Γf:AB and Γq:IdA(a,b) there is a term Γapf(q):IdB(fa,fb) with Γapf(refla)reflfa:IdB(fa,fa): set apf(q):=J(x.y.p.IdB(fx,fy);z.reflfz;q). Thus every function preserves identifications: no operation of the theory can distinguish identified elements.

Construction 30.18 — Dependent action

For Γf:x:AB and Γq:IdA(a,b) there is a term Γapdf(q):IdB[b/x](trqx.B(fa),fb)withΓapdf(refla)reflfa:IdB[a/x](fa,fa), namely apdf(q):=J(x.y.p.IdB[y/x](trpx.B(fx),fy);z.reflfz;q). Note that the clause z.reflfz has the required type IdB[z/x](trreflzx.B(fz),fz) only via the computation rule trreflz(fz)fz and the conversion rule: the well-typedness of the eliminand depends on Id-comp for transport, as announced in convention 30.6(ii).

Example 30.19 — Identifications beyond judgmental equality

Use the addition of construction 28.23, which recurs on the second argument. Thus m+0m and m+suc(n)suc(m+n). Then:

  1. refln+0:IdN(n+0,n), by lemma 30.4: the equation holds judgmentally.

  2. For a variable n, no defining equation applies to 0+n: the recursor inspects its second argument and that argument is a variable. Reflexivity has type refl0+n:IdN(0+n,0+n), not the required type IdN(0+n,n), because the endpoints 0+n and n are not judgmentally equal. Induction instead gives an inhabitant α:=indN(m.IdN(0+m,m);refl0,λm.λh.apsuc(h);n), where the step clause is well-typed because 0+suc(m)suc(0+m), so that apsuc(h):IdN(suc(0+m),suc(m)) converts to the required type.

Here the defining equations prove the right-unit law, whereas induction proves the left-unit identification. Identifications can therefore express equations not supplied by the defining computations; they are terms that must themselves be transported, inverted, and compared. Groupoid laws perform those comparisons.

Exercise 30.3

★☆☆ Let B be a type not depending on x:A and q:IdA(a,b). Construct a term of type IdB(trqx.B(u),u) for each u:B. Explain why this identification is in general not a judgmental equality, although trreflax.B(u)u.

Exercise 30.4

★★★ Define pq by identity induction on p, so that reflaqq, and construct a term of type IdIdA(a,c)(pq,pq) for all p:IdA(a,b), q:IdA(b,c). First induct on p to compare preflb with p; then induct on q with p generalized into the motive, using the inverse of that comparison in the reflexivity case.

Exercise 30.5

★★☆ Construct identifications IdIdA(a,b)(apλx.x(q),q)andIdIdB(b0,b0)(apλx.b0(q),reflb0) for q:IdA(a,b) and b0:B. Which of the two, if either, holds judgmentally for a general path variable q, and why?

Exercise 30.6

★★☆ Fix a universe Ui with A:Ui, and define the Leibniz relation L(a,b):=B:AUiBaBb. Construct maps IdA(a,b)L(a,b) and L(a,b)IdA(a,b). (For the second, instantiate B at the based family λw.IdA(a,w).) Thus identity of indiscernibles is derivable, given a universe.

Exercise 30.7

★★☆ Let A type and assume, in addition to definition 30.1, equality reflection: from Γq:IdA(a,b) conclude Γab:A. Construct a closed term of type x:Ap:IdA(x,x)IdIdA(x,x)(p,reflx). Hint: in the generic context x,y:A,p:IdA(x,y), reflection lets reflx convert to the type IdA(x,y); use this converted term in the motive of J.

The groupoid laws

The operations refl, ()1, obey the groupoid laws—but only up to further identifications. Each law is an identity type between identifications, and what we construct is an inhabitant of it.

Theorem 30.20 — Groupoid laws

Let A be a type and a,b,c,d:A, with p:IdA(a,b), q:IdA(b,c), r:IdA(c,d). The following types are inhabited:

  1. unit laws: IdIdA(a,b)(reflap,p), and judgmentally preflbp;

  2. inverse laws: IdIdA(a,a)(pp1,refla) and IdIdA(b,b)(p1p,reflb);

  3. involution: IdIdA(a,b)((p1)1,p);

  4. associativity: IdIdA(a,d)((pq)r,p(qr)).

Proof of Theorem 30.20 — Groupoid laws

Proof. (i) The judgmental half is the computation rule for concatenation. For the other half, the endpoints a,b of p are generic, so identity induction applies (convention 30.6). In context x,y:A,ρ:IdA(x,y), take the motive IdIdA(x,y)(reflxρ,ρ). For the clause, note that reflzreflzreflz by the computation rule of , so that reflreflz inhabits the instance IdIdA(z,z)(reflzreflz,reflz) after conversion. Then J(z.reflreflz;p) inhabits IdIdA(a,b)(reflap,p).

(ii) Induct on p, once for each inverse law. The two motives are x,y:A,ρ:IdA(x,y)  IdIdA(x,x)(ρρ1,reflx) type, x,y:A,ρ:IdA(x,y)  IdIdA(y,y)(ρ1ρ,refly) type. At x=y=z and ρ=reflz, inverse computes to reflz. In the first motive the resulting concatenation computes because its second argument is reflz; in the second the defining equation of applies because the right argument is again reflz. Both instances are therefore judgmentally IdIdA(z,z)(reflz,reflz), with clause z.reflreflz.

(iii) Use the motive x,y:A,ρ:IdA(x,y)  IdIdA(x,y)((ρ1)1,ρ) type. At reflexivity, the two applications of inverse both compute, so the clause is again z.reflreflz.

(iv) Concatenation computes on its second argument, so eliminate r. The fixed path q:IdA(b,c) contains the left endpoint c of r in its type, and therefore cannot remain fixed while that endpoint is made generic. Generalize both p and q into the motive. Work in context x,y:A,ρ:IdA(x,y) and quantify over a,b:A, p:IdA(a,b), and q:IdA(b,x). The fiber of the resulting iterated product is IdIdA(a,y)((pq)ρ,p(qρ)). This is well formed because x is a variable of the motive’s context. For the clause at z, both sides compute: (pq)reflzpq and p(qreflz)pq, so λa.λb.λp.λq.reflpq has the required type after conversion. Applying J to r and instantiating the resulting Π-term at a,b,p,q yields the associator αp,q,r:=J(z.λa.λb.λp.λq.reflpq;r)abpq,αp,q,r:IdIdA(a,d)((pq)r,p(qr)). ◻

Proposition 30.21 — Functoriality of

For f:AB, g:BC, p:IdA(a,b), q:IdA(b,c), the following types are inhabited:

  1. IdIdB(fa,fc)(apf(pq),apf(p)apf(q));

  2. IdIdB(fb,fa)(apf(p1),(apf(p))1);

  3. IdIdC(g(fa),g(fb))(apλx.g(fx)(p),apg(apf(p))).

Proof of Proposition 30.21 — Functoriality of

Proof. (i) Induct on q and generalize a and p into the motive. For generic x,y:A and ρ:IdA(x,y) take a:Ap:IdA(a,x)IdIdB(f(a),f(y))(apf(pρ),apf(p)apf(ρ)). At ρ=reflx, the concatenation preflx, the action apf(reflx), and the right-hand concatenation all compute. Both sides are apf(p), so the clause is λa.λp.reflapf(p). Instantiate the result at a,p.

(ii) For generic x,y:A and ρ:IdA(x,y), take the motive IdIdB(f(y),f(x))(apf(ρ1),(apf(ρ))1). At x=y=z and ρ=reflz, inverse and ap both compute. The reflexivity clause is z.reflreflf(z). Instantiating at a,b,p gives the required path.

(iii) For generic x,y:A and ρ:IdA(x,y), take the motive IdIdC(g(f(x)),g(f(y)))(apλw.g(f(w))(ρ),apg(apf(ρ))). At x=y=z and ρ=reflz, both endpoints compute to reflg(f(z)). The clause is z.reflreflg(f(z)); instantiate at a,b,p. ◻

Proposition 30.22 — Transport is functorial

Let Γ,x:AB type, and let p:IdA(a,b), q:IdA(b,c), u:B[a/x]. The following types are inhabited:

  1. IdB[c/x](trpqB(u),trqB(trpB(u)));

  2. IdB[a/x](trp1B(trpB(u)),u).

  3. for v:B[b/x], IdB[b/x](trpB(trp1B(v)),v).

Proof of Proposition 30.22 — Transport is functorial

Proof. (i) Induct on q while generalizing a, p, and u into the motive. For generic x,y:A and ρ:IdA(x,y) take a:Ap:IdA(a,x)u:B[a/x]IdB[y/x](trpρB(u),trρB(trpB(u))). At ρ=reflx, the concatenation and the outer transport compute, so both endpoints reduce to trpB(u). The clause is λa.λp.λu.refltrpB(u); instantiate at a,p,u.

(ii) Generalize u into the motive x,y:A,ρ:IdA(x,y)  u:BIdB(trρ1B(trρB(u)),u) type. At ρ=reflx both transports and the inverse compute, so the clause is λu.reflu. Instantiate the result at u.

(iii) This time generalize v into the motive x,y:A,ρ:IdA(x,y)  v:B[y/x]IdB[y/x](trρB(trρ1B(v)),v) type. Its reflexivity clause is again λv.reflv after the inverse and both transports compute. Instantiate at v. ◻

Remark 30.23 — Higher structure

The laws of theorem 30.20 are themselves terms, so their identity types may be formed in turn. Repeated identity induction constructs many coherence identifications; for example, it compares the two composites of associators that rebracket four consecutive identifications. Thus the rules produce a hierarchy: identifications, identifications between those, and so on without end. The four groupoid laws above are only its first level. A complete coherence theorem for the whole hierarchy is a separate metatheoretic result.

Exercise 30.8

★★☆ For p:IdA(a,b) and q:IdA(b,c), construct an identification IdIdA(c,a)((pq)1,q1p1). Induct first on q with p generalized; in the reflexivity instance use the inverse of the left-unit identification in theorem 30.20(i).

Exercise 30.9

★★☆ Given f,f:AB and a pointwise identification h:x:AIdB(f(x),f(x)), show that for p:IdA(a,b) the two boundary composites (h(a)1apf(p))h(b) and apf(p) are identified. Induct on p and use the groupoid laws in the reflexivity case. The other bracketing follows from the associativity identification of theorem 30.20(iv).

Exercise 30.10

★★☆ Let B and C be families over A and h:x:AB(x)C(x). For p:IdA(a,b) and u:B(a), construct an identification IdC(b)(trpC(h(a)(u)),h(b)(trpB(u))). State the motive and verify its reflexivity clause.

Singletons and based path induction

The eliminator J requires both endpoints to be generic. This section derives the sharper principle in which one endpoint stays fixed — based path induction — from a single new construction: contractibility of singletons.

A direct use of Id-elim cannot simply insert the based motive. If C is formed in Γ,y:A,p:IdA(a,y), the tempting assignment D(x,y,p):=?C(y,p)forx,y:A, p:IdA(x,y) is ill formed: inside C, the variable p must have type IdA(a,y), whereas the generic p supplied by Id-elim has type IdA(x,y). The construction below performs exactly the missing change of base point.

Definition 30.24 — Singleton type

For Γa:A, the singleton of a is SingA(a):=y:AIdA(a,y), the type of elements of A together with an identification with a. Its distinguished element is the center (a,refla):SingA(a).

Construction 30.25 — Contractibility of singletons

For Γa:A and Γu:SingA(a) there is a term Γuniqa(u):IdSingA(a)((a,refla),u). At the center it computes judgmentally: Γuniqa((a,refla))refl(a,refla):IdSingA(a)((a,refla),(a,refla)).

Proof of Construction 30.25 — Contractibility of singletons

Construction. Apply Id-elim with the motive x:A,y:A,p:IdA(x,y)IdSingA(x)((x,reflx),(y,p)) type and clause z.refl(z,reflz), obtaining e(x,y,p):IdSingA(x)((x,reflx),(y,p)). Set uniqa(u):=e(a,pr1(u),pr2(u)); by the η-rule for Σ-types (definition 27.9) we have u(pr1(u),pr2(u)), so the type of uniqa(u) converts to the one stated. The computation rule follows from Id-comp and the β-rules for Σ (which give pr1(a,refla)a, pr2(a,refla)refla). Note that the motive generalizes the goal: it proves the statement for every center x at once, which is what makes the induction legitimate. ◻

Theorem 30.26 — Based path induction

The following rules are derivable from definition 30.1 together with Σ-types:

Γa:AΓ,y:A,p:IdA(a,y)C typeΓc:C[a/y,refla/p]Γq:IdA(a,b)
ΓJ(y.p.C;c;q):C[b/y,q/p]
Id-elim'
Γa:AΓ,y:A,p:IdA(a,y)C typeΓc:C[a/y,refla/p]
ΓJ(y.p.C;c;refla)c:C[a/y,refla/p]
Id-comp'

Here the endpoint a is arbitrary — fixed, not generic — and the computation rule holds judgmentally.

Proof of Theorem 30.26 — Based path induction

Proof. Uncurry the family C over the singleton: let Γ,u:SingA(a)C^ type,C^:=C[pr1(u)/y,pr2(u)/p]. Given q:IdA(a,b), the contraction path at (b,q) is uniqa((b,q)):IdSingA(a)((a,refla),(b,q)), and we transport along it: J(y.p.C;c;q):=truniqa((b,q))u.C^(c). This is well-typed: by the β-rules for Σ, C^[(a,refla)/u]C[a/y,refla/p], the type of c, and C^[(b,q)/u]C[b/y,q/p], the stated conclusion. For the computation rule, take b:=a, q:=refla: then truniqa((a,refla))C^(c)=construction30.25trrefl(a,refla)C^(c)=construction30.9c. Both steps are judgmental, so Id-comp holds as stated. ◻

Proposition 30.27 — Equivalence of the presentations

In the presence of the Σ-rules of definition 27.9, including their judgmental η-rule, the following three presentations are interderivable with their displayed judgmental computation rules:

  1. the two-endpoint eliminator J of definition 30.1;

  2. the based eliminator J of theorem 30.26;

  3. transport of construction 30.9 together with singleton contraction uniq from construction 30.25.

Proof of Proposition 30.27 — Equivalence of the presentations

Proof. The implication (i)(iii) is the construction of transport and uniq above, and (iii)(ii) is the proof of theorem 30.26. It remains only to recover full J from (ii), or directly from (iii).

Suppose C is a motive over x,y,p and c is its reflexivity clause. For each x:A and u:SingA(x) define C^x(u):=C[x/x,pr1(u)/y,pr2(u)/p]. Given q:IdA(a,b), set Jtr(x.y.p.C;z.c;q):=truniqa((b,q))u.C^a(u)(c[a/z]). The source fiber reduces to C[a/x,a/y,refla/p] and the target fiber to C[a/x,b/y,q/p], so the term has exactly the conclusion of Id-elim. For q=refla, singleton contraction computes to refl(a,refla), and transport along that reflexivity computes to c[a/z]. Hence Id-comp is judgmental. This proves (iii)(i). From J at the fixed endpoint a one obtains the same conclusion directly: Jbased(x.y.p.C;z.c;q):=J(y.p.C[a/x];c[a/z];q). Its classifier is C[a/x,b/y,q/p], and its reflexivity equation is exactly Id-comp. This proves (ii)(i). ◻

Exercise 30.11

★☆☆ Using only J and its computation rule, reconstruct inverse and concatenation. Which unit law for the resulting concatenation is judgmental? Compare with construction 30.15.

Exercise 30.12

★★☆ Take only tr and uniq with their computation rules as primitive. Reconstruct the dependent action apdf(q) of construction 30.18. Use the formula for Jtr in proposition 30.27, and verify the reflexivity computation without appealing to primitive J.

Limits of path induction

The eliminator J proves inverse, concatenation, congruence, and groupoid laws by acting on the identity family with both endpoints generic. None of the displayed constructions identifies every pair of identifications with fixed endpoints, or supplies function extensionality, the principle that pointwise identifications produce an identification between functions. We state these types explicitly and then separate two questions: whether adding them is consistent, and whether they are derivable from J alone.

Definition 30.28 — UIP and K

For a type A, define UIPA:=x:Ay:Ap:IdA(x,y)q:IdA(x,y)IdIdA(x,y)(p,q),KA:=x:Ap:IdA(x,x)IdIdA(x,x)(p,reflx). UIPA (uniqueness of identity proofs) asserts that any two identifications of the same endpoints are identified; KA (Streicher’s axiom K) is the special case of loops at a point, compared with refl [Str93].

Proposition 30.29

For every type A, the types UIPAKA and KAUIPA are inhabited.

Proof of Proposition 30.29

Proof. The first map sends u:UIPA to λx.λp.uxxpreflx; no symmetry is needed. For the second, fix k:KA and x:A; we construct all of UIPA’s remaining arguments by based path induction on q (theorem 30.26), with p generalized into the motive: y:A,q:IdA(x,y)p:IdA(x,y)IdIdA(x,y)(p,q) type. The reflexivity clause required when y:=x and q:=reflx has type p:IdA(x,x)IdIdA(x,x)(p,reflx), and is exactly kx. The remaining loop p has both endpoints fixed at x. Thus neither Id-elim nor Id-elim applies directly; this residue is precisely KA. ◻

Construction 30.34 — Pointwise action

For f,g:x:AB there is a term happlyf,g:Idx:AB(f,g)x:AIdB(fx,gx)withhapplyf,f(reflf)λx.reflfx, by identity induction: take the motive x:AIdB(ux,vx) over u,v,p and the clause w.λx.reflwx.

Definition 30.35 — Function extensionality

For an arbitrary family Γ,x:AB type and functions f,g:x:AB, first put Pt(f,g):=x:AIdB(fx,gx). Then define FunextA,B:=f:x:ABg:x:ABPt(f,g)Idx:AB(f,g). This is the assertion converse to construction 30.34: pointwise identified functions are identified.

Proposition 77.32 — The set interpretation validates UIP and function extensionality

In ZFC, the set interpretation of definition 73.39 extends to Id-form, Id-intro, Id-elim, and Id-comp. Under the Grothendieck-universe hypothesis of lemma 74.14, it also validates Id-form-U and Lift-Id. In either corresponding signature, the extensions by UIP and Funext have semantic sections.

Proof of Proposition 77.32 — The set interpretation validates UIP and function extensionality

Proof. Interpret IdA(a,b) at ρ as {} when [[a]]ρ=[[b]]ρ and as otherwise. Reflexivity denotes . Whenever [[q]]ρ is defined, the identity fiber is inhabited, hence [[a]]ρ=[[b]]ρ. Define [[JA;a;b(x.y.p.C;z.c;q)]]ρΓ:=[[c]](ρ,[[a]]ρ)Γ,z:A. After replacing [[b]]ρ by [[a]]ρ and the unique identity element by , the right side belongs to the interpreted motive at ([[a]]ρ,[[b]]ρ,[[q]]ρ). If q is not interpreted, the partial value of the eliminator is undefined. At q=refla the defining equation is literal.

The two new raw clauses commute with semantic substitution and weakening: reindexing preserves equality of endpoint values, and the displayed J equation reduces to the substitution equation for c. Thus the structural lemma lemma 28.13 gains these two operator cases. The simultaneous derivation induction of lemma 28.14 then gains formation, introduction, elimination, computation, and congruence cases for identity types. Grothendieck-universe closure makes each equality fiber small, and strict lifting leaves that fiber unchanged, giving the two universe rules.

Every identity fiber has at most one element, which supplies the semantic UIP section. Pointwise equal set-theoretic dependent functions are the same set of ordered pairs, so the identity fiber of the two functions is inhabited; this supplies Funext. ◻

Remark 77.33 — Set-model boundary

Proposition 77.32 proves relative consistency of adding UIP and function extensionality. It validates both principles, so it cannot show either one underivable. Showing UIP underivable requires a model with nontrivial identity fibers. The groupoid model of [HS98] is such a countermodel. No independence theorem is used here.

Example 30.37 — Blocked elimination under an assumed principle

Work in the context χ:Funext2,2. Let g:=λx.ind2(y.2;tt,ff;x):22, so that gtttt and gffff, while the displayed body has no computation step when its scrutinee is the variable x. Boolean induction gives h:=λx.ind2(y.Id2(y,gy);refltt,reflff;x):x:2Id2(x,gx).

Hence e:=χ(λx.x)gh:Id22(λx.x,g). Now the term b:=J(u.v.p.2;z.tt;e):2 is blocked: its outer computation rule Id-comp requires the eliminand to be refl, and e — an application of the variable χ — is not displayed in that form. Thus an inhabitant of Funext supplies an identification but no new computation equation for eliminating it.

Remark 77.35 — Final motive audit

Every use of path induction in this chapter can be replayed with the following three-line check: generic context:x,y:A, p:IdA(x,y),motive:C(x,y,p):Uj,clause:d(z):C(z,z,reflz). For inverse functoriality, C(x,y,p) is the equality displayed in proposition 30.21(ii), and substituting y:=x, p:=reflx produces its clause. Based induction first generalizes the fixed endpoint, applies this same audit, and then specializes it back. By contrast, the K-shaped family p:IdA(a,a)  IdIdA(a,a)(p,refla):Ui has already fixed both endpoints. It cannot occupy the generic motive line, which is the exact point where the K derivation stops.

Exercise 30.13

★★★ Show that UIP is hereditary: from a term of UIPA, construct a term of UIPIdA(a,b) for any a,b:A. Hint: put I:=IdA(a,b), fix p:I, and let c(q):IdI(p,q) be supplied by UIPA. By based induction on r:IdI(p,q), compare r with the canonical composite c(p)1c(q); the reflexivity case is an inverse law. Compare any two r,s through that same composite.

Exercise 30.14

★★☆ Verify in detail that the term b of example 30.37 is well-typed in the context χ:Funext2,2, and check that its outer J computation rule does not apply. List the subterms that do compute and the variable-headed eliminators that remain blocked.

Exercise 30.15

★☆☆ Let s:FunextA,B and fix f,g:x:AB. Unfold the two displayed Π-binders and derive sfg:Pt(f,g)Idx:AB(f,g). Together with happlyf,g of construction 30.34, write down the two maps between Pt(f,g) and Idx:AB(f,g). No inverse law is asserted.

Suggested first pass.

Begin with exercise 77.16, then complete exercise 77.17.

Exercise 77.16

★★☆ Starting from J, derive based path induction and use it to prove the left unit, inverse, and associativity laws for path composition. In each case display the motive before applying J and explain why direct induction on an endpoint would be ill typed.

Exercise 77.17

★★★ Practical project.identity-eliminator-checker Implement in Agda or Kappa a checker for the displayed J rule. Maintain the invariant that the motive is checked in the full endpoint-and-path context before the reflexivity branch is substituted. It must accept the based-induction derivation above and reject the same branch with the second endpoint left free; report the missing substitution in the rejection. Before implementing the checker, write the accepted and rejected derivation attempts on paper and circle the motive premise. The rejected tree must fail exactly because the second endpoint remains free after the reflexivity substitution.

Sources. Identity formation, reflexivity, and elimination originate in Martin-Löf’s intensional type theory [ML98, ML75, ML84]. Axiom K and its intensionality criterion are due to Streicher [Str93]; the groupoid countermodel is due to Hofmann and Streicher [HS98]. The derived path operations, based induction, singleton contraction, and groupoid laws are also developed in [Uni13].

Search the book

Type to search the local edition.