Reversible calculus Ioana Cristescu 22 June 2012 Ioana Cristescu - - PowerPoint PPT Presentation

reversible calculus
SMART_READER_LITE
LIVE PREVIEW

Reversible calculus Ioana Cristescu 22 June 2012 Ioana Cristescu - - PowerPoint PPT Presentation

Reversible calculus Ioana Cristescu 22 June 2012 Ioana Cristescu Reversible calculus Internship at PPS Paris Diderot under the supervision of Jean Krivine and Daniele Varacca part of the ANR project on reversibility Reversibility in


slide-1
SLIDE 1

Reversible π calculus

Ioana Cristescu 22 June 2012

Ioana Cristescu Reversible π calculus

slide-2
SLIDE 2

Internship at PPS Paris Diderot

under the supervision of Jean Krivine and Daniele Varacca part of the ANR project on reversibility

Reversibility in concurrency

the consensus problem in distributed systems handle deadlocks

◮ by implementing backtracking ◮ by relying on a language that natively supports backtracking Ioana Cristescu Reversible π calculus

slide-3
SLIDE 3

Reversibility and process communication

◮ π calculus = model the process interaction ◮ implement undo

P

α

P′

α−

  • ◮ concurrency in an interleaving semantics

a backward trace = one of the possible forward traces P|Q

α

  • β
  • P′|Q

β

  • P|Q′

α

  • P′|Q′

◮ causality = ¬ concurrency

Ioana Cristescu Reversible π calculus

slide-4
SLIDE 4

Outline

  • 1. The π calculus and reversibility
  • 2. Reversible π calculus (Rπ) and the labeled transition system
  • 3. Properties of Rπ

3.1 correspondence with π calculus

  • 4. Causality
  • 5. Conclusions

5.1 Contributions of this internship 5.2 Future work

Ioana Cristescu Reversible π calculus

slide-5
SLIDE 5

The π calculus

model for distributed computing

actions process constructor names

  • utput

ay.P

ay

− − → P input a(x).Q

a(x)

− − → Q synchronization ay.P | a(x).Q

τ

− → P | Q{y/x} prefix α.P, α ∈ {ay, a(x)} parallel composition P | Q restriction νyP

y(t),yt

− − − − − → bound x ∈ bn(a(x).P) and y ∈ bn(νyP) free fn(P)

Ioana Cristescu Reversible π calculus

slide-6
SLIDE 6

The restriction in π

νyP

y(t),yt

− − − − − → νy(ayP)

a(νy)

− − − → P y is private in P a is an extruder of y

a labeled transition system that is compositional

  • pen

P

xy

− − → P′ νyP

x(νy)

− − − → P′

close

P

x(νy)

− − − → P′ Q

x(z)

− − → Q′ P | Q

τ

− → νy(P′ | Q′{y/z}) y / ∈ fn(Q)/{z}

Q Environment

P

y

Ioana Cristescu Reversible π calculus

slide-7
SLIDE 7

Reversibility in π calculus

a(x).P

a(x)

− − → P

Ioana Cristescu Reversible π calculus

slide-8
SLIDE 8

Reversibility in π calculus

⊲ a(x).P

a(x)

− − → ⋆, a(x) ⊲ P

a(x)−

← − − −

Ioana Cristescu Reversible π calculus

slide-9
SLIDE 9

Reversibility in π calculus

⊲ a(x).P

a(x)

− − → ⋆, a(x) ⊲ P

a(x)−

← − − − α.P | α.Q

τ

− − − − − → P | Q

τ−

← − − − − − −

Ioana Cristescu Reversible π calculus

slide-10
SLIDE 10

Reversibility in π calculus

⊲ a(x).P

a(x)

− − → ⋆, a(x) ⊲ P

a(x)−

← − − − ⊲ α.P | ⊲ α.Q

τ

− − − − − →

  • α. ⊲ P |

α. ⊲ Q

τ−

← − − − − − −

Ioana Cristescu Reversible π calculus

slide-11
SLIDE 11

Reversibility in π calculus

⊲ a(x).P

a(x)

− − → ⋆, a(x) ⊲ P

a(x)−

← − − − 1 ⊲ α.P | 2 ⊲ α.Q

1,2:τ

− − − − − → 2, α.1 ⊲ P | 1, α.2 ⊲ Q

1,2:τ−

← − − − − − −

Ioana Cristescu Reversible π calculus

slide-12
SLIDE 12

Reversibility in π calculus

⊲ a(x).P

a(x)

− − → ⋆, a(x) ⊲ P

a(x)−

← − − − 1 ⊲ α.P | 2 ⊲ α.Q

1,2:τ

− − − − − → 2, α.1 ⊲ P | 1, α.2 ⊲ Q

1,2:τ−

← − − − − − −

Objectives

◮ define a reversible π calculus (Rπ)

◮ based on the work of [Danos and Krivine, 2004] ◮ problems:

name substitution handling the private names

◮ symmetric rules for backward and forward ◮ compositional with respect to the extrusion

Ioana Cristescu Reversible π calculus

slide-13
SLIDE 13

Substitution

a(x).(x(t) | y(z)) | ay

τ

− → y(t) | y(z) a(x).(x(t) | x(z)) | ay

τ

← −

⇒ add the substitution to the memory

1 ⊲ a(x).(x(t) | y(z)) | 2 ⊲ ay

1,2:τ

− − − − − → 2, a[y/x].1 ⊲ x(t) | y(z) | 1, ay.2 ⊲ 0

backtrack transition on x

1,2:τ −

− − − − − − → 1 ⊲ a(x).(x(t) | y(z)) | 2 ⊲ ay

1:y(t)

− − − − → ⋆, x[⋆/t].1.2, a[y/x].1 ⊲ 0...

Ioana Cristescu Reversible π calculus

slide-14
SLIDE 14

The axioms of the LTS

◮ do not apply the substitution on the process itself ◮ apply it on some names in a transition label

in+ m ⊲ x(z).P

x′(z)

− − − → ⋆, x[∗/z].m ⊲ P in- ⋆, x[∗/z].m ⊲ P

x′(z)−

− − − − → m ⊲ x(z).P

  • ut+

m ⊲ xy.P

x′(y ′)

− − − → ⋆, xy.m ⊲ P

  • ut-

⋆, xy.m ⊲ P

x′(y ′)−

− − − − → m ⊲ xy.P

Ioana Cristescu Reversible π calculus

slide-15
SLIDE 15

The rules for the simple synchronizations

1 ⊲ ay | 2 ⊲ a(t)

1,2:τ

− − − − − →

Ioana Cristescu Reversible π calculus

slide-16
SLIDE 16

The rules for the simple synchronizations

1 ⊲ ay

1:ay

− − − − − → ⋆, ay.1 ⊲ 0 1 ⊲ ay | 2 ⊲ a(t)

1,2:τ

− − − − − →

Ioana Cristescu Reversible π calculus

slide-17
SLIDE 17

The rules for the simple synchronizations

1 ⊲ ay

1:ay

− − − − − → ⋆, ay.1 ⊲ 0 2 ⊲ a(t)

2:a(t)

− − − − → ⋆, a[⋆/t].2 ⊲ 0 1 ⊲ ay | 2 ⊲ a(t)

1,2:τ

− − − − − →

Ioana Cristescu Reversible π calculus

slide-18
SLIDE 18

The rules for the simple synchronizations

1 ⊲ ay

1:ay

− − − − − → ⋆, ay.1 ⊲ 0 2 ⊲ a(t)

2:a(t)

− − − − → ⋆, a[⋆/t].2 ⊲ 0 1 ⊲ ay | 2 ⊲ a(t)

1,2:τ

− − − − − → 2, ay.1 ⊲ 0 | 1, a[y/t].2 ⊲ 0

Ioana Cristescu Reversible π calculus

slide-19
SLIDE 19

The rules for the simple synchronizations

1 ⊲ ay

1:ay

− − − − − → ⋆, ay.1 ⊲ 0 2 ⊲ a(t)

2:a(t)

− − − − → ⋆, a[⋆/t].2 ⊲ 0 1 ⊲ ay | 2 ⊲ a(t)

1,2:τ

− − − − − → 2, ay.1 ⊲ 0 | 1, a[y/t].2 ⊲ 0

after a synchronization, update the memory

◮ add the substitution ◮ add the identifier of the synchronizing thread

com+

R

φ1:xy

− − − − → R′ S

φ2:x(z)

− − − − → S′ R | S

φ1,φ2:τ

− − − − → (R′ | S′)@(φ1,φ2,y)

com-

R

φ1:xy−

− − − − − → R′ S

φ2:x(z)−

− − − − − → S′ (R | S)@(φ1,φ2,y)

φ1,φ2:τ−

− − − − − − → R′ | S′

Ioana Cristescu Reversible π calculus

slide-20
SLIDE 20

The private names

νy(ay | y(t))

  • y(t)

− − →

a(νy)

− − − → y(t)

y(t)

− − → νy(ay | by | y(t))

  • y(t)

− − →

a(νy)

− − − → by | y(t)

y(t)

− − →

by

− − →

b(νy)

− − − → ay | y(t)

y(t)

− − →

ay

− − →

Ioana Cristescu Reversible π calculus

slide-21
SLIDE 21

The private names

νy(ay | y(t))

  • y(t)

− − →

a(νy)

− − − → y(t)

y(t)

− − → νy(ay | by | y(t))

  • y(t)

− − →

a(νy)

− − − → by | y(t)

y(t)

− − →

by

− − →

b(νy)

− − − → ay | y(t)

y(t)

− − →

ay

− − →

In a reversible π calculus

⋆, ay.1 ⊲ 0 | ⋆, yt.2 ⊲ 0

2:yt−

− − − − − − → OK

1:ay−

− − − − − − → not OK

Ioana Cristescu Reversible π calculus

slide-22
SLIDE 22

⇒ remember the scope of ν

δ = the “shadow” of ν νy (m ⊲ xy.P | R)

η:x(νy)

− − − − → δy (⋆, xy.m ⊲ P | R) ⇓ ⇓ bound freed

  • pen+

R

η:xy

− − − − → R′ νyR

η:x(νy)

− − − − → δyR′

Ioana Cristescu Reversible π calculus

slide-23
SLIDE 23

Passing through a δ

δy(⋆, ay.1 ⊲ 0 | 2 ⊲ yt)

2:yt

− − − − → δy(⋆, ay.1 ⊲ 0|⋆, yt.2 ⊲ 0) δy(⋆, ay.1 ⊲ 0 | 2 ⊲ yt)

2:yt−

← − − − − − −

1:ay−

← − − − − − − not allowed!

delta+-

R

η:ζ

− − → R′ δyR

η:ζ

− − → δyR′ ζ = xy, xy−

  • pen delta

R

η:xy

− − − − → R′ δyR

η:x(δy)

− − − − → δyR′

Ioana Cristescu Reversible π calculus

slide-24
SLIDE 24

When to restore a secret

νy(ay | y(t))

  • y(t)

− − →

a(νy)

− − − → y(t)

y(t)

− − →

δy(⋆, ay.1 ⊲ 0|⋆, yt.2 ⊲ 0)

1:ay−

− − − − − − → δy(⋆, ay.1 ⊲ 0|2 ⊲ yt)

1:a(νy)−

− − − − − − → νy(1 ⊲ ay | 2 ⊲ yt)

⇒ no external communication involving y

  • pen-

R

η:xy−

− − − − − → R′ δyR

η:x(νy)−

− − − − − → νyR′ y⋆ / ∈ R′

Ioana Cristescu Reversible π calculus

slide-25
SLIDE 25

When to keep δ

νy(ay | by | y(t))

  • y(t)

− − →

a(νy)

− − − → by | y(t)

y(t)

− − →

by

− − →

b(νy)

− − − → ay | y(t)

y(t)

− − →

ay

− − →

⇒ several possible forward orders

R

m2:a(νy)

− − − − − →

m1:bδy

− − − − − →

m3:yt

− − − − → R′

m2:a(νy)

− − − − − →

m3:yt

− − − − →

m1:bδy

− − − − − →

m1:b(νy)

− − − − − →

m2:aδy

− − − − − →

m3:yt

− − − − →

m1:b(νy)

− − − − − →

m3:yt

− − − − →

m2:aδy

− − − − − →

Ioana Cristescu Reversible π calculus

slide-26
SLIDE 26

When to keep δ

νy(ay | by | y(t))

  • y(t)

− − →

a(νy)

− − − → by | y(t)

y(t)

− − →

by

− − →

b(νy)

− − − → ay | y(t)

y(t)

− − →

ay

− − →

⇒ several possible forward orders ⇒ any extruder can go back

R

m2:a(νy)

− − − − − →

m1:bδy

− − − − − →

m3:yt

− − − − → R′

m2:a(νy)

− − − − − →

m3:yt

− − − − →

m1:bδy

− − − − − →

m1:bδy−

← − − − − − −

m1:b(νy)

− − − − − →

m2:aδy

− − − − − →

m3:yt

− − − − →

m1:b(νy)

− − − − − →

m3:yt

− − − − →

m2:aδy

− − − − − →

m2:aδy−

← − − − − − −

Ioana Cristescu Reversible π calculus

slide-27
SLIDE 27

Backtrack an extruder of y

◮ if an extruder left then keep δ

  • pen delta-

R

η:xy−

− − − − − → R′ δyR

η:x(δy)−

− − − − − → δyR′ ↑ y⋆ ∈ R′

◮ if no external communications

involving y then restore ν

  • pen-

R

η:xy−

− − − − − → R′ δyR

η:x(νy)−

− − − − − → νyR′ y⋆ / ∈ R′ δy(⋆, ay.m1 ⊲ 0 | ⋆, by.m2 ⊲ 0 | ⋆, yt.m3 ⊲ 0)

m1:a(δy)−

− − − − − − → δy(m1 ⊲ ay | ⋆, by.m2 ⊲ 0 | ⋆, yt.m3 ⊲ 0)

m2:b(νy)−

− − − − − − →

  • r

m2:bδy−

− − − − − − → not allowed

m3:yt−

− − − − − → δy(m1 ⊲ ay | ⋆, by.m2 ⊲ 0 | m3 ⊲ yt)

m2:b(νy)−

− − − − − − → νy(m1 ⊲ ay | m2 ⊲ by | m3 ⊲ yt)

Ioana Cristescu Reversible π calculus

slide-28
SLIDE 28

The synchronization rules

synchronization with a bound name

close+

R

φ1:x(νy)

− − − − − → R′ S

φ2:x(z)

− − − − → S′ R | S

φ1,φ2:τ

− − − − − → νy(R′ | S′)@(φ1,φ2,y) y / ∈ fn(S)/{z}

close-

R

φ1:x(νy)−

− − − − − − − → R′ S

φ2:x(z)−

− − − − − − → S′ νy(R | S)@(φ1,φ2,y)

φ1,φ2:τ−

− − − − − − → R′ | S′ y / ∈ S′

synchronization with a freed name

close delta+

R

φ1:x(δy)

− − − − − → R′ S

φ2:x(z)

− − − − → S′ R | S

φ1,φ2:τ

− − − − − → δy(R′ | S′)@(φ1,φ2,y)

close delta-

R

φ1:x(δy)−

− − − − − − − → R′ S

φ2:x(z)−

− − − − − − → S′ δy(R | S)@(φ1,φ2,y)

φ1,φ2:τ−

− − − − − − → R′ | S′ y / ∈ S′

Ioana Cristescu Reversible π calculus

slide-29
SLIDE 29

Symmetry forward and backward

Lemma (Loop)

For R reachable and for every forward transition t : R

η:γ

− − → R′ there exists a backward transition t− : R′ η:γ− − − − → R, and conversely.

Ioana Cristescu Reversible π calculus

slide-30
SLIDE 30

Correspondence with π

◮ Φ translates a Rπ process into π

example: Φ(δyφ, x[y/t] ⊲ P) = P{y/t}

Lemma

If P − →⋆ Q and Φ(R) = P then ∃S such that R − →⋆ S and Φ(S) = Q.

Ioana Cristescu Reversible π calculus

slide-31
SLIDE 31

Causality

t1 is a cause for t2 if

  • subject causality

◮ roughly the transitions occur on the same thread

m ⊲ a(x).b(y)

φ:a(x)

− − − − →

φ:b(y)

− − − − → t1 : R

µ1:ζ1

− − − → S t2 : S

µ2:ζ2

− − − → T

  • object causality

◮ if t1 forward and ζ1 = a(νy) then ζ2 ∈ {y(t), yt} ◮ if t2 backward and ζ2 = a(νy) then ζ1 ∈ {y(t), yt}

νy(1 ⊲ ay | 2 ⊲ y(t))

1:a(νy)

− − − − − →

2:y(t)

− − − − →

  • their transitive closure
  • therwise t1 and t2 are concurrent

Lemma (Square)

If t1 and t2 concurrent, then ∃t′

2 : R µ2:ζ′

2

− − − → S2 and t′

1 : S2 µ1:ζ′

1

− − − → T.

Ioana Cristescu Reversible π calculus

slide-32
SLIDE 32

Conclusions and Future work

Contributions

◮ A reversible semantics of π calculus that is symmetric and

compositional for the extrusion of bound names, handling

◮ name substitution ◮ scope extrusion

◮ The correspondence with π calculus ◮ A new causality semantics for π calculus

(previously by [Degano,Priami, 1995] and [Boreale,Sangiorgi, 1995])

Future work

◮ a fully compositional semantics ◮ a more interesting causality ◮ an equivalence relation between processes ◮ a correspondence with event structures

(based on [Crafa, Varacca and Yoshida, 2012])

δyR

y(t)

− − → R′ S

yz

− − → S′ R | S

τ

− → R′ | S′

a(νy)

− − − →

y(t)

− − →

b(δy)

− − − →

Ioana Cristescu Reversible π calculus

slide-33
SLIDE 33

Concurrent and causal transitions

νy(ay | by | y(t))

  • y(t)

− − →

a(νy)

− − − → by | y(t)

y(t)

− − →

by

− − →

b(νy)

− − − → ay | y(t)

y(t)

− − →

ay

− − →

a, b - concurrent a, y - causal

  • r

b, y -causal

b(δy)

  • ay
  • by

y(t)

  • R

a(νy)

  • b(νy)
  • y(t)
  • a(δy)
  • R′

a(δy)

  • y(t)
  • y(t)
  • Ioana Cristescu

Reversible π calculus

slide-34
SLIDE 34

More on ↑ y⋆

↑ y⋆ ∈ R iff R ≡ (m0.⋆, xy, Q.m1 ⊲ P | S)

◮ an output of y that has yet to backtrack ◮ within an external communication

⊲ νy(ay) | a(t)

τ

− → νy(2, ay.1 ⊲ 0 | 1, a[y/t].2 ⊲ 0)

and that has no communication on y in its past

νy(ay | y(t).by)

a(νy)

− − − →

y(t)

− − →

b(δy)

− − − → ↑ y⋆ not ↑ y⋆ νy(ay | y(t).c(t) | ct.by)

a(νy)

− − − →

y(t)

− − →

τ

− →

b(δy)

− − − → νzνy(ay | z(t).by | y(t).dz)

a(νy)

− − − →

y(t)

− − →

d(νz)

− − − →

z(t)

− − →

b(δy)

− − − →

delta freed- R

η:x(δy)−

− − − − − → R′ δzR

η:x(δy)−

− − − − − → δzR′ ↑ y⋆ ∈ δzR′

Ioana Cristescu Reversible π calculus

slide-35
SLIDE 35

Remark 1. Late vs. early semantics

in an early semantics

◮ an input transition: a(t).P a(y)

− − → P{y/t}

◮ confusing situations

νy(ay) | b(z).P

a(νy)

− − − →

b(y)

− − → δy(⋆, ay ⊲ 0) | ⋆, b[y/z] ⊲ P

Ioana Cristescu Reversible π calculus

slide-36
SLIDE 36

Remark 2. Syntactic correctness ⇒ semantic correctness

example: δyR | δyS

Reachability

⊲ P − →⋆ R, with P a valid π process

Soundness

R sound if

◮ its memories are pairwise coherent; ◮ in νyR, y⋆ /

∈ M(R);

◮ in δyR, ↑ y⋆ in M(R); ◮ in δyR | S if y ∈ S then ∃C[] s.t. S ≡ C[νy.S]; ◮ in δyR then ∃C[] s.t. R ≡ C[δy.S]; ◮ in νyR then ∃C[] s.t. R ≡ C[δy.S].

Theorem

if R reachable then R sound.

Ioana Cristescu Reversible π calculus

slide-37
SLIDE 37

Remark 3.

do not interleave the δ and ν of a bound name

◮ νyR | S1 | S2 with

R = n ⊲ ay.ay S1 = m1 ⊲ a(t).P1 S2 = m2 ⊲ a(t).P2

then νy(R | S1 | S2) − →⋆ νy(δy(δyR′ | S′

1) | S′ 2)

νy(R | S1 | S2) − →⋆ νy(δy(δyR′ | S′

2) | S′ 1)

Ioana Cristescu Reversible π calculus

slide-38
SLIDE 38

Synchronization with a freed name

P = νy(ay | by) | a(t).Q ⊲ P

φ1,φ3:τ

− − − − →

φ2:b(νy)

− − − − − → δy(φ3, ay.m1 ⊲ 0 | ⋆, by.m2 ⊲ 0 | φ1, a[y/t].m3 ⊲ Q) ⊲ P

φ2:b(νy)

− − − − − →

φ1,φ3:τ

− − − − → δy(φ3, ay.m1 ⊲ 0 | ⋆, by.m2 ⊲ 0) | φ1, a[y/t].m3 ⊲ Q

Ioana Cristescu Reversible π calculus

slide-39
SLIDE 39

Synchronization with a freed name

P = νy(ay | by) | a(t).Q ⊲ P

φ1,φ3:τ

− − − − →

φ2:b(νy)

− − − − − → δy(φ3, ay.m1 ⊲ 0 | ⋆, by.m2 ⊲ 0 | φ1, a[y/t].m3 ⊲ Q) ⊲ P

φ2:b(νy)

− − − − − →

φ1,φ3:τ

− − − − → δy(φ3, ay.m1 ⊲ 0 | ⋆, by.m2 ⊲ 0) | φ1, a[y/t].m3 ⊲ Q

⇒ recognize the synchronization of a freed name

close delta+ R

φ1:x(δy)

− − − − − → R′ S

φ2:x(z)

− − − − → S′ R | S

φ1,φ2:τ

− − − − → δy(R′ | S′)@(φ1,φ2,y) close delta- R

φ1:x(δy)−

− − − − − − → R′ S

φ2:x(z)−

− − − − − → S′ δy(R | S)@(φ1,φ2,y)

φ1,φ2:τ−

− − − − − − → R′ | S′ y / ∈ S′

Lemma

If ⊲ P − →⋆ R then P − →⋆ Φ(R).

Ioana Cristescu Reversible π calculus