bisimulation, games, and Hennessy-Milner logic

44 downloads 293 Views 597KB Size Report
Univeristy of Southampton, UK. Bisimulation, Games & Hennessy Milner logic – p .1/32. Classical language theory. Is concerned primarily with languages, eg.
Classical language theory Is concerned primarily with languages, eg.

Bisimulation, Games & Hennessy Milner logic

finite automata ↔ regular languages;

Lecture 1 of Modelli Matematici dei Processi Concorrenti

turing machines ↔ recursively enumerable languages;

´ Paweł Sobocinski

pushdown automata ↔ context-free languages;

This is fine when we think of an automaton/TM as a sequential process which has no interactions with the outside world during its computation.

Univeristy of Southampton, UK

However, automata which accept the same languages can behave very differently to an outside observer.

Bisimulation, Games & Hennessy Milner logic – p.1/32

The famous coffee machine example

Bisimulation, Games & Hennessy Milner logic – p.2/32

Labelled transition systems A labelled transition system (LTS) L is a triple hS, A, T i where:

Inserire soldi

s

s

Caffè

S is a set of states;

s

A is a set of actions;

Bevanda al gusto di tè al limone

T ⊆ S × A × S is the transition relation.

c

c

t

t

a

We will normally write p − → p′ for (p, a, p′ ) ∈ T . Labelled transition systems generalise both automata and trees. They are a central abstraction of concurrency theory.

We will discuss the observations one can make about such systems. Bisimulation, Games & Hennessy Milner logic – p.4/32

Bisimulation, Games & Hennessy Milner logic – p.3/32

Trace preorder

Trace equivalence

Given a state p of an LTS L, the word σ = α1 α2 . . . αk ∈ A∗ is a trace of p when ∃ transitions α

α

α

2 1 k p′ p −→ . . . pk−1 −→ p1 −→

σ

We will use p − → p′ as shorthand.

Suppose that L1 and L2 are LTSs. The trace preorder ≤tr ⊂ S1 × S2 is defined as follows: p ≤tr q



σ

Trace equivalence is defined ∼tr =≤tr ∩ ≥tr , ie def

p ∼tr q = p ≤tr q ∧ q ≥tr p

It is immediate that when L1 = L2 , ∼tr is an equivalence relation on the states of an LTS But traces are not enough: trace equivalence is very coarse, since the coffee machines have the same traces.

σ

∀σ ∈ A∗ . p − → p′ ⇒ ∃q ′ . q − → q′

Observation 1. ≤tr is reflexive and transitive.

c

Bisimulation, Games & Hennessy Milner logic – p.5/32

s

s t

∼tr

c

s t

Bisimulation, Games & Hennessy Milner logic – p.6/32

Simulation example 1

Simulation Suppose that L1 and L2 are LTSs. A relation R ⊆ SL1 × SL2 is called a simulation whenever: a

Simulation is more sensitive to branching (ie non-determinism) than traces:

a

if pRq and p − → p′ then there exists q ′ such that q − → q′ and p′ Rq ′ .

p1 s

Observation 2. The empty relation is a simulation and arbitrary unions of simulations are simulations.

Similarity ≤s ⊆ S1 × S2 is defined as the largest simulation. Equivalently, p ≤s q iff there exists a simulation R such that (p, q) ∈ R.

q1 c c1

p2

!s

s q2

≥s

t

s q3

c c2

t1

t t2

Observation 3. Similarity is reflexive and transitive. def

Observation 4. Simulation equivalence ∼s = ≤s ∩ ≥s . Bisimulation, Games & Hennessy Milner logic – p.7/32

Bisimulation, Games & Hennessy Milner logic – p.8/32

Simulation example 2

Bisimulation Suppose that L1 and L2 are LTSs. A relation R ⊆ SL1 × SL2 is called a bisimulation whenever:

But it is not entirely satisfactory.

p

p a

a

c

b r1

a

q1

q

r2

a

a

a

a

(i) if pRq and p − → p′ then there exists q ′ such that q − → q′ and p′ Rq ′ ; (ii) if qRp and q − → q ′ then there exists p′ such that p − → p′ and p′ Rq ′ .

q2

b

c

c

r1

r1′

r2

Lemma 5. R is a bisimulation iff R and Rop are simulations.

Bisimulation, Games & Hennessy Milner logic – p.10/32

Bisimulation, Games & Hennessy Milner logic – p.9/32

Properties of bisimulations

Examples of bisimulations, 1

Lemma 6. ∅ is a bisimulation. Proof. Vacously true. Lemma 7. If {Ri }i∈I are a family of bisimulations then bisimulation.

S

S

i∈I

Ri is a

a p

Proof. Let R = i∈I Ri . Suppose pRq then there exists k such that pRk q . In particular, qRk p and so qRp, thus R is symmetric.

a a If p − → p′ then there exists q ′ such that q − → q ′ and p′ Rk q ′ . But p′ Rk q ′ implies p′ Rq ′ .

Corollary 8. There exists a largest bisimulation ∼. It is called bisimilarity.

If L1 = L2 then bisimilarity is an equivalence relation.

Bisimulation, Games & Hennessy Milner logic – p.11/32

q1 a q2 a q3 a q4 a q5 a .. .

Lemma 9. p ∼ q1 .

Proof. R = { (p, qi ) | i ∈ N } is a bisimulation. Bisimulation, Games & Hennessy Milner logic – p.12/32

Examples of bisimulations, 2 a

p1

To show that states p, q are bisimilar it suffices to find a bisimulaion R which relates p and q ;

q

p a

Reasoning about bisimilarity

a



p2

It is less clear how to show that p and q are not bisimilar, one can: enumerate all the relations which contain (p, q) and show that none of them are bisimulations; enumerate all the bisimulation and show that none of them contain (p, q); borrow some techiniques from game theory...

q1

a

q a

p b p1



q2 b a b q3 b a q1 b q4

a

Bisimulation, Games & Hennessy Milner logic – p.13/32

Bisimulation, Games & Hennessy Milner logic – p.14/32

Bisimulation game, 1

Bisimulation game, 2

We are given two LTSs L1 , L2 . The configuration is a pair of states (p, q), p ∈ L1 , q ∈ L2 . The bisimulation game has two players: P and R . A round of the game proceeds as follows:

Rules: An infinite game is a win for P . R wins iff the game gets into a round where P cannot respond with a transition in step (iii).

(i) R chooses either p or q ; a

(ii) assuming it chose p, it next chooses a transition p − → p′ ;

Observation 10. For each configuration (p, q), either P or R has a winning strategy. Theorem 11. p ∼ q iff P has a winning strategy. (p ≁ q iff R has a winning strategy.)

(iii) P must choose a transition with the same label in the other LTS, ie assuming R chose p, it must find a a transition q − → q′;

(iv) the round is repeated, replacing (p, q) with (p′ , q ′ ).

Bisimulation, Games & Hennessy Milner logic – p.15/32

P has a winning strategy ⇒ p ∼ q Suppose that (p, q) ∈ GE and p − → a

does not exist a transition q − →

q′

p′ .

Suppose that there

such that a

(p′ , q ′ )

p ∼ q ⇒ P has a winning strategy Bisimulations are winning strategies:

def

Let GE = { (p, q) | P has a winning strategy }. a

Bisimulation, Games & Hennessy Milner logic – p.16/32

∈ GE .

Then R can choose the transition p − → p′ and P cannot respond in a way which keeps him in a winnable position. But

If p ∼ q then there exists a bisimulation R such that (p, q) ∈ R. Whatever move R makes, P can always make a move such that the result is in R. Clearly, this is a winning strategy for P.

this contradicts the fact that that P has a winning strategy for the game starting with (p, q). Thus GE is a bisimulation.

Bisimulation, Games & Hennessy Milner logic – p.17/32

Bisimulation, Games & Hennessy Milner logic – p.18/32

Examples of non bisimilar states

Theorem 12. ∼⊂≤ ∩ ≥ and in general the inclusion is strict.

Bisimilarity is branching-sensitive. p

q1

q b r1

Proof. Any bisimulation and its opposite are clearly simulations. On the other hand, the following example shows that bisimilarity is finer than simulation equivalence.

p a

a

c r2

Similarity and bisimilarity

a q2

p

b

c

r1

r2

p a

a

b r1

a

q1

q c r2

q2

b

c

c

r1

r1′

r2

Bisimulation, Games & Hennessy Milner logic – p.19/32

Recap: equivalences

Bisimulation, Games & Hennessy Milner logic – p.20/32

Hennessy Milner logic Suppose that A is a set of actions. Let

∼ ⊂ ∼s ⊂ ∼tr

Bisimilarity is the finest (=equates less) equivalence we have considered. Claim 13. Bisimilarity is the finest “reasonable” equivalence, where “reasonable” means that we can observe only the behaviour and not the state-space.

We will give a language, the so-called Hennessy Milner logic, which describes observations/experiments on LTSs.

L ::= [a]L | haiL | ¬L | L ∨ L | L ∧ L | ⊤ | ⊥

Given an LTS we define the semantics by structural induction over the formula ϕ: a

q  [A]ϕ if for all q ′ such that q − → q ′ we have q ′  ϕ; q  hAiϕ if there exists

q′

a

such that q − → q ′ and q ′  ϕ;

q  ¬ϕ if it is not the case that q  ϕ; q  ϕ1 ∨ ϕ2 if q  ϕ1 or q  ϕ2 ;

q  ϕ1 ∧ ϕ2 if q  ϕ1 and q  ϕ2 ; q  ⊤ always; Bisimulation, Games & Hennessy Milner logic – p.21/32

HM logic example formulas hai⊤ – can perform a transition labelled with a;

[a]⊥ – cannot perform a transition labelled with a;

q  ⊥ never;

Bisimulation, Games & Hennessy Milner logic – p.22/32

Basic properties of HM logic Lemma 14 (“De Morgan” laws for HM logic).

[a] = ¬hai¬;

hai[b]⊥ – can perform a transition labelled with a to a state from which there are no b labelled transitions.

hai = ¬[a]¬;

hai([b]⊥ ∧ hci⊤) – ?

∨ = ¬(¬ ∧ ¬);

∧ = ¬(¬ ∨ ¬); ⊤ = ¬⊥; ⊥ = ¬⊤.

In particular, to get the full logic it suffices to consider just the subsets {hai, ∨, ⊥, ¬} or {[a], ∧, ⊤, ¬} or {hai, [a], ∨, ∧, ⊤, ⊥}.

Bisimulation, Games & Hennessy Milner logic – p.23/32

Bisimulation, Games & Hennessy Milner logic – p.24/32

Distinguishing formulas p

a

q1

q c

b r1

r2

q2

b

c

r1

r2

 hai(hbi ∧ hci)

It is clearly reflexive and transitive. def

Definition 16. Logical equivalence is ∼L = ≤L ∩ ≥L . It is an equivalence relation.

p a

a

c r2

Observation 17. Actually, for HM, ≤L =∼L =≥L . This is a consequence of having negation.

a

q1

q b

p