asynchronous games
play

Asynchronous Games Paul-Andr Mellis Oregon Summer School in - PowerPoint PPT Presentation

Programming Languages in String Diagrams [ two ] Asynchronous Games Paul-Andr Mellis Oregon Summer School in Programming Languages June 2011 Starting point: game semantics Every proof of formula A initiates a dialogue where Proponent


  1. Programming Languages in String Diagrams [ two ] Asynchronous Games Paul-André Melliès Oregon Summer School in Programming Languages June 2011

  2. Starting point: game semantics Every proof of formula A initiates a dialogue where Proponent tries to convince Opponent Opponent tries to refute Proponent An interactive approach to logic and programming languages 2

  3. A formal proof of the drinker formula Axiom A ( x 0 ) ⊢ A ( x 0 ) Right Weakening A ( x 0 ) ⊢ A ( x 0 ) , ∀ x . A ( x ) Right ⇒ ⊢ A ( x 0 ) , A ( x 0 ) ⇒ ∀ x . A ( x ) Right ∃ ⊢ A ( x 0 ) , ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } Right ∀ ⊢ ∀ x . A ( x ) , ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } Left Weakening A ( y 0 ) ⊢ ∀ x . A ( x ) , ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } Right ⇒ ⊢ A ( y 0 ) ⇒ ∀ x . A ( x ) , ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } Right ∃ ⊢ ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } , ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } Contraction ⊢ ∃ y . { A ( y ) ⇒ ∀ x . A ( x ) } 3

  4. Duality Proponent Opponent Program Environment plays the game plays the game A ¬ A Negation permutes the rôles of Proponent and Opponent 4

  5. Duality Opponent Proponent Environment Program plays the game plays the game ¬ A A Negation permutes the rôles of Opponent and Proponent 5

  6. Tensor product ⊗ Play the two games in parallel 6

  7. Sum ⊕ Proponent selects one component 7

  8. Exponentials ⊗ ⊗ ⊗ · · · Opponent opens as many copies as necessary to beat Proponent 8

  9. Sequential games An idea dating back to André Joyal 9

  10. Traditional game semantics alternating A proof π A proof π sequences of moves Game semantics: an interleaving semantics of proofs. 10

  11. Sequential games A sequential game ( M , P , λ ) consists of a set of moves , M P ⊆ M ∗ a set of plays , a polarity function on moves λ : M → {− 1 , + 1 } such that every play is alternating and starts by Opponent. Alternatively, a sequential game is an alternating decision tree. 11

  12. � � Sequential games The boolean game B : Player in red � ����������������� � Opponent in blue � � � � � � � � true � false � � � � � � � question 12

  13. Deterministic strategies A strategy is a set of alternating plays of even-length σ s m 1 · · · m 2 k = such that: – σ contains the empty play, – is closed by even-length prefix: σ ∀ s , ∀ m , n ∈ M , s · m · n ∈ σ = ⇒ s ∈ σ – is deterministic: σ s · m · n 1 ∈ σ and s · m · n 2 ∈ σ ∀ s ∈ σ, ∀ m , n 1 , n 2 ∈ M , = ⇒ n 1 = n 2 . 13

  14. � � Three strategies on the boolean game B Player in red � ����������������� Opponent in blue � � � � � � � � � � true false � � � � � � � question 14

  15. Total strategies A strategy σ is total when – for every play s of the strategy σ – for every Opponent move m such that s · m is a play there exists a Proponent move n such that s · m · n is a play of σ . 15

  16. � � Two total strategies on the boolean game B Player in red � ����������������� Opponent in blue � � � � � � � � � � true false � � � � � � � question 16

  17. Tensor product Given two sequential games A and B , define A ⊗ B as the sequential game = M A ⊗ B M A + M B = [ λ A , λ B ] λ A ⊗ B = P A ⊗ B P A ⊗ P B where P A ⊗ P B denotes the set of alternating plays in M ∗ A ⊗ B obtained by interleaving a play s ∈ P A and a play t ∈ P B . 17

  18. Linear implication Given two sequential games A and B , define A ⊸ B as the sequential game = M A ⊸ B M A + M B = [ − λ A , λ B ] λ A ⊸ B = P A ⊸ B P A ⊸ P B where P A ⊸ P B denotes the set of alternating plays in M ∗ A ⊸ B obtained by interleaving a play s ∈ P A and a play t ∈ P B . 18

  19. A category of sequential games The category Games has – the sequential games as objects – the strategies of the sequential game σ ∈ A ⊸ B as maps : A −→ B σ 19

  20. The copycat strategy The identity map id A A A : −→ is the copycat strategy id A : A A ⊸ defined as id A { s ∈ P A ⊸ A | s = m 1 · m 1 · m 2 · m 2 · · · m k · m k } = 20

  21. The copycat strategy id A −→ A m 1 m 1 m 2 m 2 m 3 m 3 . . . . . . m k m k 21

  22. Composition Given two strategies σ τ A −→ B −→ C the composite strategy σ ; τ A −→ C is defined as u ↾ A = s ↾ A �   �   � s ↾ B = t ↾ B σ ; τ =  u ∈ P A ⊸ C ∃ s ∈ σ , ∃ t ∈ τ   �   �  u ↾ C = t ↾ C � The definition of composition is associative. 22

  23. Illustration id true 1 −→ −→ B B question question true true 23

  24. Illustration id false 1 −→ −→ B B question question false false 24

  25. Illustration negation true 1 −→ −→ B B question question true false 25

  26. An important isomorphism The sequential game A B C ( ⊗ ) ⊸ is isomorphic to the sequential game A ( B C ) ⊸ ⊸ for all sequential games A , B , C . Here, isomorphism means tree isomorphism. 26

  27. The category of sequential games Theorem. The category Games is symmetric monoidal closed. As such, it defines a model of linear λ -calculus. 27

  28. Illustration eval ( B B ) ⊗ −→ ⊸ B B question question bool bool f : B ⊸ B , x : B ⊢ f ( x ) : B 28

  29. Illustration eval ( B ⊸ B ) ⊗ B −→ B question question question question bool bool f ( bool ) f ( bool ) f : B ⊸ B , x : B ⊢ f ( x ) : B 29

  30. Illustration id ( B ⊸ B ) −→ B ⊸ B question question question question bool bool f ( bool ) f ( bool ) f : B ⊸ B ⊢ λ x . f ( x ) : B ⊸ B 30

  31. Currification More generally, the transformation of the term , x : A ⊢ f : B Γ into the term Γ ⊢ λ x . f : A ⊸ B does not alter the associated strategy, simply reorganizes it. 31

  32. Cartesian product Given two sequential games A and B , define A B & as the sequential game = M A & B M A M B + = λ A & B λ A + λ B = P A & B P A ⊕ P B where P A ⊕ P B is the coalesced sum of the pointed sets P A and P B . This means that every nonempty play in A & B is either in A or in B . 32

  33. The cartesian product For every sequential game X , there exists an isomorphism X ⊸ A & B ( X ⊸ A ) & ( X ⊸ B ) � This means that the game A & B is the cartesian product of A and B . 33

  34. The cartesian product For every game X , there exists a bijection between the strategies X −→ A & B and the pair of strategies X −→ A X −→ B . 34

  35. � � � � � � � � � The cartesian product The cartesian product A & B of two objects A and B is an object equipped with two maps A & B A A & B B π 1 : −→ π 2 : −→ such that for all diagrams f A π 1 � � � � � � � � � X A & B � � � � � π 2 � � � � B g there exists a unique map h : X −→ A × B making the diagram f A π 1 � � � � � � � � � X A & B h � � � � � � π 2 � � � B g commute. 35

  36. The exponential game Given a sequential game A , define ! A as the game = M ! A × M A N : ( i , m ) �→ λ A ( m ) λ ! A = P ! A ! P A where ! P A is the set of alternating plays in M ! A such that for all i ∈ N the restriction s ↾ i of s to the i -th component is a play of A 1 . for every prefix of s : 2 . u u ↾ i = ε ⇒ u ↾ i + 1 = ε. 36

  37. Two important isomorphisms Define A ⇒ B = ! A ⊸ B Observe the isomorphism ! ( A & B ) ! A ⊗ ! B � and the isomorphism ( A & B ) ⇒ C = ! ( A & B ) ⊸ C ( ! A ⊗ ! B ) ⊸ C � ! A ⊸ ( ! B ⊸ C ) � A ⇒ ( B ⇒ C ) = 37

  38. A model of the simply-typed λ -calculus Fact. Every simply-typed λ -term x 1 : A 1 · · · x k : A k ⊢ M : B , , may be interpreted as a strategy in the game ! A 1 ⊗ · · · ⊗ ! A k −→ B Here, the modality ! enables to backtrack in the sequential games 38

  39. Illustration M ! ( N ⊸ N ) ⊗ N −→ N question question 1 question 1 question 2 question 2 question n n f ( n ) f ( n ) f f ( n ) f f ( n ) f : ! ( N ⊸ N ) , x : N ⊢ f f ( x ) : N 39

  40. Asynchronous games An asynchronous reconstruction of the λ -calculus 40

  41. Geometry of rewriting b ( λy.M ) Q ( λx. ( λy.x )) MQ c a M ( λx. ( λy.x )) MN u ( λy.M ) N v Can we do the same thing for open systems ? 41

  42. � � The traditional interleaving semantics The boolean game B : Player in red � ����������������� � Opponent in blue � � � � � � � � true � false � � � � � � � question 42

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend