slides

Intersection types fit well with resource control
Silvia Ghilezan, Jelena Ivetić, Pierre Lescanne, Silvia Likavec
University of Novi Sad, École normale supérieure de Lyon, Unviersità di Torino
TYPES 2015, 18 May
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
1/9
From practice to theory
With resource control we know when a variable is
duplicated or
erased.
For a compiler maker:
duplication requires pointers and memory management,
it should be used only when necessary,
erasure allows to free memory explicitly.
For a proof theorist:
duplication corresponds to contraction,
erasure corresponds to thinning.
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
2/9
Well formed terms
The set Λr of terms are of the following forms:
x
λx.M
MN
x <xx12 M
x M
Variable
Abstraction
Application
Duplication
Erasure
Axiom
→ Introduction
→ Elimination
Contraction
Thinning
Moreover there are constraints on variables: variables occur once and only
once.
A substitution is defined for this calculus.
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
3/9
The reduction rules of λr
Rules
(λx.M)N → M||[N/
/x]|
(β)
(γ1 )
(γ2 )
(γ3 )
(ω1 )
(ω2 )
(ω3 )
x
<xx12
x
x
(λy .M) → λy .x <xx12 M
(MN) → (x <xx12 M)N, if x1 , x2 ∈
6 Fv (N)
x
1
(MN) → M(x <x2 N), if x1 , x2 ∈
6 Fv (M)
<xx12
<xx12
λx.(y M) → y (λx.M), x 6= y
(x M)N → x (MN)
M(x N) → x (MN)
(γω1 ) x <xx12 (y M) → y (x <xx12 M), y 6= x1 , x2
(γω2 ) x <xx12 (x1 M) → M||[x/
/x2 ]|
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
4/9
Structural equivalences
(ε1 )
x (y M)
(ε2 )
x <xx12 M
y
(ε3 ) x <z (y <uv M)
(ε4 ) x <xx12 (y <yy12 M)
≡λr
≡λr
≡λr
≡λr
y
x
x
y
(x M)
<xx21 M
<yu (y <zv M)
<yy12 (x <xx12 M), x 6= y1 , y2 , y 6= x1 , x2
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
5/9
Rules of λ∩r
Typing is syntax
directed.
(Ax)
x :σ`x :σ
Γ, x : α ` M : σ
(→I )
Γ ` λx.M : α → σ
n
Γ ` M : ∩i=1 τi → σ
Fitness
∆0 ` N : τ0 . . . ∆n ` N : τn
(→E )
>
Γ, ∆0 u ∆1 u ... u ∆n ` MN : σ
Γ, x : α, y : β ` M : σ
(Cont)
x
Γ, z : α ∩ β ` z <y M : σ
Γ`M :σ
(Thin)
Γ, x : > ` x M : σ
→ is
introduced by
(→I )
∩ is
introduced by
(Cont)
> is
introduced by
(Thin).
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
6/9
Role of variables
Variable have several roles with a type associated to this role.
Roles
role
placeholder variables
duplicated variables
erased variables

type
strict
intersection
>
The role of a variable may change by reduction.
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
7/9
Equivalence between strong normalisation and typeablity
SN ⇒ Typeability in Λr ∩
Typeability in Λr ∩ ⇒ SN
The proof uses
the correspondence between
typing rules and
roles of variables.
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
8/9
Conclusion
The way variables are introduced =⇒ the way terms are typed.
No irrelevant intersection types are introduced.
The flexibility on the type (as in →E ) comes from the choice in invoking
the axiom.
S. Ghilezan, J. Ivetić, P. Lescanne, S. Likavec (University
Intersection
of Novi&Sad,
resource
École control
normale supérieure de Lyon,
TYPES
Unviersità
2015, 18
di May
Torino)
9/9