Definition 16.4 extends the bounded-subtyping core by positive Self types and two primitive term forms: 𝑆::=𝖲𝖾𝗅𝖿𝑋.𝑅(𝑋),𝑎::=⋯∣𝗉𝖺𝖼𝗄𝖲𝖾𝗅𝖿𝐶𝗐𝗂𝗍𝗁𝑎𝖺𝗌𝑆∣𝗎𝗌𝖾𝖲𝖾𝗅𝖿𝑎𝖺𝗌𝑋<:𝑆,𝑥:𝑅(𝑋)𝗂𝗇𝑏. Every field type in 𝑅(𝑋) is positive in 𝑋. The Self-specific calculus extends reflexive–transitive subtyping by
𝑋<:𝐴∈Δ
Δ⊢𝑋<:𝐴
S-Bound
Δ⊢𝐴<:𝖳𝗈𝗉
S-Top
Δ⊢𝐴′<:𝐴Δ⊢𝐵<:𝐵′
Δ⊢𝐴→𝐵<:𝐴′→𝐵′
S-Arrow
𝐽⊆𝐼Δ⊢𝐴𝑗<:𝐵𝑗(𝑗∈𝐽)
Δ⊢{ℓ𝑖:𝐴𝑖}𝑖∈𝐼<:{ℓ𝑗:𝐵𝑗}𝑗∈𝐽
S-Record
Its ordinary term rules are
𝑥:𝐴∈Γ
Δ;Γ⊢𝑥:𝐴
T-Var
Δ;Γ⊢𝑛:𝖭𝖺𝗍
T-Const
𝑏∈{𝗍𝗋𝗎𝖾,𝖿𝖺𝗅𝗌𝖾}
Δ;Γ⊢𝑏:𝖡𝗈𝗈𝗅
T-Bool
Δ;Γ⊢𝗎𝗇𝗂𝗍:𝖴𝗇𝗂𝗍
T-Unit
Δ;Γ⊢𝑎:𝖭𝖺𝗍
Δ;Γ⊢𝗌𝗎𝖼𝖼(𝑎):𝖭𝖺𝗍
T-Succ
Δ;Γ,𝑥:𝐴⊢𝑎:𝐵
Δ;Γ⊢𝜆𝑥:𝐴.𝑎:𝐴→𝐵
T-Abs
Δ;Γ⊢𝑎:𝐴→𝐵Δ;Γ⊢𝑏:𝐴
Δ;Γ⊢𝑎𝑏:𝐵
T-App
Δ;Γ⊢𝑎:𝖡𝗈𝗈𝗅Δ;Γ⊢𝑏:𝐴Δ;Γ⊢𝑐:𝐴
Δ;Γ⊢𝗂𝖿𝑎𝗍𝗁𝖾𝗇𝑏𝖾𝗅𝗌𝖾𝑐:𝐴
T-If
Δ;Γ⊢𝑎𝑖:𝐴𝑖(𝑖∈𝐼)
Δ;Γ⊢{ℓ𝑖=𝑎𝑖}𝑖∈𝐼:{ℓ𝑖:𝐴𝑖}𝑖∈𝐼
T-Record
Δ;Γ⊢𝑎:{ℓ𝑖:𝐴𝑖}𝑖∈𝐼𝑗∈𝐼
Δ;Γ⊢𝑎.ℓ𝑗:𝐴𝑗
T-Proj
Δ;Γ,𝑥:𝐴⊢𝑎:𝐴
Δ;Γ⊢𝖿𝗂𝗑𝑥:𝐴.𝑎:𝐴
T-Fix
Δ;Γ⊢𝑎:𝐴Δ⊢𝐴<:𝐵
Δ;Γ⊢𝑎:𝐵
T-Sub
The Self-specific subtyping and typing rules are
Δ,𝑋<:𝖳𝗈𝗉⊢𝑅(𝑋)<:𝑅′(𝑋)
Δ⊢𝖲𝖾𝗅𝖿𝑋.𝑅(𝑋)<:𝖲𝖾𝗅𝖿𝑋.𝑅′(𝑋)
S-Self
𝑆=𝖲𝖾𝗅𝖿𝑋.𝑅(𝑋)Δ⊢𝐶<:𝑆Δ;Γ⊢𝑎:𝑅(𝐶)
Δ;Γ⊢𝗉𝖺𝖼𝗄𝖲𝖾𝗅𝖿𝐶𝗐𝗂𝗍𝗁𝑎𝖺𝗌𝑆:𝑆
T-PackSelf
𝑆=𝖲𝖾𝗅𝖿𝑋.𝑅(𝑋)Δ;Γ⊢𝑎:𝑆Δ,𝑋<:𝑆;Γ,𝑥:𝑅(𝑋)⊢𝑏:𝐷𝑋∉𝖥𝖵(𝐷)
Δ;Γ⊢𝗎𝗌𝖾𝖲𝖾𝗅𝖿𝑎𝖺𝗌𝑋<:𝑆,𝑥:𝑅(𝑋)𝗂𝗇𝑏:𝐷
T-UseSelf
Derived selection and its root are 𝑎⋅ℓ𝑗:=𝗎𝗌𝖾𝖲𝖾𝗅𝖿𝑎𝖺𝗌𝑋<:𝑆,𝑥:𝑅(𝑋)𝗂𝗇𝑥.ℓ𝑗,𝑝=𝗉𝖺𝖼𝗄𝖲𝖾𝗅𝖿𝐶𝗐𝗂𝗍𝗁𝑣𝖺𝗌𝑆0,𝑢=𝗎𝗌𝖾𝖲𝖾𝗅𝖿𝑝𝖺𝗌𝑋<:𝑆,𝑥:𝑅(𝑋)𝗂𝗇𝑏,𝑢⟼𝑏[𝐶/𝑋][𝑣/𝑥]. The selection body is subsumed from 𝐵𝑗(𝑋) to 𝐵𝑗(𝑆) by positivity; the reduction substitutes the hidden type before the payload term. The functional evaluation contexts are those of definition 16.5; they do not enter lambdas, recursion bodies, or Self-use bodies.
F-bounded comparison calculus
The separate equi-recursive calculus 𝖥eq has 𝐴::=⋯∣𝜇𝑋.𝐴∣∀𝑋<:𝐹(𝑋).𝐴,𝑎::=⋯∣Λ𝑋<:𝐹(𝑋).𝑎∣𝑎[𝐴]. It uses equi-recursive conversion 𝜇𝑋.𝐴=𝐴[𝜇𝑋.𝐴/𝑋] and the F-bound rules
Δ,𝑋<:𝐹(𝑋)⊢𝐴𝗍𝗒𝗉𝖾
Δ⊢∀𝑋<:𝐹(𝑋).𝐴𝗍𝗒𝗉𝖾
F-All
Δ,𝑋<:𝐹(𝑋);Γ⊢𝑎:𝐴
Δ;Γ⊢Λ𝑋<:𝐹(𝑋).𝑎:∀𝑋<:𝐹(𝑋).𝐴
F-Intro
Δ;Γ⊢𝑎:∀𝑋<:𝐹(𝑋).𝐴Δ⊢𝐶<:𝐹(𝐶)
Δ;Γ⊢𝑎[𝐶]:𝐴[𝐶/𝑋]
F-Elim
The root (Λ𝑋<:𝐹(𝑋).𝑎)[𝐶]⟼𝑎[𝐶/𝑋] uses the displayed post-fixpoint premise; it grants no subtype comparison between distinct post-fixpoints.
Higher-order matching target
The restricted target 𝖧𝜇 distinguishes kinds ∗ and ∗⇒∗, pointwise operator subtyping 𝐹⪯𝐺, bounded operator quantification, and iso-recursion. Proper-type subtyping includes
Ω⊢𝐴′<:𝐴Ω⊢𝐵<:𝐵′
Ω⊢𝐴→𝐵<:𝐴′→𝐵′
S-H-Arrow
𝐽⊆𝐼Ω⊢𝐴𝑗<:𝐵𝑗(𝑗∈𝐽)
Ω⊢{ℓ𝑖:𝐴𝑖}𝑖∈𝐼<:{ℓ𝑗:𝐵𝑗}𝑗∈𝐽
S-H-Record
The ordinary target term rules are
𝑥:𝐴∈Γ
Ω;Γ⊢𝑥:𝐴
T-H-Var
Ω;Γ,𝑥:𝐴⊢𝑡:𝐵
Ω;Γ⊢𝜆𝑥:𝐴.𝑡:𝐴→𝐵
T-H-Abs
Ω;Γ⊢𝑡:𝐴→𝐵Ω;Γ⊢𝑢:𝐴
Ω;Γ⊢𝑡𝑢:𝐵
T-H-App
Ω;Γ⊢𝑡𝑖:𝐴𝑖(𝑖∈𝐼)
Ω;Γ⊢{ℓ𝑖=𝑡𝑖}𝑖∈𝐼:{ℓ𝑖:𝐴𝑖}𝑖∈𝐼
T-H-Record
Ω;Γ⊢𝑡:{ℓ𝑖:𝐴𝑖}𝑖∈𝐼𝑗∈𝐼
Ω;Γ⊢𝑡.ℓ𝑗:𝐴𝑗
T-H-Proj
Ω;Γ⊢𝑡:𝐴Ω⊢𝐴<:𝐵
Ω;Γ⊢𝑡:𝐵
T-H-Sub
Operator kinding and subtyping are
Ω,𝑋:∗⊢𝐴:∗
Ω⊢𝜆𝑋:∗.𝐴:∗⇒∗
K-OpAbs
Ω⊢𝐹:∗⇒∗Ω⊢𝐴:∗
Ω⊢𝐹(𝐴):∗
K-OpApp
Ω⊢𝐹:∗⇒∗Contr(𝐹)
Ω⊢𝜇𝐹:∗
K-Mu
Ω,𝑋:∗⊢𝐹(𝑋)<:𝐺(𝑋)
Ω⊢𝐹⪯𝐺
S-OpPoint
Ω⊢𝐹⪯𝐺Ω⊢𝐴:∗
Ω⊢𝐹(𝐴)<:𝐺(𝐴)
S-OpApp
Φ⪯𝐹:∗⇒∗∈Ω
Ω⊢Φ⪯𝐹
S-OpBound
Ω⊢𝐹:∗⇒∗Contr(𝐹)Ω,Φ⪯𝐹:∗⇒∗⊢𝐴:∗
Ω⊢∀Φ⪯𝐹.𝐴:∗
K-AllOp
Ω,Φ⪯𝐹;Γ⊢𝑡:𝐴
Ω;Γ⊢ΛΦ⪯𝐹.𝑡:∀Φ⪯𝐹.𝐴
T-AllOp-I
Ω;Γ⊢𝑡:∀Φ⪯𝐹.𝐴Ω⊢𝐺:∗⇒∗Contr(𝐺)Ω⊢𝐺⪯𝐹
Ω;Γ⊢𝑡[𝐺]:𝐴[𝐺/Φ]
T-AllOp-E
Ω;Γ⊢𝑡:𝐹(𝜇𝐹)
Ω;Γ⊢𝖿𝗈𝗅𝖽𝐹(𝑡):𝜇𝐹
T-Fold
Ω;Γ⊢𝑡:𝜇𝐹
Ω;Γ⊢𝗎𝗇𝖿𝗈𝗅𝖽𝐹(𝑡):𝐹(𝜇𝐹)
T-Unfold
For source object types, matching is defined only by translated operator comparison: Ξ⊢𝐴#𝐵⟺Ξ†⊢Oper(𝐴)⪯Oper(𝐵). It licenses match abstraction, match application, and selection through a match-bound variable. It does not license source subsumption. The separate source typing judgment is generated by
𝑥:𝐷∈Γ
Ξ;Γ⊢𝑥:𝐷
T-Match-Var
Ξ;Γ,𝑥:𝐷⊢𝑡:𝐸
Ξ;Γ⊢𝜆𝑥:𝐷.𝑡:𝐷→𝐸
T-Match-Abs
Ξ;Γ⊢𝑡:𝐷→𝐸Ξ;Γ⊢𝑢:𝐷
Ξ;Γ⊢𝑡𝑢:𝐸
T-Match-App
Ξ,𝑋#𝑂;Γ⊢𝑡:𝐷
Ξ;Γ⊢Λ𝑋#𝑂.𝑡:∀𝑋#𝑂.𝐷
T-Match-I
Ξ;Γ⊢𝑡:∀𝑋#𝑂.𝐷Ξ⊢𝐶#𝑂
Ξ;Γ⊢𝑡[𝐶]:𝐷[𝐶/𝑋]
T-Match-E
𝑋#𝜇𝑍.𝑅(𝑍)∈Ξ𝑥:𝑋∈Γ𝑅(𝑋)(ℓ)=𝐷
Ξ;Γ⊢𝑥.ℓ:𝐷
T-Match-Proj
Invariant references and configuration roots
The state extension uses Δ;Σ;Γ⊢𝑎:𝐴, invariant 𝖱𝖾𝖿𝐴, and Σ⊧𝜎⟺dom(Σ)=dom(𝜎)∧⋅;Σ;⋅⊢𝜎(ℓ):Σ(ℓ)(ℓ∈dom(Σ)). The reference rules are
Δ;Σ;Γ⊢𝑎:𝐴
Δ;Σ;Γ⊢𝗋𝖾𝖿𝑎:𝖱𝖾𝖿𝐴
T-Ref
Δ;Σ;Γ⊢𝑎:𝖱𝖾𝖿𝐴
Δ;Σ;Γ⊢!𝑎:𝐴
T-Deref
Δ;Σ;Γ⊢𝑎:𝖱𝖾𝖿𝐴Δ;Σ;Γ⊢𝑏:𝐴
Δ;Σ;Γ⊢𝑎:=𝑏:𝖴𝗇𝗂𝗍
T-Assign
Σ(ℓ)=𝐴
Δ;Σ;Γ⊢ℓ:𝖱𝖾𝖿𝐴
T-Loc
Allocation extends both store and store typing; dereference and assignment preserve the current store typing: ⟨𝜎,𝗋𝖾𝖿𝑣⟩⟼⟨𝜎[ℓ↦𝑣],ℓ⟩(ℓ∉dom(𝜎)),⟨𝜎,!ℓ⟩⟼⟨𝜎,𝜎(ℓ)⟩,⟨𝜎,ℓ:=𝑣⟩⟼⟨𝜎[ℓ↦𝑣],𝗎𝗇𝗂𝗍⟩.