Exercise 34.1.
Put 𝗁𝖽𝗅(𝐿3,𝖺𝗌𝗄,11) between 𝖼𝖺𝗅𝗅(𝑓) and the outer frame. The complete prefix is then 𝗁𝖽𝗅(𝐿in,𝖺𝗌𝗄,9)::𝖼𝖺𝗅𝗅(𝑓)::𝗁𝖽𝗅(𝐿3,𝖺𝗌𝗄,11)::𝗁𝖽𝗅(𝐿out,𝖺𝗌𝗄,7). Name search still stops at the inner frame and returns 9. Identity search skips both intervening 𝖺𝗌𝗄 frames, selects 𝐿out, and returns 7. The compiler must preserve at least a datum that distinguishes the requested handler instance from every other live instance; in the displayed machine that datum is 𝐿out.
Exercise 34.2.
The first root changes the heap to 𝐻1 =𝐻[𝐿𝑘 ↦𝗇𝗌] while reinstalling 𝐾′ and binding the resumption result. A second attempt requires a premise of the form 𝐻1(𝐿𝑘) =𝖼𝗈𝗇𝗍(𝐾″). Instead 𝐻1(𝐿𝑘) =𝗇𝗌, so L-Resume is inapplicable and the untyped configuration is stuck.
Exercise 34.3.
Initially 𝗌𝗉=𝐿𝑛ℎ,𝐻(ℓexch)=𝐿𝑚𝑝. Raise loads 𝐿𝑚𝑝, writes 𝐿𝑛ℎ into the exchanger, and sets 𝗌𝗉 =𝐿𝑚𝑝. The fresh one-cell resumption contains ℓexch, not a copy of either stack. Resume replaces that cell by 𝗇𝗌, loads 𝐿𝑛ℎ through the exchanger, writes the current handler-stack top 𝐿𝑚𝑝 back, and sets 𝗌𝗉 =𝐿𝑛ℎ. A second resume reads 𝗇𝗌 where an exchanger location is required.
Exercise 34.4.
Terminating integer preservation and divergence preservation are conclusions: both are non-stuck behaviors, and positive simulation preserves them. Reflection of target stuckness is absent because the theorem is forward and excludes source stuckness. Source type safety is absent because Lexa is untyped. LLVM correctness is absent because Salt, not LLVM IR or native code, is the theorem’s target.
Exercise 34.5.
The two label-parameter cases calculate to 𝗁𝗈𝗉𝗉𝖾𝗋H(⟨̂0,𝐹⟩)=⟨̂3,𝐹⟩,𝗁𝗈𝗉𝗉𝖾𝗋H(⟨̂1,𝐺⟩)=⟨̂0,𝐺⟩. If the relevant capture set contains two labels named 𝐹, provenance by effect name has two candidates. The nonambiguity premise on a well-formed capture set rejects the metadata before the operational hopper is used.
Exercise 34.6.
No dynamic handler identity or search on mainline paths is the syntactic and layout property of proposition 34.12. Terminating SL-to-TL preservation is the semantic corollary of theorem 34.11. Reported speedups are empirical engineering evidence. A constant-factor theorem would additionally require a costed source and target semantics and a bound relating their costs; none of the three claims supplies that relation.
Exercise 34.7.
A deep resumption prepends the captured pure suffix 𝜃 to the pure component of the current generalised-continuation frame while retaining 𝐻 as its return and operation handler. A later occurrence of the same operation therefore reaches 𝐻 again. A shallow resumption restores the captured pure frames and the handler frames outside 𝐻, then continues with the caller’s continuation. It does not reinstall 𝐻, so a later occurrence is forwarded outward unless the program explicitly installs another handler.
The source operation roots have different reducts: the deep reduct wraps the resumption body with 𝐻, while the shallow reduct does not. The handling lemma and Theorem 7 consequently use separate 𝗋𝖾𝗌 and 𝗋𝖾𝗌† target cases. Simulation preserves both behaviors; it does not equate them.
Exercise 34.8.
For the higher-order row, for example, one must fix the source syntax and semantics, target syntax and semantics, the term/type translation, and the observation plus simulation relation. Deep and shallow resumptions reduce to different terms after an operation: one reinstalls the handler and the other does not. A simulation case proved for one reduct therefore cannot be reused for the other by changing only a label in the theorem statement.
Exercise 34.9.
Proceed by induction on the list. If the head has the requested identity, uniqueness of identities rules out the identity in the tail, so the prefix, selected frame, and suffix are forced. Otherwise the head belongs to the prefix and the induction hypothesis gives the unique tail factorization. With names, the list 𝗁𝖽𝗅(𝐿1,𝐹,𝑐1)::𝖼𝖺𝗅𝗅(𝑔)::𝗁𝖽𝗅(𝐿2,𝐹,𝑐2)::𝜖 has a factorization at either 𝐹-frame. Thus unrestricted factorization is nonunique, not nonexistent. A separately defined nearest-name lookup restores functional choice by selecting the first frame, but selects the wrong lexical instance when 𝐿2 was requested.
Exercise 34.10.
Induct on a terminating source derivation. The initial states are related; each source step contributes a nonempty target segment; concatenation reaches a target state related to the source final state; final-state agreement gives the integer. For divergence, let 𝐶0 ⟶𝐶1 ⟶⋯. Starting at the related 𝐷0, simulation successively supplies 𝐷𝑖 ⟶+𝐷𝑖+1 with 𝐶𝑖+1R𝐷𝑖+1. Concatenating infinitely many nonempty segments yields an infinite target run. If zero target steps were permitted, every 𝐷𝑖 could be the same state and no target divergence would follow. A stuck source supplies no source step, so the simulation premise supplies no target conclusion.
Exercise 34.11.
Take a capability instantiation containing ̂1 :𝐹,̂4 :𝐹. From ⟨˚0,𝐹⟩, an unconstrained lookup may return either ⟨̂1,𝐹⟩ or ⟨̂4,𝐹⟩. Require that labels in every relevant capture or instantiation set have pairwise distinct effect names. Then two matching labels imply equal positions, and the label-successor case is unique. If no matching label exists, the card’s at-most-one capability-variable condition makes the continuing capability clue unique. Hence the hopper is a partial function on well-formed metadata; it remains undefined when neither case applies.
Exercise 34.12.
For raises crossing ℎ1,…,ℎ𝑚 frames, zero Lexa wins in the chosen model exactly when 𝑛𝑧+𝑚∑𝑖=1𝑟𝑧(ℎ𝑖)<𝑛𝑑+𝑚𝑟𝑑. If all raises cross ℎ frames this becomes 𝑛(𝑑 −𝑧) >𝑚(𝑟𝑧(ℎ) −𝑟𝑑). The inequality only analyzes the stipulated charges. Benchmark timings do not define 𝑑,𝑧,𝑟𝑑,𝑟𝑧, quantify over all programs, or prove correspondence with reduction steps, so the calculation is not an imported cost theorem.