Prerequisites. Direct starred prerequisites: none. No later core chapter depends on this route.
Put 𝑅=(𝜆𝑢.𝑢)𝑎,𝐷=(𝜆𝑥.𝑓𝑥𝑥)𝑅. One call-by-name step copies the unreduced term 𝑅. Call by value first reduces 𝑅 to the value 𝑎, then substitutes. Call by need instead retains one binding for 𝑅 and lets both uses of 𝑥 refer to it. If the calculus records neither suspension nor sharing, the three descriptions have the same ordinary beta normal form and the operational distinction has disappeared.
Linear syntax records it. A term under (!) may be copied; an unboxed term must be used once. The call-by-name translation boxes every argument, the call-by-value translation boxes only values, and the call-by-need translation adds global weakening without adding global contraction. The last change is affinity, not a slogan about lazy evaluation.
One source grammar, two beta disciplines
Fix base types 𝑍. The common type and term grammar is 𝐴,𝐵::=𝑍∣𝐴→𝐵. 𝑀,𝑁::=𝑥∣𝜆𝑥.𝑀∣𝑀𝑁,𝑉::=𝑥∣𝜆𝑥.𝑀. Contexts are finite maps and admit weakening, contraction, and exchange. The typing rules are the simply typed rules for variables, abstraction, and application. Capture-avoiding substitution is written 𝑀[𝑥 :=𝑁].
The call-by-name calculus 𝗇𝖺𝗆𝖾 is the compatible closure of (𝜆𝑥.𝑀)𝑁⟼𝑀[𝑥:=𝑁]. The call-by-value calculus 𝗏𝖺𝗅 is the compatible closure of (𝜆𝑥.𝑀)𝑉⟼𝑀[𝑥:=𝑉]. Write ⟼∗ and ⟼∗ for their reflexive transitive closures. These are the paper’s equational reduction relations, not deterministic evaluation-context machines.
Referenced from 4 locations
The final sentence matters. Compatible closure may reduce under a lambda or inside either side of an application. Calling the second rule “call by value” describes its beta restriction; it does not select a unique next redex. Deterministic machines require a separate context grammar.
On the opening term, name beta gives 𝐷⟼𝑓𝑅𝑅, whereas value beta cannot contract the outer redex until 𝑅 has become a value. The example exhibits duplication, but not an exact cost theorem: compatible reduction can still choose different redex orders.
★☆☆ Give one 𝗇𝖺𝗆𝖾 trace and one 𝗏𝖺𝗅 trace from 𝐷 to 𝑓 𝑎 𝑎. Mark the step at which the two copies of the argument first appear.
Referenced from 4 locations
The linear target makes suspension explicit
The target calculus 𝗅𝗂𝗇 has 𝐴,𝐵::=𝑍∣!𝐴∣𝐴⊸𝐵 and 𝐿,𝑀,𝑁::=𝑥∣!𝑀∣𝗅𝖾𝗍 !𝑥=𝑀 𝗂𝗇 𝑁∣𝜆𝑥.𝑀∣𝑀𝑁. An assumption 𝑥 :𝐴 is linear. An exponential assumption !𝑥 :!𝐴 may be weakened or contracted. Linear abstraction consumes exactly one 𝑥 :𝐴; application splits the context. Promotion derives !𝑀 :!𝐴 only when every assumption is already exponential. Exponential elimination binds the duplicable assumption !𝑥 :!𝐴. The complete sheet is in subappendix A.51.
Reduction in 𝗅𝗂𝗇 is the compatible closure of (𝜆𝑥.𝑀)𝑁⟼𝗅𝗂𝗇𝑀[𝑥:=𝑁]𝐿𝑖𝑛−𝐵𝑒𝑡𝑎,𝗅𝖾𝗍 !𝑥=!𝑀 𝗂𝗇 𝑁⟼𝗅𝗂𝗇𝑁[𝑥:=𝑀]𝐿𝑖𝑛−𝐵𝑎𝑛𝑔. (𝗅𝖾𝗍 !𝑥=𝐿 𝗂𝗇 𝑀)𝑁⟼𝗅𝗂𝗇𝗅𝖾𝗍 !𝑥=𝐿 𝗂𝗇 (𝑀𝑁)𝐿𝑖𝑛−𝐴𝑝𝑝. 𝗅𝖾𝗍 !𝑦=(𝗅𝖾𝗍 !𝑥=𝐿 𝗂𝗇 𝑀) 𝗂𝗇 𝑁⟼𝗅𝗂𝗇𝗅𝖾𝗍 !𝑥=𝐿 𝗂𝗇 (𝗅𝖾𝗍 !𝑦=𝑀 𝗂𝗇 𝑁)𝐿𝑖𝑛−𝐴𝑠𝑠𝑜𝑐. Bound variables are renamed so that the commuting rules do not capture free variables.
Referenced from 4 locations
The first two rules remove an introduction followed by its elimination. The last two are administrative: they expose a redex without claiming that a source beta step occurred. Completeness below would be false if these administrative steps were silently quotiented away or added on the source side without a corresponding source rule.
If Γ,𝑥 :𝐴 ⊢𝑀 :𝐵 and Δ ⊢𝑁 :𝐴, with disjoint linear domains, then Γ,Δ ⊢𝑀[𝑥 :=𝑁] :𝐵. If the substituted variable is exponential, the substituted promoted term has only exponential free assumptions.
Referenced from 3 locations
Proof of Lemma 37.3 — Target substitution
Proof. Induct on the typing derivation of 𝑀. The variable case either returns the derivation of 𝑁 or rebuilds the unrelated variable. Abstraction renames its binder before applying the induction hypothesis. Application uses the unique premise whose split contains 𝑥; the other premise is unchanged. For exponential elimination, apply the induction hypothesis in the premise containing 𝑥 and rebuild the let. Promotion cannot contain a linear 𝑥; in the exponential case its premise contains only exponential assumptions, so copying the promoted substitution preserves the promotion side condition. Weakening and contraction are rebuilt on exponential assumptions only. ◻
The calculus 𝗅𝗂𝗇 preserves typing under one reduction.
Referenced from 4 locations
Proof of Theorem 37.4 — Subject reduction for the linear target
Proof. For Lin-Beta and Lin-Bang, invert the typing of the redex and apply lemma 37.3. For Lin-App, the application split and the exponential-elimination split reassociate the same pairwise-disjoint contexts. Rule Lin-Assoc uses the associativity of those splits and alpha-renaming of the inner binder. Compatible positions follow by induction on the surrounding term. ◻
Call by name: box every argument
Define the translation ( −)𝗇 by 𝑍𝗇=𝑍,(𝐴→𝐵)𝗇=!𝐴𝗇⊸𝐵𝗇, 𝑥𝗇=𝑥,(𝜆𝑥.𝑀)𝗇=𝜆𝑦.𝗅𝖾𝗍 !𝑥=𝑦 𝗂𝗇 𝑀𝗇,(𝑀𝑁)𝗇=𝑀𝗇!𝑁𝗇,(𝑥1:𝐴1,…,𝑥𝑘:𝐴𝑘)𝗇=!𝑥1:!𝐴𝗇1,…,!𝑥𝑘:!𝐴𝗇𝑘, where 𝑦 is fresh. The exclamation before each argument is the operational choice: the function may discard or duplicate the suspended computation.
For source terms and typing derivations, (𝑀[𝑥:=𝑁])𝗇≡𝑀𝗇[𝑥:=𝑁𝗇],Γ⊢𝑀:𝐴⟺Γ𝗇⊢𝑀𝗇:𝐴𝗇.
Referenced from 4 locations
Proof of Lemma 37.5 — Name substitution and typing
Proof. The substitution equality is structural induction on 𝑀, choosing the fresh binder in the abstraction clause away from both substitutions. For typing, induct forward on the source derivation. Source weakening and contraction become the target rules for exponential assumptions; application uses promotion on the translated argument. In the reverse direction, invert the syntax-directed last rule forced by each translated term shape. In particular, a translated application contains exactly one promoted argument, and a translated abstraction contains exactly the displayed exponential let; their inversions recover the source application and abstraction rules. ◻
For source terms 𝑀,𝑁, 𝑀⟼∗𝑁⟺𝑀𝗇⟼∗𝗅𝗂𝗇𝑁𝗇.
Referenced from 5 locations
Proof of Theorem 37.6 — Exact call-by-name translation
Proof. For preservation, a source beta step translates as 𝐾:=𝜆𝑦.𝗅𝖾𝗍 !𝑥=𝑦 𝗂𝗇 𝑀𝗇. Then 𝐾!𝑁𝗇⟶Lin−Beta𝗅𝖾𝗍 !𝑥=!𝑁𝗇 𝗂𝗇 𝑀𝗇⟶Lin−Bang𝑀𝗇[𝑥:=𝑁𝗇], which is (𝑀[𝑥 :=𝑁])𝗇 by lemma 37.5. Compatible contexts translate compositionally, and induction handles a sequence.
For reflection, consider the target terms reachable from a translation: 𝑆,𝑇::=𝑥∣𝜆𝑦.𝗅𝖾𝗍 !𝑥=𝑦 𝗂𝗇 𝑆∣𝑆!𝑇∣𝗅𝖾𝗍 !𝑥=!𝑆 𝗂𝗇 𝑇. Define erasure 𝑆♭ by the inverse clauses for variables, abstractions, and applications, and by (𝗅𝖾𝗍 !𝑥=!𝑆 𝗂𝗇 𝑇)♭=𝑇♭[𝑥:=𝑆♭]. Induction gives (𝑀𝗇)♭ =𝑀. A case analysis on the four target rules shows 𝑆 ⟼𝗅𝗂𝗇𝑇 implies 𝑆♭ ⟼∗𝑇♭: the two administrative rules erase to rearrangements of the same substitution, while the principal pair erases to beta. Apply this fact along the target sequence and then the right-inverse equation. ◻
★★☆ Translate (𝜆𝑥.𝑓 𝑥 𝑥) 𝑅. Display the Lin-Beta and Lin-Bang steps and locate the only box that licenses both uses of 𝑥.
Referenced from 4 locations
Call by value: box only values
Define mutually 𝐴𝗏, the unboxed value type 𝐴+, term translation 𝑀𝗏, and value translation 𝑉+: 𝐴𝗏=!𝐴+,𝑍+=𝑍,(𝐴→𝐵)+=𝐴𝗏⊸𝐵𝗏, 𝑥+=𝑥,(𝜆𝑥.𝑀)+=𝜆𝑦.𝗅𝖾𝗍 !𝑥=𝑦 𝗂𝗇 𝑀𝗏,𝑉𝗏=!𝑉+,(𝑀𝑁)𝗏=(𝗅𝖾𝗍 !𝑧=𝑀𝗏 𝗂𝗇 𝑧)𝑁𝗏. For a source context, put (𝑥1:𝐴1,…,𝑥𝑘:𝐴𝑘)𝗏=!𝑥1:𝐴𝗏1,…,!𝑥𝑘:𝐴𝗏𝑘. Every translated term returns a boxed value. An arbitrary argument is not newly boxed at the application site. The outer let therefore waits until the operator exposes a box, and the function’s exponential let waits until the argument does likewise.
For an arbitrary 𝑁, the outer source redex translates only as far as ((𝜆𝑥.𝑀)𝑁)𝗏⟼∗𝗅𝗂𝗇𝗅𝖾𝗍 !𝑥=𝑁𝗏 𝗂𝗇 𝑀𝗏. If 𝑁 =𝑉, then 𝑉𝗏 =!𝑉+, so Lin-Bang continues to 𝑀𝗏[𝑥 :=𝑉+]. This is the value restriction in target syntax.
Reflection needs the administrative source calculus that the target exposes.
Extend source terms with 𝗅𝖾𝗍 𝑥 =𝑀 𝗂𝗇 𝑁. Reduction is the compatible closure of (𝜆𝑥.𝑀)𝑁⟼𝗅𝖾𝗍𝗅𝖾𝗍 𝑥=𝑁 𝗂𝗇 𝑀𝐿𝑒𝑡−𝐼,𝗅𝖾𝗍 𝑥=𝑉 𝗂𝗇 𝑀⟼𝗅𝖾𝗍𝑀[𝑥:=𝑉]𝐿𝑒𝑡−𝑉,(𝗅𝖾𝗍 𝑥=𝐿 𝗂𝗇 𝑀)𝑁⟼𝗅𝖾𝗍𝗅𝖾𝗍 𝑥=𝐿 𝗂𝗇 (𝑀𝑁)𝐿𝑒𝑡−𝐶. 𝗅𝖾𝗍 𝑦=(𝗅𝖾𝗍 𝑥=𝐿 𝗂𝗇 𝑀) 𝗂𝗇 𝑁⟼𝗅𝖾𝗍𝗅𝖾𝗍 𝑥=𝐿 𝗂𝗇 (𝗅𝖾𝗍 𝑦=𝑀 𝗂𝗇 𝑁)𝐿𝑒𝑡−𝐴. Extend the translation by (𝗅𝖾𝗍 𝑥=𝑀 𝗂𝗇 𝑁)𝗏=𝗅𝖾𝗍 !𝑥=𝑀𝗏 𝗂𝗇 𝑁𝗏.
Referenced from 3 locations
For terms 𝑀,𝑁 without source let, 𝑀⟼∗𝑁⟺𝑀⟼∗𝗅𝖾𝗍𝑁.
Referenced from 4 locations
Proof of Lemma 37.8 — Conservative administrative completion
Proof. A value-beta step factors as Let-I followed by Let-V. The reverse implication is Proposition 5.4 of [MOTW99]. Its standard-reduction argument permutes Let-C and Let-A administrative steps until each Let-V exposes one value-beta contraction; between let-free endpoints the introduced lets then occur in Let-I/Let-V pairs. The proposition is imported only for these four compatible rules and the displayed value grammar. It is not a conservativity claim for arbitrary extensions of either language. ◻
The translation preserves substitution of values and typing. Moreover, 𝑀⟼∗𝑁⟺𝑀𝗏⟼∗𝗅𝗂𝗇𝑁𝗏.
Referenced from 5 locations
Proof of Theorem 37.9 — Exact call-by-value translation
Proof. Structural induction proves (𝑀[𝑥 :=𝑉])𝗏 =𝑀𝗏[𝑥 :=𝑉+] and the two mutually stated typing properties. Each of Let-I, Let-V, Let-C, and Let-A translates respectively to a nonempty sequence using the displayed linear beta, bang, application-commuting, and let-association rules. This proves preservation for call by let.
For reflection, the reachable-image grammar distinguishes boxed value images, applications headed by an administrative exponential let, and nested lets. Erase those shapes back to 𝗅𝖾𝗍. The erasure is a right inverse and maps every target step to zero or more call-by-let steps, by inspection of the four target rules. Hence target reduction reflects call-by-let reduction. Finally apply lemma 37.8 at the let-free endpoints. ◻
★★☆ Translate (𝜆𝑥.𝑀) 𝑁 and identify the residual exponential let. Then take 𝑁 =𝑉, continue the trace, and explain why replacing 𝑁𝗏 by !𝑁𝗏 would destroy the invariant “only value translations expose the outer box.”
Referenced from 4 locations
Call by need: weaken globally, contract only boxes
Call by need keeps the call-by-let syntax and adds garbage collection.
The calculus 𝗇𝖾𝖾𝖽 is 𝗅𝖾𝗍 plus 𝗅𝖾𝗍 𝑥=𝑀 𝗂𝗇 𝑁⟼𝗇𝖾𝖾𝖽𝑁when 𝑥∉fv(𝑁).(𝑁𝑒𝑒𝑑−𝐺) The target 𝖺𝖿𝖿 has the syntax and reductions of 𝗅𝗂𝗇, admits weakening for every assumption, and adds 𝗅𝖾𝗍 !𝑥=𝑀 𝗂𝗇 𝑁⟼𝖺𝖿𝖿𝑁when 𝑥∉fv(𝑁).(𝐴𝑓𝑓−𝑊𝑒𝑎𝑘) Contraction remains restricted to exponential assumptions.
Referenced from 3 locations
The calculus 𝖺𝖿𝖿 preserves typing under one reduction.
Referenced from 3 locations
Proof of Corollary 37.11 — Affine target subject reduction
Proof. The four linear rules use theorem 37.4; their typing derivations remain valid because affine weakening only adds derivations. Rule Aff-Weak deletes an unused binding. The reduct omits the bound term’s assumptions, and affine weakening restores them in the conclusion context. Compatible positions follow by induction on the surrounding term. ◻
The call-by-need translation is exactly ( −)𝗏, now read from 𝗇𝖾𝖾𝖽 into 𝖺𝖿𝖿. Rule Need-G maps to Aff-Weak. This single correspondence explains why the target is affine: an unused suspended computation may disappear before it produces a box, while an unboxed computation still may not be duplicated.
The value translation into 𝖺𝖿𝖿 preserves substitution of values and typing, and 𝑀⟼∗𝗇𝖾𝖾𝖽𝑁⟺𝑀𝗏⟼∗𝖺𝖿𝖿𝑁𝗏.
Referenced from 4 locations
Proof of Theorem 37.12 — Exact call-by-need translation
Proof. The call-by-let cases are those of theorem 37.9. The new source rule translates to 𝗅𝖾𝗍 !𝑥=𝑀𝗏 𝗂𝗇 𝑁𝗏⟶Aff−Weak𝑁𝗏, because translation preserves free-variable absence. Conversely, extend the reachable-image erasure used for call by value by mapping Aff-Weak to Need-G. Every old affine reduction has the old call-by-let image; the new reduction has exactly the displayed garbage-collection image. The same right-inverse argument reflects a target sequence. ◻
The theorem relates reductions of the two displayed calculi. It does not say that every graph reducer, lazy language, or heap machine implements this relation. In particular, the compatible source relation does not count heap updates. Sharing is represented by the retained let binding and the absence of contraction on its unboxed right-hand side; an exact update-once cost claim would need a heap semantics and a costed simulation.
For the paper’s common extension by constants and primitive delta rules, 𝗇𝖾𝖾𝖽 and 𝗇𝖺𝗆𝖾 are observationally equivalent: they reduce a closed source term to the same constants. This imported result does not identify their reduction graphs; the discarded and shared work is precisely what can differ.
★★☆ Translate 𝗅𝖾𝗍 𝑥 =𝑅 𝗂𝗇 𝑎. Reduce it in 𝖺𝖿𝖿, and prove that the same reduction is not type preserving in the purely linear target when 𝑅𝗏 consumes a nonexponential assumption.
Referenced from 4 locations
Three translations, one diagnostic table
| strategy |
argument at application |
duplicable object |
target discipline |
| name |
always !𝑁𝗇 |
suspended argument |
linear, with exponential structural rules |
| value |
𝑁𝗏, no new box |
value !𝑉+ |
linear, with exponential structural rules |
| need |
𝑁𝗏, retained by let |
value only; an unforced binding may be dropped |
affine weakening, exponential contraction |
The table predicts three useful failures. Boxing every value-translation argument would permit call-by-value functions to consume an unevaluated computation. Removing the call-by-name box would make a nonlinear source function ill typed. Giving 𝗇𝖾𝖾𝖽 global contraction would license duplication of an unforced right-hand side and erase the sharing discipline.
For the opening term 𝐷, the name translation contains one syntactic promotion around 𝑅𝗇 before target beta; the value and need translations contain no promotion introduced around 𝑅𝗏 at that application. In the need target the binding for 𝑅𝗏 may be weakened when 𝑥 is absent but may not be contracted until a box is exposed.
Referenced from 2 locations
Proof of Proposition 37.13 — Opening obstruction
Proof. Put 𝐹 =𝜆𝑥.𝑓 𝑥 𝑥 and expand the three application clauses. The name clause is 𝐷𝗇 =𝐹𝗇!𝑅𝗇. The other two are (𝗅𝖾𝗍 !𝑧 =𝐹𝗏 𝗂𝗇 𝑧)𝑅𝗏. The structural claims then follow from the linear and affine context rules: both restrict contraction to !𝑥 :!𝐴, while only the affine system admits weakening on an arbitrary 𝑥 :𝐴. ◻
★★☆ For each target rule of definition 37.2, state whether its name-erasure proof uses one source beta step or zero source steps. Repeat for the call-by-let erasure and explain why Let-C and Let-A are present.
Referenced from 3 locations
Frozen boundary and practical inspection
The completed results concern simply typed function space, explicit exponentials, compatible reduction, and the displayed let and affine extensions. Products and primitive constants can be added by the source’s stated clauses. Sums, recursion, effects, polymorphism, dependent types, and deterministic machines require new translation and simulation cases. Nothing here transfers an exact cost or full-abstraction theorem to those extensions.
Suggested first pass.
Begin with exercise 37.1, exercise 37.2 and continue with exercise 37.3, exercise 37.4. The practical project is an optional second pass.
None of these problems is a prerequisite for a later chapter.
★★★ Complete the call-by-name reachable-image proof: show closure under all four target reductions, define every erasure clause, and prove both the right-inverse and one-step reflection lemmas.
Referenced from 3 locations
★★★ For each rule of 𝗅𝖾𝗍, give its complete nonempty target trace. Then give the erasure image of each target administrative rule and identify where conservativity over let-free value terms is used.
Referenced from 3 locations
★★★ Practical project.evaluation-translation-inspector Use Kappa to implement the three translations on finite named syntax and a classifier for the principal target traces. Maintain this invariant: every reported target step is either the image of the named source step or is explicitly tagged administrative. The corpus must observe the two-step name beta image, reject a value beta whose argument is not a value, accept the same redex after replacing the argument by a value, map source garbage collection to affine weakening, and distinguish boxing every name argument from boxing only value images. Mutate the name application clause by deleting its box; the inline oracle must fail. Explain why these executions do not prove theorem 37.6, theorem 37.9, theorem 37.12. Appendix E records the acceptance commands, and appendix F gives the construction stages.
Referenced from 4 locations
Sources.
The calculi, translations, and exact reduction results are the function-only systems of Maraist, Odersky, Turner, and Wadler [MOTW99]. Their Propositions 2.1–6.7 own subject reduction, confluence, translation exactness, the conservative call-by-let bridge, and the stated observational equivalences. The chapter reconstructs the translation and reflection arguments needed above but does not import the paper’s sketched extensions as if they belonged to the frozen signature. The separate call-by-need calculus of Maraist, Odersky, and Wadler [MOW98] supplies broader operational background; it does not replace the selected translation calculus.