Question
Question: Justify that there can be the equivalent Mealy machine for any Moore machine by suitable example....
Justify that there can be the equivalent Mealy machine for any Moore machine by suitable example.

An equivalent Mealy machine can be constructed for any Moore machine by associating the output with the transition between states rather than the state itself. This involves redefining the output function to depend on both the current state and the input symbol.
Solution
To justify that an equivalent Mealy machine can be constructed for any Moore machine, we need to show a general construction method and illustrate it with an example.
Understanding Moore and Mealy Machines
-
Moore Machine: The output is associated with the state. When the machine enters a state, it produces an output.
- Formal Definition: MMoore=(Q,Σ,O,δ,λMoore,q0)
- Q: finite set of states
- Σ: finite set of input symbols
- O: finite set of output symbols
- δ:Q×Σ→Q: transition function
- λMoore:Q→O: output function (maps states to output symbols)
- q0∈Q: initial state
- A Moore machine produces an initial output λMoore(q0) even before processing any input.
- Formal Definition: MMoore=(Q,Σ,O,δ,λMoore,q0)
-
Mealy Machine: The output is associated with the transition (or input and current state). When the machine moves from one state to another based on an input, it produces an output.
- Formal Definition: MMealy=(Q,Σ,O,δ,λMealy,q0)
- Q: finite set of states
- Σ: finite set of input symbols
- O: finite set of output symbols
- δ:Q×Σ→Q: transition function
- λMealy:Q×Σ→O: output function (maps state-input pairs to output symbols)
- q0∈Q: initial state
- A Mealy machine does not produce an initial output; it only outputs when an input is processed.
- Formal Definition: MMealy=(Q,Σ,O,δ,λMealy,q0)
Justification: Construction of an Equivalent Mealy Machine from a Moore Machine
Let MMoore=(Q,Σ,O,δ,λMoore,q0) be an arbitrary Moore machine. We can construct an equivalent Mealy machine MMealy=(Q′,Σ,O,δ′,λMealy,q0′) as follows:
- States: The set of states in the Mealy machine (Q′) will be the same as the set of states in the Moore machine (Q). So, Q′=Q.
- Initial State: The initial state (q0′) remains the same as q0. So, q0′=q0.
- Transition Function: The transition function (δ′) remains the same as δ. So, δ′=δ.
- Output Function: This is the crucial part. In a Moore machine, output is based on the state it enters. In a Mealy machine, output is based on the transition. When the Moore machine is in state q and receives input a, it transitions to state δ(q,a) and then outputs λMoore(δ(q,a)). To make the Mealy machine equivalent, when it is in state q and receives input a, it should output the same symbol that the Moore machine would output after making the transition. Therefore, the output function for the Mealy machine is defined as: λMealy(q,a)=λMoore(δ(q,a))for all q∈Q,a∈Σ
Equivalence Definition: The Mealy machine constructed this way is considered equivalent to the Moore machine if, for any input string w, the output string produced by the Mealy machine is identical to the output string produced by the Moore machine, excluding the first character (which is the initial output of the Moore machine).
Example
Let's consider a simple Moore machine that outputs 'A' if the count of '1's in the input is even, and 'B' if the count of '1's is odd.
Moore Machine MMoore:
- States Q={qeven,qodd}
- Input Σ={0,1}
- Output O={A,B}
- Initial state qeven (representing an even count of '1's initially)
- Transition function δ:
- δ(qeven,0)=qeven
- δ(qeven,1)=qodd
- δ(qodd,0)=qodd
- δ(qodd,1)=qeven
- Output function λMoore:
- λMoore(qeven)=A
- λMoore(qodd)=B
State Diagram of MMoore:
Trace for input "101":
- Start in qeven. Initial output: A
- Input '1': Transition qeven→qodd. Output λMoore(qodd)=B
- Input '0': Transition qodd→qodd. Output λMoore(qodd)=B
- Input '1': Transition qodd→qeven. Output λMoore(qeven)=A Total output for "101": ABBA
Constructing Equivalent Mealy Machine MMealy
Using the construction rules:
- Q′={qeven,qodd}
- q0′=qeven
- δ′ is the same as δ.
- λMealy(q,a)=λMoore(δ(q,a)):
- λMealy(qeven,0)=λMoore(δ(qeven,0))=λMoore(qeven)=A
- λMealy(qeven,1)=λMoore(δ(qeven,1))=λMoore(qodd)=B
- λMealy(qodd,0)=λMoore(δ(qodd,0))=λMoore(qodd)=B
- λMealy(qodd,1)=λMoore(δ(qodd,1))=λMoore(qeven)=A
State Diagram of MMealy:
Trace for input "101" on MMealy:
- Start in qeven. No initial output.
- Input '1': From qeven, on '1', transition to qodd and output λMealy(qeven,1)=B.
- Input '0': From qodd, on '0', transition to qodd and output λMealy(qodd,0)=B.
- Input '1': From qodd, on '1', transition to qeven and output λMealy(qodd,1)=A. Total output for "101": BBA
Conclusion
Comparing the outputs:
- MMoore output for "101": ABBA
- MMealy output for "101": BBA
As observed, the output of the Mealy machine (BBA) is exactly the output of the Moore machine (ABBA) with its initial output (A) removed. This demonstrates the equivalence between the two machines under the standard definition.
Therefore, for any given Moore machine, an equivalent Mealy machine can always be constructed using the described method.
Solution Details:
-
Explanation of the solution: To convert a Moore machine MMoore=(Q,Σ,O,δ,λMoore,q0) to an equivalent Mealy machine MMealy=(Q′,Σ,O,δ′,λMealy,q0′):
- Keep the same set of states (Q′=Q) and initial state (q0′=q0).
- Keep the same transition function (δ′=δ).
- Define the Mealy output function λMealy(q,a) as the Moore output of the state reached after the transition: λMealy(q,a)=λMoore(δ(q,a)). The Mealy machine's output sequence for an input string will be the Moore machine's output sequence with its initial output symbol removed.
-
Answer: The justification is provided by the general construction method and the illustrative example.