Lectures onType Theory
Simple types, propositional proofs, and dynamics
appendix sectionrules

Simple types, propositional proofs, and dynamics

The core STLC types and terms are A,B::=P2AB,e::=xλx:A.eeettffif(e;e;e). Type and context formation are generated by

P type
Ty-Atom
2 type
Ty-Bool
A typeB type
AB type
Ty-Arr
 ctx
Cx-Emp
Γ ctxA typexdom(Γ)
Γ,x:A ctx
Cx-Ext

Rule instances below range over well-formed contexts and types; in Lam, the context-formation convention supplies xdom(Γ).

(x:A)Γ
Γx:A
Var
Γtt:2
True
Γff:2
False
Γe:2Γe1:CΓe2:C
Γif(e;e1;e2):C
If
Γ,x:Ae:B
Γλx:A.e:AB
Lam
Γe1:ABΓe2:A
Γe1e2:B
App

Core values are v::=ttffλx:A.e. The core call-by-value dynamics are

e1e1
e1e2e1e2
E-AppL
v1 valuee2e2
v1e2v1e2
E-AppR
v value
(λx:A.b)vb[v/x]
E-Beta
ee
if(e;e1;e2)if(e;e1;e2)
E-If
if(tt;e1;e2)e1
E-True
if(ff;e1;e2)e2
E-False

The propositional extension adds A,B::=A×BA+B10,e::=(e1,e2)fst(e)snd(e)inl(e)inr(e)case(e;x.e1;y.e2)abortA(e). Its formation and typing rules are

A typeB type
A×B type
Ty-Prod
A typeB type
A+B type
Ty-Sum
1 type
Ty-Unit
0 type
Ty-Empty
Γe1:AΓe2:B
Γ(e1,e2):A×B
Pair
Γe:A×B
Γfst(e):A
Fst
Γe:A×B
Γsnd(e):B
Snd
Γ:1
Unit-I
Γe:AB type
Γinl(e):A+B
Inl
A typeΓe:B
Γinr(e):A+B
Inr
Γe:A+BΓ,x:Ae1:CΓ,y:Be2:C
Γcase(e;x.e1;y.e2):C
Case
Γe:0C type
ΓabortC(e):C
Empty-E

Extended values add ,(v1,v2),inl(v),inr(v). Their call-by-value rules are

e1e1
(e1,e2)(e1,e2)
E-PairL
v1 valuee2e2
(v1,e2)(v1,e2)
E-PairR
ee
fst(e)fst(e)
E-Fst
v1 valuev2 value
fst((v1,v2))v1
E-Fst-Pair
ee
snd(e)snd(e)
E-Snd
v1 valuev2 value
snd((v1,v2))v2
E-Snd-Pair
ee
inl(e)inl(e)
E-Inl
ee
inr(e)inr(e)
E-Inr
ee
case(e;x.e1;y.e2)case(e;x.e1;y.e2)
E-Case
v value
case(inl(v);x.e1;y.e2)e1[v/x]
E-Case-L
v value
case(inr(v);x.e1;y.e2)e2[v/y]
E-Case-R
ee
abortA(e)abortA(e)
E-Abort

There is no root contraction for abort. Call-by-name on the untyped core uses F::=[]Feif(F;e1;e2) and the roots (λx.b)anb[a/x],if(tt;e1;e2)ne1,if(ff;e1;e2)ne2.

The propositional natural-deduction rules are

(h:A)Δ
ΔNA
Hyp
ΔN
→p I
ΔN
ΔNC
E
ΔNAΔNB
ΔNAB
I
ΔNAB
ΔNA
E_1
ΔNAB
ΔNB
E_2
Δ,h:ANB
ΔNAB
I
ΔNABΔNA
ΔNB
E
ΔNA
ΔNAB
I_1
ΔNB
ΔNAB
I_2
ΔNABΔ,h:ANCΔ,k:BNC
ΔNC
E

Finally, the proof root relation is (λx:A.b)apb[a/x],fst((a,b))pa,snd((a,b))pb,case(inl(a);x.b;y.c)pb[a/x],case(inr(a);x.b;y.c)pc[a/y],if(tt;b;c)pb,if(ff;b;c)pc. Its compatible closure is generated by K::=[]λx:A.KKeeKif(K;e1;e2)if(e;K;e2)if(e;e1;K)(K,e)(e,K)fst(K)snd(K)inl(K)inr(K)abortA(K)case(K;x.e1;y.e2)case(e;x.K;y.e2)case(e;x.e1;y.K). The closure rule is rpqK[r]pK[q]PCtx.

Search the book

Type to search the local edition.