Exercise 81.1.
The unique shape is ⋆ :𝟏 and the contents function 𝑓 :𝖥𝗂𝗇(2) →𝑋 is 𝑓(0) =𝑎 and 𝑓(1) =𝑏. Hence the element is ( ⋆,[𝑎,𝑏]). Container action leaves the shape fixed: 𝖼𝗆𝖺𝗉𝐶𝖡𝗂𝗇(ℎ,(⋆,[𝑎,𝑏]))=(⋆,[ℎ(𝑎),ℎ(𝑏)]). This is one binary-node layer: its contents label two recursive positions. A complete tree arises only after taking an appropriate fixed point of the layer operator.
Exercise 81.2.
Let 𝑚𝑆(𝑛) =𝑛 −1 and 𝑚𝑃(𝑛,𝑖) =𝗌𝗎𝖼(𝑖). If 𝑖 :𝖥𝗂𝗇(𝑛 −1), then 𝗌𝗎𝖼(𝑖) :𝖥𝗂𝗇(𝑛). At shape 0 the target has shape 0 and no positions. At shape 3, ⟨𝑚⟩𝑋((3,[𝑥0,𝑥1,𝑥2]))=(2,[𝑥1,𝑥2]). A nonempty target at source shape 0 would require a function from some inhabited target-position type to 𝖥𝗂𝗇(0), which is impossible.
Exercise 81.3.
Represent 𝐹 by the sum of the zero-position unit container and the one-position container with shape 𝐴; represent 𝐺 by one shape with two positions. Composition gives 𝐹 ∘𝐺 either zero positions or two positions indexed by a chosen 𝑎 :𝐴. Product gives 𝐺 ∘𝐹 a pair of 𝐹-shapes and therefore 0, 1, or 2 positions. In particular the shape (𝗇𝗂𝗅𝖲𝗁𝖺𝗉𝖾,𝖼𝗈𝗇𝗌𝖲𝗁𝖺𝗉𝖾(𝑎)) of 𝐺 ∘𝐹 has one position, whereas no shape of 𝐹 ∘𝐺 does. Thus the two polynomial operators are not identified by reassociation.
Exercise 81.4.
Set 𝑗𝑆(𝑗)𝑃(𝑗,−)0𝟏𝟎𝗌𝗎𝖼(𝑘)𝐴𝟏𝑛(𝗌𝗎𝖼(𝑘),𝑎,⋆)=𝑘. For 𝑢 =(𝑎,ℎ) in the successor fiber, its unique recursive child is ℎ( ⋆) :𝑋(𝑘). Replacing the last equation by 𝑛(𝗌𝗎𝖼(𝑘),𝑎, ⋆) =𝗌𝗎𝖼(𝑘) makes the child have type 𝑋(𝗌𝗎𝖼(𝑘)). The recursive index no longer descends from the result index, so the layer no longer describes the vector constructor.
Exercise 81.5.
The derivative is 𝜕(𝐴+𝑋×𝑋)=0+(1×𝑋+𝑋×1)≃𝑋+𝑋. For 𝖿𝗈𝗋𝗄(𝑙,𝑟) the left-hole context stores 𝗂𝗇𝗅(𝑟) and plugs 𝑥 as 𝖿𝗈𝗋𝗄(𝑥,𝑟); the right-hole context stores 𝗂𝗇𝗋(𝑙) and plugs 𝑥 as 𝖿𝗈𝗋𝗄(𝑙,𝑥). These are the two summands of the product rule, each storing the sibling belonging to the undifferentiated factor.
Exercise 81.6.
The result has type 𝖵𝖾𝖼(𝐴,𝑚 +𝑛). Induct on 𝑥𝑠. At 𝗏𝗇𝗂𝗅 both sides compute to 𝖿𝗈𝗋𝗀𝖾𝗍(𝑦𝑠). At 𝗏𝖼𝗈𝗇𝗌(𝑎,𝑧𝑠), both sides expose the head 𝑎 and the induction hypothesis identifies their tails: 𝖿𝗈𝗋𝗀𝖾𝗍(𝗏𝖺𝗉𝗉𝖾𝗇𝖽(𝗏𝖼𝗈𝗇𝗌(𝑎,𝑧𝑠),𝑦𝑠))≡𝑎::𝖿𝗈𝗋𝗀𝖾𝗍(𝗏𝖺𝗉𝗉𝖾𝗇𝖽(𝑧𝑠,𝑦𝑠))𝐼𝐻=𝑎::𝖺𝗉𝗉𝖾𝗇𝖽(𝖿𝗈𝗋𝗀𝖾𝗍(𝑧𝑠),𝖿𝗈𝗋𝗀𝖾𝗍(𝑦𝑠)). The forgetful map erases the result index 𝑚 +𝑛 while retaining the list spine.
Exercise 81.7.
A binary-node layer has two recursive positions. A leaf layer has none. A forgetful morphism from the alleged refinement back to the binary layer would need a position map from each of those two target positions to a position of the leaf source. Its codomain is empty, so no such function exists. For a family map that distinguishes the missing right child, the induced map to the pullback is not surjective and hence is not an equivalence. Thus the proposal violates the cartesian clause of definition 81.16; selecting only the left child does not repair the missing right position.
Exercise 81.8.
Induct on the relation witness. At 0 the input list is nil, list map is nil, and R𝐵(0,𝗇𝗂𝗅) is immediate. At a successor, write 𝑥𝑠 =𝖼𝗈𝗇𝗌(𝑎,𝑧𝑠). The induction hypothesis gives R𝐵(𝑛,𝗆𝖺𝗉𝖫𝗂𝗌𝗍(𝑓,𝑧𝑠)); the successor/cons clause yields R𝐵(𝗌𝗎𝖼(𝑛),𝖼𝗈𝗇𝗌(𝑓(𝑎),𝗆𝖺𝗉𝖫𝗂𝗌𝗍(𝑓,𝑧𝑠))). The ML type is (’a -> ’b) -> ’a list -> ’b list. It does not state that the output length equals the input length; that fact remains the displayed logical relation.
Exercise 81.9.
Reverse has shape component 𝑛 ↦𝑛 and position component 𝑟𝑛(𝑖) =𝑛 −1 −𝑖. Its self-composite has shape component the identity and position component 𝑖⟼𝑟𝑛(𝑟𝑛(𝑖))=𝑛−1−(𝑛−1−𝑖)=𝑖(𝑖:𝖥𝗂𝗇(𝑛)). Hence for every (𝑛,𝑓) its extension is (𝑛,𝜆𝑖.𝑓(𝑖)), pointwise equal to (𝑛,𝑓).
Exercise 81.10.
Write 𝐿 =1 +𝐴 ×𝑋 and 𝑅 =1 +𝐵 ×𝑋. The product rule gives 𝜕(𝐿×𝑅)≃(𝐴×𝑅)+(𝐿×𝐵). An element 𝗂𝗇𝗅(𝑎,𝑟) is a hole in the 𝐿 recursive position and plugs 𝑥 as (𝗂𝗇𝗋(𝑎,𝑥),𝑟). An element 𝗂𝗇𝗋(𝑙,𝑏) is a hole in the 𝑅 recursive position and plugs 𝑥 as (𝑙,𝗂𝗇𝗋(𝑏,𝑥)). For example, 𝗂𝗇𝗅(𝑎,𝗂𝗇𝗅 ⋆) and 𝗂𝗇𝗋(𝗂𝗇𝗋(𝑎,𝑥0),𝑏) inhabit the two summands.
Exercise 81.11.
Take 𝐴 =𝟏. Finite lists form the initial algebra of 𝐹(𝑋) =1 +𝟏 ×𝑋. The type containing one finite list for each natural length together with one infinite stream is also closed under the same one-step equation: the extra element is sent to the successor branch with itself as tail. Thus a bare fixed-point equivalence does not choose between them. Initiality distinguishes finite lists by the unique algebra morphism out; finality distinguishes the possibly infinite solution by the unique coalgebra morphism in.