Simon Castellan, LIP Soutenance de thèse 13 juillet 2017iso.mor.phis.me/publis/soutenance.pdf · A...

Preview:

Citation preview

Structures concurrentes en sémantique des jeux

Simon Castellan, LIPSoutenance de thèse

13 juillet 2017

A Monopoly problem: the theory

Property of Albert. Property of Barnabé.

To buy both:

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 2 / 37

A Monopoly problem: the practice

� (to B) How much for parklane?� (B) ¿400.� (to A) How much for mayfair?� (A) Never mind the monopoly,I need money: ¿300

Total price: ¿700.

� (to A) How much for mayfair?� (A) I need money: ¿300� (to B) How much for parklane?� (B) Eh! This monopoly willcost you: ¿600

Total price: ¿900.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 3 / 37

A Monopoly problem: the practice

� (to B) How much for parklane?� (B) ¿400.� (to A) How much for mayfair?� (A) Never mind the monopoly,I need money: ¿300

Total price: ¿700.

� (to A) How much for mayfair?� (A) I need money: ¿300� (to B) How much for parklane?� (B) Eh! This monopoly willcost you: ¿600

Total price: ¿900.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 3 / 37

Beyond formulae : strategies

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Same formula, two di�erent strategies:

Albert then Barnabé

(to A) How much for mayfair? qA

(A) I need money: ¿300

200 . . .

300

. . . 500

(to B) How much for park lane?

qB

qB

qB

(B) Eh! ¿600

500 . . .

600

. . . 300

Total price: ¿900

700

900

800

A branch is a play of the strategy against a particular environment.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 4 / 37

Beyond formulae : strategies

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Same formula, two di�erent strategies:

Albert then Barnabé

(to A) How much for mayfair? qA

(A) I need money: ¿200 200

. . .

300

. . . 500

(to B) How much for park lane? qB qB

qB

(B) Eh! ¿500 500

. . .

600

. . . 300

Total price: ¿700 700 900

800

A branch is a play of the strategy against a particular environment.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 4 / 37

Beyond formulae : strategies

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Same formula, two di�erent strategies:

Barnabé then Albert

Albert then Barnabé

(to A) How much for mayfair?

qA

(A) I need money: ¿300

200 . . . 300 . . . 500

(to B) How much for park lane?

qB qB qB

(B) Eh! ¿600

500 . . . 600 . . . 300

Total price: ¿900

700 900 800

A branch is a play of the strategy against a particular environment.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 4 / 37

Beyond formulae : strategies

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Same formula, two di�erent strategies:

Barnabé then Albert Albert then Barnabé

qB qA

200 . . . 400 . . . 500 200 . . . 300 . . . 500

qA qA qA qB qB qB

500 . . . 300 . . . 300 500 . . . 600 . . . 400

700 700 800 700 900 900

A branch is a play of the strategy against a particular environment.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 4 / 37

Beyond formulae : strategies

price = price Albert+ price Barnabé?= price Barnabé+ price Albert

Same formula, two di�erent strategies:

Barnabé then Albert Albert then Barnabé

qB qA

200 . . . 400 . . . 500 200 . . . 300 . . . 500

qA qA qA qB qB qB

500 . . . 300 . . . 300 500 . . . 600 . . . 400

700 700 800 700 900 900

A branch is a play of the strategy against a particular environment.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 4 / 37

Two kinds of interpretationsThose strategies correspond to di�erent programs:

x = askAlbert() x = askBarnabé()y = askBarnabé() y = askAlbert()tot = x + y tot = x + y

These programs have two di�erent interpretations (or semantics):

I Static interpretation via formulae

(Input / Output)

price = price Albert+ price Barnabé

I Dynamic interpretation via strategies

(Interactive process)

qB

. . . 300 . . . 400 . . . 500

. . . qA . . . qA . . . qA

. . . 300 . . . 400 . . . 200

. . . 600 . . . 800 . . . 700

qA

. . . 300 . . . 400 . . . 500

. . . qB . . . qB . . . qB

. . . 300 . . . 400 . . . 200

. . . 600 . . . 800 . . . 700

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 5 / 37

Two kinds of interpretationsThose strategies correspond to di�erent programs:

x = askAlbert() x = askBarnabé()y = askBarnabé() y = askAlbert()tot = x + y tot = x + y

These programs have two di�erent interpretations (or semantics):

I Static interpretation via formulae (Input / Output)

price = price Albert+ price Barnabé

I Dynamic interpretation via strategies (Interactive process)qB

. . . 300 . . . 400 . . . 500

. . . qA . . . qA . . . qA

. . . 300 . . . 400 . . . 200

. . . 600 . . . 800 . . . 700

qA

. . . 300 . . . 400 . . . 500

. . . qB . . . qB . . . qB

. . . 300 . . . 400 . . . 200

. . . 600 . . . 800 . . . 700

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 5 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=f (

?

0 ) + f (

?

1 )

2

q

qf

q 3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

?

average(f )=f (

?

0 ) + f (

?

1 )

2against f (x)= 2× x + 3

q

qf

q 3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=f (

?

0 ) + f (

?

1 )

2against

?

f (x)= 2× x + 3

q

qf

q 3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=f (

?0 ) + f (

?

1 )

2against f (x)= 2× x + 3

q

qf

q

3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=f (0) + f (

?

1 )

2against f (x)= 2× 0+ 3

q

qf

q

3

0

qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=3+ f (

?

1 )

2against f (x)= 3

q

qf

q 3

0

qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=3+ f (

?

1 )

2against

?

f (x)= 2× x + 3

q

qf

q 3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=3+ f (

?1 )

2against f (x)= 2× x + 3

q

qf

q 3

0 qf

q

5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=3+ f (

?

1 )

2against f (x)= 2× 1+ 3

q

qf

q 3

0 qf

q

5

1

4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=3+ 5

2against f (x)= 5

q

qf

q 3

0 qf

q 5

1

4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )= 4 against f (x)= 2× x + 3

q

qf

q 3

0 qf

q 5

1 4

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semantics

Game semantics interpretation of more complicated formulae:

average(f )=f (0)+ f (1)

2

q

qf

q n

0 qf

q m

1 n+m2

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

Game semanticsGame semantics interpretation of more complicated formulae:

average(f )=f (0)+ f (1)

2

q

qf

q n

0 qf

q m

1 n+m2

q

qf

q m

1 qf

q n

0 n+m2

left then right right then left

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 6 / 37

What if we want to compute in parallel?

q

qf qf

q n q m

0 1

n+m2

ProblemUsual game semantics only manipulates sequential plays.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 7 / 37

What if we want to compute in parallel?

q

qf qf

q n q m

0 1

n+m2

ProblemUsual game semantics only manipulates sequential plays.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 7 / 37

What if we want to compute in parallel?

q

qf qf

q n q m

0 1

n+m2

ProblemUsual game semantics only manipulates sequential plays.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 7 / 37

Is this sound?For which strategies is this optimization correct?

Code

Average

func f1(x):return 2x + 3

4

func f2(x):if(rand()) return 2× x

0, 1, or 2

else return 0func f3(x):increment counter

depends on the impl.

return counter

Correct sequential strategies are innocent and well-bracketed.

ProblemAnd what about concurrent strategies?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 8 / 37

Is this sound?For which strategies is this optimization correct?

Code Averagefunc f1(x):return 2x + 3 4

func f2(x):if(rand()) return 2× x

0, 1, or 2

else return 0func f3(x):increment counter

depends on the impl.

return counter

Correct sequential strategies are innocent and well-bracketed.

ProblemAnd what about concurrent strategies?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 8 / 37

Is this sound?For which strategies is this optimization correct?

Code Averagefunc f1(x):return 2x + 3 4

func f2(x):if(rand()) return 2× x 0, 1, or 2else return 0

func f3(x):increment counter

depends on the impl.

return counter

Correct sequential strategies are innocent and well-bracketed.

ProblemAnd what about concurrent strategies?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 8 / 37

Is this sound?For which strategies is this optimization correct?

Code Averagefunc f1(x):return 2x + 3 4

func f2(x):if(rand()) return 2× x 0, 1, or 2else return 0

func f3(x):increment counter depends on the impl.return counter

Correct sequential strategies are innocent and well-bracketed.

ProblemAnd what about concurrent strategies?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 8 / 37

Is this sound?For which strategies is this optimization correct?

Code Averagefunc f1(x):return 2x + 3 4

func f2(x):if(rand()) return 2× x 0, 1, or 2else return 0

func f3(x):increment counter depends on the impl.return counter

Correct sequential strategies are innocent and well-bracketed.

ProblemAnd what about concurrent strategies?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 8 / 37

Partial orders or interleavings?

To represent concurrency:

preheat

dough mold

oven

vs.

preheat

dough

mold

oven

,

preheat

mold

dough

oven

partial order

(true concurrency)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 9 / 37

Partial orders or interleavings?

To represent concurrency:

preheat

dough mold

oven

vs.

preheat

dough

mold

oven

,

preheat

mold

dough

oven

partial order interleavings

(true concurrency)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 9 / 37

Game semantics: sequential strategies

CompositionJoyal '77

Non-linear frameworkCoquand '91

Hyland, Ong / Nickau '90sAbramsky, Jagadeesan, Malacaria '90s

InnocenceHO/N '90s

Well-bracketingHO/N '90s, AJM '90s

Functional (PCF)HO/N '90s, AJM '90s

StateAbramsky, McCusker '96

Abramsky, Honda, McCusker '98

ControlCartwright, Curien, Felleisen '94

Laird '97

Prog. Lang.Murawski, Tzevelekos '09 '14

ApplicationsGhica, McCusker '03

Ghica '07Murawski, Tzevelekos '11

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 10 / 37

Game semantics: sequential strategies

CompositionJoyal '77

Non-linear frameworkCoquand '91

Hyland, Ong / Nickau '90sAbramsky, Jagadeesan, Malacaria '90s

InnocenceHO/N '90s

Well-bracketingHO/N '90s, AJM '90s

Functional (PCF)HO/N '90s, AJM '90s

StateAbramsky, McCusker '96

Abramsky, Honda, McCusker '98

ControlCartwright, Curien, Felleisen '94

Laird '97

Prog. Lang.Murawski, Tzevelekos '09 '14

ApplicationsGhica, McCusker '03

Ghica '07Murawski, Tzevelekos '11

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 10 / 37

Game semantics: sequential strategies

CompositionJoyal '77

Non-linear frameworkCoquand '91

Hyland, Ong / Nickau '90sAbramsky, Jagadeesan, Malacaria '90s

InnocenceHO/N '90s

Well-bracketingHO/N '90s, AJM '90s

Functional (PCF)HO/N '90s, AJM '90s

StateAbramsky, McCusker '96

Abramsky, Honda, McCusker '98

ControlCartwright, Curien, Felleisen '94

Laird '97

Prog. Lang.Murawski, Tzevelekos '09 '14

ApplicationsGhica, McCusker '03

Ghica '07Murawski, Tzevelekos '11

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 10 / 37

Game semantics: sequential strategies

CompositionJoyal '77

Non-linear frameworkCoquand '91

Hyland, Ong / Nickau '90sAbramsky, Jagadeesan, Malacaria '90s

InnocenceHO/N '90s

Well-bracketingHO/N '90s, AJM '90s

Functional (PCF)HO/N '90s, AJM '90s

StateAbramsky, McCusker '96

Abramsky, Honda, McCusker '98

ControlCartwright, Curien, Felleisen '94

Laird '97

Prog. Lang.Murawski, Tzevelekos '09 '14

ApplicationsGhica, McCusker '03

Ghica '07Murawski, Tzevelekos '11

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 10 / 37

Game semantics: concurrent strategies via interleavings

CompositionLaird '01

Non-linear frameworkLaird '01

Innocence?

Well-bracketingGhica, Murawski '07

Functional?

StateGM '07

Control?

Prog. Lang.GM '07

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 11 / 37

Game semantics: truly concurrent strategies

CompositionAbramsky, Melliès '99

Curien, Faggian '05 and Faggian, Piccolo '09Rideau, Winskel '11

Non-linear framework?

InnocenceMelliès-Mimram '07

(II) CCW '15

Well-bracketing?

Functional?

State?

Control?

Prog. Lang.?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 12 / 37

Game semantics: truly concurrent strategies

CompositionAbramsky, Melliès '99

Curien, Faggian '05 and Faggian, Piccolo '09Rideau, Winskel '11

Non-linear framework(I) C., Clairambault, Winskel '14 '15

InnocenceMelliès-Mimram '07

(II) CCW '15

Well-bracketing?

Functional?

State?

Control?

Prog. Lang.?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 12 / 37

Game semantics: truly concurrent strategies

CompositionAbramsky, Melliès '99

Curien, Faggian '05 and Faggian, Piccolo '09Rideau, Winskel '11

Non-linear framework(I) C., Clairambault, Winskel '14 '15

InnocenceMelliès-Mimram '07

(II) CCW '15

Well-bracketingC., Clairambault '17

(similar to GM '07)

Functional(II) CCW '15

State?

Control?

Prog. Lang.?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 12 / 37

Game semantics: truly concurrent strategies

CompositionAbramsky, Melliès '99

Curien, Faggian '05 and Faggian, Piccolo '09Rideau, Winskel '11

Non-linear framework(I) C., Clairambault, Winskel '14 '15

InnocenceMelliès-Mimram '07

(II) CCW '15

Well-bracketingC., Clairambault '17

(similar to GM '07)

Functional(II) CCW '15

StateC., Clairambault '16

via collapse to GM '07

Control?

Prog. Lang.?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 12 / 37

Game semantics: truly concurrent strategies

CompositionAbramsky, Melliès '99

Curien, Faggian '05 and Faggian, Piccolo '09Rideau, Winskel '11

Non-linear framework(I) C., Clairambault, Winskel '14 '15

InnocenceMelliès-Mimram '07

(II) CCW '15

Well-bracketingC., Clairambault '17

(similar to GM '07)

Functional(II) CCW '15

StateC., Clairambault '16

via collapse to GM '07

Control?

Prog. Lang.(III) C. '15 '17

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 12 / 37

I. A framework for partial-order strategies

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 13 / 37

GamesGame: partial order where each move has a polarity (Opponent,Player).

deal

qA qB ok

yesA yesB

(N ⇒ N) ⇒ Nq

q n

q m

k

From a game A we build its dual A⊥ by reversing polarities:

deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 14 / 37

GamesGame: partial order where each move has a polarity (Opponent,Player).

deal

qA qB ok

yesA yesB

(N ⇒ N) ⇒ Nq

q n

q m

k

From a game A we build its dual A⊥ by reversing polarities:

deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 14 / 37

GamesGame: partial order where each move has a polarity (Opponent,Player).

deal

qA qB ok

yesA yesB

(N ⇒ N) ⇒ Nq

q n

q m

k

From a game A we build its dual A⊥ by reversing polarities:

deal⊥

qA qB ok

yesA yesBStructures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 14 / 37

(Deterministic) Strategies

dealqA qB ok

yesA yesB

σA‖B : Albert and Barnabé in parallel

Strategies on A⊥ represent counter-strategies:

τ :

deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 15 / 37

(Deterministic) Strategies

dealqA qB ok

yesA yesB

σA;B : Albert then Barnabé

Strategies on A⊥ represent counter-strategies:

τ :

deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 15 / 37

(Deterministic) Strategies

dealqA qB ok

yesA yesB

σA‖B : Albert and Barnabé in parallel

Strategies on A⊥ represent counter-strategies:

τ :

deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 15 / 37

(Deterministic) Strategies

dealqA qB ok

yesA yesB

σA‖B : Albert and Barnabé in parallel

De�nitionA strategy on (A,≤A) is a partial order σ = (S ,≤S) such that

I S ⊆ A, and if s ≤A s ′ then s ≤S s ′ (rule-respecting)

I S only adds immediate links �_ ⊕ (courteous)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 15 / 37

(Deterministic) Strategies

dealqA qB ok

yesA yesB

σA‖B : Albert and Barnabé in parallel

Strategies on A⊥ represent counter-strategies:

τ : deal⊥

qA qB ok

yesA yesB

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 15 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA‖B : deal σA‖B ~ τ τ : deal⊥

qA qB ok

qA qB ok

qA qB ok

yesA yesB

yesA yesB

yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA‖B : deal σA‖B ~ τ τ : deal⊥

qA qB ok qA qB

ok

qA qB ok

yesA yesB

yesA yesB

yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA‖B : deal σA‖B ~ τ τ : deal⊥

qA qB ok qA qB

ok

qA qB ok

yesA yesB yesA yesB yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA‖B : deal σA‖B ~ τ τ : deal⊥

qA qB ok qA qB ok qA qB ok

yesA yesB yesA yesB yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA;B : deal σA;B ~ τ τ : deal⊥

qA qB ok

qA qB ok

qA qB ok

yesA yesB

yesA yesB

yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA;B : deal σA;B ~ τ τ : deal⊥

qA qB ok qA qB ok qA qB ok

yesA yesB yesA yesB yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA;B : deal σA;B ~ τ τ : deal⊥

qA qB ok qA qB ok qA qB ok

yesA yesB yesA yesB yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Interaction of strategies

Given a strategy on A and one on A⊥, how do they interact?

σA;B : deal σA;B ~ τ τ : deal⊥

qA qB ok qA qB ok qA qB ok

yesA yesB yesA yesB yesA yesB

De�nitionThe interaction of (S ,≤S) and (T ,≤T ) is obtained from

(S ∩ T , (≤S ∪ ≤T )∗)

by removing events occurring in a causal loop.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 16 / 37

Composition

Interaction is used to compute application and composition of strat.

average

� d

: (N ⇒ N) ⇒ Nq

q

q n

0 q

q m

1 n+m2

d : N ⇒ N

q

q

d

2× d + 3

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 17 / 37

Composition

Interaction is used to compute application and composition of strat.

average

� d

: (N ⇒ N) ⇒ Nq

q

q n

0 q

q m

1 n+m2

d : N ⇒ N

q

q

d

2× d + 3

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 17 / 37

Composition

Interaction is used to compute application and composition of strat.

average~ d : (N ⇒ N) ⇒ Nq

q

q 3

0 q

q 5

1 4

d : N ⇒ N

q

q

d

2× d + 3

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 17 / 37

Composition

Interaction is used to compute application and composition of strat.

average� d :

(N ⇒ N) ⇒

Nq

q

q 3

0 q

q 5

1 4

d : N ⇒ N

q

q

d

2× d + 3

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 17 / 37

Linearity & duplication

Our average strategy is not a strategy!

It is not linear:

average(f ) =f (0) + f (1)

2

average : (N ⇒ N) ⇒ Nq

q

q n

0 q

q m

1 n+m2

(N ⇒ N) ⇒ N

q

q n

q m

k

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 18 / 37

Linearity & duplication

Our average strategy is not a strategy! It is not linear:

average(f ) =f (0) + f (1)

2

average : (N ⇒ N) ⇒ Nq

q

q n

0 q

q m

1 n+m2

(N ⇒ N) ⇒ N

q

q n

q m

k

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 18 / 37

Copy indices & the game !ATo solve this problem, we play on expanded arenas.

N =q

n !N =

q0 . . . qi . . .

0j 1k . . . . . . nl . . .

A (parallel) strategy implementing d(x) := x + x becomes:

!( N ⇒ N )

qi

q0 q1

nj nk

(n +m)f (j ,k)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 19 / 37

Copy indices & the game !ATo solve this problem, we play on expanded arenas.

N =q

n !N =

q0 . . . qi . . .

0j 1k . . . . . . nl . . .

A (parallel) strategy implementing d(x) := x + x becomes:

!( N ⇒ N )

qi

q17 q43

nj nk

(n +m)f (j ,k)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 19 / 37

The cartesian-closed category CHO

We get a cartesian closed category (CCC):

Theorem (C., Clairambault, Winskel)

The following structure CHO is a CCC:

Objects Games A (which are alternating forests)

Morphisms Strategies uniform (and single-threaded) on !(A⇒ B).

(Usual sequential innocent HO games form a subcategory of CHO)

Rich semantic framework to interpret concurrent higher-orderprograms.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 20 / 37

What was swept under the rug

I Manage to identify strategies up to choice of copy indices.

A notion of weak isomorphism

I De�ne a notion of uniformity (when a strategy is blind toOpponent indices).

Strategies become equipped with symmetry.

I Show that, on uniform strategies, weak isomorphism is acongruence.

Proof of a bipullback property of interaction.

I Representation of nondeterminism in strategies

Addition of essential events.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 21 / 37

What was swept under the rug

I Manage to identify strategies up to choice of copy indices.

A notion of weak isomorphism

I De�ne a notion of uniformity (when a strategy is blind toOpponent indices).

Strategies become equipped with symmetry.

I Show that, on uniform strategies, weak isomorphism is acongruence.

Proof of a bipullback property of interaction.

I Representation of nondeterminism in strategies

Addition of essential events.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 21 / 37

Nondeterminism via event structures

Nondeterminism can be represented via a con�ict relation:

coin : B

q

tt ff

De�nitionAn event structure is a partial order E equipped with a binaryrelation (representing con�ict) satisfying some axioms.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 22 / 37

Nondeterminism via event structures

Nondeterminism can be represented via a con�ict relation:

coin : B

q

tt ff

De�nitionAn event structure is a partial order E equipped with a binaryrelation (representing con�ict) satisfying some axioms.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 22 / 37

Hidden divergences via essential events

But, nondeterminism and composition require some care:

σ

} coin

: B ⇒ B

q

q

tt ff

ff

σ � coin coincides with ff !

τ } σ retains more information than τ � σ (must adequacy)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 23 / 37

Hidden divergences via essential events

But, nondeterminism and composition require some care:

σ ~ coin :

B ⇒

B

q

q

tt ff

ff

σ � coin coincides with ff !

τ } σ retains more information than τ � σ (must adequacy)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 23 / 37

Hidden divergences via essential events

But, nondeterminism and composition require some care:

σ � coin :

B ⇒

B

q

q

tt ff

ff

σ � coin coincides with ff !

τ } σ retains more information than τ � σ (must adequacy)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 23 / 37

Hidden divergences via essential events

But, nondeterminism and composition require some care:

σ } coin :

B ⇒

B

q

q

tt ff

ff

σ � coin coincides with ff !

τ } σ retains more information than τ � σ (must adequacy)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 23 / 37

II. Order of evaluation and innocence

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 24 / 37

PCF and its interpretationsWe can interpret PCF in CHO:

A,B ::= N | B | proc | A⇒ B (PCF types)

M,N ::= tt | ff | ifM N1N2 | () | M;N

| x | λx .M | M N | Y | . . . (PCF terms)

Two interpretations of if in CHO:

ifs : B ⇒ N ⇒ N ⇒ N

q

q

tt ff

q q

n m

n m

ifp : B ⇒ N ⇒ N ⇒ N

q

q q q

tt ff n m

n m

These two interpretations are indistinguishable by terms of PCF.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 25 / 37

PCF and its interpretationsWe can interpret PCF in CHO:

A,B ::= N | B | proc | A⇒ B (PCF types)

M,N ::= tt | ff | ifM N1N2 | () | M;N

| x | λx .M | M N | Y | . . . (PCF terms)

Two interpretations of if in CHO:

ifs : B ⇒ N ⇒ N ⇒ N

q

q

tt ff

q q

n m

n m

ifp : B ⇒ N ⇒ N ⇒ N

q

q q q

tt ff n m

n m

These two interpretations are indistinguishable by terms of PCF.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 25 / 37

PCF and its interpretationsWe can interpret PCF in CHO:

A,B ::= N | B | proc | A⇒ B (PCF types)

M,N ::= tt | ff | ifM N1N2 | () | M;N

| x | λx .M | M N | Y | . . . (PCF terms)

Two interpretations of if in CHO:

ifs : B ⇒ N ⇒ N ⇒ N

q

q

tt ff

q q

n m

n m

ifp : B ⇒ N ⇒ N ⇒ N

q

q q q

tt ff n m

n m

These two interpretations are indistinguishable by terms of PCF.Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 25 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong?

Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong?

Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong?

Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong?

Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong? Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Sometimes parallel if just is not the same

sync : (proc ⇒ proc ⇒ proc) ⇒ proc

q

q

q q ()

() () ()

sync can distinguish both implementations of if.

( For Mε = λxλy .ifε (x ; tt) (y ; tt) tt:

syncMp converges but not syncMs .)

What is wrong? Player merges two threads started by Opponent.

Banning such patterns gives a notion of concurrent innocence.Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 26 / 37

Finite de�nability

A PCF strategy is an innocent and well-bracketed strategy.

Theorem (Finite de�nability)

If σ is PCF strategy, there exists a term M of PCF such that

JMK and σ are indistinguishable by PCF strategies.

B ⇒ proc ⇒ Bq

q q

tt ff ()

()

λbλx . if b⊥ x

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 27 / 37

Finite de�nability

A PCF strategy is an innocent and well-bracketed strategy.

Theorem (Finite de�nability)

If σ is PCF strategy, there exists a term M of PCF such that

JMK and σ are indistinguishable by PCF strategies.

B ⇒ proc ⇒ Bq

q q

tt ff ()

()

λbλx . if b⊥ x

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 27 / 37

Finite de�nability

A PCF strategy is an innocent and well-bracketed strategy.

Theorem (Finite de�nability)

If σ is PCF strategy, there exists a term M of PCF such that

JMK and σ are indistinguishable by PCF strategies.

B ⇒ proc ⇒ Bq

q q

tt ff ()

()

λbλx . x ; if b⊥ ()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 27 / 37

What was swept under the rug 2

I Innocence and well-bracketing:I Stability under composition. Forking lemma.

I Requires the addition of visibility (and locality). Control interferences between Player threads

I Finite de�nability:I De�ne a notion of �nite strategies. Reduced form (P-view �dag�)

I Factorisation theorem for higher-order strategies. First-order / λ-calculus

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 28 / 37

What was swept under the rug 2

I Innocence and well-bracketing:I Stability under composition. Forking lemma.

I Requires the addition of visibility (and locality). Control interferences between Player threads

I Finite de�nability:I De�ne a notion of �nite strategies. Reduced form (P-view �dag�)

I Factorisation theorem for higher-order strategies. First-order / λ-calculus

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 28 / 37

III. What lies beyond PCF?

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 29 / 37

What real concurrent programs are made of

while(1) { while(1) {while (canWrite == 0) ; while (canRead == 0) ;x = produce(); x = value;value := x; consume(x);canRead := 1; canWrite := 0; canRead := 0; canWrite := 1;

} }

loops, conditionals, function calls, shared memory.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 30 / 37

What real concurrent programs are made of

while(1) { while(1) {while (canWrite == 0) ; while (canRead == 0) ;x = produce(); x = value;value := x; consume(x);canRead := 1; canWrite := 0; canRead := 0; canWrite := 1;

} }

loops, conditionals, function calls︸ ︷︷ ︸in PCF

, shared memory.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 30 / 37

What real concurrent programs are made of

value := 1; f ← canRead;canRead := 1; x ← value ;

Expectation: f = 1 implies x = 1

loops, conditionals, function calls, shared memory

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 30 / 37

What real concurrent programs are made of

value := 1; f ← canRead;canRead := 1; x ← value ;

Expectation: f = 1 implies x = 1

loops, conditionals, function calls, shared memory

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 30 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 0

memory

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 0

memory

write 1 to value

canRead?

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 0

memory

ok

canRead?

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 0

memory

write 1 to canRead

canRead?

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

ok

canRead?

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

canRead=1

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

value?

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

value=1

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Running concurrent programs on a processor

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

Several executions, but never f = 1 and v = 0.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 31 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 0

memory

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 0

memory

write 1 to value

write 1 to canRead

canRead?

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 1

memory

write 1 to value

ok

canRead?

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 1

memory

canRead=1

write 1 to value

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 1

memory

write 1 to value

value?

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 1

memory

value=0

write 1 to value

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 0

canRead: 1

memory

write 1 to value

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

ok

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Weak memory models

On some processors, we get instead:

value:= 1;

canRead:= 1;

f ← canRead;

v ← value;

value: 1

canRead: 1

memory

Outcome depends on the architecture (TSO, PSO, ARM). . .

Goal: Model denotationally such complex reorderings.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 32 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?write 1 to x

write 1 to y

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?ok

ok

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?z ?

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?k

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Taking a closer look

x:= 1;

y:= 1;

r ← z;

x: ?

y: ?

z: ?

The behaviour of the thread corresponds to a strategy:

mem ⇒ proc

q

Cx :=1 Cy :=1

ok ok

R?z

k

()Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 33 / 37

Modelling weak memory models

An old motto (Reynolds, implemented in game semantics by Abramsky and McCusker)

The behaviour of imperative programs can be described as the

interaction of a (deterministic) pure functional program interacting

with a memory.

Individual programs are interpreted as parallel strategies

JtK : mem⇒ proc

In particularJt; uK = seq JtK JuK

seq : mem⇒ (mem⇒ proc)⇒ (mem⇒ proc)⇒ proc

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 34 / 37

Modelling weak memory models

An old motto (Reynolds, implemented in game semantics by Abramsky and McCusker)

The behaviour of concurrent programs can be described as the

interaction of (deterministic) pure functional threads interacting

with a (nondeterministic) memory.

Individual programs are interpreted as parallel strategies

JtK : mem⇒ proc

In particularJt; uK = seq JtK JuK

seq : mem⇒ (mem⇒ proc)⇒ (mem⇒ proc)⇒ proc

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 34 / 37

Modelling weak memory models

An old motto (Reynolds, implemented in game semantics by Abramsky and McCusker)

The behaviour of concurrent programs can be described as the

interaction of (deterministic) pure functional threads interacting

with a (nondeterministic) memory.

Individual programs are interpreted as parallel strategies

JtK : mem⇒ proc

In particularJt; uK = seq JtK JuK

seq : mem⇒ (mem⇒ proc)⇒ (mem⇒ proc)⇒ proc

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 34 / 37

Modelling weak memory models

An old motto (Reynolds, implemented in game semantics by Abramsky and McCusker)

The behaviour of concurrent programs can be described as the

interaction of (deterministic) pure functional threads interacting

with a (nondeterministic) memory.

Individual programs are interpreted as parallel strategies

JtK : mem⇒ proc

In particularJt; uK = seq JtK JuK

seq : (mem⇒ proc)⇒ (mem⇒ proc)⇒ (mem⇒ proc)

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 34 / 37

Modelling weak memory models

An old motto (Reynolds, implemented in game semantics by Abramsky and McCusker)

The behaviour of concurrent programs can be described as the

interaction of (deterministic) pure functional threads interacting

with a (nondeterministic) memory.

Individual programs are interpreted as parallel strategies

JtK : mem⇒ proc

In particularJt; uK = seq JtK JuK

seq : mem⇒ (mem⇒ proc)⇒ (mem⇒ proc)⇒ proc

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 34 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 () Cx :=2 Cy :=3 ()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1

()

Cx :=2 Cy :=3

()

Cx :=1

()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 ()

Cx :=2 Cy :=3

()

Cx :=1

()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 ()

Cx :=2 Cy :=3

()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 () Cx :=2

Cy :=3

()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 () Cx :=2

Cy :=3

()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3

ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 () Cx :=2 Cy :=3 ()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3

ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Thread semantics via game semantics

Implementation of seq (here for PSO):

mem ⇒ (mem ⇒ proc) ⇒ ( mem ⇒ proc) ⇒ proc

q

q q

Cx :=1 () Cx :=2 Cy :=3 ()

Cx :=1 ()

ok

ok

Cx :=2

ok

Cy :=3 ok

ok

ok

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 35 / 37

Final modelDepends on the architecture A:I Thread operations: seqA, readA, writeA implement the

reorderings speci�c to A.

I Memory (representing caches, barriers, . . . ) is represented by

mA : mem

Executions on A of t1 ‖ . . . ‖ tn are represented by the interaction:

(Jt1KA ‖ . . . ‖ JtnKA)~mA.

Cx :=1 R?x cy :=1 R?y

ok 0 ok 0

R?x Cx :=1 R?y Cy :=1

1 ok 1 ok

TheoremTraces generated by this

model correspond to

operational traces (on

TSO).

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 36 / 37

Final modelDepends on the architecture A:I Thread operations: seqA, readA, writeA implement the

reorderings speci�c to A.

I Memory (representing caches, barriers, . . . ) is represented by

mA : mem

Executions on A of t1 ‖ . . . ‖ tn are represented by the interaction:

(Jt1KA ‖ . . . ‖ JtnKA)~mA.

Cx :=1 R?x cy :=1 R?y

ok 0 ok 0

R?x Cx :=1 R?y Cy :=1

1 ok 1 ok

TheoremTraces generated by this

model correspond to

operational traces (on

TSO).

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 36 / 37

Final model

Depends on the architecture A:I Thread operations: seqA, readA, writeA implement the

reorderings speci�c to A.

I Memory (representing caches, barriers, . . . ) is represented by

mA : mem

Executions on A of t1 ‖ . . . ‖ tn are represented by the interaction:

(Jt1KA ‖ . . . ‖ JtnKA)~mA.

Cx :=1 Rx=0 Cy :=1 Ry=0

Rx=1 Cx :=1 Ry=1 Cy :=1

TheoremTraces generated by this

model correspond to

operational traces (on

TSO).

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 36 / 37

Perspectives

I Describe �nitely non-innocent strategies.

Represent e�ciently operations on them.

I Which language corresponds to innocent concurrent strategies?

Concurrent control operators (eg. fork).

I Weaker architectures (eg. ARM) and software speci�cations.

How to handle speculation, complex barriers speci�cation.

Structures concurrentes en sémantique des jeux · Simon Castellan, LIP Soutenance de thèse 37 / 37

Recommended