Question

Question 1: Design a DFA with at most 5 states for the language L1 = {w...

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 haven’t 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.

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
Question 1: Design a DFA with at most 5 states for the language L1 = {w...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet...

    Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that the number of 0s is divisible by 2 and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a methodical way to do this: Figure out all the final states and label each with the shortest string it accepts, work backwards from these states to...

  • Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of...

    Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that there are no consecutive 0s, and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a way to approach the problem: First focus only building the DFA which accepts the language: As you build your DFA, label your states with an explanation of what the state actually represents in terms...

  • Consider the language L below. (a) Is L a regular language? – Yes, or No. (b)...

    Consider the language L below. (a) Is L a regular language? – Yes, or No. (b) If L is a regular language, design the DFA (using a State Table) to accept the language L, with the minimum number of states.  Assume , (c) Suppose the input is “101100”. Is this input string in the language L? Σ = {0,1} L={w l w has both an even number of O's and an odd number of 1's}

  • 1. Design an NFA (Not DFA) of the following languages. a) Lw E a, b) lw...

    1. Design an NFA (Not DFA) of the following languages. a) Lw E a, b) lw contain substring abbaab) b) L- [w E 10,1,2) lsum of digits in w are divisible by three) c) L-(w E {0,1,2)' |The number is divisible by three} d) The language of all strings in which every a (if there are any) is followed immediately by bb. e) The language of all strings containing both aba and bab as substrings. f L w E 0,1every...

  • Create DFA : a)L={w| w is a word that begins with 1 or 2,finishes with 2...

    Create DFA : a)L={w| w is a word that begins with 1 or 2,finishes with 2 or 3 and the number of the other symbols is even} alphabet={1,2,3}. b)L={w| w is a word that represents an integer in a binary form and when is divided by 4 the remaining is 3 (number&4=3)} alphabet={0,1} c)L={w| w is a word where every a is followed either from an odd number of b or from an odd number of c} alphabet={a,b,c} d)L={w| w...

  • Question 1: Every language is regular T/F Question 2: There exists a DFA that has only...

    Question 1: Every language is regular T/F Question 2: There exists a DFA that has only one final state T/F Question 3: Let M be a DFA, and define flip(M) as the DFA which is identical to M except you flip that final state. Then for every M, the language L(M)^c (complement) = L( flip (M)). T/F Question 4: Let G be a right linear grammar, and reverse(G)=reverse of G, i.e. if G has a rule A -> w B...

  • Give a DFA for the following language over the alphabet Σ = {0, 1}: L={ w...

    Give a DFA for the following language over the alphabet Σ = {0, 1}: L={ w | w starts with 0 and has odd length, or starts with 1 and has even length }. E.g., strings 0010100, 111010 are in L, while 0100 and 11110 are not in L.

  • Design an NFA with at most 5 states for the language (without epsilon transitions) L2= {w...

    Design an NFA with at most 5 states for the language (without epsilon transitions) L2= {w ∈ {0, 1}∗ | w contains the substring 0101} Provide the formal 5 tuples(Q,Σ, δ, q0, F) for the NFA Draw/provide a state diagram for your NFA Provide at least three test casesthat prove your NFA accepts/rejects the strings from the language

  • Solve the following Deterministic Finite Automata ( DFA ). For Σ = {0, 1} Construct a...

    Solve the following Deterministic Finite Automata ( DFA ). For Σ = {0, 1} Construct a DFA M such that L(M) = { w : w ends with 101 followed by an ODD number of 0's} Draw the state diagram and transition table..... 1) Given A Formal Definition M = (Q, Σ, ? , q, F) 2) Trace the Path (Listing States) taken by words state whether each word is accepted or rejected. w = 101010 v = 1010100 u...

  • 1(a)Draw the state diagram for a DFA for accepting the following language over alphabet {0,1}: {w...

    1(a)Draw the state diagram for a DFA for accepting the following language over alphabet {0,1}: {w | the length of w is at least 2 and has the same symbol in its 2nd and last positions} (b)Draw the state diagram for an NFA for accepting the following language over alphabet {0,1} (Use as few states as possible): {w | w is of the form 1*(01 ∪ 10*)*} (c)If A is a language with alphabet Σ, the complement of A is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT