Introduction to Automata

# Mealy Machine Examples

As we already covered the topic of Automata Mealy Machine. In this session, we will see some Examples of Automata Mealy machine.

## Example 1: Mealy Machine for the first complement

Question: Design a Mealy machine to generate the first complement of any given binary input.

### Solution

According to the first complement, if the given input is “1”, the output will be “0” and vice versa. Hence, the following is the Mealy Machine of the given question

For instance, take one binary number, 11100, then look at the following table.

Thus, we get 00011, which is 1’s complement of 11100,

## Example 2:  Mealy Machine

Design a Mealy Machine that prints “a” whenever the sequence “01” is encountered in any input binary string.

### Solution

The requirement is that whenever the “01” appears in the string, the output must end with “a”. The following is the desired Mealy Machine.

For instance, take one binary number, 10111001, and then look at the following table.

As shown in the above table, whenever the “01” occurs in the input string, the output will be “a”.