exercise 49.1.
Let the representation of 𝑝 have root ℓ𝑝 and child locations ℓ𝑥,ℓ𝑦. Before copying, acc(𝜋,ℓ𝑝)={ℓ𝑝,ℓ𝑥,ℓ𝑦}. The recursive copy chooses fresh ℓ𝑞,ℓ′𝑥,ℓ′𝑦, copies the two scalars, and produces acc(𝜋′,ℓ𝑞)={ℓ𝑞,ℓ′𝑥,ℓ′𝑦},acc(𝜋′,ℓ𝑝)∩acc(𝜋′,ℓ𝑞)=∅. Assignment to 𝑞.𝑥 changes only 𝜋′(ℓ′𝑥), so 𝜋′(ℓ𝑥) =𝜋(ℓ𝑥) and 𝑝.𝑥 is unchanged. A shallow copy that reused ℓ𝑥 would put ℓ𝑥 in both accessible sets, contradicting their disjointness.
exercise 49.2.
The book check accepts (&𝑝.𝑥,&𝑝.𝑦) at its first distinct fields, rejects (&𝑝,&𝑝.𝑥) when the first path ends, and accepts (&𝑎[0],&𝑎[1]) at the distinct constant indices. It rejects (&𝑎[𝑖].𝑥,&𝑎[𝑖].𝑦) as soon as it meets the unknown index. Under the published relation, &𝑝 ⪯&𝑝.𝑥 follows by reflexivity and right-field extension. The pairs (&𝑝.𝑥,&𝑝.𝑦) and (&𝑎[0],&𝑎[1]) are unrelated. The published relation also fails to relate the final nested pair: its unknown-index rule relates the array paths, but it has no left congruence for extending both sides. Thus the book and source checks differ on the final pair.
exercise 49.3.
Suppose 𝜂1(𝑜) =ℓ𝑜, the 𝑝-field of 𝜋(ℓ𝑜) is ℓ𝑝, and the 𝑥-field of 𝜋(ℓ𝑝) is ℓ𝑥. The lvalue trace begins with 𝜂1(𝑜)=ℓ𝑜𝜋(ℓ𝑜)=𝗏𝖺𝗋𝑣𝑜𝑜⟶𝗅𝗏ℓ𝗏𝖺𝗋𝑜PSS−Name. Rule PSS-Struct lifts that step under 𝑝, after which 𝜋(ℓ𝑜)=𝗏𝖺𝗋[…,ℓ𝑝,…]𝑠Δ(𝑠)(𝑝)=𝗏𝖺𝗋𝑠𝑝ℓ𝗏𝖺𝗋𝑜.𝑝⟶𝗅𝗏ℓ𝗏𝖺𝗋𝑝PSS−Prop selects the first child. A second congruence step and PSS-Prop, using Δ(𝑠𝑝)(𝑥) =𝗏𝖺𝗋 ℤ, select ℓ𝗏𝖺𝗋𝑥. Both qualifier meets are min(𝗏𝖺𝗋,𝗏𝖺𝗋) =𝗏𝖺𝗋, so the displayed T-Inout derives the argument judgment. If 𝑜.𝑞.𝑥 follows a distinct first-field child ℓ𝑞, the book comparison has an apart witness at 𝑝 ≠𝑞. Tree independence makes the subtrees rooted at ℓ𝑝 and ℓ𝑞 disjoint; their selected 𝑥-locations are therefore disjoint as well.
exercise 49.4.
Let the ordinary array value have root ℓ𝑎. Copying it creates a fresh root ℓ′𝑎 and fresh descendants; the callee’s ordinary parameter maps to ℓ′𝑎. Let the two access arguments resolve to ℓ1,ℓ2. Their callee parameters map directly to those existing locations. By the exercise hypothesis, 𝜂𝜆 is already well formed. The copied set is disjoint from its roots and all caller roots by proposition 49.3; the borrowed sets are disjoint by lemma 49.6. Mutual freshness covers further ordinary parameters. The complete callee frame is well formed. Its 𝗉𝗈𝗉 drops ℓ′𝑎 and its descendants, but neither borrowed location.
exercise 49.5.
If 𝑎 :[ℤ], then 𝑎[3] is well typed even when the runtime array has length two. Its evaluation reaches a designated out-of-bounds runtime error, one instance of the progress theorem’s error alternative. An overlapping access call is different: the conservative call premise fails, so the program has no typing derivation and is not deferred to runtime.
exercise 49.6.
The premise is a finite small-step execution, from the initial state, of an expression also expressible in the natural semantics. The conclusion is a natural-semantics evaluation whose value equals the pointer-store value after readback. Copy-on-write needs a forward simulation showing that sharing and the uniqueness check preserve the abstract independent-copy result. LLVM lowering needs a typed source-to-IR simulation that relates source steps, allocation, and observable results to IR execution. The source’s semantic correspondence proves neither obligation.