CSCE 551 Final Exam, Spring 2004 Answer Key

Similar documents
CSCE 551 Final Exam, April 28, 2016 Answer Key

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

V Honors Theory of Computation

Computability and Complexity

CSE 105 THEORY OF COMPUTATION

Answers to the CSCE 551 Final Exam, April 30, 2008

CSE 105 THEORY OF COMPUTATION

Lecture 12: Mapping Reductions

Computation Histories

CPSC 421: Tutorial #1

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

TURING MAHINES

CSCE 551: Chin-Tser Huang. University of South Carolina

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

CpSc 421 Final Exam December 15, 2006

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

1 Showing Recognizability

Theory of Computation (IX) Yijia Chen Fudan University

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

Theory of Computation

Midterm II : Formal Languages, Automata, and Computability

CSE 105 THEORY OF COMPUTATION

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

Reducability. Sipser, pages

CSE 105 Theory of Computation

1 More finite deterministic automata

CpSc 421 Final Exam December 6, 2008

Theory of Computation

Decidability (What, stuff is unsolvable?)

Lecture Notes: The Halting Problem; Reductions

Exam Computability and Complexity

Languages, regular languages, finite automata

Chapter 3: The Church-Turing Thesis

Non-emptiness Testing for TMs

CSE 555 Homework Three Sample Solutions

6.045 Final Exam Solutions

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Undecidable Problems and Reducibility

3130CIT Theory of Computation

Homework Assignment 6 Answers

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

ACS2: Decidability Decidability

Name: Student ID: Instructions:

Student#: CISC-462 Exam, December XY, 2017 Page 1 of 12

The Unsolvability of the Halting Problem. Chapter 19

NP, polynomial-time mapping reductions, and NP-completeness

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Notes for Lecture Notes 2

CS154, Lecture 13: P vs NP

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Computability Theory

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Introduction to Turing Machines. Reading: Chapters 8 & 9

DM17. Beregnelighed. Jacob Aae Mikkelsen

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

1 Computational Problems

Theory Bridge Exam Example Questions

Finite Automata and Regular languages

CpSc 421 Homework 9 Solution

UNIVERSITY OF CALIFORNIA, RIVERSIDE

CS 311 Sample Final Examination

Finish K-Complexity, Start Time Complexity

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Final exam study sheet for CS3719 Turing machines and decidability.

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CS154, Lecture 13: P vs NP

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

Advanced topic: Space complexity

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

Problems, and How Computer Scientists Solve Them Manas Thakur

Further discussion of Turing machines

Computability and Complexity

UNIT-VIII COMPUTABILITY THEORY

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Friday Four Square! Today at 4:15PM, Outside Gates

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

CSE 105 THEORY OF COMPUTATION

CSE 105 Theory of Computation

6.045J/18.400J: Automata, Computability and Complexity Final Exam. There are two sheets of scratch paper at the end of this exam.

CSCI3390-Second Test with Solutions

CS21 Decidability and Tractability

CS 361 Meeting 26 11/10/17

Part I: Definitions and Properties

CS243, Logic and Computation Nondeterministic finite automata

1 Reducability. CSCC63 Worksheet Reducability. For your reference, A T M is defined to be the language { M, w M accepts w}. Theorem 5.

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Turing Machines. Lecture 8

Transcription:

CSCE 551 Final Exam, Spring 2004 Answer Key 1. (10 points) Using any method you like (including intuition), give the unique minimal DFA equivalent to the following NFA: 0 1 2 0 5 1 3 4 If your answer is correct, you get full credit even if you do not show how you arrived at it. Answer: The one-state DFA whose start start is also an accepting state, and both of whose transitions are self-loops. This DFA accepts every binary string, recognizing {0, 1}. 2. (10 points) Give an implementation-level description of a standard (1-tape deterministic) TM M that decides the following language over input alphabet {0, 1}: Answer: On input w {0, 1}: {w w contains at least as many zeros as ones}. (a) Scan right until a blank is encountered, replacing the first 1 seen with x. If no 1 is seen in this scan, then accept. (b) Scan left to the beginning, replacing the first 0 seen with x. If no 0 is seen, then reject; otherwise, go to Step (a). Other algorithms are possible.

3. (10 points) Let A and B be two disjoint languages. Recall (Problem 4.18) that a language C separates A from B if A C and B C. Consider the two languages and A DIAG = { M M is a TM that accepts the string M } R DIAG = { M M is a TM that rejects the string M }. By filling in the bracketed parts, complete the following proof that there is no decidable language C that separates A DIAG from R DIAG : Suppose that there is some decidable C separating A DIAG from R DIAG. Let D be the following machine: On input w: [YOU FILL IN THIS PART (HIGH- LEVEL DESCRIPTION)]. Consider D running on input D. Clearly, D does not loop on input D. But, if D accepts D, then [YOU EXPLAIN WHY D MUST REJECT D ]. Likewise, if D rejects D, then [YOU EXPLAIN WHY D MUST ACCEPT D ]. This is a contradiction, thus there is no such decidable C. Answer: Here is a description of D. In fact, D decides C. D := On input w: (a) If w C, then reject; otherwise accept. If D accepts D, then D / C (by the definition of D), and thus D does not accept D (by the definition of C), and thus D rejects D (because D is a decider). Likewise, if D rejects D, then D C (by the definition of D), and thus D does not reject D (by the definition of C), and thus D accepts D (because D is a decider). 4. (10 points) Let f be any computable function. Show that the set R = {y ( x A TM ) f(x) = y} is Turing-recognizable by giving a high-level description of a TM that recognizes R. Answer: The following machine recognizes R: M := On input y: (a) Cycling through every string x: i. Compute f(x). ii. If f(x) = y, then accept; else continue to the next x. 5. (10 points) Find a mapping reduction from A TM to the language { M M is a TM and L(M) = A TM }.

Answer: Let L be the language above. Fix a TM M 0 that loops on all inputs. (Thus L(M 0 ) = A TM, and so M 0 / L.) Let f := On input x: (a) If x is not of the form M, w, where M is a TM and w an input string to M, then output M 0. // This works because x / A TM. (b) Otherwise, we have x = M, w as above. Let R be the following TM: R := On input N, y, where N is a TM and y a string: i. Run M on input w. ii. If M ever accepts w, then run N on input y (and do what N does). iii. Otherwise, loop. (c) Output R. If M does not accept w, then L(R) = A TM. Conversely, if M does accept w, then L(R) = A TM. Thus M, w A TM f( M, w ) L. 6. (10 points) Show that there is no computable function f outputting natural numbers such that, for any TM M and string w, if M accepts w, then M accepts w in at most f( M, w ) steps. [Hint: Argue by contradiction.] Answer: Suppose there exists such an f. Then the following TM clearly decides A TM : D := On input M, w, where M is a TM and w is a string: (a) Compute t := f( M, w ). (b) Run M on input w for t steps. (c) If M accepts w within this time, then accept; else reject. This is a contradiction, because A TM is undecidable. 7. Below, G is always an undirected graph, and k is a natural number. A path in G is simple if no vertex appears more than once along the path. The length of a path is the number of edges in the path. (a) (10 points) Explain why the language LONGPATH = { G, v, k G has a simple path of length k starting at vertex v} is in NP. (b) (10 points) Show that if LONGPATH P, then there is a polynomial-time computable function f that, on input G, k, either outputs some simple path in G of length k or outputs no if there is no such path. You may take the statement of part (a) as given. A high-level description of f is fine.

Answer: (a) LONGPATH is in NP because if G does have a simple path of length k starting at v, then a ptime verifiable proof could be such a path p itself, given as a sequence of vertices. The verifier checks that: there are at least k vertices in p; no vertex is repeated in p; p starts with v; and each vertex in p except the last is adjacent to the immediately following vertex in p. (b) Here is a description of f: On input G, k, where G is a graph and k a natural number: i. Run through the vertices v of G, checking whether G, v, k LONGPATH. ii. If there is no vertex v such that G, v, k LONGPATH, then output no and halt. iii. Otherwise, let v be the first vertex found such that G, v, k LONGPATH. iv. Initialize p to be the length 0 path consisting of just v. v. While k > 0, do the following: A. Let G be the graph obtained by removing v and its incident edges from G. B. Run through the neighbors 1 of v in G until a neighbor w is found such that G, w, k 1 LONGPATH. // Such a w must exist. C. Append w onto the end of p. D. Set G := G and k := k 1. vi. Return p. The function f can be computed in ptime, because there are at most 2 V (G) 1 calls to LONGPATH, each on a polynomial sized input. The rest of the algorithm (besides the calls to LONGPATH clearly takes polynomial time. 8. (10 points) Using any method you like, show that the language is not regular. {0 m 1 n m, n 0 and n m 2 } Answer: Let L be the language above. There are (at least) two different solutions to this problem: Solution 1: Suppose L is regular. Then by the closure properties of regular languages, the language L = L L(0 1 ) is also regular. But L = {0 m 1 m2 m 0}, 1 A neighbor of a vertex v is any vertex adjacent to v.

and this language cannot be regular, as is seen via the pumping lemma for regular languages: given any p > 0, set s := 0 p 1 p2. Clearly s L and s p. Given any x, y, z such that xyz = s, y > 0, and xy p, it must be that y = 0 k for some k > 0. Let i := 0. Then xy i z = xz = 0 p k 1 p2 / L. Thus L is not regular. Contradiction. It follows that L cannot be regular. Solution 2: Using the pumping lemma directly, given any p > 0, set s := 0 p 1 (p!+p)2. Clearly, s p and s L, since (p! + p) 2 p 2. Given strings x, y, z such that xyz = s, y > 0, and xy p, it must be that y = 0 k for some 0 < k p. Set i := p! + 1 (which is an k integer). Then xy i z = 0 p!+p 1 (p!+p)2 / L. Thus L is not regular.