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 Moore machine that gives an output of 1 whenever the number of symbols in the input string read so far is divisible by 4 and an output of 0 otherwise.

Short Answer

Expert verified

The Moore machine model is shown below.

Step by step solution

01

General form

Moore machine (Definition):

A Moore machine\({\bf{M = }}\left( {{\bf{S,}}\,\,{\bf{I,}}\,\,{\bf{O,}}\,\,{\bf{f,}}\,\,{\bf{g,}}\,\,{{\bf{s}}_0}} \right)\)consists of a finite set of states, an input alphabet I, an output alphabet O, a transition function f that assigns the next state to every pair of a state, and an input, an output function g that assigns an output to every state, and a starting state\({{\bf{s}}_0}\). A Moore machine can be represented either by a table listing the transitions for each pair of states and input and the outputs for each state, or by a state diagram that displays the states, the transitions between states, and the output for each state. In the diagram, transitions are indicated with arrows labelled with the input, and the outputs are shown next to the states.

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 Moore machine model

Given that, a Moore machine that gives an output of 1 whenever the number of symbols in the input string read so far is divisible by 4 and an output of 0 otherwise.

The input is a bit string.

Construction:

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

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

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

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

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

The output is 1 when we are at state \({{\bf{s}}_0}\) as the number of symbols so far is divisible by 4. The other states all have output 0.

We move from state \({{\bf{s}}_{\bf{0}}}\) to\({{\bf{s}}_{\bf{1}}}\), from \({{\bf{s}}_1}\) to\({{\bf{s}}_{\bf{2}}}\), from \({{\bf{s}}_{\bf{2}}}\)to\({{\bf{s}}_{\bf{3}}}\) , and from \({{\bf{s}}_{\bf{3}}}\) to\({{\bf{s}}_0}\) every time a digit is read. Moving from a state to another state is represented by an arrow, while the input is mentioned next to the arrow.

The model of the Moore machine is shown below.

Therefore, the result shows that the required Moore machine.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

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

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

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

a) the set consisting of the bit strings 10, 01, and 101.

b) the set of bit strings that start with 00 and end with one or more 1s.

c) the set of bit strings consisting of an even number of 1s followed by a final 0.

d) the set of bit strings that have neither two consecutive 0s nor two consecutive 1s.

Show that a set is generated by a regular grammar if and only if it is a regular set.

Construct phrase-structure grammars to generate each of these sets.

a) \(\left\{ {{{\bf{1}}^{\bf{n}}}{\bf{|n}} \ge {\bf{0}}} \right\}\)

b) \(\left\{ {{\bf{1}}{{\bf{0}}^{\bf{n}}}{\bf{|n}} \ge {\bf{0}}} \right\}\)

c) \(\left\{ {{\bf{1}}{{\bf{1}}^{\bf{n}}}{\bf{|n}} \ge {\bf{0}}} \right\}\)

Determine whether all the strings in each of these sets are recognized by the deterministic finite-state automaton in Figure 1.

a){0}* b){0} {0}* c){1} {0}*

d){01}* e){0}*{1}* f){1} {0,1}*

Let V = {S, A, B, a, b} and T = {a, b}. Determine whether G = (V, T, S, P) is a type 0 grammar but not a type 1 grammar, a type 1 grammar but not a type 2 grammar, or a type 2 grammar but not a type 3 grammar if P, the set of productions, is

\(\begin{array}{*{20}{l}}{{\bf{a) S }} \to {\bf{ aAB, A }} \to {\bf{ Bb, B }} \to {\bf{ \lambda }}{\bf{.}}}\\{{\bf{b) S }} \to {\bf{ aA, A }} \to {\bf{ a, A }} \to {\bf{ b}}{\bf{.}}}\\{{\bf{c) S }} \to {\bf{ABa, AB }} \to {\bf{ a}}{\bf{.}}}\\{{\bf{d) S }} \to {\bf{ ABA, A }} \to {\bf{ aB, B }} \to {\bf{ ab}}{\bf{.}}}\\{{\bf{e) S }} \to {\bf{ bA, A }} \to {\bf{ B, B }} \to {\bf{ a}}{\bf{.}}}\\{{\bf{f ) S }} \to {\bf{ aA, aA }} \to {\bf{ B, B }} \to {\bf{ aA, A }} \to {\bf{ b}}{\bf{.}}}\\{{\bf{g) S }} \to {\bf{ bA, A }} \to {\bf{ b, S }} \to {\bf{ \lambda }}{\bf{.}}}\\{{\bf{h) S }} \to {\bf{ AB, B }} \to {\bf{ aAb, aAb }} \to {\bf{ b}}{\bf{.}}}\\{{\bf{i) S }} \to {\bf{ aA, A }} \to {\bf{ bB, B }} \to {\bf{ b, B }} \to {\bf{ \lambda }}{\bf{.}}}\\{{\bf{j) S }} \to {\bf{ A, A }} \to {\bf{ B, B }} \to {\bf{ \lambda }}{\bf{.}}}\end{array}\)

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