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

Info icon This 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 0 0 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 { A, B } 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:
Image of page 1

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

View Full Document Right 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 NOPREFIX ( A ), then w has no proper prefix that is also in A . In particular, this means that none of the states
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern