Moore Machine in Automata Theory



In the finite automata domain, unlike NFA or DFA, there are other machines that can produce outputs when inputs are consumed. One such machine is Moore Machine. In this chapter, we will explain the concept of Moore Machine, then the components and strategy to form a Moore machine by using transition graph for a better understanding.

The Concept of Moore Machine

In finite automata theory, the Moore machine is a type of machine that can produce output. Another variation of output producing machine is Mealy machine on which will discuss on the next article. Unlike finite automata we have studied before, such as NFA and DFA, a Moore machines' output capability is the unique thing. In the Moore machine's output depends solely on the present state. This is important to understand how Moore Machines operate and how they are constructed.

We can use NFA or DFA, where we normally assess whether a string is accepted or rejected by starting from an initial state and perhaps reaching several end states. A final state is not necessary for Moore machines. It just has a beginning state. Rather, the Moore machine generates an output when we reach at any state for each input that is provided to it.

Components of a Moore Machine

Moore 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.

The state transition and output transition functions are the two types of transition functions that we have seen. The machine's transition between states is determined by the state transition function (δ), which takes into account the input. For example, we could go to state Q1 if we supply input 1 when in state Q0.

The output generated for each input supplied to a state is specified by the output function (λ). For instance, if we provide input 1 when in state Q0, the result could be A.

Designing a Moore Machine

Let's take a couple of examples to demonstrate how we can design a Moore machine.

Example 1

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

Current State Input Next State Output
q0 0 q1 a
q0 1 q2 a
q1 0 q1 c
q1 1 q3 c
q2 0 q2 a
q2 1 q3 a
q3 0 q3 b
q3 1 q2 b

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

Designing a Moore Machine1

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

The machine consists of three states: starting from q0, output are c and a when we are reaching q1 with input 0 and q2 with input 1 respectively.

Similarly from q1, getting input 0 it is in the same state and producing c again; and for 1, moving towards q3 with input b. Like these the q2 and q3 are working.

For input "001101", it will produce −

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

So, the output string is "ccbaab"

Example 2

Let us see another example for complementing binary input string through Melay machine.

Current State Input Next State Output
q0 0 q1 1
q0 1 q2 0
q1 0 q1 1
q1 1 q2 0
q2 0 q1 1
q2 1 q2 0

The graph will look like this −

Designing a Moore Machine2

There are three states. For input 0, q1 is responsible and for input 1, q2 is responsible, when it is reaching q1, producing 1 as output and for q2, it is producing 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 machines. In Moore machines, the outputs are coming with the states, so after reaching a state, we are getting outputs. It is characterized by having an initial state, but no final state.

In this chapter, this article we have seen the structure of Moore machine, how they are formed and then have seen two different examples for Moore machine formation.

Advertisements