Semantic Games for Synchrony M. Mendler & J. Aguado Informatics - - PDF document

semantic games for synchrony
SMART_READER_LITE
LIVE PREVIEW

Semantic Games for Synchrony M. Mendler & J. Aguado Informatics - - PDF document

Semantic Games for Synchrony M. Mendler & J. Aguado Informatics Theory Group University of Bamberg What is this talk about? To illustrate how the co-contravariant fixed point problem in synchronous languages can be handled by means of a


slide-1
SLIDE 1

Semantic Games for Synchrony

  • M. Mendler & J. Aguado

Informatics Theory Group University of Bamberg

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

2

What is this talk about?

  • To illustrate how the co-contravariant fixed point problem in

synchronous languages can be handled by means of a game theory approach.

  • To show that the Must/Cannot analysis of combinational

Esterel corresponds to the computation of winning strategies

  • f a particular game (the maze).
  • Sequencing is modelled by a notion of stratified plays.
slide-2
SLIDE 2

Synchronous Configurations: A Declarative View

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

4

Programming Synchronous Reactions

At every instant, signals may be present or absent, emitted or not emitted

(reactive) instant clock

"if a present and b absent, then emit c and d" a, ¬b / c, d trigger / action positive negative

  • nly positive

Transitions P, ¬N / A

slide-3
SLIDE 3
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

5

Programming Synchronous Reactions

"if a present and b absent, then emit c and d" a, ¬b / c, d trigger / action Positive negative

  • nly positive

Transitions P, ¬N / A Declarative a ∧¬b ⊃ c ∧ d

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

6

How do we code configurations ?

Transitions a / b c / d Nondeterministic (Statecharts) a, ¬t2 / b c, ¬t1 / d (a ∧ ¬t2 ⊃ b) ∧ (c ∧ ¬t1 ⊃ d)

Reducible to parallel composition of transitions

t1 t2 Encoding

slide-4
SLIDE 4
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

7

How do we code configurations ?

Transitions a / b c / d Deterministic (Esterel, SyncCharts) a / b c, ¬a / d (a ⊃ b) ∧ (c ∧ ¬a ⊃ d) <1> <2> Priority Encoding

Reducible to parallel composition of transitions

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

8

How do we execute configurations ?

Transitions a / b c / d t2 t1 Encoding

Nondeterministic:

(a ∧ ¬t2 ⊃ b) ∧ (c ∧ ¬t1 ⊃ d) Deterministic (a ⊃ b) ∧ (c ∧ ¬a ⊃ d) (a ∧ ¬c ⊃ b) ∧ (c ⊃ d) Sequential

Reducible to parallel composition of transitions

slide-5
SLIDE 5
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

9

How do we code configurations ?

Sequential Transitions a / b c / d t2 t1 Eager t2 t1 t1 t2 Lazy t2

Reducible to parallel composition of transitions

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

10

How do we code configurations ?

Transitions a / b c / d t2 t1 Sequential (Eager) a/ b, t1 c, t1/ d (a ⊃ b ∧ t1) ∧ (c ∧ t1 ⊃ d) Encoding

Reducible to parallel composition of transitions

slide-6
SLIDE 6
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

11

How do we code configurations ?

Sequential (Lazy) a / b, t1 (a ⊃ b ∧ t1) ∧ (c ∧ t1 ⊃ d) ∧ (c ∧ ¬a / d) Transitions a / b c / d t2 t1 Encoding c, (t1 ∨ ¬a) / d

Reducible to parallel composition of transitions

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

12

How do we code configurations ?

reducible to parallel composition of transitions environment stimulus (event) reaction (event) ⇒ ⇒

Configuration

Choice and priorities can be represented using negations

environment input + configuration ⇒ reaction

t1∥t2∥ ...∥tN

slide-7
SLIDE 7
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

13

How do we code configurations ?

reducible to parallel composition of transitions reaction (event) ⇒

Configuration

Choice and priorities can be represented using negations

configuration ⇒ reaction

Environment stimulus can be accounted for as part of the configuration

t1∥t2∥ ...∥tN∥/a,e

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

14

Configurations

Kernel syntax (for "instantaneous" reactions in the combinational fragment) C ::= nothing | emit s | present s then C | present s else C | C || C C ::= true | s | s / C | ¬s / C | C || C present s then C else D s / C || ¬s / D

slide-8
SLIDE 8

Have a break ... play a Maze

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

16

  • Players A, B take alternate turns:

visible corridor ( ) = turn changes to opponent secret corridor ( ) = player keeps his/her turn

  • Winning Rule: “last player loses”

Finite 2-Player Games

Finite game graph (maze) rooms visible corridor secret corridor dungeon token

slide-9
SLIDE 9
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

17

Finite 2-Player Games

A starts

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

18

Finite 2-Player Games

A

slide-10
SLIDE 10
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

19

Finite 2-Player Games

B

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

20

Finite 2-Player Games

A

slide-11
SLIDE 11
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

21

Finite 2-Player Games

B

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

22

Finite 2-Player Games

A loses

slide-12
SLIDE 12
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

23

Finite 2-Player Games

A

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

24

Finite 2-Player Games

B

slide-13
SLIDE 13
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

25

Finite 2-Player Games

A

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

26

Finite 2-Player Games

B loses

slide-14
SLIDE 14
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

27

Strategies

Let M = (R, , ) be a finite maze and ≔ ∪ . →

ι

τ

rooms visible secret corridors

γ

ι

τ

A strategy is a partial mapping α : R → R such that ∀r. if α(r) is defined then r α(r). →

γ

A pair of strategies (α, β) and a start room r determines a unique play in M, denoted play(α, β, r), where player A uses function α player B uses function β to determine his/her next move, as long as α and β are defined (maximality).

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

28

Winning Positions

A room r ∈ R is called a winning position (for the starting player A) if ∃α.∀β. last(α, β, r) = B losing position (for the starting player A) if ∀α.∃β. last(α, β, r) = A Let length(α, β, r) be the length (possibly ∞). Let last(α, β, r) ∈ {A, B, ⊥} the last player in play(α, β, r).

slide-15
SLIDE 15
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

29

Winning Positions

A room r ∈ R is called an n-winning position (for the starting player A) if ∃α.∀β. length(α, β, r) ≤ n & last(α, β, r) = B n-losing position (for the starting player A) if ∀α.∃β. length(α, β, r) ≤ n & last(α, β, r) = A n-safe position (for the starting player A) if ∃α.∀β. length(α, β, r) > n ∨ last(α, β, r) = B Let length(α, β, r) be the length (possibly ∞). Let last(α, β, r) ∈ {A, B, ⊥} the last player in play(α, β, r).

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

30

Computing Winning Positions

Rwin

n ≔ {r∈R | r is n-winning } Rsafe n ≔ {r∈R | r is n-safe }

Bounded Winning Iterative Approximation: R-1

win ≔ ∅

R-1

safe ≔ all

Rn+1

win ≔ {r∈R | ∃s∈R.

(r s ∧ s∈Rn

win) ∨ (r s ∧ s∉Rn safe)}

Rn+1

safe ≔ {r∈R | ∃s∈R.

(r s ∧ s∈Rn

safe) ∨ (r s ∧ s∉Rn win)}

τ

ι

ι

τ

slide-16
SLIDE 16
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

31

Computing Winning Positions

The iteration constructs approximation sequences ∅ ⊆ R0

win ⊆ R1 win ⊆ R2 win ⊆ ... ⊆ Rn win ⊆ ...

all ⊇ R0

safe ⊇ R1 safe ⊇ R2 safe ⊇ ... ⊇ Rn safe ⊇ ...

in which ∅ ⊆ Rn+1

win ⊆ Rn+1 safe ⊆ all.

Theorem (standard result) Let Rwin ≔ ∪n Rn

win and Rsafe ≔ ∩n Rn

  • safe. Then,
  • r ∈ Rwin iff r winning position
  • r ∈ all \ Rsafe iff r losing position
  • r ∈ Rsafe \ Rwin iff r draw position.

So, what is the game in a synchronous reaction ?

slide-17
SLIDE 17
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

33

Configurations as Mazes

a b c d

  • rooms = signals, corridors = transitions
  • winning position = signal present
  • losing position = signal absent

z x y c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b Maze GC Configuration C

if c is winning position then a is winning position if b is losing position then d is winning position

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

34

Mazes as Configurations

a b c d z x y c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b Maze GC Configuration C

R-1

win = ∅

R-1

safe = {a, b, c, d, x, y, z }

slide-18
SLIDE 18
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

35

The Esterel Game

a b c d z x y c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b Maze GC Configuration C

R0

win = ∅

R0

safe = {a, b, c, d, x, y }

lose present z absent

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

36

The Esterel Game

a b c d z x y c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b Maze GC Configuration C

R1

win = { b }

R1

safe = {a, b, c, d, x, y }

b present z absent lose

slide-19
SLIDE 19
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

37

The Esterel Game

a b c d z x y c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b Maze GC Configuration C

R2

win = { b }

R2

safe = {a, b, d, x, y }

lose b present z,c absent

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

38

The Esterel Game

a b c d z x y Maze GC Configuration C

R3

win = { b }

R3

safe = {a, b, d, x }

lose b present z,c,y absent c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b

slide-20
SLIDE 20
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

39

The Esterel Game

a b c d z x y Maze GC Configuration C

R4

win = { b, d }

R4

safe = {a, b, d, x }

lose c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b b,d present z,c,y absent

  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

40

The Esterel Game

a b c d z x y Maze GC Configuration C

R5

win = { b, d } = R4 win

R5

safe = {a, b, d, x } = R4 safe

lose Fixed point reached b,d present z,c,y absent c/a║a/x║¬x/a║¬d/a║¬d/x║¬y/d║c/y║¬b/c║¬b/y║¬b/d║¬z/b

slide-21
SLIDE 21
  • J. Aguado, Dec/02/03 SYNCHRON'03 Marseille

41

Coincidence Theorem

Theorem Let C be a configuration and GC be the game associated with C. Then, for all signals a ∈ Sigs:

 a is present in the Esterel reaction of C

iff a is a winning position in GC

 a is absent in the Esterel reaction of C

iff a is a losing position in GC

 a is non-constructive in the Esterel reaction of C

iff a is a draw position