Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Construct a finite-state machine that gives an output of 1 if the number of input symbols read so far is divisible by 3 and an output of 0 otherwise.

Short Answer

Expert verified

Therefore, the finite-state machine that gives an output of 1 if the number of input symbols read so far is divisible by 3 and an output of 0 otherwise machine model is shown below:

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

General form

Finite-State Machines with Outputs (Definition):

A finite-state machine\({\bf{M = }}\left( {{\bf{S,}}\,\,{\bf{I,}}\,\,{\bf{O,}}\,\,{\bf{f,}}\,\,{\bf{g,}}\,\,{{\bf{s}}_0}} \right)\)consists of a finite set S of states, a finite input alphabet I, a finite output alphabet O, a transition function f that assigns to each state and input pair a new state, an output function g that assigns to each state and input pair output and an initial state\({{\bf{s}}_0}\).

Concept of input string and output:

An input string takes the starting state through a sequence of states, as determined by the transition function. As we read the input string symbol by symbol (from left to right), each input symbol takes the machine from one state to another. Because each transition produces an output, an input string also produces an output string.

02

Step 2: Construct a finite-state machine model

Given that, an output of 1, if the number of input symbols read so far, is divisible by 3 and an output of 0 otherwise.

Construction:

Let us consider the states\({{\bf{s}}_{\bf{i}}}\), where\({\bf{i = 0,1,2}}\).

\({{\bf{s}}_0}\)represents that we are at a position in the string that is divisible by 3.

\({{\bf{s}}_1}\)represents that we are at a position x in the string for which x mod\({\bf{3 = 1}}\).

\({{\bf{s}}_2}\)represents that we are at a position x in the string for which x mod\({\bf{3 = }}2\).

No matter what the input is, we move from state \({{\bf{s}}_0}\)to\({{\bf{s}}_1}\), from \({{\bf{s}}_1}\) to \({{\bf{s}}_2}\) , and from \({{\bf{s}}_2}\) to\({{\bf{s}}_0}\).

We only output a 1 every time we return to the state \({{\bf{s}}_0}\) as we are then at a position that is divisible by 3; else we will return to 0.

The model of the finite-state machine is shown below:

Therefore, the result shows the required finite-state machine.

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Describe the set of strings defined by each of these sets of productions in EBNF.

\(\begin{array}{c}\left( {\bf{a}} \right){\bf{string :: = L + D?L + }}\\{\bf{L :: = a }}\left| {{\bf{ b }}} \right|{\bf{ c }}\\{\bf{D :: = 0 | 1}}\\\left( {\bf{b}} \right){\bf{string :: = signD + |D + }}\\{\bf{sign :: = + | - }}\\{\bf{D :: = 0 | 1|2|3|4|5|6|7|8|9}}\\\left( {\bf{c}} \right){\bf{string :: = L*}}\left( {{\bf{D + }}} \right){\bf{?L* }}\\{\bf{L :: = x |y }}\\{\bf{D :: = 0 | 1}}\end{array}\)

Draw the state diagrams for the finite-state machines with these state tables.

A palindrome is a string that reads the same backward as it does forward, that is, a string w, where \({\bf{w = }}{{\bf{w}}^{\bf{R}}}\), where \({{\bf{w}}^{\bf{R}}}\) is the reversal of the string w. Find a context-free grammar that generates the set of all palindromes over the alphabet {0, 1}.

Let V be an alphabet, and let A and B be subsets of \({\bf{V*}}\) with AโŠ†B. Show that \({\bf{A*}}\)โŠ†B*.

Find a phrase-structure grammar for each of these languages.

a) the set of all bit strings containing an even number of 0s and no 1s

b) the set of all bit strings made up of a 1 followed by an odd number of 0s

c) the set of all bit strings containing an even number of 0s and an even number of 1s

d) the set of all strings containing 10 or more 0s and no 1s

e) the set of all strings containing more 0s than 1s

f) the set of all strings containing an equal number of 0s and 1s

g) the set of all strings containing an unequal number of 0s and 1s

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free