Lectures onType Theory
Chapter 120
Chapter 120Optional

Definitional Functoriality and Generic Type-Former Action

Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.

Even a coherent cast graph leaves repetitive work. Composable casts g:AB and f:BC induce list actions, dependent-pair actions, and actions for every other positive type former. Writing these functions separately gives only propositional equations mapid=id and mapf(mapgx)=map(fg)x. Propositional proofs do not make nested casts disappear during conversion. The calculus below adds generic actions and the two functor laws to judgmental equality at a boundary where normalization and checking remain decidable.

Convention 120.1 — Principal functorial calculus

Write MLTTmap for the principal system. The calculus extends intensional MLTT with a primitive mapF for each parametrized type former F of MLTT, namely Π, Σ, +, lists, W, and the identity type; 0 and 1 are unparametrized and retain their ordinary MLTT rules. The source proves metatheory for a smaller, representative fragment: one universe with 0, Π, Σ, lists, and N, together with their map operators. Every endpoint below is stated for that proved fragment, and the paper owns the rest. Each type former F has a domain of parameters, a family of morphisms homF(X,Y), identity and composition in that domain, and an action mapF. The annotated action syntax stores the tuple of former, source parameter, target parameter, morphism, and argument. Surface notation suppresses the two endpoints after the typing premises fix them. The rules Map-Id and Map-Comp are judgmental equalities. Reduction computes maps on constructors and compacts consecutive maps on stuck neutrals; identity on a neutral is handled by conversion rather than by an expanding reduction. The source metatheory proves normalization, canonicity, equivalence of declarative and algorithmic typing, and decidable checking for the exact proved fragment. It does not generate maps for arbitrary strictly positive declarations.

The primitive action and its two new conversion rules are therefore not left implicit. If X,Y,Z are parameters of F, α:homF(X,Y), and β:homF(Y,Z), the rule delta is

Γα:homF(X,Y)Γt:F(X)
ΓmapF(α)(t):F(Y)
Map-Ty
Γt:F(X)
ΓmapF(idF,X)(t)t:F(X)
Map-Id
Γα:homF(X,Y)Γβ:homF(Y,Z)Γt:F(X)
ΓmapF(β)(mapF(α)(t))mapF(βFFα)(t):F(Z)
Map-Comp

The subscript on FF records that identities and composition are those of homF; for Π and Σ they are the variance-sensitive operations calculated below.

Positive descriptions force an action

Before using the paper’s primitive type formers, compute the generic action on a small description language.

Definition 120.2 — Positive descriptions

Fix a context Γ and reserve X as a parameter marker, not as a variable that an ambient type expression may mention. The formation judgment ΓD desc is generated as follows. The codes 1 and X are well formed. A constant code K(A) is well formed only if ΓA type and XFV(A). Products and sums require both component codes to be well formed. Finally, Σ(a:A).D(a) is well formed only if ΓA type, XFV(A), and Γ,a:AD(a) desc. Thus descriptions have grammar D::=1K(A)XD1×D2D1+D2Σ(a:A).D(a). For any ΓX type, the interpretation [[D]]X replaces X by X, constants by their named types, and description products, sums, and dependent sums by the corresponding type formers. In particular, neither a constant nor the index type of a dependent sum changes when X changes. Negative occurrences such as XA are not descriptions.

Definition 120.3 — Generated action

For f:XY, define mapD(f):[[D]]X[[D]]Y by recursion on D: map1(f)()=,mapK(A)(f)(a)=a,mapX(f)(x)=f(x),mapD1×D2(f)(x1,x2)=(mapD1(f)(x1),mapD2(f)(x2)),mapD1+D2(f)(inlx)=inl(mapD1(f)(x)),mapD1+D2(f)(inry)=inr(mapD2(f)(y)),mapΣ(a:A).D(a)(f)(a,x)=(a,mapD(a)(f)(x)). These equations are the computation rules of the generated operation. They do not silently choose an eliminator branch for a neutral. The final clause of the generated action is the typed neutral form

ΓD descΓf:XYΓn:[[D]]Xn neutral
ΓmapD(f)(n):[[D]]Y
Desc-Map-Neutral

and its conclusion is neutral unless a composition-compaction rule applies. For a neutral sum, product, or dependent sum, the action therefore remains stuck at the outer mapD; it does not project or case-split the neutral input.

For the list-layer description D:=1+(K(A)×X), the interpretation is [[D]]X=1+(A×X), and the two constructors of a list layer are the two injections: nil:=inl(),cons(a,x):=inr(a,x). For every f:XY, the clauses of definition 120.3 compute to mapD(f)(nil)nil,mapD(f)(cons(a,x))cons(a,f(x)), because the sum clause preserves the injection, the constant clause returns a unchanged, and the parameter clause applies f to x. A negative description would require an action (XA)(YA) from only f:XY; its direction is wrong. One would need a map YX, which explains the positivity restriction.

Constructor computation does not prove these equations for a neutral input. For example, if D=X+1 and z:[[D]]X is a variable, then mapD(id)(z) is stuck: the sum clause cannot choose inl or inr. Hence it is not judgmentally equal to z in the pre-extension calculus.

Proposition 120.4 — Constructor functor laws for descriptions

Suppose ΓD desc, ΓX type, ΓY type, and ΓZ type. For every Γg:XY, Γf:YZ, and constructor-headed canonical value Γv:[[D]]X, constructor computation derives mapD(id)(v)v,mapD(f)(mapD(g)(v))mapD(fg)(v).

Proof of Proposition 120.4 — Constructor functor laws for descriptions

Proof. Structural induction on D. For 1 and K(A), both sides reduce to the input. For X, the first equation is the identity computation and the second is the definition of composition. For D1×D2, the computation rule exposes two components; the two induction hypotheses make the corresponding components judgmentally equal, and pair congruence closes the equations. For D1+D2, case analysis exposes inl or inr, and the corresponding induction hypothesis closes that branch. For Σ(a:A).D(a), the first component is constant and the induction hypothesis for D(a) proves the second component. These are all description constructors. The sum step uses the hypothesis that v is constructor headed. Without it, the stuck term displayed before the proposition prevents the reduction. ◻

Definition 120.5 — Functoriality rule delta

The description functoriality extension closes typed definitional equality under the two new rules

ΓD descΓX typeΓx:[[D]]X
ΓmapD(id)(x)x:[[D]]X
Desc-Map-Id
ΓD descΓX typeΓY typeΓZ typeΓx:[[D]]XΓg:XYΓf:YZ
ΓmapD(f)(mapD(g)(x))mapD(fg)(x):[[D]]Z
Desc-Map-Comp

Constructor equations remain the reduction rules of definition 120.3; Desc-Map-Comp may additionally be oriented from left to right only when its mapped argument is neutral. Thus the delta compacts neutrals without pretending that the two laws followed from the pre-extension computation rules.

Theorem 120.6 — Extended definitional functor laws for descriptions

In the rule delta of definition 120.5, identity and composition hold at every well-typed argument, including a neutral one.

Proof of Theorem 120.6 — Extended definitional functor laws for descriptions

Proof. Identity is Desc-Map-Id. Composition is Desc-Map-Comp. The premises of those rules are exactly the typing hypotheses in the theorem; no case analysis on the argument is required. ◻

The description language above has one varying parameter. An indexed family varies over a whole family at once, and the generic action follows the same recursion once the parameter code is given an index.

Definition 120.7 — Indexed descriptions

Fix ΓI type. Indexed descriptions replace the code X by a family of codes X(j) for Γj:I: D::=1K(A)X(j)D1×D2D1+D2Σ(a:A).D(a). Formation is the indexed version of definition 120.2: K(A), every index term j, and every dependent-sum index type A must be formed in the ambient context and may not mention the varying family marker X. The body D(a) may depend on the bound index a, and may contain the family only through codes X(j). Their interpretation [[D]]X is taken at a family X:IUk, with [[X(j)]]X:=X(j) and the remaining clauses unchanged. For a family of maps fj:X(j)Y(j), the generated action mapD(f) has the clauses of definition 120.3 together with mapX(j)(f)(x)=fj(x).

The one-parameter language is the special case I:=1.

Exercise 120.1

★★☆ In definition 120.7, let R:IIUk and Di:=Σ(j:I).(K(R(i,j))×X(j)). Write mapDi(f) in full for a family fj:X(j)Y(j), and prove its constructor identity law by the exact induction used in proposition 120.4. Name the one clause of that induction that changes.

Dependent products and sums

The domain category of a dependent product remembers variance. For X=(A,B) and Y=(A,B), a morphism consists of g:AA,f:x:AB(g(x))B(x). Its action is mapΠ(g,f)(h):=λx.f(x)(h(g(x))). The base map is contravariant. For dependent sums, a morphism consists of g:AA and f:x:AB(x)B(g(x)), with mapΣ(g,f)(x,y):=(g(x),f(x)(y)).

For X=(A,B), the product identity is (idA,λx.idB(x)). If (g1,f1):XY and (g2,f2):YZ in the contravariant product domain, their composite has g12(z):=g1(g2(z)),f12(z)(b):=f2(z)(f1(g2(z))(b)). For the covariant sum domain, the identity has the same componentwise form. If (g1,f1):XY and (g2,f2):YZ, its composite is g21(x):=g2(g1(x)),f21(x)(b):=f2(g1(x))(f1(x)(b)). The displayed fiber types determine the order; reversing either base composition makes the corresponding fiber map ill typed.

Lemma 120.8 — Product and sum functor laws

With componentwise identities and the variance-correct compositions of the displayed morphisms, mapΠ and mapΣ satisfy identity and composition by judgmental equality.

Proof of Lemma 120.8 — Product and sum functor laws

Proof. For Π, apply the identity action to h and x: beta reduction gives id(h(id(x))), which reduces to h(x); function eta closes the equation. For composition, beta-reduce the two nested actions. Both sides become the same term λx.f2(x)(f1(g2(x))(h(g1(g2(x))))) after unfolding componentwise composition. For Σ, projection and pair computation reduce identity to (x,y), while both composite actions reduce to (g2(g1(x)),f2(g1(x))(f1(x)(y))). ◻

These extensional type formers need no new neutral equation: beta and eta already prove their laws. Lists do not have a judgmental eta law, so a neutral l:ListA leaves mapListidl stuck.

Compacted neutrals

Definition 120.9 — Map compaction

Let F be a nonextensional positive type former, let X,Y,Z be parameters, and in a context Γ let g:homF(X,Y), f:homF(Y,Z), and n:F(X) be well typed. A compacted neutral is either a neutral n or one outer action mapF(h)(n) for a well-typed morphism h. Weak-head reduction includes mapF(f)(mapF(g)(n))mapF(fFFg)(n) only when the mapped argument is neutral and no constructor computation applies. Conversion additionally identifies mapF(id)(n) with n.

Definition 120.10 — Typed evaluation contexts

A base weak-head frame has one of the following forms: K::=[]uπ1[]π2[]indN([];P;b0;bs)indList([];P;bε;b::)mapF(α)([]). No frame places its hole in an argument, motive, branch, type annotation, or morphism. Evaluation contexts are generated inductively by E::=[]K[E]; hence every context contains exactly one distinguished term occurrence. Their typing is generated from

 
Γ,z:Az:A
Ctx-Hole
Γ,z:AE[z]:C(z)Γ,z:A,y:C(z)Kz[y]:D(z,y)zFVterm(Kz[y])
Γ,z:AKz[E[z]]:D(z,E[z])
Ctx-Frame

The final premise forbids another term occurrence of the hole name; dependence on z in the displayed types remains permitted. The ordinary typing rules instantiate Ctx-Frame for application, projections, and the two eliminators. The functorial extension adds exactly the frame

Γα:homF(X,Y)
Γ,z:F(X)mapF(α)(z):F(Y)
Frame-Map

The base frames include genuinely dependent conclusions. For example, the list-eliminator frame and dependent second projection have the exact shapes

ΓA typeΓ,:ListAP() typeΓbε:P(ε)Γ,x:A,y:ListA,h:P(y)b:::P(x::y)
Γ,z:ListAindList(z;.P();bε,x.y.h.b::):P(z)
Frame-ListInd
ΓA typeΓ,x:AC(x) type
Γ,z:x:AC(x)π2z:C(π1z)
Frame-Snd

Thus the result family is P(z) for dependent list elimination and C(π1z) for the second projection; replacing either by a fixed result type would lose the typing rule.

It remains to select a redex rather than merely describe a hole. Let hred(r) hold exactly for beta redexes, projections of pairs, the zero and successor cases of N-elimination, the nil and cons cases of list elimination, an action applied to a constructor covered by its action equation, and mapF(β)(mapF(α)(n)) with neutral n. The latter is the compaction redex; an identity action on a neutral is not a head redex because Map-Id belongs to conversion. The selection predicate Select(E,t,r) is generated by

hred(t)
Select([],t,t)
Select-Here
¬hred(K[t])Select(E,t,r)
Select(K[E],K[t],r)
Select-Under

The negative premise gives outermost priority to constructor computation and map compaction. Plugging is capture avoiding.

Lemma 120.11 — Uniqueness of weak-head selection

If Select(E,t,r) and Select(E,t,r), then E=E and r=r.

Proof of Lemma 120.11 — Uniqueness of weak-head selection

Proof. Induct on the first selection derivation. In Select-Here, hred(t) excludes Select-Under, whose first premise would be its negation; the second derivation is Select-Here. In Select-Under, the outer constructor of t determines its unique frame K because the frame grammar has one computational position per constructor. The second derivation cannot be Select-Here by the negative premise, so it uses the same frame. The induction hypothesis identifies the inner contexts and selected redexes. ◻

Lemma 120.12 — Typed-context preservation

If Γ,z:AE[z]:B(z), Γu:A, and Γu:A, then ΓE[u]:B(u),ΓE[u]:B(u). If moreover Γuu:A, then ΓB(u)B(u) type, and after converting the second term to B(u), ΓE[u]E[u]:B(u).

Proof of Lemma 120.12 — Typed-context preservation

Proof. Apply the ordinary substitution lemma to the displayed derivation, first with (id,u) and then with (id,u). This gives the two typing judgments with their possibly different result types. Substitution congruence applied to uu:A gives both B(u)B(u) and equality of the plugged terms. The conversion rule changes the right-hand term from type B(u) to type B(u), yielding the homogeneous equality displayed in the statement. For Frame-ListInd, these two types are exactly P(u) and P(u); for Frame-Snd, they are C(π1u) and C(π1u). The new Frame-Map has the constant family B(z)=F(Y), so its case is Map-Ty and map congruence. ◻

Lemma 120.13 — Generated action commutes with substitution

Let σ:ΓΓ be a well-typed simultaneous substitution, ΓD desc, ΓX type, ΓY type, Γf:XY, and Γt:[[D]]X. Then capture-avoiding substitution in the generated syntax satisfies (mapD(f)(t))[σ]=αmapD[σ](f[σ])(t[σ]). Here equality is alpha-equivalence of generated terms. In the named presentation, before descending under a binder, alpha-rename it outside the finite set FV(D)FV(f)FV(t)FV(ranσ)supp(Γ), where supp(Γ) contains every name declared or occurring in the target context. Different fresh choices produce alpha-equivalent terms; no literal syntactic equality is claimed. Freshness from the domain of σ alone does not prevent capture by a term in its range.

Proof of Lemma 120.13 — Generated action commutes with substitution

Proof. Induct on D. The unit, constant, and parameter clauses follow by the definitions of substitution and generated action. The product clause applies the two induction hypotheses to the projections. The sum clauses apply the corresponding induction hypothesis below inl or inr. For Σ(a:A).D(a), choose a outside the five-set union printed in the statement. The first projection is substituted once, and the induction hypothesis for D(a) gives the second projection. These are all description constructors. ◻

Lemma 120.14 — Primitive actions commute with substitution

Let F be an action-bearing primitive former in the proved fragment, let σ:ΓΓ be well typed, and suppose ΓX type, ΓY type, ΓZ type, Γα:homF(X,Y), Γβ:homF(Y,Z), and Γt:F(X). Then (mapF(α)(t))[σ]=αmapF(α[σ])(t[σ]), with X,Y and every family component of α substituted as well. Moreover substitution sends idF,X to idF,X[σ] and (βFFα)[σ] to β[σ]FFα[σ]. In named syntax, every binder introduced by a primitive action is renamed outside the exact finite set FV(F)FV(α)FV(β)FV(t)FV(ranσ)supp(Γ).

Proof of Lemma 120.14 — Primitive actions commute with substitution

Proof. There are three action-bearing primitive families in the proved fragment. For Π, write α=(g,f) and substitute into λx.f(x)(h(g(x))), alpha-renaming x outside the six-set union printed in the statement; the ordinary substitution-under-binder equation gives the displayed right-hand side, and the formulas for g12 and f12 give identity and composition. For Σ, again write α=(g,f) and substitute componentwise into (g(x),f(x)(y)); the formulas for g21 and f21 give the composition equation. For lists, substitution is defined homomorphically on the primitive syntax constructor mapList; identities and composites substitute in its map argument. N has no varying parameter and hence no action rule. These are all primitive formers in the proved fragment. ◻

Orienting the identity equation as nmapF(id)(n) would expand forever. Orienting it in the other direction requires type-directed matching and interacts with eta. The principal calculus therefore keeps identity in conversion and uses reduction only to compact composition.

Proposition 120.15 — Compaction is an instance of the composition law

Assume Map-Comp holds for F. Let Γg:homF(X,Y), Γf:homF(Y,Z), and let Γn:F(X) be neutral. Put s:=mapF(f)(mapF(g)(n)),s:=mapF(fFFg)(n). If Γ,z:F(Z)E[z]:B(z), then ΓB(s)B(s) type,ΓE[s]E[s]:B(s), where the right-hand term is converted from B(s) to B(s).

Proof of Proposition 120.15 — Compaction is an instance of the composition law

Proof. Map-Comp instantiated at f, g and n is exactly ΓmapF(f)(mapF(g)(n))mapF(fFFg)(n):F(Z) and hence says ss:F(Z). lemma 120.12 gives the type equality and places both sides in E, using conversion to compare them at B(s). The neutrality side condition of definition 120.9 plays no part here: it schedules weak-head reduction deterministically and does not restrict the equation. ◻

Theorem 120.16 — Metatheory of MLTT_

For the proved fragment with 0, N, Π, Σ, lists, and one universe, the source proves normalization, subject reduction, injectivity, canonicity, equivalence of declarative and algorithmic typing, and decidability of conversion and type checking after adding compacted neutrals and the functor laws.

Proof of Theorem 120.16 — Metatheory of MLTT_

Proof. We give the logical-relation argument, concentrating on the one clause changed by functoriality. Parameterize typing, multi-step weak-head reduction, and neutral conversion by an interface I satisfying weakening, substitution, subject conversion, and deterministic weak-head reduction. Define type reducibility and reducible term conversion simultaneously by induction on a type-former tag. The 0,N,Π,Σ, and universe clauses are the usual Kripke clauses. A type X is reducible as a list when it weak-head reduces to List(A) and every weakening of A is reducible.

At a reducible list type, reduce both terms to normal forms. Two constructor forms are related when they are both nil with convertible stored parameters, or both cons with reducibly convertible heads and tails. For compacted neutrals use four clauses. Two ordinary neutrals are related by neutral conversion in I. Two forms mapList(f)(n) and mapList(f)(n) are related when n and n are neutrally convertible and, in every weakened context with x:A, the terms fx and fx are reducibly convertible at the target parameter. A mapped neutral is related to an ordinary neutral when the same condition compares its function body with x; the fourth clause is the converse. Eta-expansion of the two functions makes these clauses well typed even before reducibility of their source is known.

Simultaneous induction on the reducibility witnesses proves reflexivity, symmetry, transitivity, irrelevance of the chosen type witness, weakening, and closure under anti-reduction. Only transitivity of compacted neutrals is new. There are three middle-form possibilities: ordinary, mapped, or one of each. In each, transitivity of neutral conversion identifies the underlying neutrals; the induction hypothesis in the extended context composes the two body relations. If one side supplied the identity body, beta conversion turns that body into x. This produces exactly one of the four clauses above.

We next validate the functor equations. Induct on a reducible list term. Nil and cons compute constructorwise, using the induction hypotheses for the head and tail. An ordinary neutral uses the mixed compacted-neutral clause with body idxx. A mapped neutral first uses definitionally associative composition in the domain category to compact nested maps, then uses the mapped–mapped clause and the induction hypothesis on the composed body. These four cases prove reducible identity and composition; no fusion equation is used.

The fundamental lemma is a simultaneous induction on typing and conversion. Variables use the related environment; substitution uses its Kripke extension; the ordinary constructor and eliminator cases use the corresponding reducibility clauses. Map-Ty uses the list clause just defined, Map-Id and Map-Comp use the preceding validation, and neutral compaction uses anti-reduction. Thus every well-typed term is reducible and every judgmental equality is reducible conversion. Instantiating I by declarative typing gives weak-head normalization and subject reduction. Inspection of related normal forms gives injectivity and nonconfusion; inspection at N gives numeral canonicity.

For algorithmic typing, compare reduced types, ordinary neutrals, and compacted neutrals by mutual recursion. The compacted-neutral clauses are the four logical-relation clauses above, now read as syntax-directed rules; every recursive call either removes a constructor, descends into a neutral spine, or descends into a function body at a structurally smaller type. Hence comparison is decidable. Induction on algorithmic derivations proves soundness. Instantiating the same fundamental lemma by the algorithmic interface proves that every declarative equality is accepted, so declarative and algorithmic typing coincide. Decidable conversion and syntax-directed checking then give decidable type checking. This establishes every item in the theorem at the stated finite signature; no clause constructs actions for arbitrary indexed inductives. ◻

Lemma 120.17 — Local uniqueness of typing

In the proved fragment fixed by convention 120.1, if Γt:A and Γt:B, then ΓAB type.

Proof of Lemma 120.17 — Local uniqueness of typing

Proof. Use the type-former injectivity supplied by theorem 120.16. Induct on the first typing derivation and invert the second derivation after removing its final conversions. A variable has the unique declaration found at its de Bruijn position. The universe, N, zero, and successor rules have fixed conclusions. Formation of Π, Σ, and lists is fixed by the types of their displayed components. For lambda and application, the induction hypotheses identify the annotated domain and function type; dependent-Π injectivity identifies the codomain after substitution. For a pair, the induction hypotheses identify the first component type and the second component type in its substituted fiber; dependent-Σ injectivity identifies the domain and fiber. For either projection, inversion gives the two candidate Σ-types, and dependent-Σ injectivity identifies the selected component type. The N- and list-eliminator syntax stores its motive and branches; inversion therefore gives the same motive instance, while the induction hypotheses identify the scrutinee and branch types.

For an action term, the annotated syntax stores F,X,Y. Inverting Map-Ty in both derivations gives the same result type F(Y); constructor-action and neutral-action rules are instances of that rule, not additional typing conclusions. Map-Id, Map-Comp, and their description counterparts derive equality and introduce no typing alternative. Finally, if the first derivation ends in conversion, apply the induction hypothesis before that conversion and compose type equalities; if only the second ends in conversion, compose with its conversion premise. This list covers every term and conversion rule in the stated fragment. ◻

Theorem 120.18 — Typing preservation for the functoriality delta

Suppose Γ is well formed.

  1. Both sides of every instance of Desc-Map-Id, Desc-Map-Comp, Map-Id, and Map-Comp have the type printed in that rule.

  2. Let g:homF(X,Y), f:homF(Y,Z), and neutral n:F(X) be well typed in Γ, let s=mapF(f)(mapF(g)(n)) and s=mapF(fFFg)(n), and suppose Γ,z:F(Z)E[z]:B(z). If ΓE[s]:A and contextual compaction takes E[s] to E[s], then ΓE[s]:A.

  3. Every rule instance remains an instance after a well-typed substitution σ:ΓΓ.

Proof of Theorem 120.18 — Typing preservation for the functoriality delta

Proof. For the description rules, induction on D gives mapD(f):[[D]]X[[D]]Y; application typing then assigns the displayed common types. The fixed-former rules use the domain-morphism signatures in convention 120.1. This proves clause 1.

For clause 2, the only new reduction has source and target s=mapF(f)(mapF(g)(n)),s=mapF(fFFg)(n). The rule premises type both terms at F(Z). The contextual reduction instance supplies Γ,z:F(Z)E[z]:B(z). By lemma 120.12, the target has type B(s) and B(s)B(s). Lemma 120.17 gives AB(s); two conversions therefore assign E[s] the original type A. This argument includes Frame-ListInd, where the two intermediate result types are P(s) and P(s).

For clause 3, apply lemma 120.13 to the description rules and lemma 120.14 to Map-Ty, Map-Id, and Map-Comp. Substituting the typing premises rebuilds the same rule. These are the constructor computation, identity, composition, and neutral-compaction families introduced by the delta. ◻

No eliminator-map fusion rule is added: no rule pushes an outer mapF through the eliminator of F into its branches. The source records that such a rule is unnecessary for the functorial equations and takes the conservative option of leaving it out, and notes separately that it becomes necessary only when the parameters of an inductive type are inferred from the scrutinee rather than stored at the eliminator. The absence is therefore part of the system card, not an omitted optimization.

Adapter extension boundary

Convention 120.19 — AdapTT extension card

AdapTT is a separate calculus, not an extension of the Coq fragment in convention 120.1. Besides contexts, types, terms, and substitution, its primitive judgments include Γf:ABandΓaf:B for an adapter f and its action on a:A. Adapters have identity and composition; substitution preserves both; and action satisfies the judgmental identity, composition, and substitution laws printed in the paper’s Figure 2. No uniqueness of parallel adapters is assumed.

AdapTT2 adds positive and negative type variables, positive and negative context extension, substitutions, and transformations. These construct a variance-sensitive domain category for a type former. Section 4 then describes indexed inductive families by a parameter context, an index telescope, a finite list of constructor descriptions, and recursive arguments whose arity telescope is contravariant. The construction derives an adapter for the described family and its computation on constructors. It does not derive a recursor, a recursor–adapter fusion law, mixed-variance telescopes, or nested inductive types.

Proposition 120.20 — AdapTT semantic boundary

At the signature of convention 120.19, the following statements hold.

  1. AdapTT has a sound interpretation in every natural model whose types and terms form the stated discrete-opfibration structure (Theorem 2.3).

  2. For every small such model C, the 2-category of category-valued presheaves on C models AdapTT2 (Theorem 3.4).

  3. The Section 4 signature construction yields the type and adapter, together with constructor-action equations, for each description admitted by that construction.

The source proves neither normalization nor decidability of type checking for AdapTT or AdapTT2. It also leaves mixed variance, the conjectured embedding of AdapTT into AdapTT2, nested types, recursors, and fusion outside the proposition.

Proof of Proposition 120.20 — AdapTT semantic boundary

Proof. For clause 1, fix a natural model with a representable natural transformation p:TmTy that is an objectwise discrete opfibration. Interpret a type in Γ as an object of Ty(Γ), an adapter as one of its arrows, and a term as an object of Tm(Γ) above its type. Given t:Tm(Γ) above A and f:AB, the discrete opfibration supplies a unique lift f¯:tt above f. Define tf=t. Uniqueness identifies the lift of an identity with the identity and the lift of a composite with the composite of lifts. Naturality of the opfibration identifies reindexing of f¯ with the lift of the reindexed adapter. These are exactly the adapter identity, composition, and substitution equations. Representability of p supplies context extension, weakening, and the variable, so every rule of the AdapTT card is interpreted.

For clause 2, let C be small. In the 2-category [Cop,Cat], take contexts to be category-valued presheaves, substitutions to be 2-natural transformations, and transformations to be modifications. Positive context extension is the Grothendieck construction of a covariant family; negative extension uses the same construction after taking the stipulated dual. Whiskering and composition are the strict 2-categorical operations, so their identity, associativity, interchange, and duality equations hold on the nose. Types, terms, adapters, and adapter action are interpreted pointwise by the model of clause 1. The positive and negative extension equations follow from the universal property of the two Grothendieck constructions. This verifies each rule family in the AdapTT2 card and proves the model claim.

For clause 3, induct on an admitted datatype description. The parameter and index telescopes interpret as the iterated positive or negative extensions just constructed. A nonrecursive constructor argument is reindexed by the induction hypothesis for its telescope. A recursive argument uses the contravariant arity extension followed by the covariant recursive result. The outer constructor is preserved, while all fields receive their induced adapters; this is the displayed constructor-action equation. Finite lists of constructors are handled componentwise. Thus the interpretation yields the described type, its adapter, and every constructor equation.

The induction contains no case defining a recursor or a recursor–adapter fusion equation, and the grammar has no mixed-variance or nested-description case. The semantic construction is not a normalization or decision procedure. None of the excluded claims follows. ◻

The cited source does not prove preservation, normalization, canonicity, coherence, or either semantic result above for an executable checker. No result after this chapter depends on the adapter extension.

Sources

The MLTTmap calculus follows Laurent, Lennon-Bertrand, and Maillard [LLBM24]. The adapter calculus follows Adjedj, Lennon-Bertrand, Benjamin, and Maillard [ALBBM25].

Suggested first pass.

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

Exercise 120.2

★★☆ Calculate composition of two list maps on nil, a two-element constructor list, and a neutral variable. Mark the constructor reductions and the one neutral-compaction step separately.

Exercise 120.3

★★★ Derive identity and composition for the dependent-product action without omitting the substituted fiber types. Then reverse the domain morphism and display the first ill-typed application.

Exercise 120.4

★★★ Practical project.positive-description-action-checker Implement in Agda or Kappa the descriptions of definition 120.2, their finite values, and generated action. Maintain the invariant that action preserves the outer constructor of a description value. Represent a finite dependent sum whose zero-index fiber is constant and whose successor-index fiber contains the parameter. On identity-product, compose-sigma, and dependent-sigma, print identity, composition, and dependent-sigma, respectively. The last oracle must show that the same parameter map leaves the zero fiber unchanged and maps the successor fiber. On negative-description, print rejected: negative- occurrence. A mutation that maps only the left product component must fail identity-product; a mutation that always selects the zero sigma fiber must fail dependent-sigma. The program checks the finite description language; it is not a mechanization of the normalization or semantic proofs above.

Search the book

Type to search the local edition.