Exercise 78.1.
Induct on 𝑥𝑠. The empty branch has 𝑘 :𝖥𝗂𝗇ind(𝟢) and closes by empty elimination. In a successor branch 𝑥𝑠 =𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑎𝑠), eliminate 𝑘. For 𝑘 =𝖿𝗓(𝑛), both sides compute to 𝑓(𝑎), so use reflexivity. For 𝑘 =𝖿𝗌(𝑛,𝑙), the calculation is 𝗅𝗈𝗈𝗄𝗎𝗉(𝗆𝖺𝗉(𝑓,𝗏𝖼𝗈𝗇𝗌(𝑛,𝑎,𝑎𝑠)),𝖿𝗌(𝑛,𝑙))≡𝗅𝗈𝗈𝗄𝗎𝗉(𝗆𝖺𝗉(𝑓,𝑎𝑠),𝑙)=𝑓(𝗅𝗈𝗈𝗄𝗎𝗉(𝑎𝑠,𝑙)). The first step is the two constructor computations; the second is the propositional induction hypothesis at 𝑙. It is not a judgmental map–lookup equation for a neutral tail.
Exercise 78.2.
At a 𝛿(𝐴,𝑆) node the constructor field is a pair (𝑓,𝑥) with 𝑓 :𝐴 →𝖨𝖱(𝑆0) and 𝑥 :𝖤𝑆(𝖤𝗅∘𝑓)(𝖨𝖱(𝑆0),𝖤𝗅). Thus the continuation is selected by the decoded recursive field 𝖤𝗅 ∘𝑓, not by 𝑓 alone. The 𝛿 clause of 𝗆𝖺𝗉𝖨𝖧 is 𝗆𝖺𝗉𝖨𝖧𝛿(𝐴,𝑆)(𝑔,(𝑓,𝑥))=((𝜆𝑎.𝑔(𝑓(𝑎))),𝗆𝖺𝗉𝖨𝖧𝑆(𝖤𝗅∘𝑓)(𝑔,𝑥)). At a chosen 𝑎 :𝐴 its first component computes to 𝑔(𝑓(𝑎)); for 𝑔 =𝖾𝗅𝗂𝗆𝖨𝖱(𝑃,𝑚) this has type 𝑃(𝑓(𝑎)), exactly the recursive hypothesis consumed by the method.
Exercise 78.3.
The method has type 𝑞:(𝑐:𝐶(Γ))→𝑇(𝖾𝗑𝗍(Γ,𝖴(Γ)),𝑥(𝑐,𝑢(𝑐)),𝖤𝗅(Γ)). Instantiate 𝑐 with 𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ). The target demanded by 𝖾𝗅𝗂𝗆𝖳𝗒(𝖤𝗅(Γ)) has context-result index 𝖾𝗅𝗂𝗆𝖢𝗈𝗇(𝖾𝗑𝗍(Γ,𝖴(Γ))). The preceding computation rule rewrites this judgmentally to 𝑥(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ),𝖾𝗅𝗂𝗆𝖳𝗒(𝖴(Γ))), and the 𝖴 computation rewrites the second argument to 𝑢(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ)). The resulting classifier is precisely the displayed type of 𝑞(𝖾𝗅𝗂𝗆𝖢𝗈𝗇(Γ)).
Exercise 78.4.
The solution transition applies to 𝑥 =𝗌𝗎𝖼(𝑦) because 𝑥 ∉FV(𝗌𝗎𝖼(𝑦)); it records [𝗌𝗎𝖼(𝑦)/𝑥] and leaves the empty equation list. For 𝗌𝗎𝖼(𝑥) =𝗌𝗎𝖼(𝑥), constructor injectivity first passes the vacuous index self-unification check for ℕ and produces 𝑥 =𝑥. No solution transition applies because its occurs side condition fails, and deletion is absent, so the problem is stuck. Adding deletion would remove 𝑥 =𝑥 and report a positive solution, which is the forbidden step.
Exercise 78.5.
Put 𝐿(𝑛):=𝖵𝖾𝖼(𝐴,𝗌𝗎𝖼(𝑛)) →𝐴. Natural-number induction defines 𝗅𝖺𝗌𝗍0(𝑦𝑠):=𝗁𝖾𝖺𝖽(𝑦𝑠),𝗅𝖺𝗌𝗍𝗌𝗎𝖼(𝑛)(𝑦𝑠):=𝗅𝖺𝗌𝗍𝑛(𝗍𝖺𝗂𝗅(𝑦𝑠)). The operations head and tail are the Vec-elim terms of construction 78.2, so this construction uses no pattern principle. Their computation rules give 𝗅𝖺𝗌𝗍0(𝗏𝖼𝗈𝗇𝗌(𝟢,𝑎,𝗏𝗇𝗂𝗅))≡𝑎,𝗅𝖺𝗌𝗍𝗌𝗎𝖼(𝑛)(𝗏𝖼𝗈𝗇𝗌(𝗌𝗎𝖼(𝑛),𝑎,𝑥𝑠))≡𝗅𝖺𝗌𝗍𝑛(𝑥𝑠). The first equation uses head computation; the second uses tail computation before the induction equation.
Exercise 78.6.
The constructor clauses are 𝗅𝖺𝗌𝗍𝟢(𝗏𝖼𝗈𝗇𝗌(𝟢,𝑎,𝗏𝗇𝗂𝗅))=𝑎,𝗅𝖺𝗌𝗍𝗌𝗎𝖼(𝑛)(𝗏𝖼𝗈𝗇𝗌(𝗌𝗎𝖼(𝑛),𝑎,𝗏𝖼𝗈𝗇𝗌(𝑛,𝑏,𝑥𝑠)))=𝗅𝖺𝗌𝗍𝑛(𝗏𝖼𝗈𝗇𝗌(𝑛,𝑏,𝑥𝑠)). The case tree first splits the vector at index 𝗌𝗎𝖼(𝑛). Its only root is 𝗏𝖼𝗈𝗇𝗌(.𝑛,𝑎,𝑦𝑠), where the dot records the index equation forced by the scrutinee. It then splits 𝑛. At zero, 𝑦𝑠 can only be 𝗏𝗇𝗂𝗅; at successor, its only root is 𝗏𝖼𝗈𝗇𝗌(.𝑛,𝑏,𝑥𝑠). Neither split deletes a reflexive equation. The tree therefore satisfies definition 78.9.
The translation of theorem 78.19 is the eliminator-only definition 𝗅𝖺𝗌𝗍𝟢(𝑦𝑠):=𝗁𝖾𝖺𝖽(𝑦𝑠),𝗅𝖺𝗌𝗍𝗌𝗎𝖼(𝑛)(𝑦𝑠):=𝗅𝖺𝗌𝗍𝑛(𝗍𝖺𝗂𝗅(𝑦𝑠)), where 𝗁𝖾𝖺𝖽 and 𝗍𝖺𝗂𝗅 are the Vec-elim terms of construction 78.2. On the first leaf, head computation gives 𝑎. On the second, tail computation exposes the successor vector. The natural-number computation rule then gives the displayed recursive call. These are exactly the two leaf calculations of definition 78.18.
Exercise 78.7.
With 𝑦𝑠 :𝖵𝖾𝖼(𝐴,𝑛) fixed, use motive 𝑃(𝑚,𝑥𝑠):=𝖵𝖾𝖼(𝐴,𝑛 +𝑚), branch 𝑦𝑠, and successor branch 𝑚.𝑎.𝑥𝑠.𝑞.𝗏𝖼𝗈𝗇𝗌(𝑛 +𝑚,𝑎,𝑞). This is the eliminator term for append; addition recurses on its second argument, so both constructor branches have the displayed types judgmentally.
For right identity, first prove 𝑙𝑚 :𝟢 +𝑚 =𝑚 by natural-number induction, with 𝑙𝟢:=𝗋𝖾𝖿𝗅 and 𝑙𝗌𝗎𝖼(𝑚):=𝖺𝗉(𝗌𝗎𝖼,𝑙𝑚). Vector elimination on 𝑥𝑠 proves 𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍𝑘.𝖵𝖾𝖼(𝐴,𝑘)(𝑙𝑚,𝖺𝗉𝗉𝖾𝗇𝖽(𝑥𝑠,𝗏𝗇𝗂𝗅))=𝑥𝑠. The empty case is reflexivity. The successor branch uses the transport lemma 𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍𝑘.𝖵𝖾𝖼(𝐴,𝑘)(𝖺𝗉(𝗌𝗎𝖼,𝑟),𝗏𝖼𝗈𝗇𝗌(𝑝,𝑎,𝑞))=𝗏𝖼𝗈𝗇𝗌(𝑝′,𝑎,𝗍𝗋𝖺𝗇𝗌𝗉𝗈𝗋𝗍𝑘.𝖵𝖾𝖼(𝐴,𝑘)(𝑟,𝑞)), for 𝑟 :𝑝 =𝑝′, proved by identity induction on 𝑟. Congruence of 𝗏𝖼𝗈𝗇𝗌 with the vector induction hypothesis closes that branch. For a neutral 𝑥𝑠, the eliminator does not contract, so 𝖺𝗉𝗉𝖾𝗇𝖽(𝑥𝑠,𝗏𝗇𝗂𝗅) ≡𝑥𝑠 is not judgmental.