Candidato: Andrea Tosatto Relatore: Corelatore: Dott. Luca Padovani Prof. Viviana Bono Tesi di Laurea Triennale in Informatica Types for leak detection in a session-oriented functional programming language Andrea Tosatto 1 / 12
t | t t | t ⊗ t | T Endpoint Type T ::= end (termination) | !t.T (input) | ?t.T (output) | α (type variable) | rec α.T (recursive type) Types for leak detection in a session-oriented functional programming language Andrea Tosatto 5 / 12
open () in close (send a b) t ::= Bool | Unit | t → t | t t | t ⊗ t | T T ::= end | !t.T | ?t.T | α | rec α.T Types for leak detection in a session-oriented functional programming language Andrea Tosatto 6 / 12
open () in close (send a b) T = !S.end t ::= Bool | Unit | t → t | t t | t ⊗ t | T T ::= end | !t.T | ?t.T | α | rec α.T Types for leak detection in a session-oriented functional programming language Andrea Tosatto 6 / 12
open () in close (send a b) T = !S.end S = ?S.end t ::= Bool | Unit | t → t | t t | t ⊗ t | T T ::= end | !t.T | ?t.T | α | rec α.T Types for leak detection in a session-oriented functional programming language Andrea Tosatto 6 / 12
close (send a (g b)) Unit Unit g = λx.λy.(fix(λf .λz.f z)x) g b E Types for leak detection in a session-oriented functional programming language Andrea Tosatto 7 / 12
of pointers starting from object of type t” • only pointers whose type has finite weight can be sent T = ?Bool.end T = 1 T = ?T.end T = ∞ t = s1 s2 t = ? Types for leak detection in a session-oriented functional programming language Andrea Tosatto 8 / 12
of pointers starting from object of type t” • only pointers whose type has finite weight can be sent T = ?Bool.end T = 1 T = ?T.end T = ∞ t = s1 s2 t = ? Types for leak detection in a session-oriented functional programming language Andrea Tosatto 8 / 12
of pointers starting from object of type t” • only pointers whose type has finite weight can be sent T = ?Bool.end T = 1 T = ?T.end T = ∞ t = s1 s2 t = ? Types for leak detection in a session-oriented functional programming language Andrea Tosatto 8 / 12
of pointers starting from object of type t” • only pointers whose type has finite weight can be sent T = ?Bool.end T = 1 T = ?T.end T = ∞ t = s1 s2 t = ? Types for leak detection in a session-oriented functional programming language Andrea Tosatto 8 / 12
of pointers starting from object of type t” • only pointers whose type has finite weight can be sent T = ?Bool.end T = 1 T = ?T.end T = ∞ t = s1 w s2 t = w Types for leak detection in a session-oriented functional programming language Andrea Tosatto 8 / 12
close (send a (g b)) Unit ∞ Unit (T-Send) Γ1 E1 : !t.T Γ2 E2 : t t < ∞ Γ1 + Γ2 send E1 E2 : T Types for leak detection in a session-oriented functional programming language Andrea Tosatto 10 / 12
leaks... . . . BUT. . . Does it really work?! Theorem (Soundness) If E is well typed, then E is leak free. Possible extensions • Subtyping... Types for leak detection in a session-oriented functional programming language Andrea Tosatto 11 / 12
leaks... . . . BUT. . . Does it really work?! Theorem (Soundness) If E is well typed, then E is leak free. Possible extensions • Subtyping... Types for leak detection in a session-oriented functional programming language Andrea Tosatto 11 / 12
leaks... . . . BUT. . . Does it really work?! Theorem (Soundness) If E is well typed, then E is leak free. Possible extensions • Subtyping... Types for leak detection in a session-oriented functional programming language Andrea Tosatto 11 / 12
leaks... . . . BUT. . . Does it really work?! Theorem (Soundness) If E is well typed, then E is leak free. Possible extensions • Subtyping... Types for leak detection in a session-oriented functional programming language Andrea Tosatto 11 / 12