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 determines whether the input string read so far ends in at least five consecutive 1s.

Short Answer

Expert verified

Therefore, the finite-state 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, the input string read so far ends in at least five consecutive 1s.

The input is a bit string.

Construction:

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

\({{\bf{s}}_0}\)is the start state. And will represent the fact that no bits were processed yet or that the last bit processed was a 0.

\({{\bf{s}}_1}\)represents that the last digit was a 1 but there were no digits before that or a 0.

\({{\bf{s}}_2}\)represents that the last digit was an 11 but there were no digits before that or a 0.

\({{\bf{s}}_3}\)represents that the last digit was a 111 but there were no digits before that or a 0.

\({{\bf{s}}_4}\)represents that the last digit was an 1111 but there were no digits before that or a 0.

\({{\bf{s}}_5}\)represents that the last digit was a 11111 but there were no digits before that or a 0.

The output is always 0 except when we move to state \({{\bf{s}}_5}\) or remain at \({{\bf{s}}_5}\).

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

a) Explain what the productions are in a grammar if the Backusโ€“Naur form for productions is as follows:

\(\begin{array}{*{20}{l}}{{\bf{ < expression > :: = }}\left( {{\bf{ < expression > }}} \right){\bf{ }}\left| {{\bf{ < expression > + < expression > }}} \right|}\\\begin{array}{c}{\bf{\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;}}\,\,\,\,{\bf{ < expression > * < expression > |}}\\\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{\bf{ < variable > }}\end{array}\\{\,\,\,\,\,\,\,\,\,{\bf{ < variable > :: = xly}}}\end{array}\)

b) Find a derivation tree for \(\left( {{\bf{x*y}}} \right){\bf{ + x}}\) in this grammar.

Find a phrase-structure grammar that generates each of these languages.

\({\bf{a)}}\)the set of bit strings of the form \({{\bf{0}}^{{\bf{2n}}}}{{\bf{1}}^{{\bf{3n}}}}\), where \({\bf{n}}\) is a nonnegative integer

\({\bf{b)}}\)the set of bit strings with twice as many \({\bf{0's}}\) as \({\bf{1's}}\)

\({\bf{c)}}\)the set of bit strings of the form \({{\bf{w}}^{\bf{2}}}\), where \({\bf{w}}\) is a bit string

a) Construct a derivation of \({{\bf{0}}^{\bf{2}}}{{\bf{1}}^{\bf{4}}}\) using the grammar \({{\bf{G}}_{\bf{1}}}\) in Example 6.

b) Construct a derivation of \({{\bf{0}}^{\bf{2}}}{{\bf{1}}^{\bf{4}}}\) using the grammar \({{\bf{G}}_{\bf{2}}}\) in Example 6.

Find the strings constructed using the derivation trees shown here.

In Exercises 16โ€“22 find the language recognized by the given deterministic finite-state automaton

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