hw2sol - CS 181 - Winter 2005 Formal Languages and Automata...

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

View Full Document Right Arrow Icon
CS 181 — Winter 2005 Formal Languages and Automata Theory Problem Set #2 Solutions Problem 2.1. Convert the following NFA into an equivalent DFA . (Don’t bother to write down unreachable states.) Also, describe in words the language accepted by each automaton. A B 0,1 C 1 0,1 D 1 Solution A AB 1 0 0 ABC 1 1 00 1 1 0 ABCD AD To build this machine, we simply use the subset construction. Starting from the initial state A , on input 0 we can only stay in A . Thus, the state { A } goes to itself on 0 . From A , on input 1 , we can go to either A or B . Thus, the state { A } goes to { A,B } on input 1 . We continue this process { } and all subsequent states. The final states are the subsets that contain final states. Thus, { A,B,C,D } and { A,D } are final states of the DFA. Looking at the NFA, we can see that this machine only looks at the last three symbols of input. While the last doesn’t matter, the second and third from last are required to be 1 ’s. After making these obsevations, it is easy to see that the language of the NFA is the set of strings whose second and third from last symbols are 1 ’s. We can also deduce this from the DFA by giving the states the following interpretations:
Background image of page 1

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

View Full DocumentRight Arrow Icon
{ A } ... string is ε or ends with 010 or 00 { A,B } string is 1 or ends with 01 { A,B,C } string is 11 or ends with 011 { A,B,C,D } string ends with 111 { A,D } string ends with 110 Problem 2.2. Say that string x is a prefix of string y if a string z exists where xz = y and that x is a proper prefix of y if in addition x 6 = y . In each of the following parts, we define an operator on a language A . Show that the class of regular languages is closed under the operation. 1. NOPREFIX ( A ) = { w A | no proper prefix of w is a member of A } Solution Let M = ( Q, Σ ,δ,q 0 ,F ) be a DFA for A . The key observation is the following: Let w A and say the run of M on w is given by state sequence r 0 ,r 1 ,...,r n . Then if w ( A ), then w has no proper prefix that is also in A . In particular, this means that none of the states
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/02/2008 for the course COM SCI 181 taught by Professor Griebach during the Spring '08 term at UCLA.

Page1 / 4

hw2sol - CS 181 - Winter 2005 Formal Languages and Automata...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online