Output Length
Number of output symbols produced when the machine processes an input string.
For an input string of length :
| Machine | Output Length | Description |
|---|---|---|
| Moore | Initial state + outputs for each input symbol | |
| Mealy | Outputs only for transitions based on input symbols |
Output for Empty String
| Machine | Output | Description |
|---|---|---|
| Moore | Output associated with the initial state | |
| Mealy | No output, since no transitions |
Moore–Mealy Equivalence
Moore and Mealy machines are computationally equivalent models. Moore and Mealy machines are equivalent iff they produce the same output (ignoring the extra initial output) for the same input strings.
For any Moore machine, an equivalent Mealy machine can be constructed. And vice versa.
Conversion
Moore to Mealy
Move the state output of the destination state onto the transition leading to that state.
Each transition in the Moore machine, translates to:
States remain the same. State outputs are moved to transitions.
Mealy to Moore
From a state, transitions with different outputs, the state must be split into multiple states.
For each transitions in Mealy machine, translates into a new Moore state where:
- state = destination state
- output = transition output
Steps:
- Create states based on (destination state, output).
- Assign each new state the corresponding output value.
- Redirect transitions accordingly.
States may increase. Transition outputs are moved to states.