Moore Machine

8
cs3102: Theory of Computation Class 11: Moore, Mealy, and Markov Models Spring 2010 University of Virginia David Evans Menu Exam Review Variations on DFAs: Moore Machine: states produce output Mealy Machine: edges produce output Markov Model: transitions have probabilities Moore Machine Edward Moore, Gedanken-experiments on Sequential Machines, 1956. http://people.mokk.bme.hu/~kornai/MatNyelv/moore_1956.pdf Moore Machine Example q0; 1 0 q1; 0 1 1 0 “Power” of a Machine Power of a DFA, NFA, DPDA, NPDA/CFG: Set of languages it can recognize/produce. Power of a Moore Machine: Set of functions it can perform. Language Function Set of strings Set of <string, string> (input/output)pairs

Transcript of Moore Machine

Page 1: Moore Machine

cs3102: Theory of Computation

Class 11:

Moore, Mealy, and Markov Models

Spring 2010

University of Virginia

David Evans

Menu

• Exam Review

• Variations on DFAs:

– Moore Machine: states produce output

– Mealy Machine: edges produce output

– Markov Model: transitions have probabilities

Moore Machine

Edward Moore, Gedanken-experiments on Sequential Machines, 1956.

http://people.mokk.bme.hu/~kornai/MatNyelv/moore_1956.pdf

Moore Machine Example

q0; 1

0

q1; 0

1

1 0

“Power” of a Machine

Power of a DFA, NFA, DPDA, NPDA/CFG:

Set of languages it can recognize/produce.

Power of a Moore Machine:

Set of functions it can perform.

Language Function

Set of strings Set of <string, string>

(input/output) pairs

Page 2: Moore Machine

Formal Definition Computing ModelDFA Moore

Computing ModelDFA Moore

Moore’s Experiments

Okay...guess the machine!

Page 3: Moore Machine

You LOSE!

q0; 1

0

q1; 0

1

10

q2; 0 q3; 0

0

1

q6; 1 q5; 0 q4; 0

1

11

0

0

01

0

You always lose.

Sometimes “you” win...

Lorenz Cipher Machine

used by Nazi high

command: links between

conquered capitals

Machine determined by

Bill Tutte (1941) from

intercepted messages

Colossus

Bletchley Park, 1943

Bletchley Park, 2004 (rebuilt)

Decoded 63 million letters in Nazi

command messages

Learned German troop locations to plan

D-Day (knew the deception was working)

Arguably, the first electronic,

digital, programmable computer.

A More Fair Game

Reveal: n, maximum number of states in the

machine (and Σ, input alphabet)

Equality Rule: two machines are the same if

they compute the same function

Page 4: Moore Machine

Σ= {0, 1} n = 3

q1; 0

1q2; 0 q3; 1

1

00

0

How many experiments is enough?

Alternate Game

Given: state machine

Experiment: input -> output

Win: guess what state the machine started in

Moore proved for some machines where all states are distinguishable,

it is impossible to know the starting state from one experiment.

Mealy MachineGeorge Mealy, A Method for Synthesizing Sequential Circuits, 1955

q0

0; 1

q1

1; 0

1; 0 0; 1

Computing Model

Mo

ore

Ma

chin

eM

ea

ly

Ma

chin

e

Page 5: Moore Machine

Computing Model

Mo

ore

Ma

chin

eM

ea

ly

Ma

chin

e

Which is more powerful?

Mealy

Moore

For any Moore Machine M, we can construct a

Mealy Machine M’ that performs the same

function:

qa; z

qi; x

qb; y

For any Moore Machine M, we can construct a

Mealy Machine M’ that performs the same

function:

qa; z

qi; x

qb; y

qa

qi

qb

x

x

Page 6: Moore Machine

For any Mealy Machine M, we can construct a

Moore Machine M’ that performs the same

function:

qa

qi

qb

x

y

For any Mealy Machine M, we can construct a

Moore Machine M’ that performs the same

function:

qa

qi

qb

x

y

qa

qi1; x

qb

qi2; y

Both have all the same outgoing

transitions as qi

Equally Powerful

Mealy

Moore

(Moore may need more needs more states)

Are they good models?

q0

0; 1

q1

1; 01; 0

0; 1

Page 7: Moore Machine

Markov Model

Andrey Markov, 1856-1922

Happy

Grumpy

Sleepy

Sneezy0.9

0.3

0.3

0.7

0.1

1.0

Markov Model with Outputs

Happy

Grumpy

Sleepy

Sneezy0.9

0.3

0.3

0.7

0.1

1.0

“#%#$&”

“ARRGH”

0.70.3

“Zzzzzzzz”

1.0

“achoo!”

1.0

“ho ho ho!”

“wahoowa!”

0.5

0.5

Markov Model Examples

a.com

b.com

c.org

d.com 1/2

1/2

1/2

1/2

Nodes: URLs

Links: hyperlinks

Probabilities: 1/n number of non-

self outgoing links

Pr(u) = probability of

reaching u starting from

random seed states

Lawrence Page, Sergey Brin, Rajeev Motwani and Terry Winograd

Garkov

http://www.joshmillard.com/garkov/

Hidden Markov Model

Happy

Grumpy

Sleepy

Sneezy0.9

0.3

0.3

0.7

0.1

1.0

“#%#$&”

“ARRGH”

0.70.3

“Zzzzzzzz”

1.0

“achoo!”

1.0

“ho ho ho!”

“wahoowa!”

0.5

0.5

From just the outputs guess the states (and machine)

Page 8: Moore Machine

Hidden Markov Model Example

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

Sent Review

Topics

Sent Review

Topics

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

Question

No Review

QuestionHidden Markov Model

LazyWant more

challenging

exam

Active

Student

No Review

Question

No Review

Question

Sent Review

Topics

Sent Review

Topics

1.00.11.0 0.9

Hidden Markov Model

A A

A K

7 2

Raise Call Fold

0.6

0.4

0.9

0.08

0.02

Opponent Raises

0.8

Flop: 222

Return PS3front of room

A-D E-K

L-R S-Z