/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Problem 25 Construct a Moore machine that d... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

Construct a Moore machine that determines whether an input string contains an even or odd number of 1s. The machine should give 1 as output if an even number of 1s are in the string and 0 as output if an odd number of 1s are in the string.

Short Answer

Expert verified
Define states A and B; A for even 1s, B for odd 1s. State transitions: A->A with 0, A->B with 1; B->B with 0, B->A with 1. Outputs: A=1, B=0.

Step by step solution

01

- Define States

Identify the states the machine will have. We need two states: one to represent an even number of 1s (let's call it State A) and one to represent an odd number of 1s (let's call it State B).
02

- Determine State Transitions

Determine how the machine transitions from one state to another based on the input. From State A, if the input is 0, it remains in State A because the count of 1s has not changed. If the input is 1, it transitions to State B. Conversely, from State B, if the input is 0, it stays in State B, and if the input is 1, it transitions back to State A.
03

- Define Outputs

Assign outputs to each state. Since we want to output 1 if the number of 1s is even and 0 if the number of 1s is odd, we can assign output 1 to State A (for even) and output 0 to State B (for odd).
04

- Create Transition Table

Construct the transition table. The table will have the current state, the input, the next state, and the output for the current state. For State A: Input 0 -> Next State A, Output 1 Input 1 -> Next State B, Output 1. For State B: Input 0 -> Next State B, Output 0 Input 1 -> Next State A, Output 0.
05

- Diagram

Draw the state diagram. State A transitions to itself with input 0 and to State B with input 1. State B transitions to itself with input 0 and back to State A with input 1. Label State A with output 1 and State B with output 0.

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 91Ó°ÊÓ!

Key Concepts

These are the key concepts you need to understand to accurately answer the question.

Finite State Machine
A Finite State Machine (FSM) is a computational model used to design and analyze systems that have discrete states. These states represent various conditions of the system at any given time.
FSMs are widely used in digital circuits, computer programs, and linguistics.
In general, FSMs consist of a finite number of states, transitions between these states, and can produce outputs based on the current state.
This structure makes FSMs particularly useful in applications where systems respond to a sequence of inputs, such as parsing texts, network protocols, and control systems.
State Transitions
State transitions are the paths taken between different states in a finite state machine based on the input received.
For our Moore machine that identifies even or odd numbers of 1s, state transitions work as follows:
  • Starting from State A (even), receiving an input of 0 keeps the machine in State A.
  • Receiving an input of 1 shifts the machine to State B (odd).
  • From State B, receiving an input of 0 keeps it in State B.
  • Receiving 1 returns the machine back to State A.
This process continues as the machine processes each bit of the input string.
Output Function
In a Moore machine, the output function is tied to the states themselves rather than the transitions.
This means that each state is labeled directly with the output it generates.
In our example, the outputs are defined as:
  • State A produces an output of 1, indicating an even count of 1s.
  • State B produces an output of 0, indicating an odd count of 1s.
Thus, because outputs are linked to states, every transition between states impacts the output indirectly by changing the current state.
Transition Table
A transition table provides a visual representation of the transitions between states in response to inputs.
It details the current state, given input, resulting next state, and the output for the current state.
For our Moore machine example, the transition table is:
  • For State A (output 1):
    • Input 0 -> Next State A
    • Input 1 -> Next State B
  • For State B (output 0):
    • Input 0 -> Next State B
    • Input 1 -> Next State A
This table helps in understanding and designing the overall behavior of the machine.
State Diagram
A state diagram is a graphical representation of the FSM.
It clearly shows the states, transitions, and outputs, making it easier to visualize and understand how the FSM operates.
In our specific example:
  • State A with output 1 transitions to itself with input 0 and to State B with input 1.
  • State B with output 0 transitions to itself with input 0 and back to State A with input 1.
This diagram simplifies the understanding of the state transitions, assisting in the design and troubleshooting of FSMs.

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 in words the strings in each of these regular sets. \(\begin{array}{ll}{\text { a) } 1^{*} 0} & {\text { b) } 1^{*} 00^{*}} \\\ {\text { c) } 111 \cup 001} & {\text { d) }(1 \cup 00)^{*}} \\ {\text { e) }\left(00^{*} 1\right)^{*}} & {\text { f) }(0 \cup 1)(0 \cup 1)^{*} 00}\end{array}\)

Express each of these sets using a regular expression. a) the set containing all strings with zero, one, or two bits b) the set of strings of two 0 \(\mathrm{s}\) , followed by zero or more \(1 \mathrm{s},\) and ending with a 0 c) the set of strings with every 1 followed by two 0 \(\mathrm{s}\) d) the set of strings ending in 00 and not containing 11 e) the set of strings containing an even number of 1 \(\mathrm{s}\)

Let \(G=(V, T, S, P)\) be the phrase-structure grammar with \(V=\\{0,1, A, B, S\\}, T=\\{0,1\\},\) and set of productions \(P\) consisting of \(S \rightarrow 0 A, S \rightarrow 1 A, A \rightarrow 0 B, B \rightarrow 1 A,\) \(B \rightarrow 1\). a) Show that 10101 belongs to the language generated by \(G\) . b) Show that 10110 does not belong to the language generated by \(G .\) c) What is the language generated by \(G ?\)

Explain how you can change the deterministic finite-state automaton \(M\) so that the changed automaton recognizes the set \(I^{*}-L(M) .\)

Exercises \(1-3\) refer to the grammar with start symbol sentence, set of terminals \(T=\\{\text {the}, \text { sleepy, happy, tortoise, hare, }\) passes, runs, quickly, slowly \(\\}\) , set of nonterminals \(N=\\{\text { noun }\) phrase, transitive verb phrase, intransitive verb phrase, \(\mathrm{~ a r t i c l e , ~ a d j e c t i v e , ~ n o u n , ~ v e r b , ~ a d v e r b \\} , ~ a n d ~ p r o d u c t i o n s : ~}\) $$ \begin{array}{l}{\text { sentence } \rightarrow \text { noun phrase transitive verb phrase }} \\ {\text { noun phrase }} \\ {\text { sentence } \rightarrow \text { noun phrase intransitive verb phrase }} \\ {\text { noun phrase } \rightarrow \text { article adjective noun }} \\ {\text { noun phrase } \rightarrow \text { article noun }}\end{array} $$ $$ \begin{array}{l}{\text { transitive verb phrase } \rightarrow \text { transitive verb }} \\ {\text { intransitive verb phrase } \rightarrow \text { intransitive verb adverb }} \\ {\text { intransitive verb phrase } \rightarrow \text { intransitive verb }} \\ {\text { article } \rightarrow \text { the }}\end{array} $$ $$ \begin{array}{l}{\text { adjective } \rightarrow \text { sleepy }} \\ {\text { adjective } \rightarrow \text { happy }} \\ {\text { noun } \rightarrow \text { tortoise }} \\ {\text { noun } \rightarrow \text { hare }} \\ {\text { transitive verb } \rightarrow \text { passes }} \\ {\text { intransitive verb } \rightarrow \text { runs }} \\ {\text { adverb } \rightarrow \text { quickly }} \\ {\text { adverb } \rightarrow \text { slowly }}\end{array} $$ Use the set of productions to show that each of these sentences is a valid sentence. a) the happy hare runs b) the sleepy tortoise runs quickly c) the tortoise passes the hare d) the sleepy hare passes the happy tortoise

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.