Lectures onType Theory
Chapter 142
Chapter 142Core route

Adjunctions, Limits, and Locally Cartesian Closure

A substitution σ:ΞΓ of definition 141.1 is a list of terms, one for each declaration of Γ. Lists can be cut. If Γ=x1:A1,,xn:An and Δ=y1:B1,,ym:Bm declare disjoint variables, then writing ΓΔ for the concatenated context, a substitution ΞΓΔ is a list of n+m terms, and cutting it after the n-th entry produces a substitution ΞΓ and a substitution ΞΔ. Joining two such lists inverts the cut. So homCtx(Ξ,ΓΔ)homCtx(Ξ,Γ)×homCtx(Ξ,Δ) as sets, for every Ξ.

Lemma 141.27 showed that a description of the arrows into an object determines that object up to a unique isomorphism. Equation 142.1 is a second such description, and it determines ΓΔ in the same way. The two descriptions are instances of one pattern, and the pattern has three further instances that this chapter needs: substituting a family along a map, forming a function space, and forming a dependent product over a family. Each is an object described by its arrows, and each such description is a bijection of hom-sets that respects composition. The object that organizes all of them is an adjunction.

The chapter ends where that organization stops being enough. A universal object is determined only up to isomorphism, whereas the substitution equation J[fg]=(J[f])[g] of proposition 71.51 is a literal identity of syntax. Section 142.10 exhibits the gap in a three-element calculation.

Products

Recall from definition 141.26 that 1 is terminal in C when each object c admits exactly one arrow c1. The description (142.1) has the same shape with a pair of arrows in place of the empty tuple, and it becomes a definition once the two projections that perform the cut are named.

Definition 142.1 — Binary product

Let a,b be objects of C. A product of a and b is an object a×b together with arrows pr1:a×ba and pr2:a×bb such that for every object c and every pair of arrows f:ca, g:cb there is exactly one arrow f,g:ca×b with pr1f,g=f,pr2f,g=g. The arrows pr1,pr2 are the projections and f,g is the pairing of f and g.

The projections carry the definition: the same object can be a product in more than one way, and the data being defined is the triple (a×b,pr1,pr2). Two equations record this.

Lemma 142.2 — Pairing calculus

Let (a×b,pr1,pr2) be a product in C. Then

  1. pr1,pr2=ida×b;

  2. f,gh=fh,gh for every h:cc, f:ca, g:cb.

Proof of Lemma 142.2 — Pairing calculus

Proof. For (1), ida×b satisfies the two equations (142.2) required of pr1,pr2, because priida×b=pri by the unit law; the uniqueness clause of definition 142.1 applied to the pair (pr1,pr2) then identifies the two arrows.

For (2), the arrow f,gh satisfies the two equations required of fh,gh: pr1(f,gh)=assoc.(pr1f,g)h=(142.2)fh, and the same calculation with pr2 and g. Uniqueness applied to the pair (fh,gh) gives the equation. ◻

Lemma 142.3 — Uniqueness of products

Let (p,pr1,pr2) and (p,pr1,pr2) both be products of the objects a and b in the category C. Then exactly one arrow u:pp satisfies the two equations pr1u=pr1 and pr2u=pr2, and that arrow is an isomorphism.

Proof of Lemma 142.3 — Uniqueness of products

Proof. Existence and uniqueness of u are the universal property of p applied to the pair (pr1,pr2) out of p. Symmetrically there is exactly one v:pp with priv=pri. Then pri(vu)=assoc.(priv)u=def. vpriu=def. upri=unitpriidp, for i=1,2, so vu and idp both mediate the pair (pr1,pr2); uniqueness in the universal property of p gives vu=idp. Exchanging the roles of p and p gives uv=idp. ◻

Example 142.4 — Products of sets

In Set take A×B={(x,y)xA, yB} with pr1(x,y)=x and pr2(x,y)=y. Given f:CA and g:CB, the function f,g(z)=(f(z),g(z)) satisfies (142.2). If h:CA×B also satisfies them, then for each z the pair h(z) has first component f(z) and second component g(z), hence h(z)=(f(z),g(z)).

Example 142.5 — Meets in a preorder

Let (P,) be a preorder viewed as a category, so that homP(p,q) has one element when pq and is empty otherwise. A product of p and q is an element r with rp, rq, and sr whenever sp and sq: a greatest lower bound. The uniqueness clause of definition 142.1 is automatic, since every hom-set of a preorder has at most one element.

Example 142.6 — A preorder without a product

Let P={a,b,c,d} be ordered by ca, cb, da, db, together with the reflexive instances, and with c,d incomparable. A product of a and b would be a lower bound r of a and b with cr and dr. The lower bounds of {a,b} are exactly c and d; cd fails and dc fails; so no lower bound is greatest, and a and b have no product in P. Existence of products is therefore a genuine hypothesis, not a construction available in every category.

The opening calculation now becomes a statement about Ctx.

Proposition 142.7 — Concatenation is the product of contexts

Let Γ=x1:A1,,xn:An and Δ=y1:B1,,ym:Bm declare disjoint variables, and let ΓΔ be their concatenation. Put pr1:=(x1,,xn):ΓΔΓ,pr2:=(y1,,ym):ΓΔΔ. Then (ΓΔ,pr1,pr2) is a product in Ctx. The empty context is terminal.

Proof of Proposition 142.7 — Concatenation is the product of contexts

Proof. Each xi has type Ai in ΓΔ by Var, and likewise each yj, so both lists are substitutions in the sense of definition 141.1. Let f=(a1,,an):ΞΓ and g=(b1,,bm):ΞΔ. The concatenated list f,g:=(a1,,an,b1,,bm) is a substitution ΞΓΔ, since its i-th entry has the type declared at position i of ΓΔ. Composition acts entrywise by definition 141.4, so pr1f,g=(x1[f,g],,xn[f,g])=(a1,,an)=f, and the same calculation gives pr2f,g=g. For uniqueness, let h=(c1,,cn+m) satisfy the two equations. Its composite with pr1 is (c1,,cn), so ci=ai for in; its composite with pr2 is (cn+1,,cn+m), so cn+j=bj. Hence h=f,g.

For the empty context, a substitution Ξ is the empty list, and there is exactly one empty list. ◻

Exercise 142.1

★☆☆ Take Γ=x:2, Δ=y:22 and Ξ=z:2. Write f,g for f=(tt) and g=(λw:2.z), and check both equations of (142.2) entrywise (two lines).

Exercise 142.2

★★☆ Assume C has all binary products. Construct an isomorphism (a×b)×ca×(b×c) from the universal property alone, and prove that it commutes with the three evident projections. Do not use elements.

Exercise 142.3

★☆☆ In Mon, equip the cartesian product of the underlying sets with componentwise multiplication. Verify that the two projections are monoid homomorphisms and that the pairing of two homomorphisms is one.

Substituting a family: pullbacks

A family of sets (Eg)gΓ is the same thing as a function p:EΓ, namely the projection from E={(g,e)gΓ, eEg}; conversely Eg is recovered as the preimage p1(g). Given a further function γ:ΔΓ, the family may be substituted along γ: the family over Δ whose component at d is Eγ(d). Its total set is Δ×ΓE:={(d,e)Δ×Eγ(d)=p(e)}, with the two projections to Δ and to E. The next definition names the mapping property of that set, and then (142.3) is verified against it.

Definition 142.8 — Pullback

Let γ:ΔΓ and p:EΓ be arrows of C with common target. A pullback of p along γ is an object P with arrows u:PΔ and v:PE such that γu=pv and such that for every object X with arrows u:XΔ, v:XE satisfying γu=pv there is exactly one h:XP with uh=u and vh=v.

The square in question is Mathematical diagramDiagram and the displayed equation γu=pv is what it asserts. A square with this universal property is called a pullback square; u is the substituted family and is written γp when the choice of P is fixed.

Proposition 142.9 — The set-theoretic pullback

In Set, the set (142.3) with u(d,e)=d and v(d,e)=e is a pullback of p along γ, and u1(d) is in bijection with p1(γ(d)) for every dΔ.

Proof of Proposition 142.9 — The set-theoretic pullback

Proof. Commutation. For (d,e)Δ×ΓE the defining condition gives γ(u(d,e))=γ(d)=p(e)=p(v(d,e)).

Existence. Let u:XΔ and v:XE satisfy γu=pv. For xX the pair (u(x),v(x)) satisfies γ(u(x))=p(v(x)), hence lies in Δ×ΓE. Put h(x):=(u(x),v(x)); then uh=u and vh=v by the definition of u and v.

Uniqueness. If h also satisfies the two equations then for each x the pair h(x) has first component u(x) and second component v(x), so h(x)=h(x).

Fibers. Fix dΔ. The map e(d,e) sends p1(γ(d)) into u1(d), and (d,e)e sends u1(d) into p1(γ(d)); the two are mutually inverse. ◻

The same square occurs in the syntax of a dependent theory, where it is the mapping property of context extension. Fix the theory of chapter 26: contexts, context substitutions f:ΓΔ of definition 26.45, and the action J[f] of proposition 71.51. Two context substitutions with the same source and target are identified when their corresponding entries are judgmentally equal; the identification is needed for the uniqueness clause below and for nothing else.

Definition 142.10 — The syntactic category of a dependent theory

Let T be a dependent theory over the rules of chapter 26. The category CtxT has the derivable contexts Γ ctx as objects; an arrow ΔΓ is an equivalence class of context substitutions f:ΔΓ under the relation identifying f=(b1,,bm) with f=(b1,,bm) when Δbjbj:Bj[b<j/y<j] for every j. Composition and identities are those of proposition 71.51.

That the operations descend to classes is the congruence property of judgmental equality under substitution (definition 26.16); the category laws hold because they hold for representatives. For a type ΓA type write Γ.A for the extended context Γ,x:A with x fresh, and wA:=(x1,,xn):Γ.AΓ,x:=x, so that wA is the variable list of Γ and x is the last variable, with Γ.Ax:A[wA].

Proposition 142.11 — Context extension is a pullback

Let ΓA type and f:ΔΓ in CtxT, and put f+:=(fwA[f],x). Then Mathematical diagramDiagram is a pullback square in CtxT.

Proof of Proposition 142.11 — Context extension is a pullback

Proof. Write f=(a1,,an).

Well-formedness. From ΓA type and f the action of proposition 71.51 gives ΔA[f] type, so Δ.A[f] is a context. The list f+ has entries a1[wA[f]],,an[wA[f]] followed by x. The first n entries have the types of Γ by weakening, and the last has type A[fwA[f]]=proposition71.51A[f][wA[f]], which is the type required at the last declaration of Γ.A.

Commutation. Both composites are the list (a1[wA[f]],,an[wA[f]]): on one side because wA selects the first n entries of f+, on the other by entrywise substitution.

Existence. Let h:ΞΔ and k:ΞΓ.A satisfy fh=wAk. Split k=(k0,c) where k0 is the list of its first n entries and Ξc:A[k0]. Then wAk=k0, so the hypothesis reads k0=fh, whence A[k0]=A[fh]=proposition71.51A[f][h], and Ξc:A[f][h]. Therefore m:=(h,c) is a context substitution ΞΔ.A[f]. It satisfies wA[f]m=h, since wA[f] selects the first entries; and f+m=(a1[wA[f]][m],,an[wA[f]][m],x[m])=(fh,c)=(k0,c)=k.

Uniqueness. Let m satisfy the same two equations. From wA[f]m=h its first entries are judgmentally equal to those of h, and from f+m=k its last entry is judgmentally equal to c. Hence m=m as an arrow of CtxT. ◻

The uniqueness step is the only place where definition 142.10 used judgmental equality rather than literal equality of lists: two substitutions with judgmentally equal entries induce the same action on judgments, but need not be the same list of raw terms.

Exercise 142.4

★★☆ Show that in the square of definition 142.8, if p is a monomorphism in the sense of definition 141.28, then so is u. Hint: use the uniqueness clause with two competing arrows into P (four lines).

Exercise 142.5

★★☆ Let the right square below be a pullback. Prove that the left square is a pullback if and only if the outer rectangle is. Mathematical diagramDiagram State precisely which universal property is applied in each direction.

Exercise 142.6

★☆☆ In proposition 142.11 take Γ=(u:A), Δ=(), f=(a) with a:A, and ΓB type. Write out all four arrows of the square explicitly and identify A[f], f+, and the mediating map for h=id, k=(a,b).

Equalizers and finite limits

Products and pullbacks are two instances of one construction: an object equipped with arrows to a family of objects, universal among such. One further instance is needed before that construction can be stated in general, and it is the one that solves equations.

Definition 142.12 — Equalizer

Let f,g:ab. An equalizer of f and g is an object e with an arrow i:ea such that fi=gi and such that every j:xa with fj=gj factors as j=ik for exactly one k:xe.

Example 142.13 — Equalizers of sets

For f,g:AB put E={xAf(x)=g(x)} with i the inclusion. If j:XA satisfies fj=gj, then j(x)E for every x, so j corestricts to k:XE with ik=j; and k is forced, because i is injective.

Definition 142.14 — Diagram, cone, limit

Let J be a category with finitely many objects and finitely many arrows, and let D:JC be a functor in the sense of definition 141.32. A cone over D with vertex c is a family of arrows τi:cD(i), one for each object i of J, with D(α)τi=τj for every α:ij of J. A limit of D is a cone (l,(πi)) such that for every cone (c,(τi)) there is exactly one h:cl with πih=τi for all i. A category has finite limits when every such D has a limit.

A terminal object is the limit of the empty diagram, a product the limit of a diagram with two objects and no nonidentity arrows, an equalizer the limit of a diagram with two parallel arrows, and a pullback the limit of a diagram . The next theorem says that the first three suffice.

Theorem 142.15 — Finite limits from products and equalizers

If C has a terminal object, binary products, and equalizers of all parallel pairs, then C has finite limits.

Proof of Theorem 142.15 — Finite limits from products and equalizers

Proof. Terminal objects and binary products give a product iD(i) of the finitely many objects D(i), by induction on their number: the empty product is the terminal object and in+1=(in)×D(n+1); write ρi for the resulting projections. Likewise form αD(tgtα) over the finitely many arrows α of J, with projections ρα. Define u,v:iD(i)αD(tgtα) as the unique arrows with ραu=D(α)ρsrcα,ραv=ρtgtα for every α; these exist and are unique by the universal property of the second product. Let i:eiD(i) be an equalizer of u and v, and put πi:=ρii.

(e,(πi)) is a cone. For α:ij, D(α)πi=def.D(α)ρii=def. uραui=equalizerραvi=def. vρji=def.πj.

Universality. Let (c,(τi)) be a cone. Let t:ciD(i) be the unique arrow with ρit=τi. Then for each α:ij, ραut=def. uD(α)ρit=def. tD(α)τi=coneτj=def. tρjt=def. vραvt, and since this holds for every α, uniqueness in the universal property of α gives ut=vt. Hence t=ih for exactly one h:ce, and πih=ρiih=ρit=τi. If h also satisfies πih=τi for all i, then ih and ih have the same composites with every ρi, so ih=t=ih, and uniqueness of the equalizer factorization gives h=h. ◻

Corollary 142.16 — Pullbacks from products and equalizers

Under the hypotheses of theorem 142.15, a pullback of p:EΓ along γ:ΔΓ is obtained as the equalizer i:PΔ×E of γpr1 and ppr2, with u=pr1i and v=pr2i.

Proof of Corollary 142.16 — Pullbacks from products and equalizers

Proof. The stated diagram is the case of theorem 142.15 in which J has objects 1,2,3 and two nonidentity arrows 132; the product over the objects is Δ×E×Γ and the equalizer conditions reduce to γpr1=ppr2 after deleting the redundant third factor, since the cone component at 3 is determined by the component at 1. ◻

Reversing every arrow in definition 142.14 gives colimits: a cocone is a family τi:D(i)c with τjD(α)=τi, and a colimit is an initial such cocone. By definition 141.25, a colimit of D in C is a limit of the corresponding diagram in Cop; the transformation reverses every arrow and every composite, exchanges source and target, and therefore converts theorem 142.15 into: a category with an initial object, binary coproducts, and coequalizers has finite colimits. The binary coproduct in Set is the disjoint union A+B with the two injections; the initial object is .

Exercise 142.7

★☆☆ Prove that the arrow i of an equalizer is a monomorphism (definition 141.28). Two lines.

Exercise 142.8

★★☆ Let P be a preorder viewed as a category. Identify limits of finite diagrams in P in order-theoretic language, and explain why every equalizer in P is an identity arrow.

Exercise 142.9

★★★ In Ctx take Γ=x:2, Δ=y:2 and the two substitutions f=(tt), g=(ff):ΓΔ. Show that f and g have an equalizer and identify it. Then take instead f=(x) and g=(tt) and show that their equalizer is the context Ξ with the property that a substitution ΘΓ equalizes f and g exactly when its single component is α-equal to tt; conclude that Ctx has this equalizer as well. Which step would fail if arrows were terms modulo β-conversion?

Adjunctions

Let S be a set and S the monoid of finite lists of elements of S under concatenation, with the empty list as unit. There is a function ηS:SS sending s to the one-element list [s]. Now let M be any monoid and k:SUM a function into its underlying set. A monoid homomorphism k^:SM with Uk^ηS=k is forced: it must send the empty list to the unit of M and [s1,,sn] to k(s1)k(sn), since k^ preserves the unit and the multiplication. That assignment is a homomorphism, so homMon(S,M)homSet(S,UM) by k^Uk^ηS. Here U:MonSet is the forgetful functor of example 141.34.

Equation 142.4 is a bijection for each pair (S,M), and it interacts with composition on both sides. That interaction is the content of the next definition; without it the bijections could be chosen independently at each pair and would carry no information.

Definition 142.17 — Adjunction, hom-set form

Let F:CD and G:DC be functors. An adjunction FG is a family of bijections φc,d:homD(Fc,d)homC(c,Gd) indexed by objects c of C and d of D, such that for all g:Fcd, h:cc in C, and k:dd in D, φc,d(gFh)=φc,d(g)h,φc,d(kg)=Gkφc,d(g). F is the left adjoint and G the right adjoint. We write φ(g) when the objects are determined by the argument.

The two equations of (142.5) say that φ is a natural isomorphism in the sense of proposition 141.43 between two functors Cop×DSet, namely (c,d)homD(Fc,d) and (c,d)homC(c,Gd); proposition 141.55 supplies the functor structure.

Proposition 142.18 — The free monoid is left adjoint to the underlying set

Let F:SetMon send S to S and a function h:SS to the homomorphism Fh acting entrywise on lists. Then F is a functor and FU, with φ(k^)=Uk^ηS.

Proof of Proposition 142.18 — The free monoid is left adjoint to the underlying set

Proof. F is a functor. Acting entrywise preserves concatenation and the empty list, so Fh is a homomorphism; entrywise action of a composite is the composite of entrywise actions, and entrywise action of the identity is the identity.

φ is a bijection. The paragraph opening this section showed that for each k:SUM there is exactly one homomorphism k^ with Uk^ηS=k, which is exactly the statement that φ is injective and surjective.

First equation. Let h:SS and k^:SM. Both sides are functions SUM; evaluate at sS: φ(k^Fh)(s)=def. φk^(Fh([s]))=entrywisek^([h(s)])=def. φφ(k^)(h(s)).

Second equation. Let l:MM be a homomorphism. At sS, φ(lk^)(s)=def. φl(k^([s]))=def. φUl(φ(k^)(s)), which is the value of Ulφ(k^) at s. ◻

Example 142.19 — Free category on a graph

Let U send a small category to its underlying graph, with the arrows as edges. Definition 141.17 builds Free(G) from paths, and proposition 141.35 exhibits its mapping property: a graph morphism GUC extends to exactly one functor Free(G)C. That mapping property is the bijection homCat(Free(G),C)homGraph(G,UC), and it satisfies (142.5) for the same reason as in proposition 142.18: both sides of each equation are determined by their values on edges.

Unit, counit, and the triangle identities

The bijection φ of definition 142.17 is determined by two of its values, and those two values satisfy two equations. The function ηS of the previous section is the first of them.

Definition 142.20 — Unit and counit form

Let F:CD and G:DC. A unit–counit adjunction consists of natural transformations η:IdCGF and ε:FGIdD such that εFcFηc=idFc,GεdηGd=idGd for all objects c of C and d of D. The two equations are the triangle identities.

Theorem 142.21 — The two presentations agree

Let F:CD and G:DC be functors.

  1. If φ is an adjunction in the sense of definition 142.17, then ηc:=φ(idFc) and εd:=φ1(idGd) are natural and satisfy (142.6).

  2. If (η,ε) satisfy (142.6), then φ(g):=Ggηc for g:Fcd is a bijection satisfying (142.5), with inverse ψ(f)=εdFf.

  3. The two passages are mutually inverse.

Proof of Theorem 142.21 — The two presentations agree

Proof. The proof uses only the two equations (142.5) and the functor laws; every step is one of them.

(1) Naturality of η. Let h:cc. Then GFhηc=(142.5)(2)φ(FhidFc)=unitφ(Fh)=unitφ(idFcFh)=(142.5)(1)ηch. Naturality of ε is the same calculation performed on φ1, whose two equations are obtained from (142.5) by applying φ1 to both sides: φ1(fh)=φ1(f)Fh and φ1(Gkf)=kφ1(f). Explicitly, for l:dd, εdFGl=φ1(1)φ1(idGdGl)=unitφ1(Gl)=unitφ1(GlidGd)=φ1(2)lεd.

(1) Triangle identities. For the first, φ(εFcFηc)=(142.5)(1)φ(εFc)ηc=def. εidGFcηc=unitηc=def. ηφ(idFc), and φ is injective, so εFcFηc=idFc. For the second, apply φ1 to GεdηGd: φ1(GεdηGd)=φ1(2)εdφ1(ηGd)=def. ηεdidFGd=unitεd=def. εφ1(idGd).

(2) φ and ψ are mutually inverse. For g:Fcd, ψ(φ(g))=def.εdF(Ggηc)=functorεdFGgFηc=εnaturalgεFcFηc=(142.6)(1)g. For f:cGd, φ(ψ(f))=def.G(εdFf)ηc=functorGεdGFfηc=ηnaturalGεdηGdf=(142.6)(2)f.

(2) The two equations. For h:cc, φ(gFh)=def.G(gFh)ηc=functorGgGFhηc=ηnaturalGgηch=def.φ(g)h, and for k:dd, φ(kg)=def.G(kg)ηc=functorGkGgηc=def.Gkφ(g).

(3). Starting from φ, part (1) produces ηc=φ(idFc), and part (2) then rebuilds gGgφ(idFc)=φ(gidFc)=φ(g) by (142.5)(2) and the unit law. Starting from (η,ε), part (2) produces φ, and part (1) returns φ(idFc)=GidFcηc=ηc and ψ(idGd)=εdFidGd=εd. ◻

Example 142.22 — The triangles for the free monoid

For FU of proposition 142.18, the unit is ηS(s)=[s] and the counit εM:(UM)M multiplies a list out: εM[m1,,mn]=m1mn, the empty list going to the unit. The first triangle identity, at a list [s1,,sn] in S, reads εS(FηS[s1,,sn])=entrywiseεS[[s1],,[sn]]=def. ε[s1][sn]=concat.[s1,,sn]. The second, at mUM, reads UεM(ηUM(m))=εM[m]=m.

Exercise 142.10

★★☆ Let FG and FG with the same right adjoint G. Construct a natural isomorphism FF from the two hom-set bijections, and prove its naturality. Hint: compose the two bijections at d=Fc and use corollary 141.59.

Exercise 142.11

★☆☆ Let P,Q be preorders and f:PQ, g:QP monotone. Show that fg holds exactly when f(p)qpg(q) for all p,q, and that the triangle identities are automatic. Two lines each.

Exercise 142.12

★★☆ Assume C has binary products. Show that the diagonal functor Δ:CC×C, Δ(c)=(c,c), has (a,b)a×b as a right adjoint, and identify the unit and the counit. Use definition 141.54.

Right adjoints preserve limits

An adjunction transports mapping properties. Since a limit is a mapping property, a right adjoint carries limits to limits; the proof is the hom-set bijection applied to every leg of a cone at once.

Theorem 142.23 — Preservation

Let FG with F:CD, G:DC, and let D:JD be a diagram with limit (l,(πi)). Then (Gl,(Gπi)) is a limit of GD:JC.

Proof of Theorem 142.23 — Preservation

Proof. Cone. For α:ij in J, G(Dα)Gπi=G(Dαπi)=Gπj by the functor law and the cone equation for (l,(πi)).

Universality. Let (c,(τi)) be a cone over GD in C, so τi:cG(Di). Put τi:=φ1(τi):FcDi. These form a cone over D: for α:ij, Dατi=φ1(2)φ1(G(Dα)τi)=coneφ1(τj)=def.τj, where φ1(2) is the equation φ1(Gkf)=kφ1(f) established in the proof of theorem 142.21. By the universal property of l there is exactly one m:Fcl with πim=τi for all i. Put h:=φ(m). Then Gπih=def. φφ(πim)=def. mφ(τi)=inverseτi, the first step being (142.5)(2). If h:cGl also satisfies Gπih=τi for all i, then m:=φ1(h) satisfies πim=φ1(Gπih)=φ1(τi)=τi, so m=m by uniqueness, and h=φ(m)=h. ◻

Corollary 142.24

A right adjoint G preserves terminal objects, binary products, equalizers, and pullbacks: G1 is terminal, G(a×b) with (Gpr1,Gpr2) is a product of Ga and Gb, and the image of a pullback square is a pullback square. Dually a left adjoint preserves initial objects, coproducts, coequalizers, and pushouts, by applying theorem 142.23 in Cop and Dop, where a left adjoint becomes a right adjoint and a colimit becomes a limit.

Remark 142.25 — The converse fails, and the failure is visible

A left adjoint need not preserve limits. The free monoid functor F of proposition 142.18 does not preserve the terminal object: the terminal set is a one-element set {s}, and F{s}={s} is the monoid of natural numbers under addition, which has infinitely many elements, whereas the terminal monoid has one. So a functor with a right adjoint may destroy a limit, and the direction of theorem 142.23 matters.

Exercise 142.13

★★☆ The coproduct of two monoids M,N in Mon has as elements the alternating words m1n1m2n2 with each letter a non-unit element of its monoid. Exhibit two monoids for which the underlying set of this coproduct is not the disjoint union of the underlying sets, and explain why this does not contradict corollary 142.24.

Exercise 142.14

★☆☆ Specialize the proof of theorem 142.23 to an equalizer: write out the two arrows, the transposed pair, and the mediating arrow, without invoking the general diagram J (half a page).

Cartesian closure

Products interpret contexts. A function type is an object internalizing a hom-set, and the mapping property that internalizes it is the one already familiar from programming: a two-argument function is a one-argument function returning a function.

Definition 142.26 — Cartesian closed category

A category C is cartesian closed if it has a terminal object, binary products, and for each pair of objects a,b an object ba together with an arrow ev:ba×ab such that for every c and every f:c×ab there is exactly one λ(f):cba with evλ(f)pr1,pr2=f. The object ba is the exponential and λ(f) the transpose of f.

The arrow λ(f)pr1,pr2 is the action of λ(f) on the first factor of c×a; it is what the notation λ(f)×ida abbreviates. Written as a bijection, definition 142.26 states that λ:homC(c×a,b)homC(c,ba) is a bijection for every c, and the equations (142.5) for it say exactly that ()×a is left adjoint to ()a.

Proposition 142.27 — Currying is an adjunction

C with terminal object and binary products is cartesian closed if and only if for every object a the functor ()×a has a right adjoint.

Proof of Proposition 142.27 — Currying is an adjunction

Proof. Assume exponentials. The assignment bba becomes a functor by ka:=λ(kev) for k:bb; the functor laws follow from uniqueness in definition 142.26, because λ(kkev) and λ(kev) composed appropriately satisfy the same equation (142.7). The bijection (142.8) satisfies the first equation of (142.5) because, for h:cc, both λ(f(h×ida)) and λ(f)h have the same composite with ev after pairing, and λ is injective; the second equation is the definition of ka.

Conversely, an adjunction ()×aG gives, at c=Gb and the counit, an arrow ev:=εb:Gb×ab; the hom-set bijection at c is λ, and (142.7) is the statement φ1(φ(f))=f written out with φ1(u)=εb(u×ida), which is the formula of theorem 142.21(2). ◻

Example 142.28 — Sets are cartesian closed

In Set put BA:={hh:AB} and ev(h,x):=h(x). Given f:C×AB, define λ(f)(z):=(xf(z,x)). Then ev(λ(f)(z),x)=def. evλ(f)(z)(x)=def. λf(z,x), which is (142.7) evaluated at (z,x). If u:CBA also satisfies it, then u(z)(x)=f(z,x)=λ(f)(z)(x) for all x, so u(z)=λ(f)(z) as functions, and u=λ(f).

The syntactic case is the one this book needs, and it is the one where the naive attempt fails. Take Ctx of example 141.9, whose arrows are lists of terms up to α-equivalence. For Γ arbitrary, Δ=x:A and Θ=y:B, a substitution ΓΔΘ is a term Γ,x:Ab:B, and a substitution Γz:AB is a term Γc:AB. Abstraction and application propose the two directions, bλx:A.b,ccx. They are not mutually inverse on the nose. Starting from b and returning gives (λx:A.b)x, a redex, which is a different list of terms from b; starting from c=y, a variable, and returning gives λx:A.yx, again a different term. The first discrepancy is removed by β, the second by η, and by nothing weaker: a β-normal form of the shape λx:A.yx has no β-reduct at all.

Definition 142.29 — The category of contexts modulo conversion

Let be the least congruence on typed terms of chapter 2 containing (λx:A.b)ab[a/x] and cλx:A.cx for Γc:AB and x not free in c. The category Ctxβη has the contexts as objects and, as arrows ΓΔ, the substitutions of definition 141.1 taken up to entrywise .

Composition descends to -classes because is a congruence closed under substitution, and the category laws of proposition 141.7 hold for representatives, hence for classes.

Proposition 142.30 — The syntactic category is cartesian closed

Ctxβη is cartesian closed. For Δ=x:A and Θ=y:B the exponential is the one-declaration context ΘΔ=z:AB, with ev=(zx):ΘΔΔΘ and λ(b)=(λx:A.b).

Proof of Proposition 142.30 — The syntactic category is cartesian closed

Proof. Products and the terminal object are proposition 142.7, whose proof used only entrywise composition and therefore descends to classes. Fix Γ and Γ,x:Ab:B. The arrow λ(b)pr1,pr2 is the substitution (λx:A.b,x) from ΓΔ to ΘΔΔ, so evλ(b)pr1,pr2=((zx)[(λx:A.b,x)])=((λx:A.b)x)=β(b), which is (142.7). For uniqueness, let u=(c):ΓΘΔ satisfy the same equation, so that cxb with x not free in c. Then c=ηλx:A.cx=congruenceλx:A.b=def.λ(b), so u=λ(b) as an arrow of Ctxβη. For contexts with several declarations, iterate: Θ with declarations y1:B1,,yk:Bk has exponential the context with declarations zj:ABj, and both the equation and the uniqueness argument apply entrywise. ◻

The η-rule is used exactly once, in the uniqueness clause, and nothing else in the proof replaces it. Dropping η leaves the arrow λ(b) existing but no longer unique, which is a failure of the universal property, not of the object: Ctxβ has an exponential candidate and two distinct transposes of the same arrow.

Exercise 142.15

★★☆ Let β be the congruence generated by β alone. Take A=B=2, Γ=w:22 and b:=wx. Exhibit two substitutions Γz:22 that both satisfy (142.7) for b and are not β-equal, and identify which clause of definition 142.26 fails.

Exercise 142.16

★☆☆ In a preorder viewed as a category, write out what an exponential qp is in order-theoretic language, and identify it in the preorder of subsets of a fixed set ordered by inclusion.

Exercise 142.17

★★☆ Prove the functor laws for bba asserted in proposition 142.27, by showing that both sides of each law satisfy the equation (142.7) characterizing the same transpose (half a page).

Slices

A dependent family does not live in C; it lives over an object of C. Proposition 142.9 already used the description of a family (Eg)gΓ as an arrow EΓ. Collecting those arrows into a category makes substitution a functor.

Definition 142.31 — Slice category

Let Γ be an object of C. The slice category C/Γ has as objects the arrows p:EΓ of C, and as arrows pp the arrows k:EE of C with pk=p. Composition and identities are those of C.

The condition pk=p is preserved by composition and holds for identities, so C/Γ is a category.

Proposition 142.32 — Elementary structure of a slice

Let C have pullbacks and let Γ be an object.

  1. idΓ is a terminal object of C/Γ.

  2. If u:PE, v:PE is a pullback of p along p, then pu with the two arrows u,v is a product of p and p in C/Γ.

Proof of Proposition 142.32 — Elementary structure of a slice

Proof. (1) An arrow pidΓ is an arrow k:EΓ with idΓk=p, that is, k=p; so there is exactly one.

(2) First, u is an arrow pup and v is an arrow pup in C/Γ, the latter because pv=pu is the pullback square. Let q:XΓ be an object of C/Γ with arrows f:qp and g:qp, that is, pf=q=pg. The pullback property applied to f,g gives exactly one h:XP with uh=f and vh=g; and h is an arrow qpu in the slice because puh=pf=q. Conversely any slice arrow qpu satisfying the two equations is such an h. So the mediating arrow exists and is unique in C/Γ. ◻

Two functors relate slices over different objects.

Definition 142.33 — Substitution and dependent sum

Let C have pullbacks and γ:ΔΓ. Choose, for each object p:EΓ of C/Γ, a pullback square Mathematical diagramDiagram and let γ:C/ΓC/Δ send p to γp and a slice arrow k:pp to the unique arrow γk with γpγk=kγp and γpγk=γp. Let Σγ:C/ΔC/Γ send q:FΔ to γq and a slice arrow to itself.

Σγ needs no choices: composition with γ is defined outright, and an arrow k with qk=q satisfies γqk=γq. The functor γ needs a choice of pullback for each object, because definition 142.8 determines the pullback only up to a unique isomorphism (lemma 142.3 applies verbatim to any universal property). Section 142.10 returns to that choice.

Theorem 142.34 — Dependent sum is left adjoint to substitution

Let C have pullbacks and γ:ΔΓ. Then Σγγ.

Proof of Theorem 142.34 — Dependent sum is left adjoint to substitution

Proof. Let q:FΔ be an object of C/Δ and p:EΓ an object of C/Γ. An arrow Σγqp is an arrow t:FE of C with pt=γq. An arrow qγp is an arrow s:FγE with γps=q.

Given such an s, put φ1(s):=γps. Then pγps=γγps=γq by the pullback square and the hypothesis on s, so φ1(s) is an arrow Σγqp.

Given such a t, the pair (q,t) satisfies γq=pt, so the pullback property gives exactly one φ(t):FγE with γpφ(t)=q and γpφ(t)=t. The first equation says φ(t) is a slice arrow qγp; the second says φ1(φ(t))=t. Conversely, for s as above, both s and φ(φ1(s)) are arrows into the pullback with the same two composites, so they are equal. Hence φ is a bijection.

For (142.5), let h:qq in C/Δ and k:pp in C/Γ. Both φ(th) and φ(t)h are arrows into the pullback whose composites with γp and γp are q and th, so they agree. Both φ(kt) and γkφ(t) are arrows into γE whose composite with γp is q and whose composite with γp is kt — for the second, using γpγk=kγp from definition 142.33 — so they agree. ◻

Proposition 142.35 — Slices over a set are families

Let I be a set and let SetI be the category whose objects are I-indexed families (Ai)iI of sets and whose arrows (Ai)(Bi) are families of functions (ki:AiBi). Then Set/I and SetI are equivalent in the sense of definition 141.45.

Proof of Proposition 142.35 — Slices over a set are families

Proof. Define Φ:Set/ISetI by Φ(p:EI):=(p1(i))iI and, for a slice arrow k:pp, by Φ(k)i:=kp1(i), which lands in p1(i) because pk=p. Define Ψ:SetISet/I by Ψ((Ai)):=(pr1:{(i,a)iI, aAi}I) and Ψ((ki))(i,a):=(i,ki(a)). Both preserve identities and composition by construction.

ΦΨ sends (Ai) to ({(i,a)aAi})iI, and a(i,a) is a natural isomorphism to the identity functor. ΨΦ sends p:EI to the projection from {(i,e)p(e)=i}, and e(p(e),e) is an isomorphism EΨΦ(p) over I, natural in p because k(e) has p(k(e))=p(e). By definition 141.45 the two categories are equivalent. ◻

Exercise 142.18

★★☆ For γ:ΔΓ construct an isomorphism of categories (C/Γ)/γC/Δ, and show that it carries the forgetful functor (C/Γ)/γC/Γ to Σγ.

Exercise 142.19

★☆☆ Under proposition 142.35, compute Σγ on families for a function γ:ΔΓ. Show that Σγ(B)g is in bijection with the disjoint union dγ1(g)Bd.

Locally cartesian closed categories

Definition 142.36 — Locally cartesian closed

A category C is locally cartesian closed if it has a terminal object and every slice C/Γ is cartesian closed.

This is the definition used by Castellan, Clairambault and Dybjer, Categories with Families, Definition 30 (arXiv version, physical page 41). The same source records, on the same page, the equivalent formulation by dependent products: C has finite limits and every pullback functor γ has a right adjoint. The implication proved here is the one this book uses.

Lemma 142.37 — Adjunctions compose

If FG with F:CD, G:DC, and FG with F:DE, G:ED, then FFGG.

Proof of Lemma 142.37 — Adjunctions compose

Proof. Compose the bijections: homE(FFc,e)homD(Fc,Ge)homC(c,GGe). Each equation of (142.5) for the composite is the corresponding equation for the outer bijection followed by the one for the inner: for h:cc, the outer bijection is natural in its first argument along Fh, and the inner along h; for k:ee, the inner is natural in its second argument along Gk and the outer along k, and G(Gk)=(GG)k by the functor laws. ◻

Theorem 142.38 — Dependent products give local closure

Let C have finite limits and suppose that for every arrow γ:ΔΓ the functor γ has a right adjoint Πγ. Then C is locally cartesian closed, and for every γ ΣγγΠγ.

Proof of Theorem 142.38 — Dependent products give local closure

Proof. Theorem 142.34 gives the left half of (142.9), and the right half is the hypothesis. Fix Γ; by proposition 142.32 the slice C/Γ has a terminal object and binary products, the latter computed by pullback. By proposition 142.27 it remains to give, for each object γ:ΔΓ of the slice, a right adjoint to ()×γ:C/ΓC/Γ.

The product of p and γ in C/Γ is γγp by proposition 142.32(2) read on the chosen pullback square of definition 142.33, which is Σγ(γp). Hence ()×γ=Σγγ, as functors C/ΓC/Γ. Applying lemma 142.37 to Σγγ and γΠγ gives ΣγγΠγγ. So the exponential by γ in C/Γ is Πγγ, and C/Γ is cartesian closed. ◻

The family calculation in Set

Read slices as families through proposition 142.35. Fix a function γ:ΔΓ. For a family (Bd)dΔ and gΓ put Πγ(B)g:={s:γ1(g)dBd|s(d)Bd for all dγ1(g)}, the set of choice functions on the fiber, and recall γ(A)d=Aγ(d) and Σγ(B)g={(d,b)dγ1(g), bBd}.

Proposition 142.39 — The three functors on families

For families (Ag)gΓ and (Bd)dΔ there are bijections homSetΓ(ΣγB,A)homSetΔ(B,γA),homSetΔ(γA,B)homSetΓ(A,ΠγB), natural in A and B.

Proof of Proposition 142.39 — The three functors on families

Proof. First bijection. A family of functions tg:Σγ(B)gAg assigns to each g, each dγ1(g) and each bBd an element tg(d,b)Ag. Since d determines g=γ(d), this is the same as a family of functions sd:BdAγ(d)=γ(A)d, by sd(b):=tγ(d)(d,b) and tg(d,b):=sd(b). The two assignments are mutually inverse by direct substitution.

Second bijection. A family ud:Aγ(d)Bd assigns to each d and each aAγ(d) an element ud(a)Bd. Define vg:AgΠγ(B)g by vg(a)(d):=ud(a) for dγ1(g); this is a legitimate choice function because ud(a)Bd, and aAg=Aγ(d) for such d. Conversely a family vg:AgΠγ(B)g defines ud(a):=vγ(d)(a)(d). Then vg(a)(d)=def.ud(a)=def.vγ(d)(a)(d)=γ(d)=gvg(a)(d) for every dγ1(g), so vg(a)=vg(a) as functions on the fiber; and ud(a)=vγ(d)(a)(d)=ud(a).

Naturality. Both bijections were defined by formulas that only rename arguments, so post-composing with a family (kg) or (ld) commutes with them; writing out either equation of (142.5) gives the same expression on both sides after substituting the defining formula. ◻

Remark 142.40 — Where the axiom of choice does not enter

Πγ(B)g may be empty: if some Bd with dγ1(g) is empty, no choice function exists. The construction (142.10) asserts nothing about nonemptiness, and the adjunction of proposition 142.39 is proved without any choice principle, because each bijection transports a given family of functions rather than selecting one.

The family calculation in the syntax

Let T now be the theory of chapter 27: the rules of chapter 26 together with definition 27.2, definition 27.9 and definition 27.14. Work in CtxT of definition 142.10. For ΓA type the display map is wA:Γ.AΓ, and by proposition 142.11 the chosen pullback along an arbitrary f is given by substitution. Substitution along a display map is weakening.

Proposition 142.41 — Weakening is the substitution functor

Let ΓA type and ΓB type. Then wA(wB)=wB[wA]:Γ.A.B[wA]Γ.A.

Proof of Proposition 142.41 — Weakening is the substitution functor

Proof. Proposition 142.11 with f:=wA and the type B gives a pullback square whose left edge is wB[wA]. Choosing that square as the chosen pullback of definition 142.33 gives the claim. ◻

Theorem 142.42 — The dependent product along a display map

Let ΓA type and Γ.AC type. In CtxT, ΠwA(wC)=wx:AC:Γ.x:ACΓ is a right adjoint value: there is a bijection homCtxT/Γ.A(wA(p),wC)homCtxT/Γ(p,wx:AC) natural in p, for every object p of CtxT/Γ of the form wD with ΓD type.

Proof of Theorem 142.42 — The dependent product along a display map

Proof. Both sides are described by terms, and the bijection is λ-abstraction.

The left-hand set. By proposition 142.41, wA(wD)=wD[wA]. An arrow wD[wA]wC in CtxT/Γ.A is a context substitution k:Γ.A.D[wA]Γ.A.C with wCk=wD[wA]. Splitting k as in the proof of proposition 142.11, the condition forces its first components to be the variable list of Γ.A, so k is determined by its last entry, a term Γ,x:A,y:Dc:C after renaming, where y does not occur in A and x does not occur in D.

The right-hand set. An arrow wDwx:AC in CtxT/Γ is likewise determined by a term Γ,y:De:x:AC.

The bijection. Send c to e:=λ(x:A).c, which has type x:AC over Γ,y:D by Π-intro. Send e to c:=ex, of type C over Γ,x:A,y:D by Π-elim. The two composites are identities: (λ(x:A).c)xΠβc,λ(x:A).(ex)Πηe, the second requiring x not free in e, which holds because e is typed over Γ,y:D. Judgmental equality is exactly the identification made in definition 142.10, so the two assignments are mutually inverse on arrows.

Naturality. Let h:wDwD over Γ, given by a term Γ,y:Dd:D. Precomposition substitutes d for y, and λ-abstraction commutes with that substitution because x is chosen fresh for d: (λ(x:A).c)[d/y]=λ(x:A).c[d/y]. Postcomposition with an arrow into wC substitutes into c under the binder, and the same freshness applies. ◻

Proposition 142.43 — The dependent sum along a display map

Let ΓA type and Γ.AC type. Then ΣwA(wC)=wAwC:Γ.A.CΓ is isomorphic in CtxT/Γ to wx:AC.

Proof of Proposition 142.43 — The dependent sum along a display map

Proof. Define θ:Γ.A.CΓ.x:AC by the variable list of Γ followed by the term (x,y), where x,y are the last two variables; it is a context substitution by Σ-intro. Define θ:Γ.x:ACΓ.A.C by the variable list of Γ followed by pr1(z) and pr2(z), where z is the last variable; the two entries are typed by Σ-elim1 and Σ-elim2. Both commute with the maps to Γ, since both keep the variable list of Γ. Then θθ=(,(pr1(z),pr2(z)))Ση(,z)=id, and θθ=(,pr1(x,y),pr2(x,y))Σβ1,Σβ2(,x,y)=id. ◻

The three operations of (142.9) are therefore, in the syntax, the dependent sum, weakening, and the dependent product, and the adjunctions are the introduction and elimination rules together with their β- and η-equations.

Exercise 142.20

★☆☆ Show that the empty context is terminal in CtxT and that w1:Γ.1Γ is an isomorphism. Which rule of definition 27.14 is used?

Exercise 142.21

★★★ Prove the Frobenius equation in a locally cartesian closed category: for γ:ΔΓ, p in C/Γ and q in C/Δ, the canonical arrow Σγ(q×γp)Σγ(q)×p is an isomorphism. Then verify it in SetΓ by computing both sides at a fixed gΓ.

The strictness obstruction

Definition 142.33 made a choice. A pullback is determined only up to a unique isomorphism, so γ depends on which pullback square is selected for each object. The syntax makes no such choice: by proposition 71.51 the action of a composite substitution is literally the composite action, A[fg]=A[f][g], an identity of raw expressions up to α-equivalence, not an isomorphism. The two demands do not agree, and three sets suffice to show that they do not.

Example 142.44 — Chosen pullbacks do not compose

Work in Set with the canonical choice (142.3): for γ:ΔΓ and p:EΓ take γE={(d,e)γ(d)=p(e)} with γp the first projection. Put Γ={0,1},Δ={a},Ω={u},γ(a)=0,δ(u)=a, and let p:EΓ with E={e} and p(e)=0. Then γE={(a,e)},δ(γE)={(u,(a,e))},(γδ)E={(u,e)}. The two sets {(u,(a,e))} and {(u,e)} are not equal: their unique elements are a pair whose second component is a pair, and a pair whose second component is e. Hence δγ(γδ) as functors, while (u,(a,e))(u,e) is an isomorphism between the two values.

The example is not an artifact of one bad choice. Any choice function on pullbacks produces objects specified by their mapping property alone, and no mapping property distinguishes δ(γp) from (γδ)p; a choice making the two literally equal for all γ,δ,p is an extra structure, not a consequence of the finite limits.

Remark 142.45 — What the obstruction blocks

Suppose a semantics interprets a type ΓA type as an object [[A]] of C/[[Γ]] and substitution as γ. The syntactic law (142.11) then requires δ(γ[[A]])=(γδ)[[A]] on the nose, because the two sides interpret two syntactically identical types. Example 142.44 shows that requirement failing in Set. Two types that the syntax proves equal are therefore sent to objects known only to be isomorphic, and an interpretation defined by recursion on derivations is not yet well defined on judgments.

This is the obstruction identified by Castellan, Clairambault and Dybjer, Categories with Families, physical pages 38–39: for an arbitrary choice of pullbacks the assignment is not functorial, so “the codomain fibration is not split, whereas the fibration implicit in a cwf is always split,” and Seely’s proposed interpretation of type theory in locally cartesian closed categories “sends types that are provably equal in the syntax to morphisms in C that are only known to be isomorphic.” The same pages record two repairs: Curien weakens equality to isomorphism in the syntax and adds explicit coercions, at the cost of a coherence theorem; Hofmann replaces a type by an object of the slice together with a pre-chosen substitution pullback for every substitution, chosen so that the choices compose. The second repair is the one that survives into the algebraic presentations, and its cost is recorded on physical page 39: the resulting assignment is a pseudofunctor and not a functor, so the correspondence between finitely complete categories and the algebraic models is a biequivalence of 2-categories rather than an equivalence of categories. With Π-types added, that statement is Theorem 9 of the same source, physical page 43.

Universal objects therefore describe the operations of a dependent calculus correctly and its equations only up to isomorphism. Recovering the equations requires a presentation in which substitution is a primitive operation with stated laws, rather than an operation reconstructed from a mapping property.

Suggested first pass.

Begin with exercise 142.23 and exercise 142.24, then complete exercise 142.27.

Exercise 142.22

★☆☆ Take S={s1,s2} and M=(N,+,0). Write ηS, εM, and both triangle identities of example 142.22 explicitly on the elements [s1,s2,s1] and 3.

Exercise 142.23

★★☆ Reconstruct theorem 142.23 for a pullback without invoking a general index category: given FG and a pullback square in D, prove directly that its G-image is a pullback square, naming the equation of (142.5) used at each step.

Exercise 142.24

★★☆ Using proposition 142.35, compute the exponential of two objects of Set/I directly as a family: show that (BA)i is the set of functions AiBi, and check the λ-equation (142.7) fiberwise. Then explain why this computation does not immediately give Πγ for a general γ:ΔΓ.

Exercise 142.25

★★★ (The section object.) Let C have finite limits and suppose every slice of C is cartesian closed. Fix γ:ΔΓ and δ:EΔ. In C/Γ form the exponential (γδ)γ and the arrow γγ obtained by transposing pr2; let σ:idΓγγ be the transpose of pr2 again, viewed as a point. Define Πγ(δ) as the pullback of δγ along σ, where δγ:(γδ)γγγ is the exponential transpose of δ. Prove that this construction is right adjoint to γ. Check your construction against (142.10) by computing both in Set for Γ={0,1}.

Exercise 142.26

★★☆ Continue example 142.44. Show that no choice of pullbacks in Set satisfies δγ=(γδ) for all composable pairs and all p, by exhibiting one family for which the two prescriptions force different underlying sets whenever the chosen pullback of a map along an identity is required to be that map itself. State precisely which two of your requirements are incompatible.

Exercise 142.27

★★★ Practical project.lccc-dependent-product-calculator Implement a calculator for the three functors of (142.9) over finite sets. A family over a finite set Γ is given as an explicit list of pairs (g,list of elements of Ag), and a function γ:ΔΓ as a list of pairs. The program must compute γA, ΣγB, and ΠγB as defined in (142.10) and above it, and must implement both bijections of proposition 142.39 in both directions.

Invariant. Every family the program returns is well formed: each element of Πγ(B)g is a function whose domain is exactly γ1(g) and whose value at d lies in Bd; each element of Σγ(B)g is a pair (d,b) with γ(d)=g and bBd. The program checks this invariant on every output before printing it.

Concrete result. For named inputs the program prints, for each of the four transposition directions, either accepted together with the transported family, or rejected together with the first index at which the round trip differs from the input. It also prints the two composite families δ(γp) and (γδ)p and reports whether they are literally equal.

Acceptance test. Run it on Γ={0,1}, Δ={a}, γ(a)=0, Ω={u}, δ(u)=a, on A with A0={} and A1=, and on B with Ba={p,q}. The expected outcomes are: Πγ(B)0 has two elements and Πγ(B)1 has exactly one, the empty function; all four round trips print accepted; and the two composite families are reported unequal, with elements (u,(a,e)) and (u,e) for the one-element family E over 0. A run in which the empty fiber yields an empty Πγ(B)1 has the quantifier of (142.10) implemented incorrectly.

Sources. The elementary theory of limits, adjunctions, and the preservation theorem follows Riehl [Rie16]; Asperti and Longo [AL91] develop the same material with typed calculi as the running examples. The formulation of quantifiers and substitution as adjoints originates with F. W. Lawvere, Adjointness in Foundations, Dialectica 23 (1969), reprinted in Reprints in Theory and Applications of Categories 16 (2006); the systematic fibrational development is Jacobs [Jac99]. The interpretation of dependent products as right adjoints to pullback in a locally cartesian closed category is due to R. A. G. Seely, Locally cartesian closed categories and type theory, Mathematical Proceedings of the Cambridge Philosophical Society 95 (1984), 33–48. Definition 142.36 and the boundary statements of section 142.10 are taken from Castellan, Clairambault and Dybjer [CCD21], physical pages 38–43 of the arXiv version; Hofmann’s split-fibration repair and the partial-interpretation method are in [Hof97]. The algebraic presentation that restores (142.11) as a primitive equation is developed in chapter 54.

Search the book

Type to search the local edition.