Lectures onType Theory
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 A::=IntAAA×AA&A,e::=nxλx.eee(e,e)πiee,,e(e:A),T::=IntTTT×T,M::=nxλx.MMM(M,M)πiM,V::=nλx.M(V,V),E::=[]EMVE(E,M)(V,E)πiE. The target typing family is

x:TΓ
Γx:T
DT-Var
Γn:Int
DT-Int
Γ,x:TM:U
Γλx.M:TU
DT-Lam
ΓM:TUΓN:T
ΓMN:U
DT-App
ΓM:TΓN:U
Γ(M,N):T×U
DT-Pair
ΓM:T1×T2
ΓπiM:Ti
DT-Proj

Its root contractions and compatible call-by-value step are (λx.M)V0M[V/x],πi(V1,V2)0Vi,M0NE[M]E[N]. There is no Top. Intersections erase to target products. The elaborating subtyping judgment A<:Bc is generated by

Int<:Intλx.x
S-Int
B1<:A1c1A2<:B2c2
A1A2<:B1B2λf.λx.c2(f(c1x))
S-Arr
A1<:B1c1A2<:B2c2
A1×A2<:B1×B2λp.(c1(π1p),c2(π2p))
S-Prod
A<:B1c1A<:B2c2
A<:B1&B2λx.(c1x,c2x)
S-&R
A1<:BcB ordinary
A1&A2<:Bλp.c(π1p)
S-&L_1
A2<:BcB ordinary
A1&A2<:Bλp.c(π2p)
S-&L_2

The projection rules require an ordinary target: Int, an arrow, or a product. There is no general transitivity rule.

Simple disjointness is AB¬C. A<:CB<:C. The witness C ranges over every raw type in the displayed grammar, not only well-formed types. Well-formed intersection formation is

ΓA typeΓB typeAB
ΓA&B type
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 ΓeAM and ΓeAM. Their complete rules are

x:AΓ
ΓxAx
I-Var
ΓnIntn
I-Int
Γe1AM1Γe2BM2
Γ(e1,e2)A×B(M1,M2)
I-Pair
Γe1ABM1Γe2AM2
Γe1e2BM1M2
I-App
ΓeA1×A2M
ΓπieAiπiM
I-Proj
Γe1AM1Γe2BM2AB
Γe1,,e2A&B(M1,M2)
I-Merge
ΓeAM
Γ(e:A)AM
I-Ann
Γ,x:AeBM
Γλx.eABλx.M
I-Lam
ΓeAMA<:Bc
ΓeBcM
I-Sub

All types in a typing derivation are well formed.

Search the book

Type to search the local edition.