Introduction to the Theory of Computation

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

View Full Document Right Arrow Icon
Theory of Computation - CSE 105, Fall 1998 Regular Languages Sample Problems and Solutions Notes: The alphabet in all problems is unless explicitly mentioned otherwise. 1 Deterministic Finite Automata (DFA) Problem 1 - Designing DFAs Define the language to be : contains either or as a consecutive substring Give the state diagram of a DFA with at most five states that recognizes the language , and give a formal proof of the correctness of your construction. Strategy: We first try to determine what we need to remember about a string as we are reading it. In this case we would need the following states: a start state, a state in which we have just seen a . Then states that have just seen and . And finally a state that has seen either a or a . This will be our accept state. Note that it suffices to have one state represent both and , since all that matters is that we need to accept both. Construction: The following DFA recognizes . 1 0 1 0 1 0 0 1 0, 1 1 2 3 4 5 Figure 1: A DFA recognizing 1
Image of page 1

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

View Full Document Right Arrow Icon
Correctness of Construction: We need to give a formal argument proving that the DFA constructed for accepts all and only those strings that are in . The proof, thus, has two subproblems : 1. Prove that for any string in , is accepted by the constructed DFA 2. Prove that for any string not in , is not accepted by the constructed DFA To get an idea for how to solve subproblem 1, recognize that we are trying to prove that a specific property (acceptance by the constructed DFA) holds for all elements of an infinite set ( ). This is exactly the type of problem for which proof by induction is designed (see page 23 of the text). Subproblem 2 fits the same model as subproblem 1, since the complement of is also an infinite set. Hence, we can prove the construction correct by giving inductive proofs for subproblems 1 and 2. Subproblem 1 - Proof by Induction In order to construct an inductive proof, we need to choose an appropriate variable to perform induction on. That is, we must find some function defined for all in that maps to the set of integers. As every string in has a length which is an integer value, the length function is suitable. Hence, let be the length of a string . We shall perform induction on the variable . Basis The constucted DFA accepts all in such that 3. When 2, the basis claim is vacuously true since the definition of states that all elements contain either or as a substring, both of which have a length of 3 2. When = 3, must be either or , as no other string of length 3 can possibly be in . We need to show that the constructed DFA accepts both and . From the start state, , the string moves the DFA along the following path of states : . Since is an accept state, the DFA accepts the string . Similarly, the string causes transitions along the path : .
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