43
Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Embed Size (px)

Citation preview

Page 1: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synthesis for Concurrent Models

Anca Muscholl

LIAFA, Univ. Paris 7

Dagstuhl, June 2005

joint work with Blaise Genest (Warwick, UK)

Page 2: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Framework

Current applications/systems (web, networks, embedded systems…) are mostly distributed and asynchronous

Design process needs formal methods and automatic verification techniques

Here: Distributed synthesis for closed systems

Page 3: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Outline of talk

Models for distributed systems

Synthesis for shared-variable FSM

Synthesis for communicating FSM

Outlook

Page 4: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Distributed Models

Fixed set of processes and FSM Mp

(one per process p)

Mp cooperate either through

messages/signals (message-passing, I/0 automata) or

shared variables (Petri nets, asynchronous automata)

Page 5: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Outline of talk

Models for distributed systems

Synthesis for shared-variable FSM

Synthesis for communicating FSM

Outlook

Page 6: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Shared-variable models

distributed alphabet A = (A1, …, An), over processes {1,2,…,n}

action a involves processes from dom(a) = { i j a 2 Ai }

a-transition changes all local states of processes i 2 dom(a)

Page 7: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Shared variables

Two flavors of transitions: (q1,…,qn) !a (q’1,…,q’n)

Loosely cooperating

qi !a,i q’i for all i 2 dom(a)

Synchronously communicating (asynchronous automata)

(qi)i 2 dom(a) !a (q’i)i 2 dom(a)

Page 8: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Shared variables

Example: A = {a,b,c}, A1 = {a,b}, A2 = {b,c}

dom(a) = {1}, dom(b) = {1,2}, dom(c) = {2}

q1

q2

a

b

c

loosely-cooperating:

if (0,0) !b (1,1) and (1,1) !b (0,0), then also (0,1) !b (1,0) and(1,0) !b (0,1)

Page 9: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Loosely cooperating case

Given: FSM M = (Q, A, q0, !)

Q: Test whether M is equivalent to a loosely cooperating FSM, and construct one, if yes.

PSPACE algorithm:

test whether L(M) is a product language:

L(M) = i Proji L(M)

Page 10: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

Given: FSM M = (Q, A, q0, !, F)

Q: Test whether M is equivalent to a synchronously-communicating FSM, and construct one, if yes.

PSPACE algorithm: test whether L(M) is commutation-closed:

dom(a) Å dom(b) = ; implies u ab v 2 L(M) iff u ba v 2 L(M)

Page 11: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

alphabet A,

independence relation || µ A £ A

a || b iff dom(a) Å dom(b) = ;

Mazurkiewicz trace [w] = set of words

obtained from w by commuting independent adjacent letters

Framework: Mazurkiewicz traces

Page 12: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

Example:

A = {a,b,c}, A1 = {a,b}, A2 = {b,c}

dom(a) = {1}, dom(b) = {1,2}, dom(c) = {2}

trace [acabbca] = {acabbca, aacbbca, caabbac,…}

L = ((aa+ac+ca+cc)* (a+c) b)* commutation-closed

Page 13: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

Zielonka’s Theorem ’87

For every commutation-closed regular language one can construct an equivalent,deterministic synchronous-communication FSM of doubly exponential size.

Rem. Determinism hard to get. Doubly exponential only in number of processes.

Page 14: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

FSM M1, M2, with state set Qi = {0,1}

each a-transition counts modulo 2 in Q1 (c-transition modulo 2 in Q2)

each b-transition checks that the sum is odd, and resets both counters

Example: A = {a,b,c}, A1 = {a,b}, A2 = {b,c}

L = ((aa+ac+ca+cc)* (a+c) b)* comm.-closed

Page 15: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication

Deterministic synchronous-comm. (Muller) FSM

Regular,commutation-closed languages

Monadic second-order logic

over trace pomsets

[Ebinger, Diekert, Muscholl, Thomas, Zielonka ‘9x]

Page 16: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synchronous communication: deadlocks

Additional requirement: deadlock-freeness Safe synchr.-comm. FSM: all reachable

states are final [Stefanescu/Esparza/M.’03, Mukund’02]

A regular, commutation-closed language L is safely implementable iff it is prefix-closed and satisfies the forward diamond property:

ua 2 L, ub 2 L, a || b implies uab 2 L

Page 17: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Outline of talk

Models for distributed systems

Synthesis for shared-variable FSM

Synthesis for communicating FSM

Outlook

Page 18: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Asynchronous communication models

Several peers exchange messages through P2P fifo channels (unbounded)

Each peer: FSM with send/receive events to/from other peers

ITU norm Z.100 (SDL)

Page 19: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Sequential processes P, Q, …

Each process: FSM AP with events:

send P snd Q(m), receive P rcv Q(m)

Configuration of CFM = current local states sP

+ current contents of (FIFO) channels CP,Q

infinite-state systems

Communicating FSM (CFM)

Page 20: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

CFM: Good for what?

CFM hard to design (need to consider global runs/executions)

… aka assembler programming

CFM: models of protocols

Suitable formalism for protocol specification?

Page 21: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

P

C

rcv(P)

snd(C)

Psnd(C) Psnd(C) Crcv(P) Crcv(P)

Psnd(C) Crcv(P) Psnd(C) Crcv(P)

P C

several executions: one diagram

Message sequence chart(ITU norm Z120)

Diagrams: One for All

Page 22: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Events a,b,c,d

Partial order:

process order: a <P c, b <C d

message order: a < b, c < d

time

MSC

P C

a

b

c

d

Partial order semantics:

Example: events b and c are uncomparable

Message Sequence Charts (MSC, ITU Z.120)

Page 23: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Message Sequence Charts (MSC, ITU Z.120)

Scenario-based formalism: positive and negative scenarios

Capture requirements in visual form

Good for high-level description

Collection of MSC: MSC-graphs

Page 24: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

P C P CP C

P C

Graph representation: composition, iteration, choice

MSC-graph defines set of MSCs:

Collections of scenarios: MSC-graphs

Page 25: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

L(G) = set of MSC labeling accepting paths of G

C1 C2

G

P

data

C1 C2P

C1C2

P

dataack

ack

ack

resend

ack

A

B

CS = {A,B,C}

Initial state A

Final state C

Accepting paths AB* Cresend

MSC-Graphs (ITU Z.120)

Page 26: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synthesis: Communication

Specification: high-level, abstract,.. MSC-graph,..

Implementation: local design

Communicating FSM (CFM)

Page 27: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Synthesis: Bounded (regular) case

A CFM is bounded if there is a bound B such that in any reachable configuration, the number of pending messages on any channel is · B.

Loop-connected MSC-graph G: syntactical property ensuring boundedness

(communication graph of each loop of G is strongly connected)

Page 28: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Bounded case: expressivity

Bounded CFM

[Mukund, Thiagarajan et al. 00]

Loop-connected(C)MSC-graphs

Monadic second-order

logic overbounded MSCs

Page 29: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Bounded case

Loop-connected MSC-graphs can be translated into finite automata, hence they can be model-checked.

[M/Peled 99, Alur/Yannakakis 99]

Distributed synthesis: from regular MSC language to CFM

[Mukund, Thiagarajan et al. 00]

Page 30: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Bounded case: too weak

P

C

rcv(P)

snd(C)

CFM

Bounded CFM have low expressivity.

Producer/consumer:typical unbounded behavior

Page 31: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Weakly bounded channels

P

C

rcv(P)

snd(C) R = (P snd(C) C rcv(P))* regularset of representatives:

every execution of the CFM has anequivalent execution in R

A CFM is weakly-B-bounded if its B-boundedexecutions build a set of representatives.

Def.

Page 32: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Weakly bounded channels

What does a weak channel bound mean?

Receiving messages can be (fairly) scheduled within channels of some fixed size.

Implementations of communication protocols are usually weakly bounded!

Page 33: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Weak bounds: expressivity

Weakly-boundedCFM

[Genest, Kuske, Muscholl 04]

Globally-cooperative

CMSC-graphs

Monadic second order logic over

w-bounded MSC

Page 34: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Weak bounds: main result

Globallycooperative CMSC-graph

Weakly-bounded CFM

Regular set of B-boundedrepresentatives

Monadic second-order logic over w-bounded MSC

Distributed synthesis

Page 35: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Some proof ideas

weakly-2-bounded:

P C

a

ba a b a b b a a b ba b a b a b a b a b, …

Compute B-bounded executions by applying special rewriting rules (commutations). [Kuske’s trick]

Example:

Page 36: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Weakly bounded CMSC-graphs and Mazurkiewicz traces

a b ´ b aa b ´ b a

a,a,b,b}alphabet

ab ab ab ´ a a b a b b ´ a a b b a b

CP

a

a b

M

a

b

b

[ab ab ab]´

Mazurkiewicz trace

commutation rules

Page 37: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

B-bounded executions

a

amsg

rev

lP

lP

a b

b

lC

lC

brev associates the i-th receive

with the (i+2)-th send

Process order <P

Message order msgRelation rev

B-bounded executions = set of Mazurkiewicz traces

Page 38: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Mazurkiewicz Trace Theory: [Zielonka ‘87] Synchr.-communicating automata

Start with CMSC-graph (or MSO-formula) such thatthe set of B-bounded executions is a regular set of representatives

Construct an equivalent, weakly-B-bounded CFM.

special case of distributed synthesis

From regular representatives to CFM

Page 39: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

2. Simulate a synchr.-comm. automaton T by a CFM:

1. B-bounded executions: equivalent trace automaton

T uses:

process ordermessage orderrev relation

(k1)

state k1

k2

k3 (k

3)

k4 (k5 ,GUESS)

k5

k6

check GUESS = k2

From regular representatives to CFM

Page 40: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Using trace automata: equivalent CFM up to weakly-B-bounded executions

Reject non-weakly-B-bounded MSCs:

Given Set of MSCs with regular set of B-bounded representatives. Construct equivalent CFM

Construct CFM that controls weakly-B-bounded on-the-fly.

From regular representatives to CFM

Page 41: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Asynchronous communication: deadlocks

Our implementation of weakly-bounded MSC-graphs has too many deadlocks

Another approach [Genest, Concur’05]: Implement a given regular specification by adding messages (within a fixed

architecture). Then: Any specification satisfying the diamond

properties is deadlock-free implementable, if choices are always local.

Page 42: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Conclusion

Shared-variable case is solved. Communication-based models: solved

for language equivalence (modulo deadlocks), but other types of equivalence are even more challenging

Weak channel bounds are a reasonable restriction: messages can be scheduled on finite channels

Page 43: Synthesis for Concurrent Models Anca Muscholl LIAFA, Univ. Paris 7 Dagstuhl, June 2005 joint work with Blaise Genest (Warwick, UK)

Outlook

Deadlocks: find reasonable restrictions on specifications ensuring deadlock-free implementations (Genest’05)

Extend the MSC-graph framework by partial views, synthesis from partial

views? Open systems: Alternating synchr.-comm. automata

(Gastin et al. ’04): special case CFM with uncontrolable processes?