Lectures onType Theory
ch:identity-types: ch:identity-types
appendix sectionsolutions

ch:identity-types: ch:identity-types

exercise 30.3.

Identity induction on q gives J(x.y.p.IdB(trpx.B(u),u);z.reflu;q):IdB(trqx.B(u),u). The base clause has the asserted type because trreflzx.B(u)u. For a variable q, however, the eliminator is blocked: its computation rule applies only when the identification is displayed as refl. Thus the constructed identification does not arise from the defining computation equation for a general q.

exercise 30.5.

For the identity function, use identity induction with motive x,y:A, p:IdA(x,y)  IdIdA(x,y)(apλz.z(p),p) type; the reflexivity case is reflreflx. For the constant function use the motive x,y:A, p:IdA(x,y)  IdIdB(b0,b0)(apλz.b0(p),reflb0) type, with the same kind of reflexivity clause.

With the definition of ap in construction 30.17, neither equation is a defining computation on a general identification variable q: both eliminators are blocked on q. Both compute judgmentally when q is refl.

exercise 77.16.

For fixed a:A, based induction has motive C(x,p) in x:A,p:IdA(a,x) and branch c:C(a,refla); it is exactly J(C,c,x,p). Left unit uses C(x,p):=Id(reflap,p); inverse uses C(x,p):=Id(p1p,reflx); associativity fixes the other two paths and uses C(x,p):=Id((rq)p,r(qp)). Each reflexive branch reduces by the path-composition definitions and is refl. Inducting on the endpoint x alone is ill typed: the motive also depends on the path p:a=x, which is not determined by x.

Exercise 30.1.

Start with the given premise A type. Its ambient empty context is formed by Ctx-Emp; extending it gives X ctxCtxEmpA typex:A ctxCtxExt. Writing out the context premise that is suppressed in the book’s compressed version of Var, the term derivation is A typeX ctxCtxEmpA typex:A ctxCtxExtx:Ax:AVarx:Areflx:IdA(x,x)Idintro. The final identity type is well formed by Id-form applied twice to the same variable judgment; this formation judgment is a presupposition of the conclusion of Id-intro. Thus every context and variable step has been made explicit rather than left to convention 26.14.

Exercise 30.2.

The based formation rule is Γa:AΓ,y:AIdA(a,y) typeIdformbased. It follows from ordinary Id-form. The premise presupposes ΓA type. Weakening gives Γ,y:Aa:A, while Var gives Γ,y:Ay:A; hence Γ,y:Aa:AΓ,y:Ay:AΓ,y:AIdA(a,y) typeIdform.

Conversely, suppose the based rule is primitive and let a,b:A in Γ. Apply it to a and then substitute b for its final variable: Γ,y:AIdA(a,y) typeSubstΓIdA(a,b) type. This recovers binary Id-form.

Reflexivity already has only one meaningful based shape: Γa:AΓrefla:IdA(a,a). The constructor lives on the diagonal, so its two endpoints are necessarily the same term. Unlike formation, there is no free second endpoint to turn into a variable or later recover by substitution; hence there is no distinct “binary” introduction rule to compare.

Exercise 30.4.

Define concatenation by induction on its first argument, generalizing the third endpoint and second path: pq:=(J(x.y.r.z:AIdA(y,z)IdA(x,z);w.λz.λs.s;p))(c)(q). The reflexivity computation is judgmental: reflaqq.

We now construct the comparison in the two stages requested. First, identity induction on p gives η(p):IdIdA(a,b)(preflb,p). The motive is x,y:A,r:IdA(x,y)  IdIdA(x,y)(rrefly,r) type, and at r=reflx both endpoints compute to reflx, so the clause is reflreflx.

Next induct on q:IdA(b,c), with p generalized into the motive y,z:A,s:IdA(y,z)  r:IdA(a,y)IdIdA(a,z)(rs,rs) type. At s=refly, the original concatenation computes rreflyr, whereas the target is rrefly. The required clause is therefore λr.η(r)1:r:IdA(a,y)IdIdA(a,y)(r,rrefly). Applying the resulting dependent function to the original p yields IdIdA(a,c)(pq,pq). Thus the two asymmetric definitions agree propositionally, although they choose opposite unit laws as their judgmental computation.

Exercise 30.6.

For p:IdA(a,b), transport in an arbitrary small family gives Leibniz substitution: λp.λB.λu.trpx.B(x)(u):IdA(a,b)L(a,b). Indeed, for B:AUi, rule U-El makes each B(x) a type, so transport sends u:B(a) to a term of B(b).

Conversely, let :L(a,b). The based identity family B0:=λw.IdA(a,w):AUi is small by Id-form-U. Since refla:B0(a), instantiate at this family: λ.(B0)(refla):L(a,b)IdA(a,b). Thus identity implies indiscernibility and, once all small predicates may be quantified over, indiscernibility implies identity. No assertion that the two maps are judgmental inverses is needed.

Exercise 30.7.

Work in the extension with equality reflection. In the generic context x:A,y:A,p:IdA(x,y), reflection gives xy:A. Hence reflx:IdA(x,x) converts to a term reflx:IdA(x,y) with the same raw expression. This makes the following motive legitimate: C(x,y,p):=IdIdA(x,y)(p,reflx). On the reflexivity diagonal it reduces to C(z,z,reflz)=IdIdA(z,z)(reflz,reflz), inhabited by reflreflz. Put d(z):=reflreflz. Then k:=λx.λp.J(u.v.q.C(u,v,q);z.d(z);p). When the eliminand p has endpoints x,x, the result type is literally IdIdA(x,x)(p,reflx). Thus k:x:Ap:IdA(x,x)IdIdA(x,x)(p,reflx). The construction pinpoints why reflection collapses intensional identity: it permits the diagonal reflexivity constructor to be typed in every generic fiber, thereby making the otherwise invalid K-motive well formed.

Exercise 30.8.

Let (r):IdIdA(u,v)(reflur,r) denote the left-unit identification of theorem 30.20(i), for r:IdA(u,v). Induct on q:IdA(b,c), generalizing both the earlier endpoint and the path p. Use the motive y,z:A,s:IdA(y,z)  x:Ar:IdA(x,y)IdIdA(z,x)((rs)1,s1r1) type. In the reflexivity instance s=refly, the left endpoint computes as (rrefly)1r1, while the right endpoint computes to reflyr1, since refly1refly. Hence the clause is λx.λr.(r1)1:x:Ar:IdA(x,y)IdIdA(y,x)(r1,reflyr1). Identity induction supplies the desired family for arbitrary q; applying it to a and p gives IdIdA(c,a)((pq)1,q1p1). The inverse on the left-unit witness is forced by the orientation of the goal in the reflexivity case.

Exercise 30.9.

Use identity induction on p with motive x,y:A,r:IdA(x,y) IdIdB(f(x),f(y))((h(x)1apf(r))h(y),apf(r)) type. At r=reflx, functorial action computes to reflexivity for both functions. The left endpoint therefore reduces judgmentally to (h(x)1reflf(x))h(x)h(x)1h(x), because the first concatenation uses its judgmental right-unit law. The right endpoint reduces to reflf(x). Apply the second inverse law of theorem 30.20(ii) to h(x):f(x)=f(x). It supplies the term IdIdB(f(x),f(x))(h(x)1h(x),reflf(x)). This supplies the reflexivity clause, so path induction gives the required identification for every p.

If the boundary composite is bracketed as h(a)1(apf(p)h(b)), first use the associativity witness of theorem 30.20(iv) to compare it with the left-associated composite above, then concatenate that comparison with the constructed naturality identification.

Exercise 30.10.

Generalize the transported argument into the motive x,y:A,p:IdA(x,y)  v:B(x)IdC(y)(trpC(h(x)(v)),h(y)(trpB(v))) type. At p=reflx, both transports compute judgmentally: trreflxC(h(x)(v))h(x)(v),h(x)(trreflxB(v))h(x)(v). Hence the reflexivity clause is simply λv.reflh(x)(v). Identity elimination with this motive yields a dependent function in v:B(a); applying it to u produces IdC(b)(trpC(h(a)(u)),h(b)(trpB(u))). The construction is the naturality of transport with respect to a fiberwise map h.

Exercise 30.11.

For q:IdA(a,b), based induction at the fixed source a reconstructs inverse as q1:=J(y.p.IdA(y,a);refla;q):IdA(b,a). Its computation is refla1refla by Id-comp.

For p:IdA(a,b) and q:IdA(b,c), apply based induction to q, whose fixed source is b: pq:=J(z.r.IdA(a,z);p;q):IdA(a,c). The based computation rule gives preflbp. Thus the right unit is judgmental. This is the same asymmetry and, up to notation, the same operation as the concatenation of construction 30.15, which transports p along the second path. Defining concatenation instead by based induction on the first path would require the second path to be generalized and would select the left unit as the direct computation.

Exercise 30.12.

Let f:x:AB(x) and q:IdA(a,b). For the ordinary J-motive used by dependent action, put C(x,y,p):=IdB(y)(trpB(f(x)),f(y)). Fixing the first endpoint at a, its uncurried family over the singleton u:SingA(a) is C^a(u):=IdB(pr1(u))(trpr2(u)B(f(a)),f(pr1(u))). The formula for Jtr in proposition 30.27 therefore gives the reconstruction apdf(q):=truniqa((b,q))u.C^a(u)(reflf(a)). At the center, the source fiber is C^a((a,refla))IdB(a)(trreflaB(f(a)),f(a))IdB(a)(f(a),f(a)), so the displayed reflf(a) is well typed by conversion. At (b,q), the target fiber is exactly IdB(b)(trqB(f(a)),f(b)).

For q=refla, singleton contraction computes first and transport computes second: apdf(refla)truniqa((a,refla))u.C^a(u)(reflf(a))trrefl(a,refla)u.C^a(u)(reflf(a))reflf(a). This verifies the required judgmental computation using only the primitive rules for tr and uniq, not primitive J.

Exercise 30.13.

Assume u:UIPA, fix a,b:A, and abbreviate I:=IdA(a,b). We construct UIPI. Fix first p:I, and for every q:I define the canonical path c(q):=u(a)(b)(p)(q):IdI(p,q). For q:I put k(q):=c(p)1c(q):IdI(p,q). We first compare every path out of p with this canonical one. Based path induction on r:IdI(p,q) gives d(q,r):IdIdI(p,q)(r,k(q)). The motive is q:I,r:IdI(p,q)  IdIdI(p,q)(r,c(p)1c(q)) type. At q=p,r=reflp, the target is c(p)1c(p). The inverse law supplies ι(c(p)):IdIdI(p,p)(c(p)1c(p),reflp), so the required reflexivity clause, oriented from reflp to the canonical composite, is ι(c(p))1.

Now let r,s:IdI(p,q). Both are connected to the same canonical path, hence d(q,r)d(q,s)1:IdIdI(p,q)(r,s). Abstracting successively over p,q,r,s constructs p:Iq:Ir:IdI(p,q)s:IdI(p,q)IdIdI(p,q)(r,s), which is UIPI. Thus UIP at A propagates to every identity type of A.

Exercise 30.14.

Unfold χ:f:22g:22Pt(f,g)Id22(f,g). The function g:=λx.ind2(y.2;tt,ff;x) has type 22: in context x:2, the constant motive is 2, both branches have that type, and the scrutinee is x. Its closed-constructor computations are g(tt)tt,g(ff)ff. For a variable x, however, the Boolean eliminator in its body is neutral.

For h:=λx.ind2(y.Id2(y,g(y));refltt,reflff;x), the motive is a type because y:2 and g(y):2. In the true branch, g(tt)tt, so refltt converts to Id2(tt,g(tt)); the false branch is identical. Hence h:x:2Id2(x,g(x))=Pt(λx.x,g). The applications of χ therefore derive e:=χ(λx.x)(g)(h):Id22(λx.x,g). Now take the constant J-motive u,v:22,p:Id22(u,v)2 and the clause z.tt. Rule Id-elim gives b:=J(u.v.p.2;z.tt;e):2.

The reductions available inside this construction are:

  • function beta exposes the bodies of g(t) and h(t);

  • Boolean computation reduces g(tt),g(ff) and, after beta, reduces h(tt),h(ff) to the corresponding reflexivity terms;

  • the identity function satisfies (λx.x)(t)t;

  • substitutions into the constant outer motive and constant clause are literal.

The blocked neutral subterms are:

  • ind2(y.2;tt,ff;x) when x is a variable;

  • the analogous Boolean eliminator defining h(x) when its scrutinee is a variable;

  • the application e=χ(λx.x)(g)(h), whose head is the variable χ;

  • consequently the outer J-term, whose eliminand is the neutral term e, not a displayed refl.

Rule Id-comp therefore does not apply to b. Function extensionality has supplied an identification, but no computation rule for that variable-provided identification.

Exercise 30.15.

Let F:=x:AB. Unfolding the definition gives s:f:Fg:FPt(f,g)IdF(f,g). One Pi-elimination at f:F yields s(f):g:FPt(f,g)IdF(f,g), and a second at g:F yields s(f)(g):Pt(f,g)IdF(f,g). The pointwise-action construction supplies the opposite map happlyf,g:IdF(f,g)Pt(f,g). Thus the two displayed maps are Pt(f,g)s(f)(g)IdF(f,g)happlyf,gPt(f,g). The type of s asserts only existence of the first map. It contains no fields or equations saying either composite is an identity, so no inverse law follows merely by unfolding the binders.

Search the book

Type to search the local edition.