A finite state transducer where output depends on the current state and the input symbol. Output is produced on transitions, not on states. A 6-tuple.
where:
- is a finite set of states
- is the input alphabet
- is the output alphabet
- is the initial state
- is the transition function
- is the output function
Example
A Mealy machine that outputs when the number of s seen so far is even, and otherwise:
- States: , where = even count, = odd count
- On input in : move to , output
- On input in : move to , output
Input aaa produces output 010.
Mealy vs Moore Machine
Both are finite state transducers. The difference is where output is generated.
| Property | Mealy | Moore |
|---|---|---|
| Output depends on | State + input | State only |
| Output produced on | Transition | Entry to state |
| States needed | Fewer | More |
| Output latency | Immediate on input | After state change |
Every Moore machine has an equivalent Mealy machine and vice versa. The Mealy-to-Moore conversion typically increases state count.