{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

sample problems and soln

Introduction to the Theory of Computation

Info iconThis 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
Background image of page 1

Info iconThis 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 : .
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.

{[ snackBarMessage ]}