Top-free disjoint intersections and merge elaboration
appendix sectionrules
Top-free disjoint intersections and merge elaboration
The exact source and target signatures of chapter 21 are 𝐴::=𝖨𝗇𝗍∣𝐴→𝐴∣𝐴×𝐴∣𝐴&𝐴,𝑒::=𝑛∣𝑥∣𝜆𝑥.𝑒∣𝑒𝑒∣(𝑒,𝑒)∣𝜋𝑖𝑒∣𝑒,,𝑒∣(𝑒:𝐴),𝑇::=𝖨𝗇𝗍∣𝑇→𝑇∣𝑇×𝑇,𝑀::=𝑛∣𝑥∣𝜆𝑥.𝑀∣𝑀𝑀∣(𝑀,𝑀)∣𝜋𝑖𝑀,𝑉::=𝑛∣𝜆𝑥.𝑀∣(𝑉,𝑉),𝐸::=[]∣𝐸𝑀∣𝑉𝐸∣(𝐸,𝑀)∣(𝑉,𝐸)∣𝜋𝑖𝐸. The target typing family is
𝑥:𝑇∈Γ
Γ⊢𝑥:𝑇
DT-Var
Γ⊢𝑛:𝖨𝗇𝗍
DT-Int
Γ,𝑥:𝑇⊢𝑀:𝑈
Γ⊢𝜆𝑥.𝑀:𝑇→𝑈
DT-Lam
Γ⊢𝑀:𝑇→𝑈Γ⊢𝑁:𝑇
Γ⊢𝑀𝑁:𝑈
DT-App
Γ⊢𝑀:𝑇Γ⊢𝑁:𝑈
Γ⊢(𝑀,𝑁):𝑇×𝑈
DT-Pair
Γ⊢𝑀:𝑇1×𝑇2
Γ⊢𝜋𝑖𝑀:𝑇𝑖
DT-Proj
Its root contractions and compatible call-by-value step are (𝜆𝑥.𝑀)𝑉⇝0𝑀[𝑉/𝑥],𝜋𝑖(𝑉1,𝑉2)⇝0𝑉𝑖,𝑀⇝0𝑁𝐸[𝑀]⟼𝐸[𝑁]. There is no 𝖳𝗈𝗉. Intersections erase to target products. The elaborating subtyping judgment 𝐴<:𝐵⇝𝑐 is generated by
𝖨𝗇𝗍<:𝖨𝗇𝗍⇝𝜆𝑥.𝑥
S-Int
𝐵1<:𝐴1⇝𝑐1𝐴2<:𝐵2⇝𝑐2
𝐴1→𝐴2<:𝐵1→𝐵2⇝𝜆𝑓.𝜆𝑥.𝑐2(𝑓(𝑐1𝑥))
S-Arr
𝐴1<:𝐵1⇝𝑐1𝐴2<:𝐵2⇝𝑐2
𝐴1×𝐴2<:𝐵1×𝐵2⇝𝜆𝑝.(𝑐1(𝜋1𝑝),𝑐2(𝜋2𝑝))
S-Prod
𝐴<:𝐵1⇝𝑐1𝐴<:𝐵2⇝𝑐2
𝐴<:𝐵1&𝐵2⇝𝜆𝑥.(𝑐1𝑥,𝑐2𝑥)
S-&R
𝐴1<:𝐵⇝𝑐𝐵𝗈𝗋𝖽𝗂𝗇𝖺𝗋𝗒
𝐴1&𝐴2<:𝐵⇝𝜆𝑝.𝑐(𝜋1𝑝)
S-&L_1
𝐴2<:𝐵⇝𝑐𝐵𝗈𝗋𝖽𝗂𝗇𝖺𝗋𝗒
𝐴1&𝐴2<:𝐵⇝𝜆𝑝.𝑐(𝜋2𝑝)
S-&L_2
The projection rules require an ordinary target: 𝖨𝗇𝗍, an arrow, or a product. There is no general transitivity rule.
Simple disjointness is 𝐴∗𝐵⟺¬∃𝐶.𝐴<:𝐶∧𝐵<:𝐶. The witness 𝐶 ranges over every raw type in the displayed grammar, not only well-formed types. Well-formed intersection formation is
Γ⊢𝐴𝗍𝗒𝗉𝖾Γ⊢𝐵𝗍𝗒𝗉𝖾𝐴∗𝐵
Γ⊢𝐴&𝐵𝗍𝗒𝗉𝖾
WF-&
Algorithmic disjointness distributes through intersections, compares arrow results, accepts products when either coordinate is disjoint, and accepts distinct ordinary heads.
The bidirectional judgments are Γ⊢𝑒⇒𝐴⇝𝑀 and Γ⊢𝑒⇐𝐴⇝𝑀. Their complete rules are