Chapter 9: Finite-State Machines, Turing machines

Section 9.3 Finite-State Machines



Examples of Finite-State Machines

Finite-State Machines (FSMs) can be used for recognition — that is, to produce an output of 1 when the input matches a specific description.

Recognition

A machine can be built to recognize , say by producing an output of 1, when the input it has received matches a certain description. We will soon discuss more fully the capabilities of finite-state machines as recognizers. Here we will simply construct some examples.

1. FSM for Even/Odd Parity Check:

Parity checker counts the number of 1's in a bit-serial input stream. If the checker asserts its output when the input stream cotains an odd number of 1's, it is called an odd parity checker . If it asserts its output when it has seen an even number of 1's, it is an even parity checker .



State Table
Present State Next State Output
Present Input
0           1
\(S_0\) Even \(S_0\)        \(S_1\) 0
\(S_1\) Odd \(S_1\)        \(S_0\) 1

Even(0), Odd(1):
State Graph


We see that an input sequence consisting of the characters (0011101) would produce the output of 0:

Time \(t_0\) \(t_1\) \(t_2\) \(t_3\) \(t_4\) \(t_5\) \(t_6\) \(t_7\)
Input 0 0 1 1 1 0 1 -
State \(S_0\) \(S_0\) \(S_0\) \(S_1\) \(S_0\) \(S_1\) \(S_1\) \(S_0\)
Output 0 0 0 1 0 1 1 0

Assuming an odd parity scheme, if the parity of the received string is not odd, then an error has occurred in transmitting the string, and a request for retransmission can be made. A parity bit therefore serves as a simple single-error-detection mechanism.

Practice

Redesign the odd parity checker FSM to make it check for even parity (that is, assert the output when the input contains an even number of 1's). Show your state table and state graph:


2. FSM for String Recognization

FSMs can also recognize whether a string matches a specific pattern.

What is this FSM trying to recognize?

The FSM is built to recognize if the last part of the input ends with "101".

Explanation:


Practice


Formal Definition

Now we want to see exactly what sets finite-state machines can recognize.To avoid writing down outputs, we will designate those states of a finite- state machine with an output of 1 as final states and denote them in the state graph with a double circle . Then we can give the following formal definition of recognition, where I* denotes the set of finite-length strings over the input alphabet.




Reference

Wikipedia