Indexed Inductive Families and Dependent Pattern Matching
A list records its elements but not its length. Attaching a natural number to a list repairs the statement of lookup only externally: the type checker still cannot infer from the constructor that the number is zero or a successor. The result index of a constructor must therefore be part of the declaration.
The index is fixed by the constructor
The unindexed schema of definition 28.34 permits a constructor whose recursive arguments have the type being declared. It does not permit the attempted declaration 𝗏𝗇𝗂𝗅:𝖵𝖾𝖼(𝐴,𝟢),𝗏𝖼𝗈𝗇𝗌:∏𝑛:ℕ𝐴⟶𝖵𝖾𝖼(𝐴,𝑛)⟶𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)), because there is no single unindexed result type to put in the constructor signature. Replacing every occurrence by ∑𝑛:ℕ𝖵𝖾𝖼(𝐴,𝑛) loses the constraint: the tail of a purported successor vector may then carry an unrelated index. Write 𝗏𝖼𝗈𝗇𝗌′ for the constructor produced by this attempted replacement. If 𝑥𝑠:𝖵𝖾𝖼(𝐴,5), then the raw package (𝗌𝗎𝖼(𝟢),𝗏𝖼𝗈𝗇𝗌′(𝑎,(5,𝑥𝑠))) claims outer index 1 while its displayed tail has index 5. No equation in the unindexed signature relates the two components. The index must occur in the result type of the constructor, not merely in a package around its recursive argument.
An indexed inductive family is generated simultaneously at every index, and each constructor specifies the index of its result. Extend the signature of definition 28.34 by the following vector family.
Its constructors have types 𝗏𝗇𝗂𝗅:𝖵𝖾𝖼(𝐴,𝟢),𝗏𝖼𝗈𝗇𝗌:∏𝑛:ℕ𝐴⟶𝖵𝖾𝖼(𝐴,𝑛)⟶𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)). For example, the successor constructor has the derivation Γ⊢𝑛:ℕΓ⊢𝑎:𝐴Γ⊢𝑥𝑠:𝖵𝖾𝖼(𝐴,𝑛)Γ⊢𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠):𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛))Vec−intros. In this derivation Vec-form first forms the result family at 𝗌𝗎𝖼(𝑛), and Vec-intro𝑠 then assigns the constructor the displayed result type. Its dependent eliminator has the following rule. Put 𝑃0:=𝑃[𝟢/𝑛,𝗏𝗇𝗂𝗅/𝑣] and 𝑃𝑠:=𝑃[𝗌𝗎𝖼(𝑛)/𝑛,𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠)/𝑣].
Put 𝑟:=𝗏𝗂𝗇𝖽(𝑃;𝑝0;𝑝𝑠;𝑛,𝑥𝑠). The two computation rules are 𝗏𝗂𝗇𝖽(𝑃;𝑝0;𝑝𝑠;𝟢,𝗏𝗇𝗂𝗅)≡𝑝0,𝗏𝗂𝗇𝖽(𝑃;𝑝0;𝑝𝑠;𝗌𝗎𝖼(𝑛),𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠))≡𝑝𝑠[𝑛/𝑛,𝑎/𝑎,𝑥𝑠/𝑥𝑠,𝑟/𝑞]. We refer to these two constructor equations collectively as Vec-comp. The variables displayed in the motive and successor branch are pairwise distinct and avoid dom(Γ).
The successor branch is the new feature. Its recursive hypothesis concerns 𝑥𝑠:𝖵𝖾𝖼(𝐴,𝑛), while its target concerns a value at index 𝗌𝗎𝖼(𝑛). Thus constructor typing performs the index refinement that an unindexed encoding could only postulate.
First use natural-number recursion in the universe to define ℎ,𝑡:ℕ→U𝑖 by ℎ(𝟢):=𝟏,ℎ(𝗌𝗎𝖼(𝑛)):=𝐴,𝑡(𝟢):=𝟏,𝑡(𝗌𝗎𝖼(𝑛)):=𝖵𝖾𝖼(𝐴,𝑛). Now put 𝐻(𝑛,𝑣):=ℎ(𝑛) and 𝑇(𝑛,𝑣):=𝑡(𝑛) in the context 𝑛:ℕ,𝑣:𝖵𝖾𝖼(𝐴,𝑛). These are well-formed motives because the recursion defining ℎ and 𝑡 is completed before weakening them by the dependent variable 𝑣; neither definition eliminates 𝑛 while retaining a fixed 𝑣. The vector eliminator gives 𝗁𝖾𝖺𝖽+(𝑚,𝑦𝑠):=𝗏𝗂𝗇𝖽(𝐻;⋆;𝑛.𝑎.𝑥𝑠.𝑞.𝑎;𝑚,𝑦𝑠):𝐻(𝑚,𝑦𝑠),𝗍𝖺𝗂𝗅+(𝑚,𝑦𝑠):=𝗏𝗂𝗇𝖽(𝑇;⋆;𝑛.𝑎.𝑥𝑠.𝑞.𝑥𝑠;𝑚,𝑦𝑠):𝑇(𝑚,𝑦𝑠). For 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)), set 𝗁𝖾𝖺𝖽(𝑦𝑠):=𝗁𝖾𝖺𝖽+(𝗌𝗎𝖼(𝑛),𝑦𝑠) and 𝗍𝖺𝗂𝗅(𝑦𝑠):=𝗍𝖺𝗂𝗅+(𝗌𝗎𝖼(𝑛),𝑦𝑠). Their constructor computations are judgmental: 𝗁𝖾𝖺𝖽(𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠))≡𝑎,𝗍𝖺𝗂𝗅(𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠))≡𝑥𝑠. No impossible 𝗏𝗇𝗂𝗅 clause was assumed; the eliminator places that clause in the harmless types 𝟏 and 𝟏.
If 𝑚:ℕ and 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝑚) are variables, then 𝗏𝗂𝗇𝖽(𝑃;𝑝0;𝑝𝑠;𝑚,𝑦𝑠) is neutral: neither constructor computation rule applies. The vector rules contain no uniqueness equation that could reconstruct 𝑦𝑠 from this stuck eliminator.
The recursive universe-valued family of construction 29.17 will be written 𝖥𝗂𝗇LE: it satisfies 𝖥𝗂𝗇LE(𝟢)≡𝟎 and 𝖥𝗂𝗇LE(𝗌𝗎𝖼(𝑛))≡𝖥𝗂𝗇LE(𝑛)+𝟏. An inductive presentation makes the two ways to inhabit a successor size available as constructors. The subscript LE recalls the strict inequality 𝑘<𝑛 used in the universe-valued definition; ind marks the constructor-generated presentation.
The family 𝖥𝗂𝗇ind:ℕ→U0 has constructors 𝖿𝗓:∏𝑛:ℕ𝖥𝗂𝗇ind(𝗌𝗎𝖼(𝑛)),𝖿𝗌:∏𝑛:ℕ𝖥𝗂𝗇ind(𝑛)→𝖥𝗂𝗇ind(𝗌𝗎𝖼(𝑛)). For a motive 𝑄:∏𝑛:ℕ𝖥𝗂𝗇ind(𝑛)→U𝑗, branches 𝑞𝑧:∏𝑛:ℕ𝑄(𝗌𝗎𝖼(𝑛),𝖿𝗓(𝑛)),𝑞𝑠:∏𝑛:ℕ∏𝑘:𝖥𝗂𝗇ind(𝑛)𝑄(𝑛,𝑘)→𝑄(𝗌𝗎𝖼(𝑛),𝖿𝗌(𝑛,𝑘)) determine 𝖿𝗂𝗇𝖽(𝑄;𝑞𝑧;𝑞𝑠;𝑛,𝑘):𝑄(𝑛,𝑘), with judgmental computation on 𝖿𝗓 and 𝖿𝗌. More precisely, elimination is governed by
For every 𝑛:ℕ there are maps 𝑒𝑛:𝖥𝗂𝗇ind(𝑛)→𝖥𝗂𝗇LE(𝑛),𝑑𝑛:𝖥𝗂𝗇LE(𝑛)→𝖥𝗂𝗇ind(𝑛) and identifications 𝑑𝑛(𝑒𝑛(𝑘))=𝑘 and 𝑒𝑛(𝑑𝑛(𝑢))=𝑢 for all 𝑘 and 𝑢 in their respective domains.
Proof of Theorem 78.4 — The two finite families agree
Proof. Rule Fin-elim defines 𝑒𝗌𝗎𝖼(𝑛)(𝖿𝗓(𝑛)):=𝗂𝗇𝗋(⋆),𝑒𝗌𝗎𝖼(𝑛)(𝖿𝗌(𝑛,𝑘)):=𝗂𝗇𝗅(𝑒𝑛(𝑘)). Natural-number induction defines 𝑑𝟢 by empty elimination and 𝑑𝗌𝗎𝖼(𝑛)(𝗂𝗇𝗋(⋆)):=𝖿𝗓(𝑛),𝑑𝗌𝗎𝖼(𝑛)(𝗂𝗇𝗅(𝑢)):=𝖿𝗌(𝑛,𝑑𝑛(𝑢)). For 𝑑𝑛𝑒𝑛, apply finite-index elimination. The 𝖿𝗓 branch is reflexivity; the 𝖿𝗌 branch applies 𝖺𝗉 to 𝖿𝗌(𝑛,−) and the recursive hypothesis. For 𝑒𝑛𝑑𝑛, apply natural-number induction. Its zero case is empty elimination. In the successor case apply coproduct elimination. The right branch is reflexivity; the left branch applies 𝖺𝗉 to 𝗂𝗇𝗅 and the induction hypothesis. These are all constructor cases, so the displayed definitions compute judgmentally before the final applications of 𝖺𝗉. ◻
After theorem 78.4, write 𝖥𝗂𝗇(𝑛) when a construction is invariant under these two inverse maps. The programs below use 𝖥𝗂𝗇ind because its eliminator exposes the zero and successor positions.
Finite-index elimination avoids an impossible vector branch. Take 𝑄(𝑚,𝑘):=𝖵𝖾𝖼(𝐴,𝑚)→𝐴. The 𝖿𝗓(𝑛) method sends 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)) to 𝗁𝖾𝖺𝖽(𝑦𝑠). The 𝖿𝗌(𝑛,𝑘) method sends a recursive map 𝑞:𝖵𝖾𝖼(𝐴,𝑛)→𝐴 and 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)) to 𝑞(𝗍𝖺𝗂𝗅(𝑦𝑠)). Define 𝗅𝗈𝗈𝗄𝗎𝗉(𝑦𝑠,𝑘):=𝖿𝗂𝗇𝖽(𝑄;𝑞𝑧;𝑞𝑠;𝑚,𝑘)(𝑦𝑠), where 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝑚) and 𝑘:𝖥𝗂𝗇ind(𝑚). The two finite-index equations followed by the head and tail equations give 𝗅𝗈𝗈𝗄𝗎𝗉(𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠),𝖿𝗓(𝑛))≡𝑎,𝗅𝗈𝗈𝗄𝗎𝗉(𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠),𝖿𝗌(𝑛,𝑘))≡𝗅𝗈𝗈𝗄𝗎𝗉(𝑥𝑠,𝑘). Thus lookup has no size-zero clause: there is no 𝑘:𝖥𝗂𝗇ind(𝟢) to eliminate.
For 𝐵:U𝑖 and 𝑓:𝐴→𝐵, vector elimination with motive 𝑃(𝑛,𝑥𝑠):=𝖵𝖾𝖼(𝐵,𝑛) defines 𝗆𝖺𝗉(𝑓,𝗏𝗇𝗂𝗅):=𝗏𝗇𝗂𝗅,𝗆𝖺𝗉(𝑓,𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑥𝑠)):=𝗏𝖼𝗈𝗇𝗌(𝑛,𝑓(𝑎),𝗆𝖺𝗉(𝑓,𝑥𝑠)). To append 𝑥𝑠:𝖵𝖾𝖼(𝐴,𝑚) to 𝑦𝑠:𝖵𝖾𝖼(𝐴,𝑛), use the motive 𝑃(𝑚,𝑥𝑠):=𝖵𝖾𝖼(𝐴,𝑛+𝑚). The fixed length 𝑛 is written first because the addition of construction 28.23 recurs on its second argument. The equations are 𝖺𝗉𝗉𝖾𝗇𝖽(𝗏𝗇𝗂𝗅,𝑦𝑠):=𝑦𝑠,𝖺𝗉𝗉𝖾𝗇𝖽(𝗏𝖼𝗈𝗇𝗌(𝑚,𝑎,𝑥𝑠),𝑦𝑠):=𝗏𝖼𝗈𝗇𝗌(𝑛+𝑚,𝑎,𝖺𝗉𝗉𝖾𝗇𝖽(𝑥𝑠,𝑦𝑠)). The empty branch has the required type because 𝑛+𝟢≡𝑛 by the orientation of construction 28.23. The second term has the required type because 𝑛+𝗌𝗎𝖼(𝑚)≡𝗌𝗎𝖼(𝑛+𝑚) for that same orientation.
★★☆ For 𝑓:𝐴→𝐵, 𝑥𝑠:𝖵𝖾𝖼(𝐴,𝑛), and 𝑘:𝖥𝗂𝗇ind(𝑛), construct an identification 𝗅𝗈𝗈𝗄𝗎𝗉(𝗆𝖺𝗉(𝑓,𝑥𝑠),𝑘)=𝑓(𝗅𝗈𝗈𝗄𝗎𝗉(𝑥𝑠,𝑘)). Use vector elimination and display both finite-index cases in the successor branch.
A constructor pattern refines its index, but it must not silently assert an identity between constructor forms. The required facts are derived from eliminators.
Proof of Proposition 78.6 — No confusion used for vectors and finite indices
Proof. For (i), finite-index elimination defines 𝐶:𝖥𝗂𝗇ind(𝗌𝗎𝖼(𝑛))→U0. Its constructor equations are 𝐶(𝖿𝗓(𝑛))≡𝟏 and 𝐶(𝖿𝗌(𝑛,𝑘))≡𝟎. Transporting ⋆:𝐶(𝖿𝗓(𝑛)) along 𝑝 gives an element of 𝟎.
For (ii), define a predecessor into 𝖥𝗂𝗇ind(𝑛)+𝟏 by sending 𝖿𝗓 to the right summand and 𝖿𝗌(𝑛,𝑟) to 𝗂𝗇𝗅(𝑟). Applying this map to 𝑝 gives 𝗂𝗇𝗅(𝑘)=𝗂𝗇𝗅(𝑙). Choose a default value 𝑘 and define 𝑞:𝖥𝗂𝗇ind(𝑛)+𝟏→𝖥𝗂𝗇ind(𝑛) by 𝑞(𝗂𝗇𝗅(𝑟)):=𝑟 and 𝑞(𝗂𝗇𝗋(⋆)):=𝑘. Applying 𝖺𝗉𝑞 to the displayed equality gives 𝑘=𝑙. For (iii), apply 𝖺𝗉 to 𝗁𝖾𝖺𝖽 and 𝗍𝖺𝗂𝗅 from construction 78.2. Their constructor computations identify the endpoints with 𝑎,𝑏 and 𝑥𝑠,𝑦𝑠, respectively. ◻
The disjointness proof depends only on the eliminators and identity induction. Judgmental injectivity of raw constructors would require a normalization or term-model theorem; no such stronger assertion is used here.
A pattern clause is an equation whose left side is built from variables and constructors. The clauses have coverage when every constructor compatible with the scrutinee index has a branch. A clause is accepted only after coverage and the generated index equations have been checked. Write T𝗉𝖺𝗍→𝗍𝗆(⃗𝑝) for the ordinary term tuple obtained from a pattern tuple ⃗𝑝 by erasing dots and reading every constructor pattern as the corresponding constructor term. For example, 𝗁𝖾𝖺𝖽(𝗏𝖼𝗈𝗇𝗌(.𝑛,𝑎,𝑥𝑠))=𝑎 contains an inaccessible pattern.𝑛: it records the value forced by unifying the scrutinee index 𝗌𝗎𝖼(𝑛) with the constructor result index, but it does not split on 𝑛.
The head clause has one reachable constructor. Give Vec-elim the motive 𝐻 of construction 78.2; its empty branch is ⋆, and its successor branch returns 𝑎. Restricting the result to successor indices is exactly 𝗁𝖾𝖺𝖽.
The two append clauses are covered by 𝗏𝗇𝗂𝗅 and 𝗏𝖼𝗈𝗇𝗌. Give Vec-elim the motive 𝑃(𝑚,𝑥𝑠):=𝖵𝖾𝖼(𝐴,𝑛+𝑚), the empty branch 𝑦𝑠, and the successor branch 𝑚.𝑎.𝑥𝑠.𝑞.𝗏𝖼𝗈𝗇𝗌(𝑛+𝑚,𝑎,𝑞). This is the eliminator term of construction 78.5; its two judgmental computations are the two pattern equations. Pattern syntax has therefore introduced no new proof principle in these examples.
Coverage for indexed patterns is not merely a list of constructors. Splitting 𝑥:𝐷(⃗𝑢) against a constructor 𝑐𝑖:Δ𝑖→𝐷(⃗𝑣𝑖) produces the equation list ⃗𝑢=⃗𝑣𝑖. A unifier must either solve that list, prove the branch impossible by constructor conflict or a finite occurs check, or refuse the split.
The source argument uses equality of whole telescopes, not a heterogeneous equality hidden in the unifier. We first expose that equality and its eliminator.
For a telescope Δ, define the telescopic-equality type ⃗𝑠≡Δ⃗𝑡 recursively: ()≡()():=𝟏,(𝑠;⃗𝑠)≡𝑥:𝐴;Δ(𝑥)(𝑡;⃗𝑡):=∑𝑒:𝖨𝖽𝐴(𝑠,𝑡)𝑒∗⃗𝑠≡Δ(𝑡)⃗𝑡. Here 𝑒∗⃗𝑠 transports the later components of ⃗𝑠 along 𝑒. The expression ⃗𝑠≡Δ⃗𝑡 is a type internal to the theory. It is distinct from the external judgmental-equality assertion ⃗𝑠≡⃗𝑡 even though the two notations share a glyph. Reflexivity ―――𝗋𝖾𝖿𝗅⃗𝑠 is defined recursively: at the empty telescope it is ⋆, and at (𝑠;⃗𝑠) it is (𝗋𝖾𝖿𝗅𝑠,―――𝗋𝖾𝖿𝗅⃗𝑠) after the reflexivity transport has computed. For a family 𝐶(⃗𝑠,⃗𝑡,𝑒):U𝑗, iterated identity induction gives ――𝐽Δ(𝐶):(∏⃗𝑠:Δ𝐶(⃗𝑠,⃗𝑠,―――𝗋𝖾𝖿𝗅⃗𝑠))→∏⃗𝑠,⃗𝑡:Δ∏𝑒:⃗𝑠≡Δ⃗𝑡𝐶(⃗𝑠,⃗𝑡,𝑒). It satisfies ――𝐽Δ(𝐶,𝑑,⃗𝑠,⃗𝑠,―――𝗋𝖾𝖿𝗅⃗𝑠)≡𝑑(⃗𝑠). The extension step first eliminates the head identity and then invokes ――𝐽 on the transported tail. Thus no identity proofs are equated. Telescopic symmetry is the derived map ――――𝗌𝗒𝗆Δ:⃗𝑠≡Δ⃗𝑡→⃗𝑡≡Δ⃗𝑠, obtained by ――𝐽Δ with reflexivity clause ―――𝗋𝖾𝖿𝗅⃗𝑠. Its reflexivity computation is judgmental.
A unification problem is a telescope together with a homogeneous telescopic equality. The restricted transition system has four operations.
Solution: replace a variable 𝑥 by 𝑡 when 𝑥∉FV(𝑡).
Injectivity: replace 𝑐(⃗𝑠)=𝑐(⃗𝑡) by the equations ⃗𝑠≡Δ𝑐⃗𝑡, where Δ𝑐 is the constructor argument telescope.
Conflict: reject 𝑐(⃗𝑠)=𝑑(⃗𝑡) when 𝑐≠𝑑.
Cycle: reject 𝑥=𝑐(⃗𝑡[𝑥]) when the displayed occurrence of 𝑥 lies at a recursive argument position below a constructor. First-order pattern problems produce cycles only at these 𝖡𝖾𝗅𝗈𝗐𝐷-reachable positions.
There is no transition deleting 𝑡=𝑡. Before injectivity is applied to 𝑐(⃗𝑠)=𝑐(⃗𝑡):𝐷(⃗𝑢), the index problem ⃗𝑢≡Ξ⃗𝑢 must itself have a positive solution. A positive solution records a most general substitution; conflict or cycle is negative; a stuck problem is failure, not coverage.
These are the two restrictions imposed in Cockx–Devriese–Piessens, Section 3.1: no deletion, and self-unifiability of indices before constructor injectivity. The first rejects 𝖪(𝑃,𝑝,𝗋𝖾𝖿𝗅)=𝑝 for 𝑒:𝖨𝖽𝐴(𝑎,𝑎), because matching 𝑒 with reflexivity generates 𝑎=𝑎. Deleting that equation would turn path induction with fixed endpoint into K. The second restriction blocks the same deletion from being concealed by constructor injectivity one level higher. The second restriction has its own boundary. Without it, injectivity would admit the single clause 𝗐𝖾𝖺𝗄𝖪(𝗋𝖾𝖿𝗅𝗋𝖾𝖿𝗅𝑎)=𝗋𝖾𝖿𝗅𝗋𝖾𝖿𝗅𝗋𝖾𝖿𝗅𝑎 at the type 𝗐𝖾𝖺𝗄𝖪:∏𝑒:𝖨𝖽𝖨𝖽𝐴(𝑎,𝑎)(𝗋𝖾𝖿𝗅𝑎,𝗋𝖾𝖿𝗅𝑎)𝖨𝖽𝖨𝖽𝖨𝖽𝐴(𝑎,𝑎)(𝗋𝖾𝖿𝗅𝑎,𝗋𝖾𝖿𝗅𝑎)(𝑒,𝗋𝖾𝖿𝗅𝗋𝖾𝖿𝗅𝑎). Splitting 𝑒 compares 𝗋𝖾𝖿𝗅𝑎 with itself. Injectivity would accept that comparison if it inspected only the constructor heads, and the clause would prove that every loop at 𝗋𝖾𝖿𝗅𝑎 is reflexivity. The self-unifiability test first asks the restricted unifier to solve the index problem 𝑎=𝑎; deletion is unavailable, so the problem is stuck and the clause is rejected. Thus each restriction blocks a separate route to K.
Fix 𝐷:Ξ→U𝑖. Abbreviate 𝑅𝑘,𝑟:=Φ𝑘,𝑟→𝐷(⃗𝑣𝑘,𝑟). Its constructors have the homogeneous telescopic form 𝑐𝑘:(⃗𝑡:Δ𝑘)→(𝑥1:𝑅𝑘,1)→⋯→(𝑥𝑛𝑘:𝑅𝑘,𝑛𝑘)→𝐷(⃗𝑢𝑘). For 𝑃:(⃗𝑢:Ξ)→𝐷(⃗𝑢)→U𝑗, basic case analysis has type 𝐵𝑘(𝑃):=(⃗𝑡:Δ𝑘)→(𝑥1:𝑅𝑘,1)→⋯→(𝑥𝑛𝑘:𝑅𝑘,𝑛𝑘)→𝑃(⃗𝑢𝑘,𝑐𝑘⃗𝑡𝑥1⋯𝑥𝑛𝑘). The operation is 𝖼𝖺𝗌𝖾𝐷:(∏𝑘𝐵𝑘(𝑃))→∏⃗𝑢:Ξ∏𝑥:𝐷(⃗𝑢)𝑃(⃗𝑢,𝑥). It computes by selecting 𝑏𝑘(⃗𝑡,𝑥1,…,𝑥𝑛𝑘) on the 𝑘th constructor. The absent arguments are the recursive hypotheses of the full eliminator.
Define 𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑢,𝑥) by the dependent eliminator with universe-valued motive. Its 𝑘th constructor equation is the telescope product 𝑛𝑘∏𝑟=1∏𝜙:Φ𝑘,𝑟𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑣𝑘,𝑟,𝑥𝑟𝜙)×𝑃(⃗𝑣𝑘,𝑟,𝑥𝑟𝜙). Thus nullary constructors produce 𝟏, and a recursive function argument contributes one pair at each 𝜙:Φ𝑘,𝑟. Put ̂𝐷:=∑⃗𝑢:Ξ𝐷(⃗𝑢),𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,(⃗𝑢;𝑥)):=𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑢,𝑥). The two-argument form is used only when its second argument is visibly a point of ̂𝐷; otherwise all three arguments are printed. Put 𝖲𝗍𝖾𝗉𝐷(𝑃):=∏⃗𝑢:Ξ∏𝑥:𝐷(⃗𝑢)𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑢,𝑥)→𝑃(⃗𝑢,𝑥). Given 𝑝:𝖲𝗍𝖾𝗉𝐷(𝑃), the helper 𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑝):∏⃗𝑢:Ξ∏𝑥:𝐷(⃗𝑢)𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑢,𝑥) is defined by the full eliminator. At recursive argument 𝑥𝑟 with induction hypothesis ℎ𝑟, its tuple component is 𝜆𝜙.(ℎ𝑟(𝜙),𝑝(⃗𝑣𝑘,𝑟,𝑥𝑟𝜙,ℎ𝑟(𝜙))). The associated recursor is 𝗋𝖾𝖼𝐷:𝖲𝗍𝖾𝗉𝐷(𝑃)→∏⃗𝑢:Ξ∏𝑥:𝐷(⃗𝑢)𝑃(⃗𝑢,𝑥). We print the motive 𝑃 as an explicit bookkeeping parameter, so an application has the form 𝗋𝖾𝖼𝐷(𝑃,𝑝,⃗𝑢,𝑥). It is defined by 𝗋𝖾𝖼𝐷(𝑃,𝑝,⃗𝑢,𝑥):=𝑝(⃗𝑢,𝑥,𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑝,⃗𝑢,𝑥)). All displayed constructor equations are judgmental.
Let ⃗𝑎,⃗𝑏:̂𝐷. Define 𝖭𝗈𝖢𝗈𝗇𝖿𝗎𝗌𝗂𝗈𝗇𝐷 by two applications of basic case analysis. For equal constructor tags it is the homogeneous telescopic equality of all constructor arguments; for distinct tags it is 𝟎. Telescopic identity elimination and basic case analysis give 𝗇𝗈𝖢𝗈𝗇𝖿𝐷(⃗𝑎,⃗𝑏):⃗𝑎≡Ξ;𝐷⃗𝑏→𝖭𝗈𝖢𝗈𝗇𝖿𝗎𝗌𝗂𝗈𝗇𝐷(⃗𝑎,⃗𝑏),𝗇𝗈𝖢𝗈𝗇𝖿−1𝐷(⃗𝑎,⃗𝑏):𝖭𝗈𝖢𝗈𝗇𝖿𝗎𝗌𝗂𝗈𝗇𝐷(⃗𝑎,⃗𝑏)→⃗𝑎≡Ξ;𝐷⃗𝑏. On the diagonal, the first map returns reflexivity; the inverse transports the argument telescope through the constructor-and-index map and returns reflexivity.
Proof. Apply ――𝐽Ξ;𝐷 to 𝑒. Its reflexivity case computes by basic case analysis to reflexivity, which proves the displayed identity without equating arbitrary identity proofs. ◻
The acyclicity argument needs a second family elimination; constructor disjointness alone does not supply it. Retain ̂𝐷:=∑⃗𝑢:Ξ𝐷(⃗𝑢) and write a bold argument ⃗𝑎=(⃗𝑢;𝑎):̂𝐷 for an index together with an inhabitant. Define ⃗𝑎⊀𝐷⃗𝑏:=𝖡𝖾𝗅𝗈𝗐𝐷(𝜆⃗𝑏′.⃗𝑎≡Ξ;𝐷⃗𝑏′→𝟎,⃗𝑏),𝗇𝗈𝗍𝖡𝖾𝗅𝗈𝗐𝖤𝗊𝐷(⃗𝑎,⃗𝑏):=(⃗𝑎⊀𝐷⃗𝑏)×(⃗𝑎≡Ξ;𝐷⃗𝑏→𝟎).
Proof of Lemma 78.14 — Acyclicity of recursive descent
Proof. Telescopic identity elimination reduces it to (⃗𝑎:̂𝐷)→⃗𝑎⊀𝐷⃗𝑎. In the 𝑐𝑖 method of the first family eliminator, fix a recursive child 𝑥𝑗𝜙 and define the complete child ⃗𝑥𝑗,𝜙:=(⃗𝑣𝑖,𝑗;𝑥𝑗𝜙):̂𝐷. Define the auxiliary family 𝖲𝗍𝖾𝗉𝑖,𝑗(⃗𝑡,⃗𝑥,𝜙,⃗𝑏):=(⃗𝑥𝑗,𝜙⊀𝐷⃗𝑏)→𝗇𝗈𝗍𝖡𝖾𝗅𝗈𝗐𝖤𝗊𝐷((⃗𝑢𝑖;𝑐𝑖⃗𝑡⃗𝑥),⃗𝑏). The second family eliminator, now on ⃗𝑏, constructs 𝗌𝗍𝖾𝗉𝑖,𝑗:(⃗𝑡,⃗𝑥,𝜙,⃗𝑏)→𝖲𝗍𝖾𝗉𝑖,𝑗(⃗𝑡,⃗𝑥,𝜙,⃗𝑏). To display its method, let ⃗𝑏=(⃗𝑢𝑝;𝑐𝑝⃗𝑡′⃗𝑥′), let ℎ′𝑞𝜙′ be the second eliminator’s hypothesis for the complete child ⃗𝑥′𝑞,𝜙′:=(⃗𝑣𝑝,𝑞;𝑥′𝑞𝜙′), and assume 𝐻:⃗𝑥𝑗,𝜙⊀𝐷(⃗𝑢𝑝;𝑐𝑝⃗𝑡′⃗𝑥′). Unfolding 𝐻 gives, for every 𝑞,𝜙′, the component 𝐻𝑞(𝜙′):𝗇𝗈𝗍𝖡𝖾𝗅𝗈𝗐𝖤𝗊𝐷(⃗𝑥𝑗,𝜙,⃗𝑥′𝑞,𝜙′). The method returns (𝛼,𝛽), where 𝛼:(⃗𝑢𝑖;𝑐𝑖⃗𝑡⃗𝑥)⊀𝐷(⃗𝑢𝑝;𝑐𝑝⃗𝑡′⃗𝑥′),𝛼𝑞(𝜙′):=ℎ′𝑞(𝜙′)(𝗉𝗋1(𝐻𝑞𝜙′)),𝛽:(⃗𝑢𝑖;𝑐𝑖⃗𝑡⃗𝑥)≡Ξ;𝐷(⃗𝑢𝑝;𝑐𝑝⃗𝑡′⃗𝑥′)→𝟎. For 𝛽, suppose 𝑒 is such an equality. If 𝑖≠𝑝, 𝗇𝗈𝖢𝗈𝗇𝖿𝐷(𝑒):𝟎. If 𝑖=𝑝, no confusion exposes the homogeneous equality of the argument telescopes. Its 𝑗th recursive component transports 𝐻𝑗𝜙 to 𝗇𝗈𝗍𝖡𝖾𝗅𝗈𝗐𝖤𝗊𝐷(⃗𝑥𝑗,𝜙,⃗𝑥𝑗,𝜙); the second projection applied to 𝗋𝖾𝖿𝗅 is in 𝟎. These are the two components of the source construction: the parent is not below the descendant, and the parent is not the descendant.
Finally the 𝑐𝑖 method of the first eliminator is 𝜆⃗𝑡.⃗𝑥.⃗ℎ.(𝜆𝜙.𝗌𝗍𝖾𝗉𝑖,1(⃗𝑡,⃗𝑥,𝜙,⃗𝑥1,𝜙,ℎ1𝜙),…,𝜆𝜙.𝗌𝗍𝖾𝗉𝑖,𝑛𝑖(⃗𝑡,⃗𝑥,𝜙,⃗𝑥𝑛𝑖,𝜙,ℎ𝑛𝑖𝜙)). It has exactly the telescope product required by 𝖡𝖾𝗅𝗈𝗐𝐷. The first eliminator computes to this tuple, and ――𝐽 computes at reflexivity. Thus the resulting 𝗇𝗈𝖢𝗒𝖼𝗅𝖾𝐷 is obtained from two ordinary eliminations and ――𝐽; it assumes neither K nor judgmental constructor injectivity. ◻
A case tree for 𝑓:(⃗𝑡:Δ)→𝑇 is a finite tree. A leaf contains a body of its specialized type. A split selects 𝑥:𝐷(⃗𝑢) and has the branches obtained by restricted unification with constructor result indices; negative branches have no subtree. A recursive leaf may call 𝑓 only on a proper recursive field of one fixed datatype argument. The tree is valid when every split has only positive or negative solutions, all specialized leaves typecheck, constructor branches cover the selected family, and calls have the stated structural decrease. The translation uses 𝖼𝖺𝗌𝖾𝐷, 𝖡𝖾𝗅𝗈𝗐𝐷, 𝗋𝖾𝖼𝐷, no confusion, and acyclicity from definition 78.10, definition 78.11, lemma 78.14.
Let a positive restricted solution of ⃗𝑢≡Ξ⃗𝑣 in Δ be represented by a telescope map 𝜎:Δ′→Δ. For every 𝑇:(⃗𝑡:Δ)→⃗𝑢(⃗𝑡)≡Ξ⃗𝑣(⃗𝑡)→U𝑗 and 𝑚:(⃗𝑧:Δ′)→𝑇(𝜎⃗𝑧,―――𝗋𝖾𝖿𝗅) there is 𝑠:(⃗𝑡:Δ)→(𝑒:⃗𝑢(⃗𝑡)≡Ξ⃗𝑣(⃗𝑡))→𝑇(⃗𝑡,𝑒) such that 𝑠(𝜎⃗𝑧,―――𝗋𝖾𝖿𝗅)⟶∗𝑚(⃗𝑧). A negative solution yields a term of the same target for arbitrary 𝑇.
Proof of Lemma 78.16 — Proof-relevant specialization
Proof. The internal transition terms must retain the proof argument. For a constructor 𝑐 whose result indices have already self-unified, injectivity uses the term 𝗂𝗇𝗃𝖾𝖼𝗍𝗂𝗏𝗂𝗍𝗒′𝑐:(Φ:(𝑒:(⃗𝑢;𝑐⃗𝑠)≡Ξ;𝐷(⃗𝑢;𝑐⃗𝑡))→U𝑗)→((𝑞:⃗𝑠≡Δ𝑐⃗𝑡)→Φ(𝗇𝗈𝖢𝗈𝗇𝖿−1𝐷(⃗𝑢;𝑐⃗𝑠,⃗𝑢;𝑐⃗𝑡,𝑞)))→(𝑒:𝖨𝖽𝐷(⃗𝑢)(𝑐⃗𝑠,𝑐⃗𝑡))→Φ(―――𝗋𝖾𝖿𝗅⃗𝑢;𝑒). It applies 𝗇𝗈𝖢𝗈𝗇𝖿𝐷 and then the supplied method. Its reflexivity calculation uses 𝗇𝗈𝖢𝗈𝗇𝖿−1𝐷𝗇𝗈𝖢𝗈𝗇𝖿𝐷=𝗂𝖽, so it preserves the actual equality proof. The conflict transition and cycle transition both retain the proof parameter: 𝖼𝗈𝗇𝖿𝗅𝗂𝖼𝗍′ and 𝖼𝗒𝖼𝗅𝖾′ have targets (𝑒:⃗𝑎≡Ξ;𝐷⃗𝑏)→Φ(𝑒): the former eliminates 𝗇𝗈𝖢𝗈𝗇𝖿𝐷(𝑒):𝟎, and the latter eliminates 𝗇𝗈𝖢𝗒𝖼𝗅𝖾𝐷(⃗𝑎,⃗𝑏,𝑒) at the offending descendant. These are proof-dependent transition terms, not conversions of equalities to mere constraints.
A solution step, possibly after a dependency-preserving permutation of its telescope, is ――𝐽 with the solved variable generalized. Its reflexivity branch is 𝑚. There is no deletion step. Inductively a positive run therefore has telescopes Δ0=Δ,…,Δ𝑛=Δ′ and maps 𝜏𝑟:Δ𝑟→Δ𝑟−1 with 𝜎=𝜏1∘⋯∘𝜏𝑛. Only solution/permutation and 𝗂𝗇𝗃𝖾𝖼𝗍𝗂𝗏𝗂𝗍𝗒′ occur on such a run. Write (J) for the reflexivity equation of ――𝐽 and (N) for the no-confusion retraction of lemma 78.12. If 𝑠𝑟 is its 𝑟th internal transition term, then 𝑠(𝜎⃗𝑧,―――𝗋𝖾𝖿𝗅)=𝑠1(𝑠2(⋯𝑠𝑛(𝑚)⋯))(𝜏1(⋯𝜏𝑛⃗𝑧⋯),―――𝗋𝖾𝖿𝗅)(𝐽),(𝑁)⟶∗𝑠2(⋯𝑠𝑛(𝑚)⋯)(𝜏2(⋯𝜏𝑛⃗𝑧⋯),―――𝗋𝖾𝖿𝗅)(𝐽),(𝑁)⟶∗⋯(𝐽),(𝑁)⟶∗𝑚(⃗𝑧). This proves (78.4) without proof irrelevance. ◻
Suppose a valid node in context Θ splits 𝑥:𝐷(⃗𝑢) and has goal 𝑇. If every positive constructor branch has an eliminator-only term at its exact specialized type, then the node has an eliminator-only term of type 𝑇. On 𝑥≡𝑐𝑘⃗𝑦, it reduces to the 𝑘th branch specialized by that branch’s telescope map.
Proof of Lemma 78.17 — One case-tree split is eliminable
Proof. Use basic case analysis with the proof-dependent motive 𝑄(⃗𝑤,𝑧):=(⃗𝑡:Θ)→(⃗𝑢(⃗𝑡);𝑥(⃗𝑡))≡Ξ;𝐷(⃗𝑤;𝑧)→𝑇(⃗𝑡). The 𝑐𝑘 branch has target (⃗𝑡:Θ)→(⃗𝑢(⃗𝑡);𝑥(⃗𝑡))≡Ξ;𝐷(⃗𝑣𝑘(⃗𝑦);𝑐𝑘⃗𝑦)→𝑇(⃗𝑡). For a positive unifier this is the specializer target in lemma 78.16; insert the translated subtree as 𝑚. For a negative unifier, insert its empty eliminator. Apply the resulting 𝖼𝖺𝗌𝖾𝐷 term to (⃗𝑢;𝑥) and ―――𝗋𝖾𝖿𝗅(⃗𝑢;𝑥). On 𝑐𝑘⃗𝑦, the basic-case equation and then (78.4) contract to the specialized 𝑘th subtree. Replacing (78.7) by a motive that forgets the equality proof would silently assume proof irrelevance. ◻
Let C be a valid case tree for 𝑓:(⃗𝑡:Δ)→𝑇. The predicate 𝖢𝖳C(⃗𝑡,𝑢) holds if and only if there are a leaf 𝑓⃗𝑝𝑖=𝑒𝑖 of C and a well-typed substitution 𝜃 for its pattern variables such that the following three conditions hold.
⃗𝑡≡T𝗉𝖺𝗍→𝗍𝗆(⃗𝑝𝑖)[𝜃];
starting at the root, constructor selection and the positive restricted unifier at each split follow the unique path to that leaf;
𝑢 is the literal instance 𝑒𝑖[𝜃], with recursive occurrences of 𝑓 left unchanged.
This predicate defines root contraction only. Compatible closure, when needed, is the ordinary compatible closure of these contractions.
Work in intensional dependent type theory with homogeneous identity types but without K. If 𝑓:(⃗𝑡:Δ)→𝑇 is given by a valid case tree C obeying definition 78.9, there is an eliminator-only 𝑓′:(⃗𝑡:Δ)→𝑇. Write 𝑒[𝑓′/𝑓] for replacement of recursive occurrences. If 𝖢𝖳C(⃗𝑡,𝑢), then 𝑓′⃗𝑡≡𝑢[𝑓′/𝑓].
Proof of Theorem 78.19 — Elimination of valid dependent case trees
Proof. Let 𝑡𝑗:𝐷(⃗𝑣) be the designated structural argument. On a complete family argument ⃗𝑥 use the motive 𝑃(⃗𝑥):=(⃗𝑡:Δ)→⃗𝑥≡Ξ;𝐷(⃗𝑣(⃗𝑡);𝑡𝑗(⃗𝑡))→𝑇(⃗𝑡). Suppose for the moment that 𝑚:(⃗𝑡:Δ)→𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑣(⃗𝑡),𝑡𝑗(⃗𝑡))→𝑇(⃗𝑡). Its recursor step is the proof-dependent wrapper 𝑚𝑠(⃗𝑥,𝐻,⃗𝑡,𝑒):=――𝐽Ξ;𝐷(𝜆⃗𝑦.𝑒′.𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,⃗𝑦)→𝑇(⃗𝑡))(𝑚⃗𝑡,(⃗𝑣(⃗𝑡);𝑡𝑗(⃗𝑡)),⃗𝑥,――――𝗌𝗒𝗆Ξ;𝐷(𝑒),𝐻). Consequently 𝑚𝑠((⃗𝑣;𝑡𝑗),𝐻,⃗𝑡,―――𝗋𝖾𝖿𝗅)⟶∗𝑚⃗𝑡𝐻. Define 𝑓′(⃗𝑡):=𝗋𝖾𝖼𝐷(𝑃,𝑚𝑠,⃗𝑣(⃗𝑡),𝑡𝑗(⃗𝑡))(⃗𝑡,―――𝗋𝖾𝖿𝗅). Write (R) for the defining equation of 𝗋𝖾𝖼𝐷 and (J) for the reflexivity equation of ――𝐽. The head calculation is 𝑓′(⃗𝑡)(𝑅)⟶∗𝑚𝑠((⃗𝑣;𝑡𝑗),𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,⃗𝑣,𝑡𝑗),⃗𝑡,―――𝗋𝖾𝖿𝗅)(𝐽)⟶∗𝑚⃗𝑡𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,⃗𝑣,𝑡𝑗).
It remains to construct 𝑚, by induction on the case tree. At a node whose patterns have variables Θ and induce 𝜏:Θ→Δ, retain the strengthened target 𝑚𝜏:(⃗𝑧:Θ)→𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,(⃗𝑣;𝑡𝑗)(𝜏⃗𝑧))→𝑇(𝜏⃗𝑧). Suppose the node splits Θ=Θ1,(𝑦:𝐷′(⃗𝑣𝑦)),Θ2. For a constructor 𝑐:(⃗𝑠:Δ𝑐)→𝐷′(⃗𝑢𝑐), basic case analysis requires the method 𝑚𝑐:(⃗𝑠:Δ𝑐)→(⃗𝑧:Θ)→(⃗𝑢𝑐(⃗𝑠);𝑐⃗𝑠)≡Ξ;𝐷(⃗𝑣𝑦(⃗𝑧);𝑦(⃗𝑧))→𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,(⃗𝑣;𝑡𝑗)(𝜏⃗𝑧))→𝑇(𝜏⃗𝑧). This is the proof-dependent target to which the transition terms above apply. A negative unification run supplies it by 𝖼𝗈𝗇𝖿𝗅𝗂𝖼𝗍′ or 𝖼𝗒𝖼𝗅𝖾′. A positive run has a most general unifier (MGU) 𝜎:Θ′→Δ𝑐;Θ. Write 𝜎Θ:=𝗉𝗋Θ∘𝜎 for its projection to the original node variables. The subtree induction hypothesis is 𝑚′𝑐:(⃗𝑧′:Θ′)→𝖡𝖾𝗅𝗈𝗐𝐷(𝑃,(⃗𝑣;𝑡𝑗)(𝜏𝜎Θ⃗𝑧′))→𝑇(𝜏𝜎Θ⃗𝑧′). The specializer of lemma 78.16, instantiated with the remaining 𝖡𝖾𝗅𝗈𝗐𝐷 argument in its motive, turns 𝑚′𝑐 into (78.13).
The computation is not hidden in an MGU assertion. When the selected value is 𝑐⃗𝑠, the equations are satisfied, so the syntactic first-order MGU computes ⃗𝑧′:Θ′ with the literal substitution identity 𝜎⃗𝑧′≡(⃗𝑠;⃗𝑧1;𝑐⃗𝑠;⃗𝑧2), where (⃗𝑧1,𝑐⃗𝑠,⃗𝑧2) has the original valid telescope order. The factorization may permute independent declarations while finding ⃗𝑧′, but that permutation is reflected in the displayed literal identity and drops no dependent declaration. Write (B) for basic-case computation, (M) for this literal identity, and (S) for (78.4). Then 𝑚𝜏(⃗𝑧1;𝑐⃗𝑠;⃗𝑧2,𝐻)(𝐵)⟶∗𝑚𝑐(⃗𝑠,⃗𝑧1;𝑐⃗𝑠;⃗𝑧2,―――𝗋𝖾𝖿𝗅,𝐻)(𝑀)≡𝑚𝑐(𝜎⃗𝑧′,―――𝗋𝖾𝖿𝗅,𝐻)(𝑆)⟶∗𝑚′𝑐(⃗𝑧′,𝐻). The last reduction is (78.6). This is why the factorization must preserve the telescope dependencies, not merely pass an occurs check. An empty node has only negative methods and no subtree.
At a leaf with body 𝑒𝑖:𝑇𝜏, replace each structurally recursive call 𝑓⃗𝑟 by the projection supplied by 𝐻. If 𝑟𝑗 is the named proper recursive child, that projection has type 𝜋𝐻:(⃗𝑟:Δ)→(⃗𝑤;𝑟𝑗)≡Ξ;𝐷(⃗𝑣;𝑡𝑗)→𝑇(⃗𝑟). On the canonical below-package it calculates, using (R) and (J), 𝜋𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,⃗𝑣,𝑡𝑗)(⃗𝑟,―――𝗋𝖾𝖿𝗅)(𝑅)⟶∗𝑚𝑠((⃗𝑤;𝑟𝑗),𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,⃗𝑤,𝑟𝑗),⃗𝑟,―――𝗋𝖾𝖿𝗅)(𝐽)⟶∗𝑚⃗𝑟𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,⃗𝑤,𝑟𝑗)(78.10)≡𝑓′(⃗𝑟). Thus the translated leaf 𝑒′𝑖 is judgmentally equal to 𝑒𝑖[𝑓′/𝑓] when its 𝐻 argument is canonical.
For a source clause 𝑓⃗𝑝𝑖=𝑒𝑖, combine (78.11), the node calculations (78.15), and (78.16): Write (H) for (78.11), (N) for (78.15), and (L) for (78.16). Then 𝑓′(T𝗉𝖺𝗍→𝗍𝗆(⃗𝑝𝑖))(𝐻)⟶∗𝑚T𝗉𝖺𝗍→𝗍𝗆(⃗𝑝𝑖)(𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,T𝗉𝖺𝗍→𝗍𝗆(⃗𝑣;𝑝𝑖,𝑗)))(𝑁)⟶∗𝑒′𝑖[𝐻↦𝖻𝖾𝗅𝗈𝗐𝐷(𝑃,𝑚𝑠,T𝗉𝖺𝗍→𝗍𝗆(⃗𝑣;𝑝𝑖,𝑗))](𝐿)≡𝑒𝑖[𝑓′/𝑓]. By definition 78.18, every 𝖢𝖳C(⃗𝑡,𝑢) selects one such leaf and substitution. Substitution into the displayed calculation gives 𝑓′⃗𝑡≡𝑢[𝑓′/𝑓]. No transition deletes a reflexive equation, and every use of equality is through its proof-dependent motive, so K is absent. ◻
This is a source-bounded reconstruction of Cockx–Devriese–Piessens, Theorem 1 [CDP16]. It retains the theorem’s homogeneous telescopic equality, dependency-preserving unifier factorization, proof-dependent internal transitions, basic case analysis, and 𝖡𝖾𝗅𝗈𝗐𝐷 recursion; only notation is normalized to the book. The specialization proof has no deletion case, and its injectivity case begins with the index self-unifier.
Fix 𝑎:𝐴. The single clause 𝖩(𝑃,𝑝,.𝑎,𝗋𝖾𝖿𝗅)=𝑝 has input 𝑏:𝐴,𝑒:𝖨𝖽𝐴(𝑎,𝑏). Splitting on 𝑒 generates 𝑏=𝑎. Solution replaces 𝑏 by 𝑎 without deleting a reflexive equation. The translated term is based identity induction, and on 𝗋𝖾𝖿𝗅 both the case clause and the translated 𝐽 term reduce to 𝑝. If the input instead fixes 𝑒:𝖨𝖽𝐴(𝑎,𝑎), the generated problem is 𝑎=𝑎; restricted unification is stuck, so the K case tree is invalid.
The eliminator discipline scales beyond a family whose constructors merely fix an index. It does not license theorem transfer from one larger signature mechanism to another. This section freezes two bounded rule cards: inductive–recursive signatures, where a datatype and a decoding function are generated together, and induction–induction, where a type and a family over it are generated together. We calculate their rules and stop there.
Inductive–recursive and indexed inductive–recursive signatures. Fix 𝑂:U𝑗. The selected IR signature codes are generated by 𝜄(𝑜),𝜎(𝐴,𝑆),𝛿(𝐴,𝑆), where 𝑜:𝑂, 𝐴:U𝑖, 𝑆:𝐴→𝖲𝗂𝗀𝑖(𝑂) in the 𝜎 case, and 𝑆:(𝐴→𝑂)→𝖲𝗂𝗀𝑖(𝑂) in the 𝛿 case. Given 𝑅:U𝑖 and 𝑒:𝑅→𝑂, define the constructor fields 𝖤𝑆(𝑅,𝑒) and decoded output 𝖥𝑆 by 𝖤𝜄(𝑜)(𝑅,𝑒):=𝟏,𝖥𝜄(𝑜)(⋆):=𝑜,𝖤𝜎(𝐴,𝑆)(𝑅,𝑒):=∑𝑎:𝐴𝖤𝑆(𝑎)(𝑅,𝑒),𝖥𝜎(𝐴,𝑆)(𝑎,𝑥):=𝖥𝑆(𝑎)(𝑥),𝖤𝛿(𝐴,𝑆)(𝑅,𝑒):=∑𝑓:𝐴→𝑅𝖤𝑆(𝑒∘𝑓)(𝑅,𝑒),𝖥𝛿(𝐴,𝑆)(𝑓,𝑥):=𝖥𝑆(𝑒∘𝑓)(𝑥). The generated type and decoder have the rules 𝖨𝖱(𝑆):U𝑖,𝖤𝗅:𝖨𝖱(𝑆)→𝑂,𝗂𝗇𝗍𝗋𝗈:𝖤𝑆(𝖨𝖱(𝑆),𝖤𝗅)→𝖨𝖱(𝑆), with recursive decoding equation 𝖤𝗅(𝗂𝗇𝗍𝗋𝗈(𝑥))≡𝖥𝑆(𝑥). For 𝑃:𝖨𝖱(𝑆)→U𝑘, let 𝖨𝖧𝑆(𝑃,𝑥) contain one 𝑃(𝑓(𝑎)) for every recursive field 𝑓:𝐴→𝖨𝖱(𝑆) in a 𝛿 node and recurse through the residual signature. Then 𝖾𝗅𝗂𝗆𝖨𝖱:(𝑃:𝖨𝖱(𝑆)→U𝑘)→((𝑥:𝖤𝑆(𝖨𝖱(𝑆),𝖤𝗅))→𝖨𝖧𝑆(𝑃,𝑥)→𝑃(𝗂𝗇𝗍𝗋𝗈(𝑥)))→(𝑧:𝖨𝖱(𝑆))→𝑃(𝑧), and 𝖾𝗅𝗂𝗆𝖨𝖱(𝑃,𝑚,𝗂𝗇𝗍𝗋𝗈(𝑥))≡𝑚(𝑥,𝗆𝖺𝗉𝖨𝖧𝑆(𝖾𝗅𝗂𝗆𝖨𝖱(𝑃,𝑚),𝑥)). A 𝛿 field is genuinely recursive: its decoded function 𝖤𝗅∘𝑓 selects the continuation signature, and the method receives the recursively computed values for every 𝑓(𝑎).
For indexed IR, fix 𝐼:U𝑘 and 𝑂:𝐼→U𝑗. A 𝛿 code now also carries ix:𝐴→𝐼 and continuation 𝑆:((𝑎:𝐴)→𝑂(ix(𝑎)))→𝖲𝗂𝗀𝑖(𝐼,𝑂). The generated objects are 𝖨𝖨𝖱(𝑆):𝐼→Umax(𝑖,𝑘),𝖤𝗅:𝖨𝖨𝖱(𝑆)(𝑢)→𝑂(𝑢),𝗂𝗇𝗍𝗋𝗈:𝖤𝑆(𝖨𝖨𝖱(𝑆),𝖤𝗅,𝑢)→𝖨𝖨𝖱(𝑆)(𝑢), again with 𝖤𝗅(𝗂𝗇𝗍𝗋𝗈(𝑥))≡𝖥𝑆(𝑥). For the vector signature, the cons branch chooses 𝑛:ℕ, stores 𝑎:𝐴, takes one recursive field at index 𝑛, and returns index 𝗌𝗎𝖼(𝑛). Its derived constructor and recursive-decoding calculation are 𝖼𝗈𝗇𝗌:(𝑛:ℕ)→𝐴→𝖨𝖨𝖱(𝑆)(𝑛)→𝖨𝖨𝖱(𝑆)(𝗌𝗎𝖼(𝑛)),𝖤𝗅(𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑎𝑠))≡𝖥𝑆𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑎𝑠). The indexed eliminator has motives 𝑃:(𝑢:𝐼)→𝖨𝖨𝖱(𝑆)(𝑢)→U𝑙; its cons computation passes the induction hypothesis 𝑃(𝑛,𝑎𝑠) to the cons method. These are precisely the formation, introduction, recursive-decoding, elimination, and computation rules used here from Kovács’s signatures [Kov26]. His canonicity construction is not imported.
A context/type induction–induction card. The small simultaneous signature has 𝖢𝗈𝗇:U,𝖳𝗒:𝖢𝗈𝗇→U,𝜖:𝖢𝗈𝗇,𝖾𝗑𝗍:(Γ:𝖢𝗈𝗇)→𝖳𝗒(Γ)→𝖢𝗈𝗇,𝖴:(Γ:𝖢𝗈𝗇)→𝖳𝗒(Γ),𝖤𝗅:(Γ:𝖢𝗈𝗇)→𝖳𝗒(𝖾𝗑𝗍(Γ,𝖴(Γ))). Its dependent eliminator requires two motives, because the motive for types is indexed by the already computed context result: 𝐶:(Γ:𝖢𝗈𝗇)→U,𝑇:(Γ:𝖢𝗈𝗇)→𝐶(Γ)→𝖳𝗒(Γ)→U. The four methods are 𝑒:𝐶(𝜖),𝑥:(𝑐:𝐶(Γ))→𝑇(Γ,𝑐,𝐴)→𝐶(𝖾𝗑𝗍(Γ,𝐴)),𝑢:(𝑐:𝐶(Γ))→𝑇(Γ,𝑐,𝖴(Γ)),𝑞:(𝑐:𝐶(Γ))→𝑇(𝖾𝗑𝗍(Γ,𝖴(Γ)),𝑥(𝑐,𝑢(𝑐)),𝖤𝗅(Γ)). They produce simultaneous eliminators 𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ):𝐶(Γ),𝖾𝗅𝗂𝗆𝖳𝗒(𝐴):𝑇(Γ,𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ),𝐴), with computations 𝖾𝗅𝗂𝗆𝖢𝗈𝗇(𝜖)≡𝑒,𝖾𝗅𝗂𝗆𝖢𝗈𝗇(𝖾𝗑𝗍(Γ,𝐴))≡𝑥(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ),𝖾𝗅𝗂𝗆𝖳𝗒(𝐴)),𝖾𝗅𝗂𝗆𝖳𝗒(𝖴(Γ))≡𝑢(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ)),𝖾𝗅𝗂𝗆𝖳𝗒(𝖤𝗅(Γ))≡𝑞(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ)). The final equation is well typed because the 𝐶-result for the extended context computes by the preceding equation. This is the bounded context/type example of Lafont, Kaposi, and Kovács [KKL20]. We claim neither their reduction to ordinary induction nor initiality, extensional reduction, gluing, quotient, or path constructors.
★★☆ Expand one 𝛿 case in the IR eliminator. Show where 𝖤𝗅∘𝑓 selects the continuation signature, and calculate the induction-hypothesis component for one chosen 𝑎:𝐴.
★★☆ Run definition 78.9 on the two problems 𝑥=𝗌𝗎𝖼(𝑦) and 𝗌𝗎𝖼(𝑥)=𝗌𝗎𝖼(𝑥). Give the transition sequence for the first and identify the exact point at which the second fails. Explain why adding deletion would admit the second problem.
★★☆ Construct 𝗅𝖺𝗌𝗍:∏𝑛:ℕ𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛))→𝐴 from Vec-elim. State its value on a one-element vector and on a vector whose tail is nonempty, and justify both equations from Vec-comp.
★★☆ Give constructor clauses for 𝗅𝖺𝗌𝗍 from exercise 78.5. Build their valid case tree, including the dot pattern forced by the successor index, and apply theorem 78.19. Display the eliminator-only term and verify its one-element and nonempty-tail equations from definition 78.18. (Half a page.)
★★☆ Reconstruct the eliminator term for append from construction 78.7. Prove by vector elimination that appending 𝗏𝗇𝗂𝗅 on the right yields the input after the required transport. More precisely, first construct 𝑙𝑚:𝖨𝖽ℕ(𝟢+𝑚,𝑚) by natural-number induction, and then construct 𝗍𝗋𝑘.𝖵𝖾𝖼(𝐴,𝑘)𝑙𝑚(𝖺𝗉𝗉𝖾𝗇𝖽(𝑥𝑠,𝗏𝗇𝗂𝗅))=𝑥𝑠(𝑥𝑠:𝖵𝖾𝖼(𝐴,𝑚)). State why the equality is not judgmental for a neutral vector.
★★★Practical project.indexed-format-parser Implement in Kappa a format-indexed parser for fixed-width unsigned decimal fields. A format contains field widths as an indexed vector; a typed intermediate form pairs each parsed field with evidence that its digit count is the constructor-determined width. Maintain this index invariant through parsing and printing. On the format [2,1,3], the program must parse 𝟺𝟸𝟽𝟷𝟶𝟻 as [42,7,105] and print the same six-character string. It must reject 𝟺𝟸𝟽𝟷𝟻 before constructing the typed intermediate form, naming the final field’s expected width 3 and actual width 2. The acceptance test compares these exact success and rejection results.
Sources. The no-K case-tree criterion, its two restricted-unification conditions, and the eliminator translation follow Cockx, Devriese, and Piessens, Eliminating Dependent Pattern Matching without K, Theorem 1 and Section 3.1 [CDP16]. The chapter has restated the theorem at its case-tree signature and proved the identity-family witness locally; it has not assumed Agda’s K axiom or a completeness theorem for unrestricted dependent unification. The IR/IIR rule card is restricted to the signature, introduction, decoding, elimination, and computation rules on pp. 4–8 of Kovács [Kov26]; its canonicity theorem is outside this chapter. The context/type induction–induction card reproduces the signature and general eliminator calculation on pp. 2–3 of Lafont, Kaposi, and Kovács [KKL20]; their reduction and uniqueness results are likewise not transferred.