Types are 𝑋 or 𝐶▹𝑈, where 𝑈::=⊤∣Π(𝑥:𝑆).𝑇∣∀(𝑋<:𝑆).𝑇 and 𝐶::={𝑥1,…,𝑥𝑛}∣⋆. Capture-set substitution replaces 𝑥 by a finite or universal bound in type annotations. The complete subcapturing generators are
Γ⊢𝐶≼𝖼𝖺𝗉⋆
SC-Star
Γ⊢{𝑥𝑖}≼𝖼𝖺𝗉𝐶(1≤𝑖≤𝑛)
Γ⊢{𝑥1,…,𝑥𝑛}≼𝖼𝖺𝗉𝐶
SC-Set-L
1≤𝑖≤𝑛
Γ⊢{𝑥𝑖}≼𝖼𝖺𝗉{𝑥1,…,𝑥𝑛}
SC-Set-R
𝑥:𝑇∈ΓΓ⊢cv(𝑇,Γ)≼𝖼𝖺𝗉𝐶
Γ⊢{𝑥}≼𝖼𝖺𝗉𝐶
SC-Var
Reflexivity and transitivity are admissible. Capture and function subtyping retain their two premises:
Γ⊢𝐶1≼𝖼𝖺𝗉𝐶2Γ⊢𝑈1<:𝑈2
Γ⊢𝐶1▹𝑈1<:𝐶2▹𝑈2
Capt
Γ⊢𝑆2<:𝑆1Γ,𝑥:𝑆2⊢𝑇1<:𝑇2
Γ⊢Π(𝑥:𝑆1).𝑇1<:Π(𝑥:𝑆2).𝑇2
Fun
The capture-specific typing interface is 𝑥:𝐶▹𝑈∈ΓΓ⊢𝑥:{𝑥}▹𝑈Var−C.Γ,𝑥:𝑆⊢𝑡:𝑇Γ⊢Π(𝑥:𝑆).𝑇𝗐𝖿Γ⊢𝜆(𝑥:𝑆).𝑡:fv(𝜆(𝑥:𝑆).𝑡)▹Π(𝑥:𝑆).𝑇Abs−C. Variables declared at abstract type 𝑋 retain type 𝑋. Type abstraction attaches its free variables, type application performs bounded substitution, and subsumption closes the typing relation:
𝑥:𝑋∈Γ
Γ⊢𝑥:𝑋
Var-X
Γ,𝑋<:𝑆⊢𝑡:𝑇Γ⊢∀(𝑋<:𝑆).𝑇𝗐𝖿
Γ⊢Λ(𝑋<:𝑆).𝑡:fv(Λ(𝑋<:𝑆).𝑡)▹∀(𝑋<:𝑆).𝑇
TAbs-C
Γ⊢𝑡:𝐶▹∀(𝑋<:𝑅).𝑇Γ⊢𝑆<:𝑅Γ⊢𝑆𝗐𝖿
Γ⊢𝑡[𝑆]:𝑇[𝑆/𝑋]
TApp-C
Γ⊢𝑡:𝑇Γ⊢𝑇<:𝑆
Γ⊢𝑡:𝑆
Sub-C
Γ⊢𝑡:𝐶▹Π(𝑥:𝑆).𝑇Γ⊢𝑠:𝑆Γ⊢𝑡𝑠:𝑇[cv(𝑆,Γ)/𝑥]App−C.𝑣value(𝜆(𝑥:𝑆).𝑡)𝑣⟶𝖼𝖺𝗉𝑡[fv(𝑣)/𝑥][𝑣/𝑥]Beta−C. Formation tracks positive and negative occurrences of term variables in type annotations. An arrow swaps polarities in its domain and admits its binder only positively in its codomain.
The separate 𝖢𝖢◻<: card uses pure types containing ◻(𝐶▹𝑅), explicit unboxing, and monadic-normal-form machine states ⟨𝑆∣𝐸∣𝑒⟩. Its state-typing judgment combines store, continuation, and focused-expression typing. These rules do not extend the 𝖢𝖥<: signature above.
Chapter 52: affine file typestate
The state set is {𝗈𝗉𝖾𝗇,𝖾𝗈𝖿,𝖼𝗅𝗈𝗌𝖾𝖽}. Read branches from open to open or eof; close goes from open or eof to closed. Protocol contexts map variables to 𝖥𝗂𝗅𝖾[𝑞] and admit no contraction. The flow judgment Δ⊢𝑃⊣Δ′ has the following return, open, close, and read rules:
Δ⊢𝗋𝖾𝗍𝗎𝗋𝗇⊣Δ
TS-Return
Δ,𝑓:𝖥𝗂𝗅𝖾[𝗈𝗉𝖾𝗇]⊢𝑃⊣Δ′𝑓∉dom(Δ)
Δ⊢𝗈𝗉𝖾𝗇𝑓;𝑃⊣Δ′
TS-Open
𝑞∈{𝗈𝗉𝖾𝗇,𝖾𝗈𝖿}Δ⊢𝑃⊣Δ′
Δ,𝑓:𝖥𝗂𝗅𝖾[𝑞]⊢𝖼𝗅𝗈𝗌𝖾𝑓;𝑃⊣Δ′
TS-Close
Δ,𝑓:𝖥𝗂𝗅𝖾[𝗈𝗉𝖾𝗇]⊢𝑃𝑚⊣Δ′Δ,𝑓:𝖥𝗂𝗅𝖾[𝖾𝗈𝖿]⊢𝑃𝑒⊣Δ′
Δ,𝑓:𝖥𝗂𝗅𝖾[𝗈𝗉𝖾𝗇]⊢𝗋𝖾𝖺𝖽𝑓𝖺𝗌{𝗆𝗈𝗋𝖾(𝑓)⇒𝑃𝑚∣𝖾𝗈𝖿(𝑓)⇒𝑃𝑒}⊣Δ′
TS-Read
The two read premises have different input states and the same output context. Runtime/static agreement 𝐻,𝜂⊧𝗍𝗌Δ requires state equality and injective handle identities. The root steps are
ℓ∉dom(𝐻)
⟨𝐻,𝜂,𝗈𝗉𝖾𝗇𝑓;𝑃⟩⟶𝗍𝗌⟨𝐻[ℓ↦𝗈𝗉𝖾𝗇],𝜂[𝑓↦ℓ],𝑃⟩
TSO-Open
𝜂(𝑓)=ℓ𝐻(ℓ)∈{𝗈𝗉𝖾𝗇,𝖾𝗈𝖿}
⟨𝐻,𝜂,𝖼𝗅𝗈𝗌𝖾𝑓;𝑃⟩⟶𝗍𝗌⟨𝐻∖ℓ,𝜂∖𝑓,𝑃⟩
TSO-Close
𝜂(𝑓)=ℓ𝐻(ℓ)=𝗈𝗉𝖾𝗇
⟨𝐻,𝜂,𝗋𝖾𝖺𝖽𝑓𝖺𝗌{𝑃𝑚∣𝑃𝑒}⟩⟶𝗍𝗌⟨𝐻,𝜂,𝑃𝑚⟩
TSO-Read-More
𝜂(𝑓)=ℓ𝐻(ℓ)=𝗈𝗉𝖾𝗇
⟨𝐻,𝜂,𝗋𝖾𝖺𝖽𝑓𝖺𝗌{𝑃𝑚∣𝑃𝑒}⟩⟶𝗍𝗌⟨𝐻[ℓ↦𝖾𝗈𝖿],𝜂,𝑃𝑒⟩
TSO-Read-Eof
The call step unfolds a checked body after capture-avoiding renaming:
𝑋:(𝑥:𝖥𝗂𝗅𝖾[𝑞])⊸Δ𝑋=𝑃𝑋∈Ω
⟨𝐻,𝜂,𝑋(𝑓)⟩⟶𝗍𝗌⟨𝐻,𝜂,𝑃𝑋[𝑓/𝑥]⟩
TSO-Call
For a fixed checked procedure table Ω, the call interface is 𝑋:(𝑥:𝖥𝗂𝗅𝖾[𝑞])⊸Δ𝑋=𝑃𝑋∈Ω𝑓:𝖥𝗂𝗅𝖾[𝑞]⊢𝑋(𝑓)⊣Δ𝑋[𝑓/𝑥]TS−Call. Here dom(Δ𝑋)⊆{𝑥}. Its dynamic companion replaces 𝑋(𝑓) by 𝑃𝑋[𝑓/𝑥] after alpha-renaming every procedure-local handle binder fresh for the caller.
Chapter 53: three coeffect cards
A scalar structure (C,⊛,⊕𝖼,𝗎𝗌𝖾,𝗂𝗀𝗇,≤) has two monoids and two-sided distributivity of ⊛ over ⊕𝖼. A flat calculus adds ∧𝖼 with 𝑟∧𝖼𝑠≤𝑟⊕𝖼𝑠 and judgments Γ@𝖿𝑟⊢𝑒:𝜏. Flat call-by-value beta contracts only arguments typed at 𝗎𝗌𝖾. Flat call-by-name preservation requires either top-pointedness or bottom-pointedness together with ∧𝖼=⊛=⊕𝖼, commutativity, and idempotence.
Its four typing rules are
∅@𝖿𝗂𝗀𝗇⊢𝑐:𝜄
F-Const
𝑥:𝜏@𝖿𝗎𝗌𝖾⊢𝑥:𝜏
F-Var
Γ,𝑥:𝜎@𝖿(𝑟∧𝖼𝑠)⊢𝑒:𝜏
Γ@𝖿𝑟⊢𝜆𝑥.𝑒:𝜎𝑠→𝖼𝜏
F-Abs
Γ1@𝖿𝑟⊢𝑒1:𝜎𝑡→𝖼𝜏Γ2@𝖿𝑠⊢𝑒2:𝜎
Γ1,Γ2@𝖿(𝑟⊕𝖼(𝑡⊛𝑠))⊢𝑒1𝑒2:𝜏
F-App
The structural calculus annotates an 𝑛-variable context by a vector in C𝑛. Abstraction removes the last scalar into the latent arrow; application concatenates the function vector with the argument vector scaled by the latent scalar. Weakening appends 𝗂𝗀𝗇, exchange swaps the corresponding vector cells, and contraction combines adjacent cells with ⊕𝖼. Its substitution conclusion replaces the bound cell 𝑟 by the vector 𝑟⊛𝑆. The binder and application rules expose how that vector changes: