This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Computer Science and Engineering, UCSD Spring 04 CSE 105: Introduction to the Theory of Computation Instructor: Mihir Bellare Problem Set 1 Solutions April 8, 2004 Problem Set 1 Solutions Problem 1 Give the formal description of the machine M 1 pictured in Exercise 1.1, page 83 of the text. Before trying to do this exercise, refer to Definition 1.1, page 35 of the text and make sure you understand it. Now, the formal description is M 1 = ( Q, ,,q ,F ) where Q = { q 1 ,q 2 ,q 3 } = { a , b } : Q Q is defined via ( q 1 , a ) = q 2 ( q 1 , b ) = q 1 ( q 2 , a ) = q 3 ( q 2 , b ) = q 3 ( q 3 , a ) = q 2 ( q 3 , b ) = q 1 q = q 1 F = { q 2 } Problem 2 Exercise 1.4 part (c), page 84 of the text. 1 1 1 1 , 1 1 2 Bellare Problem 3 Exercise 1.5 part (b), page 84 of the text. The DFA of Problem 2 above has five states and any DFA is an NFA, so that is already a solution. However, the following is a simpler and easier to understand NFA: , 1 1 1 , 1 Problem 4 Problem 1.41, page 90 of the text. Below is a five state NFA for the language in question. 1 1 1 1 1 Problem 5 Problem 1.31, page 88 of the text. It is important to first understand exactly what it means for an allpaths NFA to accept or reject. If the input is in the language, it is required that all possible paths that may be followed on that input end in accepting states. What about rejection? Reject is defined as not accept. This means an input is rejected if there exists some path, on this input, that leads to a reject state. Note rejection means there exists a rejecting path, not that all paths are rejecting! (a) Let L be an arbitrary regular language. Show that there is an allpathsNFA that accepts L . Given: L is regular. So there is a DFA M that accepts L . Want: To construct an allpathsNFA M that accepts L . Construction: Just let M = M . That is, I claim the given DFA does the job. Correctness of construction: This is pretty clear because since M is a DFA, there is, on any input, only one path that can be followed. When the input x is in L this one path is accepting, so all paths are accepting. When x is not in L this one path is rejecting, so there exists a rejecting path. CSE 105 Sp04, Problem Set 1 Solutions 3 (b) Let L be a language accepted by some allpathsNFA M . Show that L is regular. We are given that L is accepted by some allpaths NFA. Let M be this NFA. We want to show that L is regular. The trick is to consider the machine M formed by reversing accept and reject states in M . That is, M is the same as M accept that all states of M that were accepting are now rejecting, and all states that were rejecting are now accepting. What kind of machine is this, and what language does it accept?...
View Full
Document
 Spring '99
 Paturi
 Computer Science

Click to edit the document details