Exercise 125.1.
Writing 𝑧 :𝖮𝗋𝖻𝗂𝗍(𝑞,𝑎), the frontiers and leaf types are 𝑧:𝖮𝗋𝖻𝗂𝗍(𝑞,𝑎)⊢𝗇𝖾𝗑𝗍(𝑧):𝐴,𝑢1=𝑞(𝑎):𝐴. Put Γ2:=𝑧 :𝖮𝗋𝖻𝗂𝗍(𝑞,𝑎), 𝗇𝖾𝗑𝗍(𝑧) =𝑞(𝑎). Then Γ2⊢𝗌𝗍𝖾𝗉(𝑧):𝖨𝖽𝐴(𝑞(𝑎),𝑞(𝑎)),𝑢2=𝗋𝖾𝖿𝗅𝑞(𝑎). For the final field the frontier and leaf are Γ3:=Γ2,𝗌𝗍𝖾𝗉(𝑧) =𝗋𝖾𝖿𝗅𝑞(𝑎), with Γ3⊢𝗍𝖺𝗂𝗅(𝑧):𝖮𝗋𝖻𝗂𝗍(𝑞,𝑞(𝑎)),𝑢3=𝗂𝗍𝖾𝗋𝖺𝗍𝖾(𝑞,𝑞(𝑎)). The tail leaf applies the state substitution [𝑞(𝑎)/𝑎] to the record index. The step leaf instead substitutes the stored next term for the earlier projection in its identity type.
Exercise 125.2.
Here 𝑁 ={2}. The first method has 𝐴∗1[] =𝟐. The recursive-field clause gives 𝐴∗2[ℎ1] =𝑆, actual output 𝑣2 =ℎ2 𝑠 :𝑆, and ¯𝑣2 =𝖼𝗈𝗋𝖾𝖼𝑅 (ℎ2 𝑠) :𝑅. Substitution of that decoded field into the third declaration gives 𝐴∗3[ℎ1,ℎ2]=𝖨𝖽𝟐(𝗅𝖺𝖻𝖾𝗅(𝖼𝗈𝗋𝖾𝖼𝑅(ℎ2𝑠)),𝗍𝗍). If the state ℎ2 𝑠 replaces ¯𝑣2, the required application judgment is ℎ2 𝑠 :𝑆 ⊢𝗅𝖺𝖻𝖾𝗅(ℎ2 𝑠) :𝟐, but the earlier generated projection has type 𝗅𝖺𝖻𝖾𝗅 :𝑅 →𝟐 and requires ℎ2 𝑠 :𝑅. Since the corecursor card assumes no conversion 𝑆 ≡𝑅, that judgment is not derivable.
Exercise 125.3.
The Tcop-tree is the coprojection spine 𝗇𝖾𝗑𝗍, 𝗌𝗍𝖾𝗉, 𝗍𝖺𝗂𝗅, with the three frontiers displayed in the preceding solution and leaves 𝑞(𝑎), 𝗋𝖾𝖿𝗅𝑞(𝑎), and 𝗂𝗍𝖾𝗋𝖺𝗍𝖾(𝑞,𝑞(𝑎)). Translation generates the indexed family and tagged constructor 𝖲𝗍𝖺𝗍𝖾G:(𝑏:𝐴)→U𝑖,𝗂𝗇𝗂𝗍𝖾𝗋𝖺𝗍𝖾:(𝑏:𝐴)→𝖲𝗍𝖺𝗍𝖾G(𝑏), where 𝑖 =𝗅𝖾𝗏(𝑏 :𝐴) is the maximum prescribed by the generated state-block rule. The sequential methods are ℎ1(𝑎,𝑠)=𝑞(𝑎),ℎ2(𝑎,𝑠)=𝗋𝖾𝖿𝗅𝑞(𝑎),ℎ3(𝑎,𝑠)=𝗂𝗇𝗂𝗍𝖾𝗋𝖺𝗍𝖾(𝑞(𝑎)). After ℎ1 has checked, the second codomain is 𝖨𝖽𝐴(ℎ1(𝑎,𝑠),𝑞(𝑎))≡𝖨𝖽𝐴(𝑞(𝑎),𝑞(𝑎)) by ordinary reduction of the previously checked method term. Thus ℎ2 checks before the corecursor and its coprojection equations are committed. The third method checks at 𝖲𝗍𝖺𝗍𝖾G(𝑞(𝑎)). The source leaf 𝗂𝗍𝖾𝗋𝖺𝗍𝖾(𝑞,𝑞(𝑎)) is recovered as 𝖼𝗈𝗋𝖾𝖼(𝑞(𝑎))𝗂𝗇𝗂𝗍𝖾𝗋𝖺𝗍𝖾(𝑞(𝑎)). The recursive field carries only the tagged state at the moved index, never a record. The empty declaration fiber contributes no extra constructor argument; the generated index 𝑏 :𝐴 remains explicit.
Two tail observations change the index from 𝑎 to 𝑞(𝑎) and then to 𝑞(𝑞(𝑎)). The final next observation returns 𝑞(𝑞(𝑞(𝑎))); for successor at zero this is three.
Exercise 125.4.
With 𝗌𝗍𝖾𝗉 declared first, its result type still contains 𝗇𝖾𝗑𝗍(𝑧), but the record telescope has not introduced the projection 𝗇𝖾𝗑𝗍. That occurrence is the first ill-scoped term. The dependency graph has the edge 𝗇𝖾𝗑𝗍 →𝗌𝗍𝖾𝗉. Every dependency-preserving field order is a topological order of this graph, so next must precede step. Consequently no such permutation can put step first.