# s2 - 6.045J/18.400J: Automata, Computability and Complexity...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6.045J/18.400J: Automata, Computability and Complexity Prof. Nancy Lynch Homework 2 Due: Tuesday, February 20, 2007 Elena Grigorescu Reading: Sipser, Sections 1.2 and 1.3. Problem 1 : Designing DFAs and NFAs. For each of the following, draw a state diagram for a DFA or NFA (as required) that recognizes the specified language. In all cases the alphabet is { , 1 } . (a) Sipser exercise 1.6, part c. L 1 = { w | w contains the substring 0101 } . Provide a DFA recogniz- ing L 1 . A B C D E 1 1 0,1 1 1 (b) Sipser exercise 1.6, part j. L 2 = { w | w contains at least two 0 s and at most one 1 } . Provide a DFA recognizing L 2 . 1 1 1 1 1 1 A B C D E F G (c) Sipser exercise 1.7, part c. L 3 = { w | w contains an even number of 0 s, or exactly two 1 s } . Provide an NFA with at most six states that recognizes L 3 . 2-1 A E C B D F 1 1 1 1 ε ε Problem 2 : Proving an FA recognizes a language. For one of the automata you designed in problem 1, prove that the machine recognizes exactly the specified language. To do this, you will need to prove that your automaton (1) accepts all strings in the language and (2) does not accept any string not in the language. Solution 2 : We show that the NFA in c) recognizes L 3 . We begin by characterizing which strings are able to reach which states. 1. State A: ǫ . 2. State B: 0 ∗ 3. State C: any string in 0 ∗ 1. 4. State D: any string in 0 ∗ 10 ∗ . 5. State E: any string in 0 ∗ 10 ∗ 10 ∗ . NFA accepts all strings in L 3 : We now show by induction on the length of input that the NFA above accepts all strings in L 3 . Let W 1 = { w | w contains an even number of 0 s } and W 2 = { w | w contains exactly two 1 s } . Then L 3 = W 1 ∪ W 2 . Let w ∈ W 1 . We will show that E ∈ δ ( A,w ), and thus w is accepted. Base case: w = ǫ . Clearly E ∈ δ ( A,ǫ ). Induction step: Assume that for any w ∈ W 1 , | w | ≤ n we have that E ∈ δ ( A,w ). We will show that if s ∈ W 1 and | s | = n + 1 then E ∈ δ ( A,s ). If s contains only 1’s, then E ∈ δ ( A, 1 n +1 ). If s = 01 n − 2 0 then again E ∈ δ ( A, 1 n +1 ), by inspecting the diagram. Otherwise, let s = s 1 s 2 , where s 1 contains an even number of 0’s and s 2 contains exactly two 0’s. Then E ∈ δ ( A,s 1 ) by induction, since | s 1 | ≤ n − 1. Also, since s 2 ∈ W 1 then E ∈ δ ( A,s 2 ). Therefore, E ∈ δ ( A,ǫs 2 ), and thus E ∈ δ ( E,s 2 ). This concludes that E ∈ δ ( A,s 1 s 2 ), and that s is accepted....
View Full Document

## This note was uploaded on 08/12/2009 for the course CS 420 taught by Professor Nancylynch during the Spring '07 term at New Mexico Junior College.

### Page1 / 7

s2 - 6.045J/18.400J: Automata, Computability and Complexity...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online