Prerequisites. Direct starred prerequisites: Chapter 32; Chapter 25 supplies the row interface used in the first source card. No later core chapter depends on this route.
Consider two library functions that both return unit. A row system might assign 𝑓:1→𝖺𝗌𝗄1,𝑔:1→∅1, while a capability system makes the authority of 𝑓 an extra block parameter. The annotations live in different places, but each says how the ambient effect context changes while the function body runs. Writing that change as a modality separates it from the ordinary arrow: ⟨⟨𝑓⟩⟩𝗋:◻[𝖺𝗌𝗄](1→1),⟨⟨𝑔⟩⟩𝗋:◻[∅](1→1). Here [𝐸] discards the current effect context and installs 𝐸. A relative modality ⟨𝐷⟩ instead extends the ambient context by 𝐷: [𝐸](𝐹)=𝐸,⟨𝐷⟩(𝐹)=𝐷,𝐹. If the ambient context is 𝐹 ={𝗐𝗋𝗂𝗍𝖾}, then [{𝖺𝗌𝗄}](𝐹)={𝖺𝗌𝗄},⟨𝖺𝗌𝗄⟩(𝐹)={𝖺𝗌𝗄,𝗐𝗋𝗂𝗍𝖾}. An absolute modality forgets the ambient permission; an extension modality retains it.
The comparison requires three calculi, not one notation with three spellings.
𝖬𝖾𝗍[T] is the modal target. Its effect structure T determines equality and inclusion of effect contexts.
System 𝐹𝜀 is a row-annotated source. Its encoding uses absolute modalities over scoped rows.
System 𝐶 is a capability source with first-class values and second-class blocks. Its encoding uses effect variables and modal boxes over sets.
Both source languages translate to the modal target. There is no translation here from System 𝐹𝜀 to System 𝐶, no translation in the opposite direction, and no claim that either source translation is an inverse.
★☆☆ Let 𝐹 ={𝗋𝖾𝖺𝖽}. Compute [{𝗐𝗋𝗂𝗍𝖾}](𝐹), ⟨𝗐𝗋𝗂𝗍𝖾⟩(𝐹), and ([{𝗐𝗋𝗂𝗍𝖾}] ∘⟨𝗋𝖾𝖺𝖽⟩)(𝐹), using the left-to-right convention for composition. State which result retains the ambient 𝗋𝖾𝖺𝖽 effect.
Referenced from 3 locations
The modal target
An effect structure T consists of a kinding relation Γ ⊢𝐷 :𝖤𝖿𝖿 for finite extensions and an equivalence Γ ⊢𝐷 ≡T𝐷′, with well-formedness closed under concatenation. Effect contexts are 𝐷::=∅∣ℓ,𝐷∣𝜖,𝐷,𝐸,𝐹::=∅∣𝜖∣𝐷,𝐸. Kinding and equivalence extend componentwise. Subeffecting is derived: 𝐸⪯𝖾𝐹⟺∃𝐷.Γ⊢𝐸,𝐷≡T𝐹. Simple rows forbid duplicate labels and identify reorderings. Scoped rows permit duplicates and commute adjacent distinct labels. Sets permit labels and effect variables and quotient by idempotent commutative union. The row encoding uses the scoped-row instance Rsc; the capability encoding uses the set instance S.
For progress, the effect structure must satisfy two validity conditions: 𝐸⪯𝖾∅⟹𝐸=∅,ℓ⪯𝖾ℓ′,𝐸 ∧ ℓ≠ℓ′⟹ℓ⪯𝖾𝐸. Together they say that a label contained in an effect context occurs there syntactically. The three instances above satisfy both conditions.
The modalities of 𝖬𝖾𝗍[T] are 𝜇,𝜈::=[𝐸]∣⟨𝐷⟩,[𝐸](𝐹)=𝐸,⟨𝐷⟩(𝐹)=𝐷,𝐹. Composition is read from left to right: 𝜇∘[𝐸]=[𝐸],[𝐸]∘⟨𝐷⟩=[𝐷,𝐸],⟨𝐷1⟩∘⟨𝐷2⟩=⟨𝐷2,𝐷1⟩. Thus (𝜇 ∘𝜈)(𝐸) =𝜈(𝜇(𝐸)). The identity is 𝗂𝖽 =⟨∅⟩.
Kinds distinguish ambient-independent types from arbitrary types: 𝐾::=𝖠𝖻𝗌∣𝖠𝗇𝗒∣𝖤𝖿𝖿, The only proper subkinding step places 𝖠𝖻𝗌 below 𝖠𝗇𝗒. Every operation parameter and result has kind 𝖠𝖻𝗌. Types, terms, contexts, and the principal judgment are 𝐴,𝐵::=1∣𝛼∣𝐴→𝐵∣∀𝛼𝐾.𝐴∣◻𝜇𝐴,𝑀,𝑁::=𝑥∣()∣𝜆𝑥𝐴.𝑀∣𝑀𝑁∣Λ𝛼𝐾.𝑉∣𝑀𝐴∣𝗆𝗈𝖽𝜇𝑉∣𝗅𝖾𝗍𝜈𝗆𝗈𝖽𝜇𝑥=𝑉𝗂𝗇𝑀∣𝖽𝗈ℓ𝑀∣𝗅𝗈𝖼𝖺𝗅ℓ:𝐴⇝𝐵𝗂𝗇𝑀∣𝗁𝖺𝗇𝖽𝗅𝖾𝜇𝑀𝗐𝗂𝗍𝗁𝐻,𝑉,𝑊::=()∣𝑥∣𝜆𝑥𝐴.𝑀∣Λ𝛼𝐾.𝑉∣𝗆𝗈𝖽𝜇𝑉∣𝑉𝐴∣𝗅𝖾𝗍𝜈𝗆𝗈𝖽𝜇𝑥=𝑉𝗂𝗇𝑊,Γ::=∅∣Γ,𝛼:𝐾∣Γ,𝑥:𝜇𝐹𝐴∣Γ,𝗅𝗈𝖼𝗄(𝜇𝐹)∣Γ,ℓ:𝐴⇝𝐵,Γ⊢𝑀:𝐴@𝐸. Write Γ ⊢𝐴 ≡𝖬𝖾𝗍𝐵 for structural type equivalence and use the same role on modalities; its only non-syntactic premises are the selected effect structure’s ≡T equations. The complete kinding, equivalence, and context-formation rules are in subappendix A.30. The grammar of 𝑉 contains complex values: type application and modal elimination may reduce internally while remaining admissible beneath a value-restricted construct. Only this class may appear in modal introduction, modal elimination, and type abstraction. Fix a global operation signature Σ. A runtime label context Ω ::=∅ ∣Ω,ℓ :𝐴 ⇝𝐵 records the fresh labels generated by local declarations. The full target judgment is Ω ∣Γ ⊢𝑀 :𝐴@𝐸; displays omit the left component when it does not change. The subscript 𝐹 records the effect context on which a modality acts. Ordinary bindings abbreviate 𝑥 :𝗂𝖽𝐹𝐴. The composite locks(Γ) multiplies the locks to the right of a variable. A variable of pure kind crosses every lock; another variable may cross only when its binding modality transforms to that composite.
The modality-transformation judgment Γ ⊢𝜇 ⇒𝜈@𝐹 has the two characteristic clauses 𝐸⪯𝖾𝜇(𝐹)[𝐸]⇒𝜇@𝐹𝐷1,𝐺⪯𝖾𝐷2,𝐺for every 𝐹⪯𝖾𝐺⟨𝐷1⟩⇒⟨𝐷2⟩@𝐹. The universal quantifier in the second premise prevents an extension coercion from becoming invalid after ambient subeffecting. Subappendix A.30 prints the selected kinding, variable, modal, operation, handler, and reduction rules.
Modal introduction and elimination have the shapes Γ,𝗅𝗈𝖼𝗄(𝜇𝐹)⊢𝑉:𝐴@𝜇(𝐹)Γ⊢𝗆𝗈𝖽𝜇𝑉:◻𝜇𝐴@𝐹 and Γ,𝗅𝗈𝖼𝗄(𝜈𝐹)⊢𝑉:◻𝜇𝐴@𝜈(𝐹)Γ,𝑥:(𝜈∘𝜇)𝐹𝐴⊢𝑀:𝐵@𝐹Γ⊢𝗅𝖾𝗍𝜈𝗆𝗈𝖽𝜇𝑥=𝑉𝗂𝗇𝑀:𝐵@𝐹. Both constructs are value restricted. In particular, 𝗆𝗈𝖽[ℓ](𝖽𝗈 ℓ ()) is not a suspension: if arbitrary computations were admitted, it could hide an unhandled request under an empty ambient context.
For an operation ℓ :𝐴′ ⇝𝐵′, a handler clause set is 𝐻 ={𝗋𝖾𝗍𝗎𝗋𝗇 𝑥 ↦𝑁,ℓ 𝑝 𝑟 ↦𝑁′}. The parameter 𝜇 determines the modal type 𝑟 :◻𝜇(𝐵′ →𝐵). Its rule requires 𝜇 ⇒𝗂𝖽@𝐹 and 𝜇 ⇒𝜇 ∘𝜇@𝐹, permitting zero or multiple handler uses. These are hypotheses of the rule, not equations for every modality.
Reduction is call by value. The value normal forms are 𝑈::=()∣𝑥∣𝜆𝑥𝐴.𝑀∣Λ𝛼𝐾.𝑉∣𝗆𝗈𝖽𝜇𝑈. Figure 2, §3.6, p. 17 of Tang and Lindley [TL26] omits () from this grammar even though unit has no reduction; the displayed grammar makes that necessary case explicit. A local declaration generates a fresh runtime label. Modal beta reduction removes matching introduction and elimination forms. Handler return wraps its result with 𝜇 ∘⟨ℓ⟩; operation handling wraps the reified continuation with 𝜇. If 𝐾 contains no handler for ℓ, 𝗁𝖺𝗇𝖽𝗅𝖾𝜇𝐾[𝖽𝗈ℓ𝑈]𝗐𝗂𝗍𝗁𝐻⟶𝑁′[𝑈/𝑝,𝗆𝗈𝖽𝜇(𝜆𝑦.𝗁𝖺𝗇𝖽𝗅𝖾𝜇𝐾[𝑦]𝗐𝗂𝗍𝗁𝐻)/𝑟]. The side condition makes dispatch choose the dynamically nearest matching handler.
Let T satisfy the two validity conditions. If Ω ∣∅ ⊢𝑀 :𝐴@𝐸, then some configuration (𝑁;Ω′) satisfies (𝑀;Ω) ⟶(𝑁;Ω′), or 𝑀 is normal at 𝐸. If Ω ∣Γ ⊢𝑀 :𝐴@𝐸 and (𝑀;Ω) ⟶(𝑁;Ω′), then Ω′ ∣Γ ⊢𝑁 :𝐴@𝐸.
Referenced from 4 locations
Proof of Theorem 33.2 — Met safety
Source import. This is Tang and Lindley’s Theorems 3.7–3.8, §3.7, p. 18 [TL26]. Their canonical-forms, weakening, substitution, and subeffecting lemmas close the two inductions. The operation case of progress uses validity to recover an occurrence of the stuck label in 𝐸; the handler-operation case of preservation uses the typed reified continuation. Subappendix D.34 records this imported boundary. ◻
At 𝐸 =∅, validity excludes the request form, so a closed well-typed term either steps or is a value. This is effect safety, not termination.
★★☆ Suppose an alleged effect structure validates ℓ ⪯𝖾∅. Show which conclusion of theorem 33.2 no longer yields empty-effect safety. Do not claim that subject reduction fails.
Referenced from 3 locations
★★☆ For 𝜇 =[𝐸], compute 𝜇 ∘⟨ℓ⟩. State the types assigned to the return value and resumption in the handler rule, and identify the two comonadic premises required at ambient context 𝐹.
Referenced from 3 locations
System 𝐹𝜀: the row source
System 𝐹𝜀 is a fine-grain call-by-value calculus with scoped rows. Its card is independent of chapter 25’s inference calculus: 𝐴,𝐵::=1∣𝛼∣𝐴→𝐸𝐵∣∀𝛼𝐾.𝐴,𝐸::=∅∣𝜖∣ℓ,𝐸,𝑉::=()∣𝑥∣𝜆𝐸𝑥𝐴.𝑀∣Λ𝛼𝐾.𝑉∣𝗁𝖺𝗇𝖽𝗅𝖾𝗋 𝐻,𝑀::=𝗋𝖾𝗍𝗎𝗋𝗇 𝑉∣𝑉𝑊∣𝑉𝐴∣𝖽𝗈ℓ𝑉∣𝗅𝖾𝗍 𝑥=𝑀𝗂𝗇𝑁,𝐻::={ℓ𝑝𝑟↦𝑁}. Rows retain duplicate labels and are equal modulo permutation. The judgments are Γ ⊢𝑣𝑉 :𝐴 and Γ ⊢𝑐𝑀 :𝐴!𝐸. In particular, Σ(ℓ)=𝐴⇝𝐵Γ⊢𝑣𝑉:𝐴Γ⊢𝑐𝖽𝗈ℓ𝑉:𝐵!(ℓ,𝐸) and a one-operation handler has type 𝗁𝖺𝗇𝖽𝗅𝖾𝗋 𝐻 :((1 →ℓ,𝐸𝐴) →𝐸𝐴). It has no source return clause. The full selected rules appear in subappendix A.30.
Define ⟨⟨ −⟩⟩𝗋 into 𝖬𝖾𝗍[Rsc] by translating rows homomorphically and setting ⟨⟨𝐴→𝐸𝐵⟩⟩𝗋=◻[⟨⟨𝐸⟩⟩𝗋](⟨⟨𝐴⟩⟩𝗋→⟨⟨𝐵⟩⟩𝗋),⟨⟨𝜆𝐸𝑥𝐴.𝑀⟩⟩𝗋=𝗆𝗈𝖽[⟨⟨𝐸⟩⟩𝗋](𝜆𝑥⟨⟨𝐴⟩⟩𝗋.⟨⟨𝑀⟩⟩𝗋),⟨⟨(𝑉:𝐴→𝐸𝐵)𝑊⟩⟩𝗋=𝗅𝖾𝗍𝗆𝗈𝖽[⟨⟨𝐸⟩⟩𝗋]𝑓=⟨⟨𝑉⟩⟩𝗋𝗂𝗇𝑓⟨⟨𝑊⟩⟩𝗋,⟨⟨𝖽𝗈ℓ𝑉⟩⟩𝗋=𝖽𝗈ℓ⟨⟨𝑉⟩⟩𝗋. Return, let, and type abstraction/application translate homomorphically. The handler translation supplies the missing source return clause and uses a modality-parameterized target handler. For source result type 𝐴, ⟨⟨𝗁𝖺𝗇𝖽𝗅𝖾𝗋{ℓ𝑝𝑟↦𝑁}⟩⟩𝗋=𝗆𝗈𝖽[𝐸](𝜆𝑓.𝗁𝖺𝗇𝖽𝗅𝖾[𝐸](𝗅𝖾𝗍𝗆𝗈𝖽[ℓ,𝐸]𝑓′=𝑓𝗂𝗇𝑓′())𝗐𝗂𝗍𝗁{𝗋𝖾𝗍𝗎𝗋𝗇 𝑥↦𝗅𝖾𝗍𝗆𝗈𝖽[ℓ,𝐸]𝑥′=𝑥𝗂𝗇𝑥′,ℓ𝑝𝑟↦⟨⟨𝑁⟩⟩𝗋}). The annotations 𝐸 and ℓ,𝐸 are part of this type-directed translation.
If Γ ⊢𝑐𝑀 :𝐴!𝐸, then ⟨⟨Γ⟩⟩𝗋⊢⟨⟨𝑀⟩⟩𝗋:⟨⟨𝐴⟩⟩𝗋@⟨⟨𝐸⟩⟩𝗋. If Γ ⊢𝑣𝑉 :𝐴, then ⟨⟨Γ⟩⟩𝗋 ⊢⟨⟨𝑉⟩⟩𝗋 :⟨⟨𝐴⟩⟩𝗋. If 𝑀 is well typed and 𝑀 ⟶𝑁, then ⟨⟨𝑀⟩⟩𝗋 ⟶∗⟨⟨𝑁⟩⟩𝗋.
Referenced from 4 locations
Proof of Theorem 33.3 — Row-to-Met preservation
Source import. These are Tang and Lindley’s Theorems 4.1–4.2, §4.2, p. 20 [TL26]. The typing induction uses the absolute-modality translation of arrows. The operational induction is on one source step; beta steps take target modal-beta steps, and the handler step uses the translated return and operation clauses. The conclusion is multi-step preservation, not a one-step lockstep simulation. ◻
★★☆ Assume Σ(ℓ) =𝐴 ⇝𝐵. Translate 𝜆ℓ,𝐸𝑥𝐴.𝖽𝗈 ℓ 𝑥 and its application to a value 𝑉. Give the translated function type and every modal elimination form. Then explain why replacing the absolute modality by ⟨ℓ⟩ changes the ambient-effect contract.
Referenced from 3 locations
System 𝐶: the capability source
System 𝐶 separates values, second-class blocks, and computations: 𝐴::=1∣𝑇@𝐶,𝑇::=(¯𝐴;¯𝑓:¯𝑇)⇒𝐵,𝐶::={¯𝑓},𝑉::=𝑥∣()∣𝖻𝗈𝗑 𝑃,𝑃::=𝑓∣{(¯𝑥:¯𝐴;¯𝑓:¯𝑇)⇒𝑀}∣𝗎𝗇𝖻𝗈𝗑 𝑉,𝑀::=𝗋𝖾𝗍𝗎𝗋𝗇 𝑉∣𝑃(¯𝑉;¯𝑄)∣𝗅𝖾𝗍 𝑥=𝑀𝗂𝗇𝑁∣𝖽𝖾𝖿 𝑓=𝑃𝗂𝗇𝑁∣𝗍𝗋𝗒{𝑓𝐴′⇒𝐵′⇒𝑀}𝗐𝗂𝗍𝗁{𝑝,𝑟↦𝑁}. The judgments Γ ⊢𝑃 :𝑇 ∣𝐶 and Γ ⊢𝑀 :𝐴 ∣𝐶 track capability sets. A tracked binding 𝑓 :∗𝑇 contributes {𝑓}; a transparent binding 𝑓 :𝐶𝑇 contributes the known set 𝐶. Blocks are not values unless explicitly boxed. This distinction is a premise of System 𝐶 safety; the modal target does not recreate it by notation.
The translation into 𝖬𝖾𝗍[S] assigns an effect variable ̂𝑓 to every tracked capability: ⟨⟨{𝑓1,…,𝑓𝑛}⟩⟩𝖼=̂𝑓1,…,̂𝑓𝑛,⟨⟨𝑇@𝐶⟩⟩𝖼=◻[⟨⟨𝐶⟩⟩𝖼]⟨⟨𝑇⟩⟩𝖼,⟨⟨(¯𝐴;¯𝑓:¯𝑇)⇒𝐵⟩⟩𝖼=∀¯̂𝑓.◻⟨¯̂𝑓⟩(⟨⟨¯𝐴⟩⟩𝖼→◻[̂¯𝑓]⟨⟨¯𝑇⟩⟩𝖼→⟨⟨𝐵⟩⟩𝖼). A box uses [⟨⟨𝐶⟩⟩𝖼]; a block abstraction quantifies its effect variables and uses ⟨¯̂𝑓⟩. To keep the two target binders visibly distinct, write ̂𝑓 for the effect variable associated with a tracked source block and ̃𝑓 for the term obtained by eliminating that block’s box. The type-directed context translation is ⟨⟨∅⟩⟩𝖼=∅,⟨⟨Γ,𝑥:𝐴⟩⟩𝖼=⟨⟨Γ⟩⟩𝖼,𝑥:⟨⟨𝐴⟩⟩𝖼,⟨⟨Γ,𝑓:∗𝑇⟩⟩𝖼=⟨⟨Γ⟩⟩𝖼,̂𝑓:𝖤𝖿𝖿,𝑓:◻[̂𝑓]⟨⟨𝑇⟩⟩𝖼,̃𝑓:[̂𝑓]⟨⟨𝑇⟩⟩𝖼,⟨⟨Γ,𝑓:𝐶𝑇⟩⟩𝖼=⟨⟨Γ⟩⟩𝖼,𝑓:◻[⟨⟨𝐶⟩⟩𝖼]⟨⟨𝑇⟩⟩𝖼,̃𝑓:[⟨⟨𝐶⟩⟩𝖼]⟨⟨𝑇⟩⟩𝖼. The ordinary value clauses are homomorphic. Boxing and the three block clauses are ⟨⟨𝖻𝗈𝗑 𝑃:𝑇@𝐶⟩⟩𝖼=𝗆𝗈𝖽[⟨⟨𝐶⟩⟩𝖼]⟨⟨𝑃⟩⟩𝖼,⟨⟨𝑓⟩⟩𝖼=̃𝑓. ⟨⟨{(¯𝑥:¯𝐴;¯𝑓:¯𝑇)⇒𝑀}⟩⟩𝖼=Λ¯̂𝑓.𝗆𝗈𝖽⟨¯̂𝑓⟩(𝜆¯𝑥⟨⟨¯𝐴⟩⟩𝖼.𝜆¯𝑓◻[̂¯𝑓]⟨⟨¯𝑇⟩⟩𝖼.𝗅𝖾𝗍𝗆𝗈𝖽[̂¯𝑓]̃¯𝑓=¯𝑓𝗂𝗇⟨⟨𝑀⟩⟩𝖼). ⟨⟨𝗎𝗇𝖻𝗈𝗑 𝑉:𝑇∣𝐶⟩⟩𝖼=𝗅𝖾𝗍𝗆𝗈𝖽[⟨⟨𝐶⟩⟩𝖼]𝑥=⟨⟨𝑉⟩⟩𝖼𝗂𝗇𝑥. Barred modal lets abbreviate one elimination per block parameter, from left to right. An unmarked elimination uses the identity elimination modality. The remaining non-handler computation clauses make the same discipline explicit: ⟨⟨𝗋𝖾𝗍𝗎𝗋𝗇 𝑉⟩⟩𝖼=⟨⟨𝑉⟩⟩𝖼,⟨⟨𝗅𝖾𝗍 𝑥=𝑀𝗂𝗇𝑁⟩⟩𝖼=𝗅𝖾𝗍 𝑥=⟨⟨𝑀⟩⟩𝖼𝗂𝗇⟨⟨𝑁⟩⟩𝖼,⟨⟨𝖽𝖾𝖿 𝑓=𝑃:𝑇∣𝐶𝗂𝗇𝑁⟩⟩𝖼=𝗅𝖾𝗍 𝑓=𝗆𝗈𝖽[⟨⟨𝐶⟩⟩𝖼]⟨⟨𝑃⟩⟩𝖼𝗂𝗇𝗅𝖾𝗍𝗆𝗈𝖽[⟨⟨𝐶⟩⟩𝖼]̃𝑓=𝑓𝗂𝗇⟨⟨𝑁⟩⟩𝖼,⟨⟨𝑃(¯𝑉;¯𝑄𝑗:𝑇𝑗∣𝐶𝑗)⟩⟩𝖼=𝗅𝖾𝗍𝗆𝗈𝖽⟨¯⟨⟨𝐶𝑗⟩⟩𝖼⟩𝑥=⟨⟨𝑃⟩⟩𝖼¯⟨⟨𝐶𝑗⟩⟩𝖼𝗂𝗇𝑥¯⟨⟨𝑉⟩⟩𝖼¯(𝗆𝗈𝖽[⟨⟨𝐶𝑗⟩⟩𝖼]⟨⟨𝑄𝑗⟩⟩𝖼). Thus a call first instantiates one quantified effect variable with each actual block’s capability set, then eliminates the resulting extension box.
For the handler, let 𝐻𝑓,𝐶 ={𝑝,𝑟 ↦𝑁}. Its translation is the following binding-sensitive schema: ⟨⟨𝗍𝗋𝗒{𝑓𝐴′⇒𝐵′⇒𝑀}𝗐𝗂𝗍𝗁 𝐻𝑓,𝐶⟩⟩𝖼=𝗅𝗈𝖼𝖺𝗅ℓ𝑓:⟨⟨𝐴′⟩⟩𝖼⇝⟨⟨𝐵′⟩⟩𝖼𝗂𝗇𝗅𝖾𝗍𝗆𝗈𝖽⟨ℓ𝑓⟩𝑔=(Λ̂𝑓.𝗆𝗈𝖽⟨̂𝑓⟩(𝜆𝑓.𝗅𝖾𝗍𝗆𝗈𝖽[̂𝑓]̃𝑓=𝑓𝗂𝗇⟨⟨𝑀⟩⟩𝖼))ℓ𝑓𝗂𝗇𝗁𝖺𝗇𝖽𝗅𝖾[⟨⟨𝐶⟩⟩𝖼](𝑔(𝗆𝗈𝖽[ℓ𝑓](𝗆𝗈𝖽𝗂𝖽(𝜆𝑥⟨⟨𝐴′⟩⟩𝖼.𝖽𝗈ℓ𝑓𝑥))))𝗐𝗂𝗍𝗁⟨⟨𝐻𝑓,𝐶⟩⟩𝖼,⟨⟨𝐻𝑓,𝐶⟩⟩𝖼={𝗋𝖾𝗍𝗎𝗋𝗇 𝑥↦𝗅𝖾𝗍𝗆𝗈𝖽[ℓ𝑓,⟨⟨𝐶⟩⟩𝖼]𝑥′=𝑥𝗂𝗇𝑥′,ℓ𝑓𝑝𝑟↦𝗅𝖾𝗍𝗆𝗈𝖽[⟨⟨𝐶⟩⟩𝖼]̃𝑟=𝑟𝗂𝗇⟨⟨𝑁⟩⟩𝖼}. The label ℓ𝑓 is fresh. The translation instantiates the handled block’s ̂𝑓 with ℓ𝑓, passes a boxed operation implementation, and exposes the resumption under [⟨⟨𝐶⟩⟩𝖼]. Erasing either binder or the local label changes target scope.
If Γ ⊢𝑀 :𝐴 ∣𝐶 in System 𝐶, then ⟨⟨Γ⟩⟩𝖼⊢⟨⟨𝑀⟩⟩𝖼:⟨⟨𝐴⟩⟩𝖼@⟨⟨𝐶⟩⟩𝖼. If Γ ⊢𝑣𝑉 :𝐴, then ⟨⟨Γ⟩⟩𝖼 ⊢⟨⟨𝑉⟩⟩𝖼 :⟨⟨𝐴⟩⟩𝖼; if Γ ⊢𝑏𝑃 :𝑇 ∣𝐶, then ⟨⟨Γ⟩⟩𝖼 ⊢⟨⟨𝑃⟩⟩𝖼 :⟨⟨𝑇⟩⟩𝖼@⟨⟨𝐶⟩⟩𝖼. If a well-typed runtime configuration reduces from (𝑀;Ω) to (𝑁;Ω′), then its translation reduces in zero or more Met steps from (⟨⟨𝑀⟩⟩𝖼;⟨⟨Ω⟩⟩𝖼) to (⟨⟨𝑁⟩⟩𝖼;⟨⟨Ω′⟩⟩𝖼).
Referenced from 4 locations
Proof of Theorem 33.4 — Capability-to-Met preservation
Source import. These are Tang and Lindley’s Theorems 5.1–5.2, §5.2, p. 23 [TL26]. Type preservation is simultaneous over value, block, and computation derivations. The block-call case instantiates one effect variable for each actual block argument; the handler case introduces the fresh local operation and types the translated resumption. Semantics preservation is a multi-step simulation on typed configurations because local-label generation changes the runtime instance context. ◻
★★☆ Let 𝑓 :∗(1 ⇒1) and translate {(𝑥 :1;𝑓 :1 ⇒1) ⇒𝑓(𝑥)}. Show the quantified effect variable, extension modality, absolute box on the block argument, and elimination that binds its hatted target variable.
Referenced from 3 locations
★★★ In the System-𝐶 handler translation, identify where freshness of ℓ𝑓 is used in typing and where it is used in operational preservation. Explain why choosing an active label invalidates the argument even when it has the same operation signature.
Referenced from 3 locations
What the common target does and does not prove
The encodings expose a common shape: row annotation𝐴→𝐸𝐵↦◻[𝐸](𝐴→𝐵),capability parameter(¯𝐴;¯𝑓:¯𝑇)⇒𝐵↦∀¯̂𝑓.◻⟨¯̂𝑓⟩(⋯). They do not establish 𝐹𝜀 ≃𝗌𝗋𝖼𝐶. The domains have different syntax, typing judgments, runtime configurations, and abstraction boundaries. A shared codomain supplies a comparison language; it does not supply a map between the domains.
The 2025 Met paper develops modal effect types and its METL surface language [TWD^+25]. The retained METL artifact implements a bidirectional type checker, interpreter, and paper examples. It does not implement either source-to-Met encoding and is not executable evidence for theorem 33.3, theorem 33.4. The earlier contextual-modal calculus is a separate design, not an earlier name for Met [ZN21].
Capability boxes refine the relation between scope-based capabilities and type-visible boxes, with safety depending on System 𝐶’s boxing and second-class discipline [BSLBG22]. Locality and effect reflection ask which effects are admitted, reflected, or confined at a boundary [Whi26]; this chapter uses that work only as a comparison card. Modal effect types here are also distinct from dependent multimodal calculi: their contexts carry no dependent modes or mode-morphism substitutions.
★★★ Fix Σ(𝖺𝗌𝗄) =1 ⇝1. In System 𝐹𝜀, handle the thunk 𝜆𝖺𝗌𝗄𝑢1.𝖽𝗈 𝖺𝗌𝗄 𝑢 with the clause 𝖺𝗌𝗄 𝑝 𝑟 ↦𝗋𝖾𝗍𝗎𝗋𝗇 𝑝. In System 𝐶, express the same single request and clause as 𝗍𝗋𝗒{𝑓1⇒1⇒𝑓(())}𝗐𝗂𝗍𝗁{𝑝,𝑟↦𝗋𝖾𝗍𝗎𝗋𝗇𝑝}. Reconstruct the modal skeleton of each translation. Mark the absolute box that records the row in the first, and the quantified effect variable, extension box, boxed operation implementation, and fresh local label in the second. Finally identify one hypothesis used only by the corresponding preservation proof in each case.
Referenced from 3 locations
★★☆ Draw the two proved translation arrows and list one syntactic and one dynamic difference between their domains. State the additional data needed to derive a behavior-preserving translation from one source to the other.
Referenced from 3 locations
Sources.
The target calculus, two source cards, and preservation pairs follow Tang and Lindley [TL26]. The modal design and METL artifact boundary follow Tang et al. [TWD^+25]. The comparison uses System 𝐶 boxes [BSLBG22], the contextual-modal predecessor [ZN21], and locality/effect reflection [Whi26].
Suggested first pass.
Exercise 33.9, Exercise 33.10, Exercise 33.12 form the suggested first pass. No exercise in this optional seminar is a prerequisite for a core chapter.
★★☆ Derive modal introduction followed by elimination for 𝗆𝗈𝖽[𝐸](𝜆𝑥.𝑥) at ambient 𝐹. Print the lock, tagged binding produced by elimination, and variable-access premise. Then replace the function type by a pure base type and locate the branch of the variable rule that no longer needs a modality transformation.
Referenced from 4 locations
★★★ Prove the application and one-operation-handler cases of theorem 33.3. For the handler case, calculate the modal types of the handled thunk, returned value, and resumption. Trace the source contraction and its nonempty target reduction sequence.
Referenced from 4 locations
★★★ Prove the block-abstraction and block-call cases of theorem 33.4. State the simultaneous induction hypotheses and show how substituting actual capability sets for quantified effect variables produces the translated result type.
Referenced from 3 locations
★★☆ For each claim, name the theorem that proves it or give a counterexample:
a closed empty-effect Met term cannot stop at an operation request;
row-to-Met preservation yields a row-to-capability compiler;
passing the METL example suite proves the System-𝐶 translation;
capability-box safety implies ownership noninterference.
Referenced from 4 locations
★★★ Practical project.modal-translation-model Implement the finite model in appendix E. Represent absolute and extension modalities, one row arrow, one capability block, and their two translations as data. Preserve duplicate row labels, instantiate capability parameters by explicit effect variables, and reject modal elimination at the wrong ambient context.
The accepted run has eight named cases. Three one-site, typechecking mutations—turning absolute replacement into extension, contracting duplicate rows, and omitting capability-effect instantiation—must each make the frozen oracle fail. The artifact is a finite observation model, not a proof of either preservation theorem.
Referenced from 4 locations