Mealy Machine in Automata Theory



In a Mealy Machine, inputs and outputs come together to form the machine. In this chapter, we will explain the concept of Mealy Machine, then the components and strategy to form a Mealy machine by using transition graphs.

The Concept of Mealy Machine

In finite automata theory, the Mealy machine is a type of machine that can produce output. A Mealy machine's output capability is its unique thing. In this machine, the output depends on both the present state and the present input.

If we try to get differences with finite automata with no outputs, we can say in NFA or DFA we typically determined whether a string is accepted or rejected by starting from an initial state and potentially reaching multiple final states.

In case of Moore or Mealy machines, they do not require a final state. It has an initial state, but no final state is needed. Instead, for every input given to a state, the Mealy machine produces an output, which is recorded at each state.

Components of a Mealy Machine

Mealy machines are six-tuples by their definitions, which are similar to those we learnt in NFA and DFA but with one additional component.

Let's define these tuples −

  • Q − A finite set of states (e.g., Q0, Q1, Q2).
  • Σ (Sigma) − A finite set called the input alphabet (e.g., A, B).
  • δ (Small delta) − The transition function, where Q × Σ → Q. It describes the state transitions based on the input alphabet.
  • q0 − The initial state.
  • O − A finite set of symbols called the output alphabet.
  • λ (Lambda) − The output transition function, where λ: Q × Σ → O. It specifies the output for each state and input pair.

There are two transition functions, the state transition and output transition functions.

  • The state transition function (δ) defines how the machine moves from one state to another based on the input. For instance, if we are in state Q0 and we give input 1, we may move to state Q1.
  • The output transition function (λ) specifies the output produced for each input given to a state. For example, if we are in state Q0 and give input 1, the output might be A.

Designing a Mealy Machine

Let us take a couple of examples to understand the process of designing a Mealy machine.

Example 1

As our first example, consider the following transition table and graph −

State Input 0 Input 1
q0 q1, a q2, a
q1 q1, b q3, c
q2 q3, c q2, a
q3 q3, c q3, b

From this table, we can create the Mealy machine by mapping the states, inputs, and outputs as described.

Designing a Mealy Machine1

From the above machine, we can determine the output from a given input. We can analyse like this −

  • Start at q0
  • Input 0: Transition to q1, output a
  • Input 1: Transition to q3, output c
  • Input 1: Stay in q3, output b
  • Input 1: Stay in q3, output b

So, the output string is "acbbb"

Example 2

Let us take another example for complementing a binary input string through a Mealy machine.

State Input 0 Input 1
q0 q1, 1 q2, 0

The graph will look like this −

Designing a Mealy Machine2

There is only one state. For input 0: stay in q0, output 1. And for input 1, stay in q0, output 0.

So, for the input string "011," the output should be "100," which is the 1's complement of the given string.

Conclusion

For finite automata with outputs, we consider the Moore and Mealy machines. We already learnt the Moore, here outputs are coming with the transition, so before reaching a state we are getting output. It is characterized by having an initial state but no final state.

In this chapter, we explained the structure of Mealy machines and how they are formed.

Advertisements