Mealy Machine
A Mealy machine makes an output String depending on the state and the input you just gave it. Essentially, the Function which produces the next string is executed on the “edges” or “arrows”, not the “nodes”. Unlike a Moore Machine which produces characters on the nodes.
Definition 1
A Mealy machine is a Finite State Transducer whose output depends on both the current state and the current input.
Formally a 6-Tuple ():
- : finite Set of states
- : input Alphabet
- : output Alphabet
- : state transition function
- : output Function
- : start state
Can always be converted to a Moore Machine.
Example 1 — Parity Checker
A Mealy machine that outputs 1 whenever the number of 1s seen so far is odd, otherwise 0.
Components
Transition + Output Table
Each entry = (next state, output):
| Current State | Input = 0 | Input = 1 |
|---|---|---|
| () | () | |
| () | () |
Example Run
Input: 1011
- Start
- Read
1: → (, output1) - Read
0: → (, output1) - Read
1: → (, output0) - Read
1: → (, output1)
Output string: 1101