Formal Methods for the Verification of Distributed Algorithms Paul - - PowerPoint PPT Presentation

formal methods for the verification of distributed
SMART_READER_LITE
LIVE PREVIEW

Formal Methods for the Verification of Distributed Algorithms Paul - - PowerPoint PPT Presentation

Formal Methods for the Verification of Distributed Algorithms Paul Gastin Laboratoire Spcification et Vrification ENS Paris Saclay & CNRS with C. Aiswarya (CMI) & Benedikt Bollig (LSV) Motivations Distributed algorithms are


slide-1
SLIDE 1

Formal Methods for the Verification of Distributed Algorithms

Paul Gastin

Laboratoire Spécification et Vérification ENS Paris Saclay & CNRS with C. Aiswarya (CMI) & Benedikt Bollig (LSV)

slide-2
SLIDE 2

Motivations

  • Distributed algorithms are extremely difficult to get right
  • Correctness proofs are often involved
  • Formal methods may help verifying the correctness of

tricky algorithms

slide-3
SLIDE 3

Peterson's algorithm

for n from 0 to N−1 exclusive level[i] ← n last_to_enter[n] ← i while last_to_enter[n] = i and there exists k ≠ i, such that level[k] ≥ n wait

Formal methods: Model Checking

Specification Mutual exclusion

  • i̸=j

¬(CSi ∧ CSj)

No Yes

slide-4
SLIDE 4

Peterson's algorithm

for n from 0 to N−1 exclusive level[i] ← n last_to_enter[n] ← i while last_to_enter[n] = i and there exists k ≠ i, such that level[k] ≥ n wait

Formal methods: Model Checking

Specification Mutual exclusion

  • i̸=j

¬(CSi ∧ CSj)

No Yes

D e c i s i

  • n

p r

  • b

l e m

slide-5
SLIDE 5
  • Finite state machine (control points)
  • Data structures
  • Boolean variables
  • Integer variables
  • Stacks (recursivity)
  • Queues (asynchronous communication)

Models for programs/algorithms

slide-6
SLIDE 6

Models for programs/algorithms

Peterson's algorithm

for n from 0 to N−1 exclusive level[i] := n last_to_enter[n] := i while last_to_enter[n] = i and there exists k ≠ i, such that level[k] ≥ n wait

wait

max{level[k], k≠i} ≥ n last_to_enter[n] = i

trying

level[i] := n last_to_enter[n] := i

CS init

n := 0 n = N n := n+1 else

wait

n < N

slide-7
SLIDE 7

Franklin’s leader election algorithm

Processes are arranged in an undirected ring. Each node has a unique identity. Each node is either active or passive (relay mode) at a given time. The algorithm executes as follows: – Each active node sends its identity to its neighbors. Let each active node p1 receive identities from p0 and p2. Where p0 and p2 are its either neighbors in the ring. – If min( ID[p0], ID[p2] ) > ID[p1], then p1 becomes passive – If min( ID[p0], ID[p2] ) < ID[p1], then p1 sends its ID to its neighbors again – If min( ID[p0], ID[p2] ) == ID[p1], then p1 declares itself as leader – Passive nodes only pass on messages. – The loop continues until a leader with highest unique ID has been elected.

Models for programs/algorithms

active passive

fwd

leader

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

slide-8
SLIDE 8
  • Modal logics
  • Temporal logics
  • First-order logic
  • Dynamic logics

Languages for the specification

slide-9
SLIDE 9
  • Each infinite/unbounded aspects
  • number of processes/agents
  • Integer variables (pids, timestamps, …)
  • FIFO channels (asynchronous communication)

Model checking: sources of undecidability

slide-10
SLIDE 10

Specification System model Behavior

L(ϕ) ϕ

L(A)

model checking

A

set of possible traces set of admissible traces

L(A) ⊆ L(ϕ) ?

| =

distributed

¬F

specificati

Model checking (Linear time)

slide-11
SLIDE 11

LTL specification Behavior

L(ϕ)

ϕ

A

A0

L(A)

L(A0)

= ∅

?

¬ϕ

Finite automata

Reachability

model checking

L(A) ⊆ L(ϕ) ?

| =

effective distributed

¬F

specificati

Model checking: First solution

slide-12
SLIDE 12

LTL specification Behavior

L(ϕ) ϕ

A

Finite automata

Validity

!

! ⇒ " ?

L(A)

model checking

L(A) ⊆ L(ϕ) ?

| =

effective distributed

¬F

specificati

Model checking: Second solution

slide-13
SLIDE 13

Models of Distributed Systems

47 23 19 71 5 42

slide-14
SLIDE 14
  • Number of processes: arbitrary, unknown
  • Unique process identification
  • Comparisons: <, =
  • No arithmetic
  • Topology: fixed degree (ring, …)
  • Communication: Synchronous in rounds
  • Round: send messages, receive messages,

compute and update local registers

Distributed algorithms: our hypotheses

slide-15
SLIDE 15

71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm

left ! id right ! id id > r1 ∧ id > r2

active passive

Leader election [Franklin ’82]

| { z }

round

5

left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2

slide-16
SLIDE 16

71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm

left ! id right ! id id > r1 ∧ id > r2

active passive

Leader election [Franklin ’82]

| { z }

round

5

left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2

Active id = 47 r1 = 23 r2 = 19

slide-17
SLIDE 17

71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm

left ! id right ! id id > r1 ∧ id > r2

active passive

fwd

Leader election [Franklin ’82] 5

71 47

left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2

slide-18
SLIDE 18

71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm

left ! id right ! id id > r1 ∧ id > r2

active passive

fwd

leader

Leader election [Franklin ’82] 5

71

left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

slide-19
SLIDE 19

71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm

left ! id right ! id id > r1 ∧ id > r2

active passive

fwd

leader

Leader election [Franklin ’82] 5

left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

slide-20
SLIDE 20

Distributed algorithms

  • Identical finite-state

processes

  • Number of processes is

unknown and unbounded

  • Processes have unique

pids (integers — unbounded data)

47 23 19 42 71 5

right left

slide-21
SLIDE 21

A formal model for distributed algorithms

An automata-like way of writing DA

  • Set of states
  • Initial state
  • Set of registers
  • stores pid
  • Set of transitions
  • send pids to neighbours
  • receive pids from neighbours,

and store in registers

  • compare registers
  • update registers

Every process can be described by:

5

slide-22
SLIDE 22

71 42 19 23 47

Behaviors

Distributed algorithm

active passive

fwd

leader

5

Cylinders Arbitrary length and width Labelled with data from an infinite domain

Active id = 47 r1 = 23 r2 = 19

two unbounded dimensions

3 sources of infinity

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

slide-23
SLIDE 23

Abstraction of Data Values

47 23 19 71 5 42

slide-24
SLIDE 24

Model Checking Distributed algorithms

71 42 19 23 47 5

Active id = 47 r1 = 23 r2 = 19

  • Behaviors: Cylinders of arbitrary width and length

Data from an infinite domain

  • System: Register automata with data comparisons
  • Specification: Data PDL with data comparisons

UNDECIDABLE

slide-25
SLIDE 25

Reduction to Satisfiability of LCPDL: Data abstraction

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

valid

  • ver cylinders

⇐ ⇒ A | = ϕ

71 42 19 23 47 5

# $ ⇒

slide-26
SLIDE 26

LCPDL: Propositional Dynamic logic with Loop and Converse

Ψ, Ψ ′ ::= E ψ | ¬Ψ | Ψ ∧ Ψ ′ ψ, ψ′ ::= ‡ | p | ¬ψ | ψ ∧ ψ′ | ⟨π⟩ψ | loop(π) π, π′ ::= {ψ}? | → | ↓ | π + π′ | π · π′ | π∗ | π−1

ψ

slide-27
SLIDE 27

LCPDL: Propositional Dynamic logic with Loop and Converse

Ψ, Ψ ′ ::= E ψ | ¬Ψ | Ψ ∧ Ψ ′ ψ, ψ′ ::= ‡ | p | ¬ψ | ψ ∧ ψ′ | ⟨π⟩ψ | loop(π) π, π′ ::= {ψ}? | → | ↓ | π + π′ | π · π′ | π∗ | π−1

slide-28
SLIDE 28

LCPDL: Propositional Dynamic logic with Loop and Converse

Ψ, Ψ ′ ::= E ψ | ¬Ψ | Ψ ∧ Ψ ′ ψ, ψ′ ::= ‡ | p | ¬ψ | ψ ∧ ψ′ | ⟨π⟩ψ | loop(π) π, π′ ::= {ψ}? | → | ↓ | π + π′ | π · π′ | π∗ | π−1

slide-29
SLIDE 29

LCPDL: Propositional Dynamic logic with Loop and Converse

Ψ, Ψ ′ ::= E ψ | ¬Ψ | Ψ ∧ Ψ ′ ψ, ψ′ ::= ‡ | p | ¬ψ | ψ ∧ ψ′ | ⟨π⟩ψ | loop(π) π, π′ ::= {ψ}? | → | ↓ | π + π′ | π · π′ | π∗ | π−1

ψ

⟨π⟩ψ

π

⟨↓∗←∗{•}?(↓↓{•}?)∗→∗{•}?→{•}?↑∗⟩•

slide-30
SLIDE 30

LCPDL: Propositional Dynamic logic with Loop and Converse

Ψ, Ψ ′ ::= E ψ | ¬Ψ | Ψ ∧ Ψ ′ ψ, ψ′ ::= ‡ | p | ¬ψ | ψ ∧ ψ′ | ⟨π⟩ψ | loop(π) π, π′ ::= {ψ}? | → | ↓ | π + π′ | π · π′ | π∗ | π−1

π

loop(π)

slide-31
SLIDE 31

Data abstraction: symbolic runs + tracking data

71 42 19 23 47 5

Distributed algorithm

active passive leader

fwd left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

Active id = 47 r1 = 23 r2 = 19

slide-32
SLIDE 32

Data abstraction: symbolic runs + tracking data

71 42 19 23 47 5

Distributed algorithm

active passive leader

fwd

t1 t1 t2 t4 t3 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

slide-33
SLIDE 33

Data abstraction: symbolic runs + tracking data

71 42 19 23 47 5

Distributed algorithm

active passive leader

fwd

t1 t1 t2 t4 t3 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

A pid distribution realizes a symbolic run if all guards are satisfied. Pb: Is there a pid distribution realizing a symbolic run?

slide-34
SLIDE 34

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

  • Register updates

r1

slide-35
SLIDE 35

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

  • Register updates

r1 right?r1

slide-36
SLIDE 36

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

r1 right?r1

slide-37
SLIDE 37

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

left?r2 r1 right?r1

slide-38
SLIDE 38

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

left?r2 right!r1 r1 right?r1 fwd fwd

slide-39
SLIDE 39

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

left?r2 right!r1 right?r1 r1 right?r1 fwd fwd

slide-40
SLIDE 40

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

left?r2 right!r1 right?r1 left!id r1 right?r1 fwd fwd fwd

slide-41
SLIDE 41

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

  • Register updates

left?r2 right!r1 right?r1 left!id r1 right?r1 fwd fwd fwd

slide-42
SLIDE 42

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

left!r2 fwd

19

(r1,id)-path can be expressed in CPDL PDL with converse

  • Register updates

left?r2 right!r1 right?r1 left!id r1 right?r1 fwd fwd fwd

slide-43
SLIDE 43

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r2=r1

  • Register updates
  • Register equality check
slide-44
SLIDE 44

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

π1:(r1,id)-path π2:(r2,id)-path

r2=r1

  • Register updates
  • Register equality check
slide-45
SLIDE 45

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

π1:(r1,id)-path π2:(r2,id)-path can be expressed in LCPDL CPDL with loop

r2=r1

  • Register updates
  • Register equality check

r2 = r1 iff loop( π1 ; π2-1 )

slide-46
SLIDE 46

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

slide-47
SLIDE 47

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

<-path

slide-48
SLIDE 48

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

<-path

slide-49
SLIDE 49

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

<-path

slide-50
SLIDE 50

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

  • If there is a <-loop, no pid assignments can turn the

symbolic cylinder into a valid run.

  • If no such loops, then there are pids that allow a

valid realization of the symbolic cylinder <-path

slide-51
SLIDE 51

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

  • If there is a <-loop, no pid assignments can turn the

symbolic cylinder into a valid run.

  • If no such loops, then there are pids that allow a

valid realization of the symbolic cylinder No loop of the form (Σi,j (ri,id)-path-1; ri<rj; (rj,id)-path)+ <-path

slide-52
SLIDE 52

Data abstraction: symbolic runs + tracking data

71 42 23 47 5

Distributed algorithm

19

r1 < r2

  • Register updates
  • Register equality check
  • Register comparison

r3 < r1 r3 < r2 r1 < r3 r3 < r1

  • If there is a <-loop, no pid assignments can turn the

symbolic cylinder into a valid run.

  • If no such loops, then there are pids that allow a

valid realization of the symbolic cylinder No loop of the form (Σi,j (ri,id)-path-1; ri<rj; (rj,id)-path)+ can be expressed in LCPDL CPDL with loop <-path

slide-53
SLIDE 53

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

71 42 19 23 47 5

t1 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

Data abstraction: symbolic runs + tracking data #

effective

slide-54
SLIDE 54

Specification language

47 23 19 71 5 42

slide-55
SLIDE 55
  • Leader election:
  • At the end there is a unique leader
  • All other processes are passive
  • The leader has the maximal pid
  • Distributed sorting algorithm
  • The output values form a permutation of the input values
  • If q is on the right of p, and q ≠ leader then p.v < q.v

Distributed algorithms: typical properties

compare values at different nodes Moves inside the behavior

slide-56
SLIDE 56

Inspired by [Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

Specifications Data PDL

⟨π⟩r ̸= ⟨π′⟩r′

Φ, Φ′ ::= A φ | Φ ∧ Φ′ φ, φ′ ::= ϕ | φ ∧ φ′ | ϕ ∨ φ | [π]φ | ⟨η⟩r < ⟨η′⟩r′ | ⟨η⟩r ≤ ⟨η′⟩r′ ϕ, ϕ′ ::= ‡ | p | ¬ϕ | ϕ ∧ ϕ′ | ⟨π⟩ϕ | ⟨π⟩r = ⟨π′⟩r′ | ⟨π⟩r ̸= ⟨π′⟩r′ π, π′ ::= {ϕ}? | → | ↓ | π−1 | π + π′ | π · π′ | π∗ η, η′ ::= {ϕ}? | ← | → | ↓ | ↑ | η · η′ | Fη

ϕ

slide-57
SLIDE 57

Inspired by [Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

Specifications Data PDL

r ≠ r’ π’ π

⟨π⟩r ̸= ⟨π′⟩r′

Φ, Φ′ ::= A φ | Φ ∧ Φ′ φ, φ′ ::= ϕ | φ ∧ φ′ | ϕ ∨ φ | [π]φ | ⟨η⟩r < ⟨η′⟩r′ | ⟨η⟩r ≤ ⟨η′⟩r′ ϕ, ϕ′ ::= ‡ | p | ¬ϕ | ϕ ∧ ϕ′ | ⟨π⟩ϕ | ⟨π⟩r = ⟨π′⟩r′ | ⟨π⟩r ̸= ⟨π′⟩r′ π, π′ ::= {ϕ}? | → | ↓ | π−1 | π + π′ | π · π′ | π∗ η, η′ ::= {ϕ}? | ← | → | ↓ | ↑ | η · η′ | Fη

ϕ

compare values at different nodes Moves inside the behavior

slide-58
SLIDE 58

71 42 19 23 47

Distributed algorithms

Behavior Specification Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Leader election [Franklin ’82] 5

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder

slide-59
SLIDE 59

71 42 19 23 47

Distributed algorithms

Behavior Specification Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Leader election [Franklin ’82] 5

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder

slide-60
SLIDE 60

71 42 19 23 47

Distributed algorithms

Behavior Specification Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Leader election [Franklin ’82] 5

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder compare values at different nodes

slide-61
SLIDE 61

71 42 19 23 47

Distributed algorithms

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

Behavior Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Data Propositional Dynamic Logic

Leader election [Franklin ’82] 5

[Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder compare values at different nodes

slide-62
SLIDE 62

71 42 19 23 47

Distributed algorithms

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

Behavior Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Data Propositional Dynamic Logic

Leader election [Franklin ’82] 5

[Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder compare values at different nodes

slide-63
SLIDE 63

71 42 19 23 47

Distributed algorithms

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

Behavior Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Data Propositional Dynamic Logic

Leader election [Franklin ’82] 5

[Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

move in the cylinder compare values at different nodes

slide-64
SLIDE 64

71 42 19 23 47

Distributed algorithms

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

Behavior Distributed algorithm

active passive

fwd

leader

«At the end, there is a leader, and the leader is the process with the maximum id.»

Data Propositional Dynamic Logic

Leader election [Franklin ’82] 5

[Bojanczyk et al. ’09; Figueira-Segoufin ‘11]

| =

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

For all n, pid distributions, and accepting runs:

move in the cylinder compare values at different nodes

slide-65
SLIDE 65

Specifications: distributed sorting

Φ, Φ′ ::= A φ | Φ ∧ Φ′ φ, φ′ ::= ϕ | φ ∧ φ′ | ϕ ∨ φ | [π]φ | ⟨η⟩r < ⟨η′⟩r′ | ⟨η⟩r ≤ ⟨η′⟩r′ ϕ, ϕ′ ::= ‡ | p | ¬ϕ | ϕ ∧ ϕ′ | ⟨π⟩ϕ | ⟨π⟩r = ⟨π′⟩r′ | ⟨π⟩r ̸= ⟨π′⟩r′ π, π′ ::= {ϕ}? | → | ↓ | π−1 | π + π′ | π · π′ | π∗ η, η′ ::= {ϕ}? | ← | → | ↓ | ↑ | η · η′ | Fη

ϕ

The output values form a permutation of the input values

  • same set of values:
  • pairwise distinct:

¬⟨→∗⟩(⟨ε⟩r = ⟨(→{¬‡}?)+⟩r)

[→∗](⟨ε⟩r = ⟨↑∗{¬⟨↑⟩}?→∗⟩r)

slide-66
SLIDE 66

5 71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id right?r2 id < r2

| {z }

For all n, pid distributions, accepting runs, and processes:

active passive leader

fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

right?r2 id < r2

slide-67
SLIDE 67

5 71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id right?r2 id < r2

| {z }

For all n, pid distributions, accepting runs, and processes:

active passive leader

fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

right?r2 id < r2

slide-68
SLIDE 68

5 71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id right?r2 id < r2

| {z }

For all n, pid distributions, accepting runs, and processes:

active passive leader

fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

right?r2 id < r2

slide-69
SLIDE 69

5 71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id right?r2 id < r2

| {z }

For all n, pid distributions, accepting runs, and processes:

active passive leader

fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

right?r2 id < r2

slide-70
SLIDE 70

5 71 42 19 23 47

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id right?r2 id < r2

| {z }

For all n, pid distributions, accepting runs, and processes:

active passive leader

fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

left ! id right ! id id > r1 ∧ id > r2 left?r1 right?r2 left ! id right ! id id < r1 ∨ id < r2 left?r1 right?r2 left ! id right ! id id = r1 left?r1 right?r2

right?r2 id < r2

slide-71
SLIDE 71

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id id < ?right id < ?right

| {z }

For all n, pid distributions, accepting runs, and processes:

left ! id right ! id id > ?left id > ?right left ! id right ! id

active passive

id = ?left

leader

id < ?left id < ?right

∨ ∧

left ! id right ! id fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

ϕ

<-path

slide-72
SLIDE 72

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id id < ?right id < ?right

| {z }

For all n, pid distributions, accepting runs, and processes:

left ! id right ! id id > ?left id > ?right left ! id right ! id

active passive

id = ?left

leader

id < ?left id < ?right

∨ ∧

left ! id right ! id fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

Loop ( π . (r,r’)-<-path . (π’)-1 )

hπir  hπ0ir0

ϕ

<-path

slide-73
SLIDE 73

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id id < ?right id < ?right

| {z }

For all n, pid distributions, accepting runs, and processes:

left ! id right ! id id > ?left id > ?right left ! id right ! id

active passive

id = ?left

leader

id < ?left id < ?right

∨ ∧

left ! id right ! id fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

Loop ( π . (r,r’)-<-path . (π’)-1 )

hπir  hπ0ir0

go-to-

—1

ϕ

there is loop

ϕ holds here

<-path

slide-74
SLIDE 74

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id id < ?right id < ?right

| {z }

For all n, pid distributions, accepting runs, and processes:

left ! id right ! id id > ?left id > ?right left ! id right ! id

active passive

id = ?left

leader

id < ?left id < ?right

∨ ∧

left ! id right ! id fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

Loop ( π . (r,r’)-<-path . (π’)-1 )

hπir  hπ0ir0

go-to-

—1

ϕ

there is loop

ϕ holds here

⇐ ⇒

no loop no evidence of there are pids making false

ϕ ϕ

<-path

slide-75
SLIDE 75

Distributed algorithms

Behavior Distributed algorithm Data PDL

∧ [ *] (id ≤ ⟨go-to- ⟩ id))

go-to- = (¬ )*

⟨ *⟩ ( ¬⟨ ⟩ ∧ ⟨go-to- ⟩

«There is a leader, and the leader is the process with the maximum id.»

left!id id < ?right id < ?right

| {z }

For all n, pid distributions, accepting runs, and processes:

left ! id right ! id id > ?left id > ?right left ! id right ! id

active passive

id = ?left

leader

id < ?left id < ?right

∨ ∧

left ! id right ! id fwd

t1 t2 t4 t3

id id

left!id

t1

t1

t2 t2 t2

t2 t1 t2

t3 t3 t3 t3 t4 t3 t3 t3 t3 t3

Loop ( π . (r,r’)-<-path . (π’)-1 )

hπir  hπ0ir0

go-to-

—1

ϕ

deterministic

there is loop

ϕ holds here

⇐ ⇒

no loop no evidence of there are pids making false

ϕ ϕ

id ≤ ⟨ ⟩ id id > ⟨ ⟩ id

<-path

slide-76
SLIDE 76

compare values at different nodes r < r’ η’ η

Φ, Φ′ ::= A φ | Φ ∧ Φ′ φ, φ′ ::= ϕ | φ ∧ φ′ | ϕ ∨ φ | [π]φ | ⟨η⟩r < ⟨η′⟩r′ | ⟨η⟩r ≤ ⟨η′⟩r′ ϕ, ϕ′ ::= ‡ | p | ¬ϕ | ϕ ∧ ϕ′ | ⟨π⟩ϕ | ⟨π⟩r = ⟨π′⟩r′ | ⟨π⟩r ̸= ⟨π′⟩r′ π, π′ ::= {ϕ}? | → | ↓ | π−1 | π + π′ | π · π′ | π∗ η, η′ ::= {ϕ}? | ← | → | ↓ | ↑ | η · η′ | Fη

ϕ

deterministic paths

⟨η⟩r < ⟨η′⟩r′

Specifications Data PDL

slide-77
SLIDE 77

Data abstraction

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

71 42 19 23 47 5

t1 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

⇐ ⇒ A | = ϕ

valid

  • ver cylinders

# $

effective effective

slide-78
SLIDE 78

Data abstraction

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

71 42 19 23 47 5

t1 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

⇐ ⇒ A | = ϕ

valid

  • ver cylinders

UNDECIDABLE

two unbounded dimensions

# $

effective effective

slide-79
SLIDE 79

Model Checking 2

47 23 19 71 5 42

slide-80
SLIDE 80

Under approximate verification

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

⇐ ⇒ A | = ϕ

valid

  • ver cylinders

undecidable

Behavior 1 2 3 k

restrict to bounded number of rounds

# $ ⇒

slide-81
SLIDE 81

Distributed algorithm Data PDL

A ϕ

PDL with loop (over finite alphabet)

valid

  • ver cylinders

71 42 19 23 47 5

t1 t1 t1 t4 t2 t2 t2 t2 t2 t3 t3 t3 t3 t3 t3 t3 t3 t3

exponentially smaller than # of processes

undecidable restrict to bounded number of rounds

# $

⇐ ⇒ A | = ϕ

slide-82
SLIDE 82

PDL with loop over bounded cylinders ➯ PDL with loop over words

Bounded Unbounded

slide-83
SLIDE 83

PDL with loop over bounded cylinders ➯ PDL with loop over words

Bounded Unbounded

slide-84
SLIDE 84

PDL with loop over bounded cylinders ➯ PDL with loop over words

Bounded Unbounded

left/right moves

slide-85
SLIDE 85

PDL with loop over bounded cylinders ➯ PDL with loop over words

Bounded Unbounded Bounded

left/right moves up/down moves

slide-86
SLIDE 86

PDL with loop over bounded cylinders ➯ PDL with loop over words ➯ Alternating 2-way Automata ➯ PSPACE

[Göller-Lohrey-Lutz ’08] [Serre ’08] Bounded Unbounded Bounded

left/right moves up/down moves

slide-87
SLIDE 87

Summary & Conclusion

47 23 19 71 5 42

slide-88
SLIDE 88

** unary encoding of # of rounds * with registers, register guards, and register updates (no arithmetic)

Summary

exponentially smaller than # of processes

Theorem (Aiswarya-Bollig-Gastin; CONCUR ’15). Round-bounded model checking distributed algorithms* against Data PDL is PSPACE- complete**.

slide-89
SLIDE 89
  • Other operations? (increment only, decrement only, …)
  • Other topologies?
  • Other restrictions? (bounded tree-width, …)
  • Other hypotheses on DA?
  • What is the right temporal logic?
  • How to deal with data?
  • How to deal with undecidability?

Use generic Data PDL. Use symbolic technique. Under-approximation.

Conclusion Future work …

slide-90
SLIDE 90

Thank you!