Trace Semantics for Polymorphic References. GaLoP 16 April 3rd 2016

Σχετικά έγγραφα
The Simply Typed Lambda Calculus

A Lambda Model Characterizing Computational Behaviours of Terms

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

Lecture 2. Soundness and completeness of propositional logic

C.S. 430 Assignment 6, Sample Solutions

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

Example Sheet 3 Solutions

EE512: Error Control Coding

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Every set of first-order formulas is equivalent to an independent set

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

2 Composition. Invertible Mappings

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

Sequent Calculi for the Modal µ-calculus over S5. Luca Alberucci, University of Berne. Logic Colloquium Berne, July 4th 2008

Finite Field Problems: Solutions

About these lecture notes. Simply Typed λ-calculus. Types

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Matrices and Determinants

5. Choice under Uncertainty

Other Test Constructions: Likelihood Ratio & Bayes Tests

The λ-calculus. Lecturer: John Wickerson. Phil Wadler

Uniform Convergence of Fourier Series Michael Taylor

The challenges of non-stable predicates

Chap. 6 Pushdown Automata

Finitary proof systems for Kozen s µ

Formal Semantics. 1 Type Logic

Commutative Monoids in Intuitionistic Fuzzy Sets

derivation of the Laplacian from rectangular to spherical coordinates

Concrete Mathematics Exercises from 30 September 2016

CS-XXX: Graduate Programming Languages. Lecture 27 Higher-Order Polymorphism. Matthew Fluet 2012

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

Reminders: linear functions

From the finite to the transfinite: Λµ-terms and streams

ST5224: Advanced Statistical Theory II

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Models for Probabilistic Programs with an Adversary

Statistical Inference I Locally most powerful tests

Fractional Colorings and Zykov Products of graphs

Nowhere-zero flows Let be a digraph, Abelian group. A Γ-circulation in is a mapping : such that, where, and : tail in X, head in

PARTIAL NOTES for 6.1 Trigonometric Identities

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Abstract Storage Devices

D Alembert s Solution to the Wave Equation

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

Numerical Analysis FMN011

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΡΗΤΗΣ. Ψηφιακή Οικονομία. Διάλεξη 7η: Consumer Behavior Mαρίνα Μπιτσάκη Τμήμα Επιστήμης Υπολογιστών

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Homomorphism in Intuitionistic Fuzzy Automata

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

A Note on Intuitionistic Fuzzy. Equivalence Relation

Section 8.3 Trigonometric Equations

CRASH COURSE IN PRECALCULUS

An Inventory of Continuous Distributions

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Areas and Lengths in Polar Coordinates

Math 6 SL Probability Distributions Practice Test Mark Scheme

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

Congruence Classes of Invertible Matrices of Order 3 over F 2

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

Inverse trigonometric functions & General Solution of Trigonometric Equations

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

ΜΕΤΑΠΤΥΧΙΑΚΗ ΔΙΠΛΩΜΑΤΙΚΗ ΕΡΓΑΣΙΑ «ΘΕΜΑ»

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Type Theory and Coq. Herman Geuvers. Principal Types and Type Checking

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 5: Component Adaptation Environment (COPE)

Generating Set of the Complete Semigroups of Binary Relations

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

Homework 3 Solutions

Instruction Execution Times

Assalamu `alaikum wr. wb.

Proving with Computer Assistance Lecture 2. Herman Geuvers

Tridiagonal matrices. Gérard MEURANT. October, 2008

Second Order RLC Filters

Math221: HW# 1 solutions

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

On the Galois Group of Linear Difference-Differential Equations

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

Parametrized Surfaces

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

Mean-Variance Analysis

Approximation of distance between locations on earth given by latitude and longitude

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequality for metrics: Let (X, d) be a metric space and let x, y, z X.

Areas and Lengths in Polar Coordinates

Section 7.6 Double and Half Angle Formulas

Main source: "Discrete-time systems and computer control" by Α. ΣΚΟΔΡΑΣ ΨΗΦΙΑΚΟΣ ΕΛΕΓΧΟΣ ΔΙΑΛΕΞΗ 4 ΔΙΑΦΑΝΕΙΑ 1

( ) 2 and compare to M.

Capacitors - Capacitance, Charge and Potential Difference

Srednicki Chapter 55

Second Order Partial Differential Equations

Μηχανική Μάθηση Hypothesis Testing

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

Solution Series 9. i=1 x i and i=1 x i.

Section 9.2 Polar Equations and Graphs

Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types

Integrals in cylindrical, spherical coordinates (Sect. 15.7)

λρ-calculus 1. each λ-variable is a λρ-term, called an atom or atomic term; 2. if M and N are λρ-term then (MN) is a λρ-term called an application;

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Transcript:

Trace Semantics for Polymorphic References Guilhem Jaber & Nikos Tzevelekos PPS, IRIF, Université Paris Diderot Queen Mary University of London GaLoP 16 April 3rd 2016 1 / 19

Goals Build an intensional model for a call-by-value language with Church-style polymorphism and higher-order (nominal) references. No bad variable problems. Fully abstract for a big fragment of the language. 2 / 19

Goals Build an intensional model for a call-by-value language with Church-style polymorphism and higher-order (nominal) references. No bad variable problems. Fully abstract for a big fragment of the language. Denotations of terms as set of traces Generated operationally using an LTS. 2 / 19

Goals Build an intensional model for a call-by-value language with Church-style polymorphism and higher-order (nominal) references. No bad variable problems. Fully abstract for a big fragment of the language. Denotations of terms as set of traces Generated operationally using an LTS. Using names to represent functional and poylmorphic values Operational Nominal Game Semantics Refresh of names to control the observational power of Opponent. 2 / 19

Goals Build an intensional model for a call-by-value language with Church-style polymorphism and higher-order (nominal) references. No bad variable problems. Fully abstract for a big fragment of the language. Denotations of terms as set of traces Generated operationally using an LTS. Using names to represent functional and poylmorphic values Operational Nominal Game Semantics Refresh of names to control the observational power of Opponent. What kind of free theorems can we get for programs with polymorphic references? Some surprise appears: possibility to disclose abstract types, Strachey parametricity seems broken! 2 / 19

System ReF v def = x l () n λx.m Λα.M v 1, v 2 pack θ, v... (x Var, α TVar, l Loc, n Z) M, N def = v MN Mθ ref M!M M := N M == N M 1, M 2 π i M pack θ, M unpack M as α, x in N θ, θ def = Unit Int θ θ ref θ θ θ θ + θ α.θ α.θ S def = Loc Val Given a functional type θ and some u, we let the argument and return type of θ be: arg(θ θ) = θ arg( α.θ) = U ret u (θ θ) = θ ret u ( α.θ) = θ{u/α} 3 / 19

Operational semantics ((λx.m)v, S) (M{v/x}, S) (ref v, S) (l, S [l v]) (!l, S) (S(l), S) (l := v, S) ((), S[l v]) (l == l, S) (true, S) (l == l, S) (false, S) (π i M 1, M 2, S) (M i, S) ((Λα.M)θ, S) (M{θ/α}, S) (unpack pack θ, v as α, x in N, S) (N{θ/α}{v/x}, S) 4 / 19

Type System (Polymorphic Part), α; Σ, Γ M : θ ; Σ, Γ Λα.M : α.θ ; Σ, Γ M : α.θ ; Σ, Γ Mθ : θ{θ /α} ; Σ, Γ M : θ{θ /α} ; Σ, Γ pack θ, M : α.θ ; Σ, Γ M : α.θ, α; Γ, x : θ N : θ ; Σ, Γ unpack M as α, x in N : θ 5 / 19

Type System (Reference part) ; Σ, Γ M : θ ; Σ, Γ ref M : ref θ (l, θ) Σ ; Σ, Γ l : ref θ ; Σ, Γ M : ref θ ; Σ, Γ! M : θ ; Σ, Γ M : ref θ ; Σ, Γ N : θ ; Σ, Γ M := N : Unit ; Σ, Γ M : refθ ; Σ, Γ M : refθ ; Σ, Γ M == N : Bool 6 / 19

Example I : Fake Identity Is the identity function the only program of type α.α α up to contextual equivalence? 7 / 19

Example I : Fake Identity Is the identity function the only program of type α.α α up to contextual equivalence? No: Λα.let count = ref0 in let z = refλ.ω α in λx:α.(if!count = 0 then z := λ.x else ()); count++;!z() 7 / 19

Example II : Type Disclosure Interaction between references and polymorphism is complex. Example: α. (refα refint) α 8 / 19

Example II : Type Disclosure Interaction between references and polymorphism is complex. Example: α. (refα refint) α What happen when the same location is given as type refα and refint? Λα.λ x, y refα refint. y := 42;!x 8 / 19

Example II : Type Disclosure Interaction between references and polymorphism is complex. Example: α. (refα refint) α What happen when the same location is given as type refα and refint? Λα.λ x, y refα refint. y := 42;!x More complex example: Λα.λ x, y refα refint. let x = ref!x, y = ref!y in y++; x := x ; if y =!y then (y := 42;!x) else!x 8 / 19

Abstract values and Semantic Types AValues v, u def = () n l f p α u, v where n Z, l Loc, f Fun, p Pol and α TVar. Nominal set A def = Loc Pol Fun TVar 9 / 19

Abstract values and Semantic Types AValues v, u def = () n l f p α u, v where n Z, l Loc, f Fun, p Pol and α TVar. Nominal set A def = Loc Pol Fun TVar θ : P(AValues (Loc P(Types))) Unit = {((), ε)} Int = {(n, ε) n Z} refθ = {(l, {(l, refθ)}) l Loc} α = {(p, ε) p Pol α } θ θ = {(f, ε) f Fun θ θ } α.θ = {(f, ε) f Fun α.θ } α.θ = {( α, v, φ) (v, φ) θ{α /α} } θ 1 θ 2 = {( v 1, v 2, φ 1 φ 2 ) (v i, φ i ) θ i } 9 / 19

From Values to Abstract Values AVal(v, θ) : P(AValues ((Fun Pol) Values) (Loc P(Types))) AVal(u, ι) def = {(u, ε, )} for ι = Unit or Int and u ι AVal(l, refθ) def = {(l, ε, {(l, refθ)} l Loc} AVal(u, α) def = {(p, [p u], ) p Pol α } {(u, ε, ) u Pol α } AVal(u, θ) def = {(f, [f u], ) f Fun θ } for θ functional AVal( u 1, u 2, θ 1 θ 2 ) def = {( v 1, v 2, γ 1 γ 2, φ 1 φ 2 ) AVal( θ, u, α.θ) def = {( α, v, γ [α θ ], φ) (v i, γ i, φ i ) AVal(u i, θ i )} (v, γ, φ) AVal(u, θ{α /α})} 10 / 19

Traces Full moves: triple (m, S, ρ) where m is a move f u, f u, ū or u (f Fun, u AValues), S is a closed abstract store, ρ is a finite map Pol AValues Used to disclose polymorphic values whose type have been disclosed. 11 / 19

Traces Full moves: triple (m, S, ρ) where m is a move f u, f u, ū or u (f Fun, u AValues), S is a closed abstract store, ρ is a finite map Pol AValues Used to disclose polymorphic values whose type have been disclosed. Traces: finite sequences of full moves. 11 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, a typing function φ for locations, 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, a typing function φ for locations, a closed store S, 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, a typing function φ for locations, a closed store S, an environment γ mapping names to values, 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, a typing function φ for locations, a closed store S, an environment γ mapping names to values, an ownership function λ (A {O, P}). 12 / 19

Configurations A configuration is a tuple E, γ, φ, S, λ with: an evaluation stack E, a typing function φ for locations, a closed store S, an environment γ mapping names to values, an ownership function λ (A {O, P}). They satisfy: dom(γ) = {a Pol Fun TVar λ(a) = P} dom(φ) = {l Loc dom(λ)} dom(s) for all a ν(e, codom(s), codom(γ))\loc, λ(a) = O 12 / 19

LTS generating Traces (Int) (M, θ) :: E, γ, φ, S, λ (M, θ) :: E, γ, φ, S, λ given (M, S) (M, S ). 13 / 19

LTS generating Traces (Int) (M, θ) :: E, γ, φ, S, λ (M, θ) :: E, γ, φ, S, λ given (M, S) (M, S ). (PA) (u, θ) :: E, γ, φ, S, λ v,s, ρ E, γ γ, φ φ, S, λ λ given (v, γ v, φ v ) AVal(u, θ) 13 / 19

LTS generating Traces (Int) (M, θ) :: E, γ, φ, S, λ (M, θ) :: E, γ, φ, S, λ given (M, S) (M, S ). (PA) (PQ) (u, θ) :: E, γ, φ, S, λ v,s, ρ E, γ γ, φ φ, S, λ λ given (v, γ v, φ v ) AVal(u, θ) (E[f u], θ) :: E, γ, φ, S, λ f v,s, ρ (E, θ θ) :: E, γ γ, φ φ, S, λ λ (v, γ v, φ v ) AVal(u, arg(θ f )), θ = ret v (θ f ) 13 / 19

LTS generating Traces (Int) (M, θ) :: E, γ, φ, S, λ (M, θ) :: E, γ, φ, S, λ given (M, S) (M, S ). (PA) (PQ) (OA) (u, θ) :: E, γ, φ, S, λ v,s, ρ E, γ γ, φ φ, S, λ λ given (v, γ v, φ v ) AVal(u, θ) (E[f u], θ) :: E, γ, φ, S, λ f v,s, ρ (E, θ θ) :: E, γ γ, φ φ, S, λ λ (v, γ v, φ v ) AVal(u, arg(θ f )), θ = ret v (θ f ) (E, θ θ) :: E, γ, φ, S, λ v,s, ρ (Ẽ[ṽ], θ) :: Ẽ, γ, φ φ, S[ S ], λ λ given (v, φ v ) θ 13 / 19

LTS generating Traces (Int) (M, θ) :: E, γ, φ, S, λ (M, θ) :: E, γ, φ, S, λ given (M, S) (M, S ). (PA) (PQ) (OA) (OQ) (u, θ) :: E, γ, φ, S, λ v,s, ρ E, γ γ, φ φ, S, λ λ given (v, γ v, φ v ) AVal(u, θ) (E[f u], θ) :: E, γ, φ, S, λ f v,s, ρ (E, θ θ) :: E, γ γ, φ φ, S, λ λ (v, γ v, φ v ) AVal(u, arg(θ f )), θ = ret v (θ f ) (E, θ θ) :: E, γ, φ, S, λ v,s, ρ (Ẽ[ṽ], θ) :: Ẽ, γ, φ φ, S[ S ], λ λ given (v, φ v ) θ E, γ, φ, S, λ f v,s, ρ (ũ ṽ, θ) :: Ẽ, γ, φ φ, S[ S ], λ λ (v, φ v ) arg(θ), θ = ret v (θ ) and γ(f ) = u 13 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) g α {}}{ (v α, α α α ), γ 1,, ε, λ 1 (α, O) λ 2 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 λ 2 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 f γ 2 {}}{{}}{, γ 1 [f λx. π 1 x],, ε, λ 2 (f, P) λ 3 λ 2 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 f γ 2 {}}{{}}{, γ 1 [f λx. π 1 x],, ε, λ 2 (f, P) f p 1,p 2 {}}{ ((λx. π 1 x) p 1, p 2, α ), γ 2,, ε, λ 3 (p 1, O) (p 2, O) λ 3 λ 2 λ 4 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 f γ 2 {}}{{}}{, γ 1 [f λx. π 1 x],, ε, λ 2 (f, P) f p 1,p 2 {}}{ ((λx. π 1 x) p 1, p 2, α ), γ 2,, ε, λ 3 (p 1, O) (p 2, O) (p 1, α ), γ 2,, ε, λ 4 λ 3 λ 2 λ 4 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 f γ 2 {}}{{}}{, γ 1 [f λx. π 1 x],, ε, λ 2 (f, P) f p 1,p 2 {}}{ ((λx. π 1 x) p 1, p 2, α ), γ 2,, ε, λ 3 (p 1, O) (p 2, O) (p 1, α ), γ 2,, ε, λ 4 λ 3 λ 2 λ 4 p 1, γ 2,, ε, λ 4 14 / 19

A Simple Example: Polymorphic projection Consider the term v Λα.λx : α α. π 1 x of type θ = α. α α α. (v, θ), ε,, ε, ε ḡ γ 1 λ 1 {}}{{}}{, [g v],, ε, (g, P) { }} { g α (v α, α α α ), γ 1,, ε, λ 1 (α, O) (λx. π 1 (x), α α α ), γ 1,, ε, λ 2 f γ 2 {}}{{}}{, γ 1 [f λx. π 1 x],, ε, λ 2 (f, P) f p 1,p 2 {}}{ ((λx. π 1 x) p 1, p 2, α ), γ 2,, ε, λ 3 (p 1, O) (p 2, O) (p 1, α ), γ 2,, ε, λ 4 λ 3 λ 2 λ 4 p 1, γ 2,, ε, λ 4 Trace? ḡ g α f f p 1, p 2 p 1 14 / 19

Computing Type Disclosure cast relations κ: relations over types. (θ, θ ) κ: we can cast values of type θ to θ. 15 / 19

Computing Type Disclosure cast relations κ: relations over types. (θ, θ ) κ: we can cast values of type θ to θ. Atomic casts from typing function of locations φ: {(θ, θ ) l Loc.(refθ, refθ ) φ(l)} cast term: y θ : refθ, y θ : refθ λx θ.let z =!y θ in y θ := x; let z =!y θ in y θ := z; z 15 / 19

Computing Type Disclosure cast relations κ: relations over types. (θ, θ ) κ: we can cast values of type θ to θ. Atomic casts from typing function of locations φ: {(θ, θ ) l Loc.(refθ, refθ ) φ(l)} cast term: y θ : refθ, y θ : refθ λx θ.let z =!y θ in y θ := x; let z =!y θ in y θ := z; z Take the closure of κ: to represent all the cast than can be build from these atomic casts Problem on ref types! No global substitution possible. 15 / 19

Computing Type Disclosure cast relations κ: relations over types. (θ, θ ) κ: we can cast values of type θ to θ. Atomic casts from typing function of locations φ: {(θ, θ ) l Loc.(refθ, refθ ) φ(l)} cast term: y θ : refθ, y θ : refθ λx θ.let z =!y θ in y θ := x; let z =!y θ in y θ := z; z Take the closure of κ: to represent all the cast than can be build from these atomic casts Problem on ref types! No global substitution possible. Quiz: Suppose f : (refint refint) Unit, g : α. refα refα and? let x, y = ref0 in f (x, y); let u = g Int x in if (u = y) then 1 else 2 =? let x, y = ref0 in f (x, y); let u = g Int x in if (u = y) then 3 else 2 15 / 19

An Example with Type Disclosure θ def v def = refα refint α = Λα.λ x, y, z θ. if x = y then (y := 42;!x) else z }{{} M 16 / 19

An Example with Type Disclosure θ def = refα refint α v def = Λα.λ x, y, z θ. if x = y then (y := 42;!x) else z }{{} M λ f {}} 1 { (v, α.θ α), ε,, ε, ε, [f v],, ε, (f, P) 16 / 19

An Example with Type Disclosure θ def = refα refint α v def = Λα.λ x, y, z θ. if x = y then (y := 42;!x) else z }{{} M λ f {}} 1 { (v, α.θ α), ε,, ε, ε, [f v],, ε, (f, P) f α {}}{ (vα, θ α), γ 1,, ε, λ 1 (α, O) λ 2 16 / 19

An Example with Type Disclosure θ def = refα refint α v def = Λα.λ x, y, z θ. if x = y then (y := 42;!x) else z }{{} M λ f {}} 1 { (v, α.θ α), ε,, ε, ε, [f v],, ε, (f, P) f α {}}{ (vα, θ α), γ 1,, ε, λ 1 (α, O) γ {}} 2 { ḡ, γ 1 [g λz θ.m],, ε, λ 2 g l,l,p,s,ρ {}}{{}}{ (M{l/x, y}{p/z}, α), γ 2, {(l, Int),(l, α)}, S, λ 2 (l, O) (p, O)) λ 2 φ 1 λ 3 16 / 19

An Example with Type Disclosure θ def = refα refint α v def = Λα.λ x, y, z θ. if x = y then (y := 42;!x) else z }{{} M λ f {}} 1 { (v, α.θ α), ε,, ε, ε, [f v],, ε, (f, P) f α {}}{ (vα, θ α), γ 1,, ε, λ 1 (α, O) γ {}} 2 { ḡ, γ 1 [g λz θ.m],, ε, λ 2 g l,l,p,s,ρ {}}{{}}{ (M{l/x, y}{p/z}, α), γ 2, {(l, Int),(l, α)}, S, λ 2 (l, O) (p, O)) 42,S, γ 1, φ 1, S, λ 3 e.g. for S =[l 9], ρ = [p 7]. λ 2 φ 1 λ 3 16 / 19

Soundness M : Set of complete traces generated by the initial configurations of M. 17 / 19

Soundness M : Set of complete traces generated by the initial configurations of M. : effective equivalent relation on (set of) traces which substitute disclosed polymorphic names by their concrete values given by the ρ s. 17 / 19

Soundness M : Set of complete traces generated by the initial configurations of M. : effective equivalent relation on (set of) traces which substitute disclosed polymorphic names by their concrete values given by the ρ s. Theorem (Soundness) For all terms ; Σ, Γ M 1, M 2 : θ, M 1 M 2 implies M 1 ctx M 2. 17 / 19

Full Abstraction SystemReF*: Forbid binders, to appear in the scope of a ref, any type variable α inside a refθ must be reachably inhabited: an abstract value of type α must have been played before. 18 / 19

Full Abstraction SystemReF*: Forbid binders, to appear in the scope of a ref, any type variable α inside a refθ must be reachably inhabited: an abstract value of type α must have been played before. Theorem (Completeness) Given SystemReF* terms ; Σ, Γ M 1, M 2 : θ, if M 1 ctx M 2 then M 1 M 2. 18 / 19

Full Abstraction SystemReF*: Forbid binders, to appear in the scope of a ref, any type variable α inside a refθ must be reachably inhabited: an abstract value of type α must have been played before. Theorem (Completeness) Given SystemReF* terms ; Σ, Γ M 1, M 2 : θ, if M 1 ctx M 2 then M 1 M 2. A type outside SystemReF* : h : α, α.(ref(α α) ref(α Int) α) α 18 / 19

Full Abstraction SystemReF*: Forbid binders, to appear in the scope of a ref, any type variable α inside a refθ must be reachably inhabited: an abstract value of type α must have been played before. Theorem (Completeness) Given SystemReF* terms ; Σ, Γ M 1, M 2 : θ, if M 1 ctx M 2 then M 1 M 2. A type outside SystemReF* : h : α, α.(ref(α α) ref(α Int) α) α let x = ref(λy.1) in let u = h Int Int (x, x, 0) in if u then 1 else 2 =? let x = ref(λy.1) in let u = h Int Int (x, x, 0) in if u then 3 else 2 18 / 19

Conclusion On the fragment without refθ: an operational variant of Laird s CBV game model of polymorphism. Link with Levy s Ultimate Patterns and Operational Bisimulations? Next Step: Hindley-Milner (Curry-style) Polymorphism Towards fully abstract model of ML! Deduce reasoning techniques for proof equivalences Examples that cannot be handle by Kripke Logical Relations and Environmental Bisimulations! 19 / 19