Towards Nominal Abramsky Towards Nominal Abramsky Andrzej Murawski Nikos Tzevelekos University of Warwick Queen Mary, U. of London
What this talk is about Abramsky's cube (1990's): a taxonomy of game semantics models Nominal game semantics (2000's): games for programs generating new/fresh resources (references, exceptions, channels, etc.) Nominal Abramsky: the construction of an analogous taxonomy for nominal game models
Game Semantics ● Computation is modelled as a 2-player game between: ● Opponent (the environment) ● Proponent (the program) ● Qualitative games ( ≠ Game Theory) ● Programs = strategies for Proponent ● Categories of games
Example strategy ─ f : int int λx.f(x)+1 : int int Int Int Int Int * O P * 5 O 5 P 14 O 15 P : : : : : : : :
Example strategy ─ f : int int λx.f(x)+1 : int int Int Int Int Int * O P * 5 O 5 P 14 15 P * * 5 5 14 15 … : : : : : : : : O P O P O P
Abramsky's cube (90's) probability non-determinism concurrency ... control PCF state move at each axis: relax constraints
Two ways to model references Reynolds ● Idealized Algol (1978) References are pairs: ref int = (unit int)x(int unit) ( 1 Z )x( Z 1 ) ● Theoretically attractive ● but: mkvar(λx.3,λx.()) ( bad variables )
Two ways to model references Reynolds Pitts & Stark ● Idealized Algol (1978) ● nu-calculus (1993) References are pairs: References are names: ref int = ref int = base type (unit int)x(int unit) N (names) ( 1 Z )x( Z 1 ) ● Notion of resource (name): ● Theoretically attractive ● atomic values ● infinitely many ● but: mkvar(λx.3,λx.()) ● comparable for equality ( bad variables )
Two ways to model references references exceptions channels Reynolds Pitts & Stark … ● Idealized Algol (1978) ● nu-calculus (1993) References are pairs: References are names: ref int = ref int = base type (unit int)x(int unit) N (names) ( 1 Z )x( Z 1 ) ● Notion of resource (name): ● Theoretically attractive ● atomic values ● infinitely many ● but: mkvar(λx.3,λx.()) ● comparable for equality ( bad variables )
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P O P O P
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O P O P
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O * P O P
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O * a (a ,0) P 1 1 O P
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O * a (a ,0) P 1 1 O * P
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O * a (a ,0) P 1 1 O * a (a ,0) P 2 2 : : : : : :
Nominal games λx.ref(0) : unit ref int 1 1 Ref int O * P * O * a (a ,0) P 1 1 O * n 15 P P 2 (a 2 ,0) … * * * a 1 (a 1 ,0) * a 2 : : : : : : : : : : : : : : : :
Nominal games λx.ref(0) : unit ref int N 1 1 Ref int O * P * O * a (a ,0) P 1 1 O * n 15 P P 2 (a 2 ,0) … * * * a 1 (a 1 ,0) * a 2 : : : : : : : : : : : : : : : :
Towards nominal Abramsky probability non-determinism concurrency ... control funML state
Towards nominal Abramsky probability GrML funML RefML non-determinism concurrency concurrency ... control funML state
RefML: storable functions A ::= unit | int | ref A | A → A , x:A s Γ : B s Γ : A → B Γ t : A ─ ─ ─ Γ λ x.s : A → B s t Γ : B ─ ─ Γ s : A ─ Γ () : unit , i : int Γ ref( s ) : ref A ─ ─ : ref A Γ Γ Γ s : ref A s : ref A, t : A s, t ─ ─ ─ Γ ! s : A s Γ := t : unit s Γ == t : int ─ ─ ─
Game semantics for RefML MTz LICS'11 ● Moves with HO-store S = { ( a, 4) , ( b,c ) , ( c, 3) , ( d, *) , ... } ● Justify by store m ( a,* ) … m' ● Frugality … m {( a,v ) , ... } ⇒ … a S … m {( a,v ) , ... }
Game semantics for RefML
Game semantics for RefML
Game semantics for RefML
Ground ML: full ground store Restrict ref constructor to non-function types ● y:ref(int int) s but not (λy. s ) (ref (λx.x)) ─ ● allow (λy. s ) (ref (ref(0))) , … In the game model: ● Ban P from introducing/creating ( a, *) ● Impose visibility
Visibility (breaking of) let x=ref( .. ) in λy int unit . first: x:=y after: (!x) 0 n 15 P P P (a,*) * (a,*) * y (a,*) * (a,*) * y (a,*) 0 (a,*) * : : : : : : : : O P O P O P
Fun ML: pure functional behaviour Remove ref constructor ● y:ref(int) s but not (λy. s ) (ref (0)) ─ In the game model: ● Ban P from introducing/creating any name ● Impose innocence
Innocence (breaking of) let x=ref(-1) in λy. x++; !x : unit int n 2 15 P P 1 P (a,0) * (a,0) * y (a,0) 0 (a,1) * y (a,) 1 (a,2) … * : : : : : : : : : : : : : : : : : : : : : : : : O P O P O P
Factorisations ● RefML = GrML + one reference of type unit unit + name generators for HO-types ● GrML = FunML + one reference of type int + name generators for base types + oracles mapping names to integers
Further axes ● Concurrent ML: Laird (FSTTCS'06) To do: ● Exceptions: Laird (LICS'01), Tz (PhD'09) ● Non-determinism: Harmer & McCusker (LICS'99) ● Polymorphism: Hughes (LICS'97), Abramsky & Jagadeesan (FOSSACS'03), Laird (LICS'10, ICALP'10) ● Probability: Danos & Harmer (LICS'00)
Recommend
More recommend