eecs 20 lecture 16 (february 26, 2001) tom henzinger

67
EECS 20 Lecture 16 (February 26, 2001) Tom Henzinger Determinizatio n

Upload: shoushan-mccoy

Post on 01-Jan-2016

31 views

Category:

Documents


2 download

DESCRIPTION

Determinization. EECS 20 Lecture 16 (February 26, 2001) Tom Henzinger. State machines. Deterministic   Output-deterministic   Nondeterministic. X. X. A state machine is deterministic iff there is only one initial state, and - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

EECS 20

Lecture 16 (February 26, 2001)

Tom Henzinger

Determinization

Page 2: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

State machines

Deterministic

Output-deterministic

Nondeterministic

X

X

Page 3: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

A state machine is deterministic

iff

1. there is only one initial state, and

2. for every state and every input, there is only one successor state.

Hence, for every input signal there is exactly one run.

Page 4: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

A state machine is output-deterministic

iff

1. there is only one initial state, and

2. for every state and every input-output pair, there is only one successor state.

Hence, for every behavior there is exactly one run.

Page 5: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

State machines

Deterministic

Output-deterministic

Nondeterministic

Simulations can be found easily

Page 6: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

If M2 is a deterministic state machine, then

M1 is simulated by M2

iff

M1 is equivalent to M2.

“if and only if”

M1 refines M2, and M2 refines M1

Page 7: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

If M2 is an output-deterministic state machine, then

M1 is simulated by M2

iff

M1 refines M2.

Page 8: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

If M2 is a nondeterministic state machine, then

M1 is simulated by M2

implies

M1 refines M2.

Page 9: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Fortunately:

For every nondeterministic state machine M, we can find an output-deterministic state machine det(M) that is equivalent to M.

( This is called “subset construction.” )

Page 10: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Then, to check if M1 refines M2, check if M1 is simulated by det(M2):

M1 refines M2

iff

M1 refines det(M2)

iff

M1 is simulated by det(M2).

Page 11: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Then, to check if M1 refines M2, check if M1 is simulated by det(M2):

M1 refines M2

iff

M1 refines det(M2)

iff

M1 is simulated by det(M2).

output-deterministic

Page 12: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Subset Construction

Given: nondeterministic state machine M

Find: output-deterministic state machine det(M) that is equivalent to M

Page 13: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Subset Construction

Given: nondeterministic state machine M

Find: output-deterministic state machine det(M) that is equivalent to M

Inputs [det(M)] = Inputs [M]

Outputs [det(M)] = Outputs [M]

Page 14: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Subset Construction

Let initialState [ det(M) ] = possibleInitialStates [M] ;

Let States [ det(M) ] = { initialState [det(M)] } ;

Repeat as long as new transitions can be added to det(M) :

Choose P States [det(M)] and (x,y) Inputs Outputs ;

Let Q = { q States [M] | p P, (q,y) possibleUpdates [M] (p,x) } ;

If Q Ø then

Let States [det(M)] = States [det(M)] {Q} ;

Let update [det(M)] (P,x) = (Q,y) .

Page 15: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

x / y

x / y

p

{p}

q1

q2

M

det(M)

Page 16: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

x / y

x / y

x / y

p

{p}

q1

q2

{q1,q2}

M

det(M)

Page 17: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

det(M)

Page 18: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

{a}

det(M)

Page 19: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

{a}

det(M)

0 / 0

Page 20: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

Page 21: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

0 / 0

Page 22: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0 1 / 1

0 / 0

Page 23: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

{b}

0 / 1

1 / 1

0 / 0

Page 24: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

{b}

0 / 1 1 / 0

1 / 1

0 / 0

Page 25: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

{b}

0 / 1

0 / 1 1 / 0

1 / 1

0 / 0

Page 26: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1 / 1 a bM

0 / 0 1 / 1

0 / 1 1 / 0

1 / 1 {a}

{a,b}

det(M)

0 / 0

{b}

0 / 1 1 / 0

0 / 1 1 / 0

1 / 1

0 / 0

Page 27: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

Page 28: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

Page 29: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

Page 30: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

Page 31: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

Page 32: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

{b} / 1

Page 33: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

{b} / 1

/ 1

Page 34: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

{b} / 1

/ 1

/ 1

Page 35: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

{b} / 1

/ 1

/ 1

{d} / 0

Page 36: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

M

det(M)

a b

/ 0

/ 1

/ 1

c d

/ 1

/ 0

/ 0

{a,c}

{a,d} / 0

{b,c}

/ 1

/ 0

{b} / 1

/ 1

/ 1

{d} / 0

/ 0

Page 37: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

For a given reactive system S:

1. If there is a nondeterministic state machine that implements S with n states, then there is an output-deterministic state machine that implements S with 2n states.

[Subset construction]

2. There may not be an output-deterministic state machine that implements S with fewer than 2n

states. [Homework 5, Problem C]

3. There may not be a unique nondeterministic state machine that implements S with the fewest states.

Page 38: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/

/ 0

/ / 0 / 1

/ 0 /

/ 0

/ / 0 / 1

equivalent but not isomorphic to

Page 39: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

So what does minimization do for nondeterministic state machines ?

Page 40: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Nondeterministic Minimization Algorithm

Input : nondeterministic state machine M

Output : minimize (M), the state machine with the fewest states that is bisimilar to M

(the result is unique up to renaming of states)

Page 41: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

A binary relation B States [M1] States [M2] is a bisimulation between M1 and M2

iff

A1. p possibleInitialStates [M1] ,

q possibleInitialStates [M2], ( p, q ) B, and

A2. p States [M1] , q States [M2] ,

if ( p, q ) B ,

then x Inputs , y Outputs , p’ States [M1] ,

if ( p’, y ) possibleUpdates [M1] ( p, x )

then q’ States [M2] ,

( q’, y ) possibleUpdates [M2] ( q, x ) and

( p’, q’ ) B , and

Page 42: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

B1. q possibleInitialStates [M2] ,

p possibleInitialStates [M1], ( p, q ) B, and

B2. p States [M1] , q States [M2] ,

if ( p, q ) B ,

then x Inputs , y Outputs , q’ States [M2] ,

if ( q’, y ) possibleUpdates [M2] ( q, x )

then p’ States [M1] ,

( p’, y ) possibleUpdates [M1] ( q, x ) and

( p’, q’ ) B .

and

Page 43: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

p

q

p’

x / y

B

Page 44: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

p

q

p’

x / y

q’

x / y

B

Page 45: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

p

q

p’

x / y

q’

x / y

B

Page 46: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

p

q

p’

x / y

q’

x / y

B

x / yq’’

x / y

X

Page 47: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

p

q

p’

x / y

q’

x / y

B

x / yq’’

Page 48: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

For deterministic state machines M1 and M2,

M1 is equivalent to M2

M1 and M2 are bisimilar.

Page 49: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

For nondeterministic state machines M1 and M2,

M1 is equivalent to M2

M1 and M2 are bisimilar.

X

Page 50: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

States

The Nondeterministic Minimization Algorithm

Page 51: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1/0 1/0

1/0

1/0

1/0

1/0

1/01/0

1/0

X

X

XX

X

The Nondeterministic Minimization Algorithm

Page 52: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Nondeterministic Minimization Algorithm

Page 53: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1/01/0

1/0 1/0

X

The Nondeterministic Minimization Algorithm

Page 54: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Nondeterministic Minimization Algorithm

Page 55: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

0/1

0/1

0/1

X

The Nondeterministic Minimization Algorithm

Page 56: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

The Nondeterministic Minimization Algorithm

Page 57: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

1. Let Q be set of all reachable states of M.

2. Maintain a set P of state sets:

Initially let P = { Q }.

Repeat until no longer possible: split P.

3. When done, every state set in P represents a single state of the smallest nondeterministic state machine bisimilar to M.

The Nondeterministic Minimization Algorithm

Page 58: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Split P

If there exist

two state sets R P and R’ P

two states r1 R and r2 R

an input x Inputs

an output y Outputs

such that

r’ R’, ( r’, y ) possibleUpdates ( r1, x ) and

r’ R’, ( r’, y ) possibleUpdates ( r2, x )

then

let R1 = { r R | r’ R’, ( r’, y ) possibleUpdates ( r, x ) } ;

let R2 = R \ R1 ;

let P = ( P \ { R } ) { R1, R2 } .

Page 59: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Split

R’Rx / y

x / y

r1

r2 X

Page 60: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

Split

R’Rx / y

x / y

r1

r2 X

Page 61: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/0

/0

/0

/1

/1

a

ed

cb

M

Page 62: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/0

/0

/0

/1

/1

a

ed

cb

M

Page 63: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/0

/0

/0

/1

/1

a

ed

cb

M

/1

/1X

Page 64: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/0

/0

/0

/1

/1

a

ed

cb

M

/0/0

X

Page 65: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/0

/0

/0

/1

/1

a

ed

cb

M

/1 /1X

Page 66: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/0/0/1

/1

a

ed

Minimal state machine bisimilar to M

b,c

Page 67: EECS 20 Lecture 16   (February 26, 2001) Tom Henzinger

/0

/1

/1

a

Minimal state machine equivalent to M

(in general, this is difficult to find)

b,c

/0

d,e