Source-linked AI summary
Expressive power of one-shot control operators and coroutines
Kentaro Kobayashi, Yukiyoshi Kameyama
TL;DR
The theoretical foundations of one-shot control operators remain less studied than those of multi-shot operators. This paper rigorously compares one-shot handlers and delimited continuations with asymmetric coroutines, finding that the former can be macro-expressed by coroutines, but not vice versa.
Problem
Theoretical foundations of one-shot control operators remain little studied despite interest in their efficiency and relevance to reasoning about sensitive resources.
Source: §1 · p. 1Method
The authors refine the translation to asymmetric coroutines by representing captured continuations with distinct reference cells and tracking their validity in stores.
Source: §3.4 · p. 14, §3.5 · p. 17Results
One-shot delimited-control operators and one-shot effect handlers can be macro-expressed by asymmetric coroutines, but the converse direction does not hold.
Source: §7 · p. 34Takeaways & Limitations
The converse failure is tied to macro-translation locality: effect handlers cannot macro-express global reference cells under this criterion.
Source: §5.1 · p. 32, §7 · p. 35The authors caution that macro-expressibility may be too strict and leave exploring relaxed translation locality, under which they conjecture EFFone could macro-express references and asymmetric coroutines, for future work.
Source: §7 · p. 35
Abstract
from arXiv · showhide
Control operators, such as exceptions and effect handlers, provide a means of representing computational effects in programs abstractly and modularly. While most theoretical studies have focused on multi-shot control operators, one-shot control operators---which restrict the use of captured continuations to at most once---are gaining attention for their balance between expressiveness and efficiency. This study aims to fill the gap. We present a mathematically rigorous comparison of the expressive power among one-shot control operators, including effect handlers, delimited continuations, and even asymmetric coroutines. Following previous studies on multi-shot control operators, we adopt Felleisen's macro-expressiveness as our measure of expressiveness. We verify the folklore that one-shot effect handlers and one-shot delimited-control operators can be macro-expressed by asymmetric coroutines, but not vice versa. We explain why a previous informal argument fails, and how to revise it to make a valid macro-translation. This is the extended version of a paper presented at APLAS 2025.
1 Introduction
The paper examines one-shot control operators, which limit captured continuations to at most one use, against a field that has mostly studied multi-shot operators.
1 Introduction
- The motivating landscape includes exceptions, coroutines, delimited control such as shift/reset, and effect handlers, which support modular abstraction of computational effects.Exceptions and coroutines are classic control operators implemented in many languages; delimited control has been extensively studied, while interest in effect handlers has grown over the last decade.Source: §1 · p. 1
- One-shot operators can avoid stack copying, reduce reasoning about sensitive resources, and connect continuation-based operators to classic operators in dynamic languages.The introduction names one-shot effect handlers in OCaml as a recent example.Source: §1 · p. 1
DRAFT PAPER UNDER REVIEW
The paper rigorously compares one-shot effect handlers, one-shot delimited-control operators, and asymmetric coroutines using macro-expressibility, showing that coroutines can express both operator forms but not vice versa.
Motivation
- Because one-shotness is dynamic, formal calculi must track continuation validity, making semantics and precise reasoning more complex than folklore suggested.An earlier correspondence between one-shot delimited control and coroutines relied heavily on mutable state storing higher-order functions.Source: DRAFT PAPER UNDER REVIEW · p. 2
Translation problem
- The paper explains why a seemingly correct translation from delimited-control operators to coroutines fails to preserve semantics.It notes that prior one-shot expressiveness results were sometimes unproved or incorrect, including an example.Source: DRAFT PAPER UNDER REVIEW · p. 2
Scope and measure
- The paper systematically compares one-shot effect handlers, one-shot delimited-control operators, and coroutines using macro-expressibility, a measure used in prior control-operator work.The authors describe this as the first systematic rigorous analysis of one-shot control-operator expressiveness.Source: DRAFT PAPER UNDER REVIEW · p. 2
Contributions
- One-shot delimited-control operators and effect handlers are each macro-expressible by asymmetric coroutines, but coroutines cannot be macro-expressed by either operator form.These results complete the comparison among the three facilities studied.Source: DRAFT PAPER UNDER REVIEW · p. 2
Extended version
- The extended version adds key definitions and proof cases, a simpler correct translation from one-shot delimited control to coroutines, and a new inexpressibility result.The new result completes the comparison among the calculi introduced in the paper.Source: DRAFT PAPER UNDER REVIEW · p. 3
2 Core calculus and macro-expressibility
MAM provides a common framework for studying computational effects, while Felleisen’s macro-expressibility offers a finer comparison than computability for extensions of a Turing-complete language. The section defines the translation and evaluation conditions used to compare such extensions.
2.1 Core calculus MAM
- MAM is a call-by-push-value-based core calculus that subsumes call-by-value and call-by-name strategies and serves as the paper’s common foundation.Source: §2.1 · p. 3
- MAM separates values, including thunks that suspend computations, from computations that consume data and return values.Source: §2.1 · p. 3
- MAM’s evaluation is deterministic, and its partial evaluation function is defined exactly when a program terminates successfully.Evaluation contexts locate redexes; pure contexts identify portions without immediate computational effects, and extensions add frames for their control abstractions.Source: §2.1 · pp. 4–5
2.2 Macro-expressibility
- Macro-expressibility, proposed by Felleisen, provides a finer basis than computability for comparing extensions of Turing-complete languages such as MAM.Source: §2.2 · p. 5
- A strong macro-translation maps source programs to target programs, preserves MAM constructors homomorphically, and translates added constructors using target-language syntactic abstractions.Source: §2.2 · p. 5
- Strong macro-expressibility requires EvalL1(M) to be defined iff EvalL2(φ(M)) is defined; weak macro-translation requires EvalL1(M) to be defined only if EvalL2(φ(M)) is defined.Source: §2.2 · p. 5
3 One-shot delimited continuations as asymmetric coroutines
This section develops a refined macro-translation of one-shot delimited continuations into asymmetric coroutines after a simple translation fails. It proves the translation correct through a simulation tracking stores and computations, establishing step simulation, semantic preservation, and strong macro-expressibility.
3.4 Refined translation from DELone to AC
- The refined translation is a correct DELone-to-AC macro-translation, using distinct reference cells to preserve each continuation’s one-way validity while sharing a coroutine.Each cell records whether its continuation is valid; invoking one copy invalidates all copies, and the evaluation example then reaches the expected error state.Source: §3 · p. 6, §3.4 · p. 14, yield · p. 16
3.1 The calculus for one-shot delimited continuations
- DELone models one-shot shift0/dollar continuations, detecting repeated invocation dynamically with a store that marks consumed continuations invalid.A label remains valid until invocation, after which its store entry becomes nil.Source: §3.1 · pp. 6–7
3.2 The calculus for asymmetric coroutines
- Asymmetric coroutines suspend and resume computations, and AC represents them with labeled computations plus create, resume, and yield operations.Coroutines are inherently one-shot in the sense that they cannot be duplicated or reused, although they may be suspended and resumed multiple times.Source: §3.2 · pp. 8–9
3.3 Naïve translation and its failure
- The naïve translation maps dollar to create, shift0 to yield, and throw to resume, but it does not preserve semantics.A continuation already consumed in DELone can be invoked again successfully in AC because the corresponding coroutine has been suspended and resumed.Source: §3.3 · pp. 10–11, yield · p. 13
yield
- The naïve translation fails because DELone creates a fresh continuation label at each shift0, while the translation reuses a coroutine label whose validity alternates across suspension and resumption.The refined translation addresses these gaps with separate cells for successive captures and never restores a cell’s valid status after invocation.Source: §3.4 · pp. 13–14
3.5 Simulation relation
- The proof of the refined translation’s correctness uses a simulation relation between transition systems.Source: §3.5 · p. 16
- The simulation relation must track stores as well as computations because continuation validity is recorded in reference cells, not in the coroutines that realize continuations.Label maps connect source continuation labels to reference cells and coroutine labels; invariants ensure that only one continuation sharing a coroutine is valid, and administrative target reductions are accommodated through canonical representatives.Source: §3.5 · pp. 17, 19
3.6 Correctness of the refined translation
- Theorem 3.11 shows that each DELone reduction step from related configurations is simulated by an AC reduction sequence to a related configuration.The proof builds this result from simulation of beta-reduction and its lift to general reduction.Source: §3.6 · pp. 19, 21
- Theorem 3.12 establishes preservation of semantics between DELone and AC programs.The proof uses the simulation theorem to transfer defined evaluations, and handles undefined evaluations by divergence, error, or stuckness.Source: §3.6 · p. 22
- Theorem 3.13 establishes that the refined translation from DELone to AC is a strong macro-translation.The translation is homomorphic on shared constructors and maps DELone-specific constructors to fixed syntactic abstractions; semantic preservation follows from Theorem 3.12.Source: §3.6 · p. 23
4 One-shot effect handlers as asymmetric coroutines
The section establishes that one-shot effect handlers are macro-expressible in asymmetric coroutines via one-shot delimited-control operators. It also gives a translation in the reverse direction when shift0 is among the available operations.
4.1 The calculus for one-shot effect handlers
- EFFone represents operations with handlers and continuation labels, while a store enforces that captured continuations are invoked at most once.Handlers have a return clause and operation clauses; continuation labels represent one-shot continuations.Source: §4.1 · pp. 23–24
4.2 Macro-translation from EFFone to DELone
- The translation uses two successive shift0 operations so EFFone continuation labels become genuine DELone continuation labels rather than thunks.The thunk-based alternative fails strong macro-translation: forcing a captured continuation can get stuck in EFFone while its translation evaluates.Source: §4.2 · p. 25
- The simulation relates EFFone and DELone stores as well as computations, accounting for which target continuations represent each source continuation.The label map associates each EFFone continuation label with a pair of DELone labels.Source: §4.2 · p. 25
- The translation preserves definedness of evaluation for every EFFone program, establishing the semantic basis for the macro-expressibility result.The proof covers divergence, getting stuck, and reaching the error state.Source: §4.2 · p. 28
- EFFone is macro-expressible in asymmetric coroutines by transitivity through DELone.The section first establishes macro-expressibility from EFFone to DELone, then combines it with the result that DELone is macro-expressible in AC.Source: §4 · p. 23, §4.2 · pp. 28–29
4.3 Macro-translation from DELone to EFFone
- When shift0 is included in the operation set O, the paper gives a macro-translation from DELone to EFFone.The translation adapts Forster et al.’s translation for multi-shot shift0/dollar.Source: §4.3 · p. 29
5 One-shot effect handlers cannot macro-express asymmetric coroutines
Reference cells witness the expressiveness gap: asymmetric coroutines can macro-express them, but one-shot effect handlers and delimited-control operators cannot macro-express asymmetric coroutines. The reverse direction also fails: reference-cell programs cannot macro-express one-shot delimited control.
5.1 Non-macro-expressibility of REF in terms of DELone
- REF can distinguish successive reference-cell values, whereas DELone reductions cannot replace a valid entry’s contents; macro-expressibility also bars translations from adding a global handler.In the witness program, the first get returns injA () and the second returns injB ().Source: §5.1 · pp. 30–32
- REF is strongly macro-expressible in AC, but cannot weakly macro-express DELone; by composition, neither DELone nor EFFone can weakly macro-express AC.The REF-to-DELone separation also extends to multi-shot delimited-control and effect handlers, supporting the conjecture that effect handlers alone cannot implement reference cells [16].Source: §5.1 · pp. 30–32
5.2 Non-macro-expressibility of DELone in terms of REF
- There is no weak macro-translation from DELone to REF, and consequently none from EFFone or AC to REF.REF cannot escape a let frame during evaluation, and REF contexts cannot distinguish thunks containing different computations, unlike DELone contexts.Source: §5.2 · pp. 32–33
6 Related work
Earlier expressiveness comparisons largely concerned multi-shot operators, while this paper systematically compares one-shot operators. Related work also situates one-shot control in programming-language implementations and in type-theoretic and semantic analyses.
Related work
- Earlier work used macro-expressiveness to compare continuations, exceptions, delimited-control operators, effect handlers, and monads [11].The studies found untyped effect handlers, monads, and delimited control equi-expressive; in typed settings, typed monads macro-express typed delimited control but not typed effect handlers, while polymorphic handlers and delimited control are equivalent [11].Source: §6 · p. 33
- This paper is the first systematic comparison of one-shot control operators, unlike earlier mutable-state coroutine work and James and Sabry’s informal yield claim.The paper studies extensions of a base calculus without mutable state; global effects such as reference cells distinguish coroutines from delimited-control operators because local translations into DELone cannot add a dollar enclosing the whole program (Section 5.1).Source: §6 · p. 33
- One-shot continuations were introduced as a more efficient but less expressive alternative to multi-shot continuations, and are now used in OCaml and WasmFX [29] [23].OCaml and WasmFX enforce one-shotness dynamically by raising a runtime error or aborting on a second invocation; this paper models that discipline directly and formally accounts for what one-shot abstractions can macro-express.Source: §6 · p. 34
- Other work studies one-shot usage through affine typing and linear CPS semantics, contrasting with this paper’s dynamically enforced one-shotness in an untyped setting.Affect statically tracks coexisting one-shot and multi-shot continuations; linear CPS work identifies linear continuation use, and Hasegawa proves full completeness for the relevant monadic transforms.Source: §6 · p. 34
7 Conclusion
The study finds that asymmetric coroutines macro-express one-shot delimited-control operators and effect handlers, but the converse does not hold. It also identifies proof gaps and open questions about relaxing macro-expressibility and extending the results to typed settings.
7 Conclusion
- One-shot delimited-control operators and one-shot effect handlers are macro-expressible by asymmetric coroutines, but the converse direction does not hold.The study summarizes these two findings in Figure 16.Source: §7 · p. 34
- The forward result, previously considered trivial, required reference cells simulated by coroutines to manage continuation validity and repair a gap in the literature.The authors emphasize that establishing this connection requires rigorous analysis.Source: §7 · p. 35
- The reverse separation relies on effect handlers’ inability to macro-express reference cells: the authors prove Kammar and Pretnar’s conjecture in this setting using translation locality [16].Kammar and Pretnar had established that effect handlers can macro-express dynamically scoped state [16].Source: §7 · p. 35
- The authors conjecture that relaxing translation locality could let EFFone macro-express REF and AC, for example by inserting a fixed root context as in Shan’s comparison.They leave exploration of this relaxation for future work.Source: §7 · p. 35
- Whether Figure 16’s relationships persist under typing remains open; linear or affine types could enforce one-shotness statically, and typed settings can change untyped relationships [30].The paper’s calculi instead detect one-shotness violations dynamically.Source: §7 · p. 35
- Designing type systems for one-shot operators is another open direction, including for general asymmetric coroutines; deriving such systems from the paper’s macro-translations remains uninvestigated.Prior work includes linearly used continuations and a coroutine type system derived through translation to shift/reset with reference cells.Source: §7 · p. 35
A Supplementary proofs for Section 3 … A.1.3 Simulation relation
The supplementary proofs establish preservation of DELone and AC well-formedness, define invariants connecting their stores, and introduce a simulation relation between their configurations. The simulation setup accounts for active coroutines and uses canonicalized target representatives.
A.1.1 Well-formedness
- DELone well-formedness tracks continuation labels against the store and is preserved by every DELone reduction.Source: §A.1.1 · p. 37
- AC well-formedness requires a well-formed term, label-free stored values, and nil store entries for active labels; it is preserved by reduction.Source: §A.1.1 · p. 39
A.1.2 Invariants
- Runtime translation maps each source label to a reference cell and coroutine label; coherence requires matching store and map domains and an injective reference-cell projection.Source: §A.1.2 · p. 40
- The invariants map invalid source continuations to invalid reference cells and valid continuations to valid cells containing realizing coroutine labels, with at most one corresponding source continuation valid.Source: §A.1.2 · pp. 40–41
A.1.3 Simulation relation
- The core relation pairs computations and contexts, but is defined on configurations because the active target coroutine requires complementary source and target store conditions.Source: §A.1.3 · pp. 41–42
- The proof excludes a structural clause for the core relation and instead canonicalizes target configurations, reasoning over representatives to simplify the proof.Source: §A.1.3 · p. 42
- The simulation relation covers paired bottom configurations or configurations satisfying well-formedness, store-map coherence, invariants, and the core relation.Source: §A.1.3 · p. 42
A.2 Proof · A.2.1 Lemmas · A.2.2 Canonicalization
The appendix establishes structural lemmas for the DELone-to-AC translation and uses canonicalization to derive an initial simulation result for every DELone program.
A.2.1 Lemmas
- For pure DELone contexts, the lemma characterizes the relation to an AC context as equivalent to the label map relating that context to the DELone context.The stated equivalence is η∼c ⟨D; τ⟩ iff D ≡H η.Source: §A.2.1 · p. 43
- The core-relation proof handles hole cases directly and extends let, application, and projection frames using their corresponding relation clauses.The let case applies the let clause; the application and projection cases follow identically using their respective clauses.Source: §A.2.1 · p. 43
- A context-decomposition proof proceeds by induction on the source context and reconstructs a target evaluation context and computation across let, application, projection, and dollar frames.The hole case takes the target context to be a hole and the target computation to be the given program.Source: §A.2.1 · p. 44
- The value-shape lemma shows that translated unit, pair, injection, thunk, and label forms arise from corresponding source constructors, with source continuation labels mapping to target labels.Its proof uses syntax case analysis and notes that translation is homomorphic on ordinary constructors.Source: §A.2.1 · pp. 44–45
- The yield-context lemma restricts a pure-context target containing yield to a corresponding source continuation form; its proof rules out incompatible constructors and handles let, application, and projection cases by induction.The dollar clause is impossible because its target contains an active labeled computation rather than a pure context plugged with yield.Source: §A.2.1 · p. 45
A.2.2 Canonicalization
- The canonicalization proof proceeds by induction on computations, translating structural cases directly and rebuilding let, application, and projection constructors from induction hypotheses.The statement also requires the relevant configuration, label-map, coherence, and invariant conditions.Source: §A.2.2 · p. 45
- For the dollar-frame case, the proof introduces a fresh coroutine label mapped to nil and verifies the dollar clause’s side conditions using well-formedness and freshness.Active labels contain nil during reduction, while freshness makes the condition involving labels mapped to the new label vacuous.Source: §A.2.2 · p. 46
- Every DELone program satisfies the stated initial-simulation corollary, obtained by applying Proposition A.24 to the empty configuration and label map.The proof notes that the empty configuration is well-formed and the empty label map satisfies the required conditions.Source: §A.2.2 · p. 46
A.2.3 Simulation · A.2.4 Non-termination preservation
These parts establish preservation properties for the translation by relating DELone and AC configurations across source steps. They also analyze stuck and irreducible configurations to show how a stuck source configuration relates to a target that can reduce to a stuck configuration.
A.2.3 Simulation
- Pure-frame cases rebuild the relation by induction; dollar-frame cases preserve side conditions because throw and shift update a coroutine distinct from the outer one.The proof also inherits Coh and Inv from the induction hypothesis when rebuilding the outer dollar frame.Source: §A.2.3 · pp. 50, 52
- Each DELone step from related configurations is matched by an AC configuration that remains related.This is the forward-simulation result of Theorem A.28.Source: §A.2.3 · p. 53
A.2.4 Non-termination preservation
- Head-shape matching pairs target returns, abstractions, lazy pairs, or yielded computations in pure contexts with corresponding DELone forms.The abstraction and lazy-pair conditions are analogues of the return and yield conditions.Source: §A.2.4 · p. 54
- For runtime-translation cases, the proof keeps the store unchanged and uses the translated computation itself except for throw, which may take administrative steps.Constructor-only translations are irreducible, and a yield outside an active label is also irreducible on the target.Source: §A.2.4 · p. 55
- If a source configuration is stuck, its related AC configuration reduces in finitely many steps to a stuck configuration.The proof uses Lemma A.30 to obtain an irreducible related target; condition (H1) rules out a return computation, so the target is stuck.Source: §A.2.4 · p. 57
- Whenever C∼D and C is stuck, there is an AC configuration D′ reached from D that is stuck.The corollary follows by applying Proposition A.31 to the AC configuration supplied by the definition of ∼.Source: §A.2.4 · p. 57
- Each source step induces at least one target step.This simulation property follows from Corollary A.25 and repeated use of Theorem A.28.Source: §A.2.4 · p. 58
A.2.5 Strong macro-expressibility … B.1.1 Well-formedness
This appendix section develops formal correctness properties for translations among the control operators, including strong macro-expressibility and preservation of well-formedness and semantics. It also identifies three cases in which EvalEFFone(M) is undefined.
A.2.5 Strong macro-expressibility
- DELone translates strongly to AC: the translation is homomorphic on shared constructors, abstracts DELone-specific constructors, and preserves semantics.The semantic-preservation theorem states that source and target evaluations are defined under the same conditions.Source: §A.2.5 · pp. 58–59
B.1.1 Well-formedness
- EFFone well-formedness is preserved by every reduction step, maintaining the condition that continuation labels used by a configuration are defined in its store.Operation steps add a fresh label and store entry; other cases preserve the condition through existing labels or reduce to the error state.Source: §B.1.1 · p. 60
- The EFFone-to-DELone correctness proof uses label maps, coherence and store invariants to relate translated configurations, and simulates each EFFone step with target steps.A label map pairs each EFFone continuation label with two DELone labels; the simulation relation also requires well-formedness and matching translated computations and stores.Source: §B.1.1 · pp. 60, 61, 63
B.1 From EFFone to DELone
- EFFone and DELone preserve definedness in both directions, with divergence, stuck configurations, and error states addressed in the translation’s correctness proof.The appendix separately establishes transfer results for divergence, getting stuck, and reaching the error state.Source: §B.1.1 · pp. 63–65
B.1.1 Well-formedness
- EvalEFFone(M) is undefined when evaluation of M(1) diverges, gets stuck, or reaches ⊥.The passage begins to state an implication for EvalDELone from Lemmas B.13–B.15, but the claim is truncated.Source: §B.1.1 · p. 65
B.2 From DELone to EFFone
The section defines a relation between DELone and EFFone configurations using a macro-translation and corresponding store and label invariants. It proves that DELone steps are simulated by EFFone steps and uses this to establish preservation of evaluation behavior.
B.2 From DELone to EFFone
- The configuration relation pairs a DELone computation with its translated EFFone computation and requires corresponding stores and continuation-label invariants.The invariants ensure translated store domains cover DELone labels and that nil continuations correspond.Source: §B.2 · pp. 65–66
- Every related DELone step is simulated by one or more EFFone steps, yielding a related successor configuration.The proposition supplies an EFFone successor whenever a related DELone configuration takes a step.Source: §B.2 · p. 67
- The translation preserves divergence and stuckness: divergent DELone evaluations imply divergent EFFone evaluations, and stuck DELone configurations translate to stuck EFFone configurations.The stuckness result assumes a well-formed DELone configuration and the invariant conditions.Source: §B.2 · p. 68
- The preservation-of-semantics corollary states that DELone evaluation is defined exactly when evaluation of its EFFone translation is defined.The proof considers undefined DELone evaluation due to divergence, getting stuck, or reaching ⊥.Source: §B.2 · p. 69
C Supplementary proofs for Section 5.1 · C.1 Proof of Theorem 5.1 · C.1.1 Lemmas
The supplement supplies proofs for Theorems 5.1 and 5.3, developing lemmas on reachability, label-renamed reductions, and preserved frames. Its reachability argument shows that invalidating a continuation label cannot add reachable labels.
C Supplementary proofs for Section 5.1
- The cited section gives a proof of Theorem 5.1 and a proof of Theorem 5.3, identifying these two theorem proofs as work presented in that section.Source: C Supplementary proofs for Section 5.1 · p. 69
C.1.1 Lemmas
- Reach(E, θ) is the smallest subset of the store domain containing labels in E that is closed over labels in the stored continuations it reaches.The closure rule adds labels occurring in a non-nil continuation stored under an already reachable label.Source: §C.1.1 · p. 69
C.1 Proof of Theorem 5.1
- Invalidating a continuation label preserves the property that every label reachable from M remains within S.The proof establishes Reach(M, θ′) ⊆ Reach(M, θ₀) ⊆ S after the throw rule invalidates a label.Source: §C.1.1 · p. 70
C.1.1 Lemmas
- The finite-permutation lemma constructs a reduction with labels renamed by a permutation that fixes S, while preserving the store correspondence for relevant live labels.Its induction tracks the renamed computation and finite sets of labels as the reduction proceeds.Source: §C.1.1 · pp. 70–72
- The reduction-simulation proof handles fresh labels by extending the renaming and handles throws by invalidating the corresponding renamed store entry.The (MAM) and (ret) cases preserve the computation shape; the fail case is impossible.Source: §C.1.1 · pp. 71–72
- A let-frame containing no dollar frame confines shift redexes to M and remains until M returns a value.The frame can be consumed only by rule (F).Source: §C.1.1 · p. 72
C.1.2 Proof of Theorem 5.1 … case
The proofs establish that REF has no weak macro-translation to DELone, while a REF-to-AC translation preserves whether evaluation is defined. The latter argument pairs reference cells with coroutine labels and uses an invariant-preserving simulation.
C.1.2 Proof of Theorem 5.1
- There is no weak macro-translation from REF to DELone, although the distinguishing REF program evaluates to a defined result.The proof uses the defined REF evaluation and derives the impossibility of such a translation.Source: §C.1.2 · pp. 72–73
C.2 Proof of Theorem 5.3
- The REF-to-AC translation extends M ↦ M with a partial map η from reference cells to coroutine labels.The proof relates configurations through a relation requiring the translated terms to agree under η.Source: §C.2 · p. 73
- The listed invariant conditions include N ≡ Mη, injectivity of η, and η(Dom(θ)) ⊆ Dom(τ); a fourth condition begins with a premise about θ(l) = V.Source: §C.2 · p. 73
- Lemma C.10 establishes a substitution property for translated REF computations with free variables, values, and a label map.Source: §C.2 · p. 74
create
- In the create case, allocating a fresh REF cell extends η with a fresh coroutine label while preserving the invariant conditions.The proof notes that the created value does not contain the fresh label.Source: create · p. 74, §C.2 · p. 74
case
- Proposition C.14 shows that each REF reduction step can be simulated by one or more AC steps, with the relation and invariant preserved.Source: case · p. 76
- If REF evaluation diverges or gets stuck, AC evaluation likewise diverges or gets stuck.The divergence argument iterates the simulation; the stuck-case argument relies on well-formedness and the invariant.Source: case · p. 76
- EvalREF(M) is defined if and only if EvalAC(⟦M⟧) is defined.The proof handles the converse by showing that divergence or getting stuck in REF also leaves the translated AC evaluation undefined.Source: case · p. 77
D Supplementary proofs for Section 5.2
The supplementary proof establishes contextual equivalence for thunk-wrapped computations in REF and uses it to prove that DELone has no weak macro-translation into REF. Its key supporting argument is that forcing the relevant thunk cannot lead to successful termination.
D Supplementary proofs for Section 5.2
- If a REF configuration diverges, placing its computation in any REF evaluation context preserves divergence.Divergence denotes an infinite maximal reduction sequence.Source: D Supplementary proofs for Section 5.2 · p. 77
- In REF, evaluating E[let _ = M in Ω] cannot terminate successfully: it either diverges or gets stuck in a configuration of the same form.The proof uses that Ω diverges and that REF evaluation is deterministic.Source: D Supplementary proofs for Section 5.2 · pp. 78–79
- For any REF computations M and N, {L[M]} and {L[N]} are observationally equivalent in every context that expects a value.A lock-step simulation shows that they can differ only when forced, and forcing leads to evaluation that cannot terminate successfully.Source: D Supplementary proofs for Section 5.2 · pp. 78–79
- Theorem 5.5 rules out a weak macro-translation from DELone to REF by deriving inequivalent translated thunk terms, contradicting Proposition D.4.The proof obtains distinct variant results for the two terms, making them observationally inequivalent.Source: D Supplementary proofs for Section 5.2 · pp. 81–82