nominal game semantics
play

NOMINAL GAME SEMANTICS PART II Andrzej Murawski UNIVERSITY OF - PowerPoint PPT Presentation

NOMINAL GAME SEMANTICS PART II Andrzej Murawski UNIVERSITY OF OXFORD FULL ABSTRACTION J M 1 K = J M 2 K if and only if M 1 = M 2 f int int .f (0) + 1 : ( int int ) int ( int 2 int 1 ) int 0 O 0


  1. NOMINAL GAME SEMANTICS PART II Andrzej Murawski UNIVERSITY OF OXFORD

  2. FULL ABSTRACTION J M 1 K = J M 2 K if and only if M 1 ∼ = M 2

  3. ⊢ λ f int → int .f (0) + 1 : ( int → int ) → int ⊢ ( int 2 → int 1 ) → int 0 O ⋆ † ′ 0 2 3 1 4 0 P † ⋆ † † ′ O O P O P O P P 0 2 3 1 O 4 0 P let g = [ ] in g ( λ x int .x + 3)

  4. ARENAS An arena A = ⟨ M A , I A , λ A , ⊢ A ⟩ is given by: • a set of moves M A and a subset I A ⊆ M A of initial ones, • a labelling function λ A : M A → { O, P } × { Q, A } , • an enabling relation ⊢ A ⊆ M A × ( M A \ I A ); satisfying, for each m, m ′ ∈ M A , the conditions: • m ∈ I A = ⇒ λ A ( m ) = ( P, A ), • m ⊢ A m ′ ∧ λ QA ⇒ λ QA A ( m ′ ) = Q , A ( m ) = A = • m ⊢ A m ′ = A ( m ′ ). ⇒ λ OP A ( m ) ̸ = λ OP

  5. ARENA (INITIAL+REST) i A A −

  6. ARENA CONSTRUCTIONS (i A , i B ) † i A A − B − A − B B A ⊗ B A ⇒ B

  7. ARENA EXAMPLES � unit � = ⟨ { ⋆ } , { ⋆ } , ∅ , ∅⟩ � int � = ⟨ Z , Z , ∅ , ∅⟩ � θ → θ ′ � = � θ � ⇒ � θ ′ � � ref θ � = � unit → θ � ⊗ � θ → unit �

  8. EXAMPLE (ARENA) � ( int → int ) → int � ( int 2 → int 1 ) → int 0 † † ′ i 2 k 0 j 1

  9. INTERPRETATION • Although types are interpreted by arenas, the actual games will be played in prearenas , which are defined in the same way as arenas with the exception that initial moves are O-questions. • Typed terms x 1 : θ 1 , · · · , x n : θ n ⊢ M : θ are interpreted using the (pre)arena � θ 1 � ⊗ · · · ⊗ � θ n � → � θ � where → is the same way as ⇒ but without † .

  10. EXAMPLE (PREARENA) � ⊢ ( int → int ) → int � ⊢ ( int 2 → int 1 ) → int 0 ⋆ † † ′ i 2 k 0 j 1

  11. JUSTIFIED SEQUENCES A justified sequence on a prearena A is a sequence of moves from M A such that • the first move must be from I A , • any other move n is equipped with a pointer to an earlier move m such that m ⊢ A n . ⋆ † † ′ i 2 k 0 † ′ 0 2 † ′ 0 2 3 1 4 0 8 1 9 0 ⋆ † j 1

  12. PLAYS A play is a justified sequence satisfying • alternation, • bracketing. ⋆ † † ′ † ′ † ′ 0 2 0 2 3 1 4 0 8 1 9 0 † ⋆ i 2 k 0 OQ PA OQ PQ OQ PQ OA PA OA PA j 1

  13. STRATEGIES A (deterministic) strategy σ on a prearena A , written σ : A , is a set of even-length plays of A satisfying • even-prefix closure: if sop ∈ σ then s ∈ σ , • determinacy: if sp 1 , sp 2 ∈ σ then p 1 = p 2 . even-length † ′ † ′ † 0 2 0 2 3 1 4 0 8 1 9 0 ⋆ prefixes of OQ PA OQ PQ OQ PQ OA PA OA PA

  14. STRATEGY COMPOSITION σ : A → B τ : B → C ⊢ int 2 → int 1 O ⋆ P † O 7 2 P 8 1 O 10 2 P 11 1

  15. TOWARDS STRATEGY COMPOSITION g : int → int ⊢ g ( g (7) + 2) + 3 : int int 2 → int 1 ⊢ int 0 int 2 → int 1 ⊢ int 0 O † O † P 7 2 P 7 2 O 8 1 O 7 1 P 10 2 P 9 2 O O 11 1 9 1 P 12 0 P 14 0

  16. INTERACTION ⊢ int 2 → int 1 int 2 → int 1 ⊢ int 0 O ⋆ O † P † P 7 2 O 7 2 O 8 1 P 8 1 P 10 2 O 10 2 O 11 1 P 11 1 P 14 0

  17. INTERACTION SEQUENCE ⊢ int 2 → int 1 ⊢ int 0 O ⋆ P † O O P 7 2 P O 8 1 O P 10 2 P O 11 1 P 14 0

  18. HIDING ⊢ int 0 O ⋆ 14 0 P

  19. STRATEGY COMPOSITION • Composition = synchronised parallel composition (interaction sequence) followed by hiding • It is non-trivial to establish associativity.

  20. COMPOSITIONAL INTERPRETATION • Types interpreted by games between O and P . • Terms interpreted by strategies for P . • Each syntactic construct interpreted through special strategies, constructions on strategies and composition. • Categories of games (arenas) and strategies.

  21. LICS’98

  22. REFERENCES • Operational semantics uses names to manage resources via references. • They come from an infinite set, can be compared for equality and generated afresh. • Game models of references from the 1990s were name-free, though, e.g. Abramsky, Honda, McCusker [LICS’98]. � ref θ � = � unit → θ � ⊗ � θ → unit �

  23. NAME-FREE GAMES � ref int � = � unit → int � ⊗ � int → unit � ⊢ ref int (0) : ref int ⋆ ( † 1 , † 2 ) ⋆ ( † 1 , † 2 ) ⋆ 1 0 1 1 2 ⋆ 2 ⋆ 1 1 1 j 2 ⋆ 1 i 1 ⋆ 2

  24. BAD VARIABLES • The model can detect the act of reading and writing. • Full abstraction results from 1990s had to rely on syntax augmented with bad variables (and no name equality). Γ ⊢ M : unit → θ Γ ⊢ M : θ → unit Γ ⊢ mkvar ( M, N ) : ref θ

  25. CONSEQUENCES ̸∼ x := 1 x := 1; x := 1 = x : ref int ⊢ x := 1; x := 1 : unit x : ref int ⊢ x := 1 : unit ( † 1 , † 2 ) 1 2 ⋆ 2 1 2 ⋆ 2 ( † 1 , † 2 ) 1 2 ⋆ 2

  26. FULL ABSTRACTION BY COMPLETE PLAYS • A play is complete if all questions have been an- swered. • Let comp ( σ ) be the set of complete plays in σ . • Full Abstraction : Γ ⊢ M 1 ∼ = M 2 if and only if comp ( � Γ ⊢ M 1 � ) = comp ( � Γ ⊢ M 2 � )

  27. VISIBILITY • Without higher-order references, the patterns created by justification pointers are more restrictive. • The target of a pointer must be present in the view of a play ( visibility ). � ε � = ε � s mt n � = � s � m n

  28. INNOCENCE • Without references, strategies turn out to depend only on a fragment of play. • Innocence : P’s responses are determined by the view. 3 1 4 0 3 1 4 0 † ⋆ O P O P O P

  29. OTHER PROPERTIES • Lack of alternation (concurrency) • Lack of bracketing (control) • General theme in game semantics: capture programming language features by conditions on plays/strategies!

  30. NOMINAL GAMES • Dialogue between the environment (O) and the program (P). • Technically, plays are moves that involve names drawn from an infinite set (stable under name invariance, i.e. nominal sets). • Moves are accompanied by evolving stores. e A = � θ A θ

  31. NOMINAL GAMES � ref θ � = ⟨ A θ , A θ , ∅ , ∅⟩ • Moves may contain names. • Moves carry a store: once a new name is played, it is added to the domain of the store. n ( n, 0 ) n ( n,i ) ⋆ ( n, 1 ) ⋆

  32. EXAMPLE ⊢ let n = ref int (0) in λ x unit .n : unit → ref int ⋆ 1 n ( n, 0) ⋆ ( n, 5) n ( n, 5) ⋆ ( n, 12) n ( n, 12) ⋆ † 1 1 O P O P O P O P

  33. EXAMPLE ⊢ λ x unit . ref int (0) : unit → ref int ⋆ 1 n ( n 1 , 0) ⋆ ( n 1 , 5) n ( n 1 , 5)( n 2 , 0) ⋆ ( n 1 , 7)( n 2 , 12) n ( n 1 , 7)( n 2 , 12)( n 3 , 0) ⋆ † 1 1 2 1 3 O P O P O P O P

  34. strong NOMINAL ARENAS nominal nominal An arena A = ( M A , I A , ` A , λ A ) is given by: • a set M A of moves, nominal nominal • a subset I A ✓ M A of initial moves, • a relation ` A ✓ M A ⇥ ( M A \ I A ), • a function λ A : M A ! { O, P } ⇥ { Q, A } , satisfying, for each m, m 0 2 M A , the conditions: • m 2 I A = ) λ A ( m ) = ( P, A ) , • m ` A m 0 ^ λ QA ) λ QA A ( m 0 ) = Q , A ( m ) = A = • m ` A m 0 = ) λ OP A ( m ) 6 = λ OP A ( m 0 ) . We call ` A the justification relation of A , and λ A its labelling function .

  35. STRATEGIES A strategy σ on a prearena A is a non-empty set of even-length plays of A satisfying: • If so S p S ′ ∈ σ then s ∈ σ ( Even-prefix closure ). • If s ∈ σ then, for all permutations π , π · s ∈ σ ( Equivariance ). • If sp S 1 1 , sp S 2 2 ∈ σ then sp S 1 1 = π · sp S 2 2 for some permu- tation π ( Determinacy ).

  36. STRONG SUPPORT • For any nominal set X , any x ∈ X and any S ⊆ A , S strongly supports x if, for any permutation π , ( ∀ a ∈ S. π ( a ) = a ) ⇐ ⇒ π x = x. • { a, b } strongly supports ( a, b ) but not { a, b } . • If one makes [( a, b ) { a, b } ] interact with [ { a, b } a ] = [ { a, b } b ] via { a, b } one gets both ( a, b ) a and ( a, b ) b. • Strong support is necessary/su ffi cient to preserve de- terminacy [Tzevelekos, LMCS’09].

  37. HIGHER-ORDER STATE • We cannot reveal higher-order values in the store. This would jeopardize full abstraction! • The properties of stored values will be revealed during play thanks to the use of special pointers to the store (in previous game models, pointers could only point at other moves). m ( a, † ) · · · n ( ··· )

  38. EXAMPLE x : ref ( int → int ) ⊢ ! x : int → int n ( n, † ) † ( n, † ) 1 ( n, † ) 1 ( n, † ) 3 ( n, † ) 3 ( n, † ) x : ref ( int → int ) ⊢ λ h int . (! x ) h : int → int n ( n, † ) ⋆ ( n, † ) 1 ( n, † ) 1 ( n, † ) 3 ( n, † ) 3 ( n, † )

  39. COMPOSITION • Move ownership (O-name vs P-name) • Interaction : enforce disjointness of P- names, propagate foreign names • Hiding : P-names cannot become O-names.

  40. NOMINAL GAMES BIBLIOGRAPHY • λν ! (Laird; FOSSACS’04) • ν (Abramsky, Ghica, M., Ong, Stark; LICS’04) • Concurrent ML (Laird; FOSSACS’06) • Reduced ML (M.,Tzevelekos; FOSSACS’09) • RefML (M., Tzevelekos; LICS’11) • Interface Middleweight Java (M.,Tzevelekos; POPL’14) • ExML (M., Tzevelekos; FOSSACS 2014)

Recommend


More recommend