Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Design a DFA with at most 5 states for the language L 1 = {w {0, 1} | w contains at most one

Question 1: Design a DFA with at most 5 states for the language

L1 = {w {0, 1} | w contains at most one 1 and |w| is odd}.

Provide a state diagram for your DFA.

Approaching the Solution --since we havent really practiced this type of assignment (i.e. had to define our machine based on only having the language given; not the formal 5 tuples), I am providing the steps for how to work through this; you are required to draw the DFA for your answer to this question and provide three test cases (additional instructions for this question are at the end of the explanation below)

To get an idea for the design of the DFA M, it is probably easiest to think about what the strings in L1 look like. A string w L1 (i.e. a string (w) that belong to L1 ) takes on one of the following forms:

w consists of an odd number of 0s and contains no 1s;

w starts with an odd number of 0s, followed by one 1, followed by an odd number of zeros; w starts with an even number of 0s, followed by one 1, followed by an even number of zeros;

Thus, our DFA M needs to keep track of the parity of the number of leading 0s (i.e. whether that number is even or odd). If no 1 is encountered, accept if the number of leading 0s is odd; otherwise go to a dead state. If a 1 is encountered, keep track of the number of trailing 0s and accept if that number has the same parity as the number of leading 0s (if applicable as a single 1 can be complete as input)

Our 5 states keep track of the following situations:

state even0no1 indicates an even number of 0s and no 1s;

state odd0no1 indicates an odd number of 0s and no 1s;

state even0one1 indicates an even number of 0s, followed by a 1;

state odd0one1 indicates an odd number of 0s, followed by a 1;

state dead indicates the encounter of a second 1.

even0no1 is the start state, since at the beginning of every string, the number of 0s encountered is zero (i.e. even) and no 1 has been encountered. It is not a final state since L1. (i.e.an empty string is not part of the language). States odd0no1 & even0one1 are final, and dead is a dead state from which the DFA should never again emerge.

To answer Question 1, you will:

  1. Draw/provide the state diagram for the DFA

Provide at least three test cases that prove your DFA accepts them (or rejects them). In other words, accepts the language L1, i.e. prove that L(M) = L1, where M is your DFA.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions