Menu cs3102: Theory of Computation Class 11: Moore, Mealy, and Markov Models Spring 2010 University of Virginia David Evans • 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 0 q0; 1 1 “Power” of a Machine Power of a DFA, NFA, DPDA, NPDA/CFG: Set of languages it can recognize/produce. 0 Power of a Moore Machine: 1 Set of functions it can perform. q1; 0 Language Set of strings Function Set of <string, string> (input/output) pairs Formal Definition Computing Model DFA Computing Model DFA Moore Moore’s Experiments Moore Okay...guess the machine! You LOSE! 0 q0; 1 1 0 0 0 q1; 0 q2; 0 1 1 0 q6; q3; 0 1 1 0 1 q5; 0 1 q4; 0 1 You always lose. 0 Sometimes “you” win... Lorenz Cipher Machine used by Nazi high command: links between conquered capitals Colossus Arguably, the first electronic, digital, programmable computer. Machine determined by Bill Tutte (1941) from intercepted messages 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 Bletchley Park, 1943 Decoded 63 million letters in Nazi command messages Learned German troop locations to plan D-Day (knew the deception was working) Bletchley Park, 2004 (rebuilt) Σ= {0, 1} n = 3 0 0 q1; 0 q2; 0 1 q3; 1 1 0 Alternate Game How many experiments is enough? 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. George Mealy, A Method for Synthesizing Sequential Circuits, 1955 0; 1 q0 1; 0 Computing Model Moore Machine Mealy Machine 1; 0 q1 Mealy Machine 0; 1 Moore Machine Computing Model Which is more powerful? Moore Mealy Machine Mealy For any Moore Machine M, we can construct a Mealy Machine M’ that performs the same function: For any Moore Machine M, we can construct a Mealy Machine M’ that performs the same function: qb; y qa; z qb qb; y qa qa; z x x qi; x qi; x qi For any Mealy Machine M, we can construct a Moore Machine M’ that performs the same function: For any Mealy Machine M, we can construct a Moore Machine M’ that performs the same function: qb qb qb qa qa qa y y x x qi qi qi1; x qi2; y Both have all the same outgoing transitions as qi Equally Powerful Are they good models? Moore 0; 1 Mealy q0 0; 1 1; 0 1; 0 q1 (Moore may need more needs more states) Markov Model Markov Model with Outputs 1.0 1.0 0.3 0.3 0.7 0.3 0.7 0.7 Happy Happy 0.3 0.3 Sleepy 0.5 Sleepy 1.0 0.5 “ho ho ho!” Sneezy 0.1 “ARRGH” Grumpy Grumpy Sneezy 0.9 0.1 0.9 Andrey Markov, 1856-1922 “wahoowa!” “#%#$&” “Zzzzzzzz” 1.0 “achoo!” Markov Model Examples Nodes: URLs Links: hyperlinks Probabilities: 1/n number of nonself outgoing links Lawrence Page, Sergey Brin, Rajeev Motwani and Terry Winograd b.com a.com 1/2 c.org 1/2 Pr(u) = probability of reaching u starting from random seed states d.com 1/2 1/2 Hidden Markov Model Garkov 1.0 0.3 “ARRGH” Grumpy 0.7 0.3 0.7 Happy 0.3 Sleepy 0.5 1.0 0.5 “ho ho ho!” Sneezy 0.1 http://www.joshmillard.com/garkov/ “wahoowa!” “#%#$&” 0.9 1.0 “achoo!” From just the outputs guess the states (and machine) “Zzzzzzzz” 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 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 Hidden Markov Model Want more challenging exam Lazy 0.9 1.0 No Review Question Hidden Markov Model Active Student 0.1 1.0 Sent Review Topics Return PS3 front of room AA Flop: 222 Opponent Raises 0.4 0.6 0.8 AK A-D E-K L-R S-Z … 0.9 72 0.02 0.08 Raise Call Fold