40
EECS 20 Lecture 9 (February 5, 2001) Tom Henzinger Transition Diagrams

EECS 20 Lecture 9 (February 5, 2001) Tom Henzinger

  • Upload
    mayda

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

Transition Diagrams. EECS 20 Lecture 9 (February 5, 2001) Tom Henzinger. Discrete-Time Reactive System : input/output function F State-Machine Implementation : decomposition of F into 1. memory-free part ( called “ Update ” ) - PowerPoint PPT Presentation

Citation preview

Page 1: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

EECS 20

Lecture 9 (February 5, 2001)

Tom Henzinger

Transition Diagrams

Page 2: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Discrete-Time Reactive System :

input/output function F

State-Machine Implementation :

decomposition of F into

1. memory-free part ( called “Update” )

2. delay part ( what delay stores is called “state” )

Page 3: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Discrete-Time Reactive System

Nats0 Inputs Nats0 Outputs

F : [ Nats0 Inputs ] [ Nats0 Outputs ]

F

Page 4: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

The Parity System

Parity : [ Nats0 Bools ] [ Nats0 Bools ]

such that x [ Nats0 Bools ] , y Nats0 ,

( Parity (x) ) (y) =

true if | trueValues (x,y) | is even

false if | trueValues (x,y) | is odd

{

where trueValues (x,y) = { z Nats0 | z < y x (z) = true }

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

The Count System

Count : [ Nats0 Bools ] [ Nats0 Bools ]

such that x [ Nats0 Bools ] , y Nats0 ,

( Count (x) ) (y) =

true if | trueValues (x,y) | | falseValues (x,y) |

false if | trueValues (x,y) | < | falseValues

(x,y) |

{

where falseValues (x,y) = { z Nats0 | z < y x (z) = false }

Page 6: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

State-Machine Implementation

Nats0 Inputs Nats0 Outputs

DinitialState

Update11

2 2

Nats0 States

Nats0 States

update : States Inputs States Outputs

initialState States

F memory-free

delay stores state

Page 7: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Nats0 Inputs Nats0 Outputs

DinitialState

Output

1

2

Nats0 States

Nats0 States

NextState

1

2

F

memory-free

delay stores state

nextState : States Inputs States

output : States Inputs Outputs

initialState States

Page 8: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

State-Machine Implementation of the Parity System

State after i-th input :

true, if first i inputs contain even number of true’s

false, if first i inputs contain odd number of true’s

Two states

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

Inputs = Bools

Outputs = Bools

States = Bools

initialState = true

nextState : States Inputs States

such that q States, x Inputs,

nextState (q,x) = ( q x )

output : States Inputs Outputs

such that q States, x Inputs,

output (q,x) = q

Page 10: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Nats0 Bools Nats0 Bools

Dtrue Nats0 Bools

Nats0 Bools

Parity

Page 11: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

State-Machine Implementation of the Count System

State after i-th input :

i, if first i inputs contain i more true’s than false’s

-i, if first i inputs contain i more false’s than true’s

Infinitely many states

Page 12: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Inputs = Bools

Outputs = Bools

States = Ints

initialState = 0

nextState : States Inputs States

such that q States, x Inputs,

nextState (q,x) = ± (x,q)

output : States Inputs Outputs

such that q States, x Inputs,

output (q,x) = pos (q)

Page 13: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Nats0 Bools Nats0 Bools

D0Nats0 Ints

Count

±

pos

Page 14: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

A State Machine

Inputs ( set of possible input values )

Outputs ( set of possible output values )

States ( set of states )

initialState States

update : States Inputs States Outputs

Page 15: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

State-Machine Implementation of the Parity System

Inputs = Bools

Outputs = Bools

States = Bools

initialState = true

update : States Inputs States Outputs

such that q States, x Inputs,

update (q,x) 1 = ( q x )

update (q,x) 2 = q

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

State-Machine Implementation of the Count System

Inputs = Bools

Outputs = Bools

States = Ints

initialState = 0

update : States Inputs States Outputs

such that q States, x Inputs,

update (q,x) 1 = ± (x,q)

update (q,x) 2 = pos (q)

Page 17: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Transition Diagram of the Parity System

true false

true / true

true / false

false / true false / false

States = Bools Inputs = Bools Outputs = Bools

Page 18: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Transition Diagram of the Count System

States = Ints Inputs = Bools Outputs = Bools

0 1

true / true

false / true

2

true / true

false / true

true / true

false / true

-1

true / false

false / true

true / false

false / false

Page 19: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Transition Diagram

Graph:

Nodes = states

Edges = transitions

Determinism : for every state and input, at most one outgoing edge

Receptiveness : for every state and input, at least one outgoing edge

( because “update” is a function )

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

Exercise

Draw the transition diagram of a state machine with

Inputs = Bools

Outputs = Bools

At all times t, the output is true iff the inputs at times t-2, t-1, and t are all true .

Page 21: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

State after i-th input :

0, if i-th input is false ( or i = 0 )

1, if i-th input is true and (i-1)-st input is false

2, if both i-th and (i-1)-st inputs are true

Three states

( or i = 1 )

Page 22: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Transition Diagram

States = { 0, 1, 2 } Inputs = Bools Outputs = Bools

0 21

true / false

false / false

false / false false / false true / true

true / false

Page 23: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

The Parity System :

States [ Parity] = { true, false }

initialState [ Parity ] = true

nextState [ Parity ] (q,x) = (q x)

output [ Parity ] (q,x) = q

The LastThree System :

States [ LastThree] = { 0, 1, 2 }

initialState [ LastThree ] = 0

nextState [ LastThree ] (q,x) =

output [ LastThree ] (q,x) = ( ( q = 2 ) x

)

0 if x

min (q+1, 2) if x{

Page 24: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Parity

LastThree

ParityOrLastThree

Nats0 Bools

Nats0 Bools

t, t, t, …

Page 25: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Parity

LastThree

ParityOrLastThree

Nats0 Bools

Nats0 Bools

t, t, t, …

t, f, t, …

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

What is the state space of ParityOrLastThree ?

What is the initial state of ParityOrLastThree ?

What is the nextState function of ParityOrLastThree ?

What is the output function of ParityOrLastThree ?

Page 27: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

Parity

LastThree

ParityOrLastThree

Nats0 Bools

Nats0 Bools

Out1

Nxt1

Dinit1

Out2

Nxt2

Dinit2

Page 28: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

ParityOrLastThree

Nats0 Bools

Nats0 Bools

Out1

Nxt1

Dinit1

Out2

Nxt2

Dinit2

Page 29: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

ParityOrLastThree

Nats0 Bools

Nats0 Bools

Out1

Nxt1

Dinit1

Out2

Nxt2

Dinit2

Page 30: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

ParityOrLastThree

Nats0 Bools

Nats0 Bools

Out1

Nxt1

Dinit1

Out2

Nxt2

Dinit2

Page 31: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

ParityOrLastThree

Nats0 Bools

Nats0 Bools

output

nextState

DinitialState

Page 32: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

The ParityOrLastThree System

Inputs [ ParityOrLastThree ] = Bools

Outputs [ ParityOrLastThree ] = Bools

States [ ParityOrLastThree ]

= States [ Parity ] States [ LastThree ]

= { true, false } { 0, 1, 2 }

initialState [ ParityOrLastThree ]

= ( initialState [ Parity ], initialState [ LastThree ] )

= ( true, 0 )

Page 33: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

The ParityOrLastThree System, continued

nextState [ ParityOrLastThree ] ( ( q1, q2 ) , x )

= ( nextState [ Parity ] (q1, x) , nextState [ LastThree ] (q2, x) )

output [ ParityOrLastThree ] ( ( q1, q2 ) , x ) = output [ Parity ] (q1, x) output [ LastThree ] (q2, x)

Page 34: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

Page 35: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t

Page 36: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t t/f

f/f

Page 37: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t t/f

f/f

t/f

f/f

Page 38: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t t/f

f/f

t/f

f/f

t/t

f/t

Page 39: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t t/f

f/f

t/f

f/f

t/t

f/t

t/t

f/t

Page 40: EECS 20 Lecture 9   (February 5, 2001) Tom Henzinger

t, 0

f, 0 f, 1 f, 2

t, 2t, 1

f/t

t/t t/f

f/f

t/f

f/f

t/t

f/t

t/t

f/t

t/t

f/f