CSCE 551 Final Exam, April 28, 2016 Answer Key

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

CSCE 551 Final Exam, Spring 2004 Answer Key

Midterm II : Formal Languages, Automata, and Computability

6.045 Final Exam Solutions

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

SOLUTION: SOLUTION: SOLUTION:

Lecture 1: Finite State Automaton

Notes for Lecture Notes 2

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

V Honors Theory of Computation

1 Computational Problems

1 Showing Recognizability

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CpSc 421 Final Exam December 6, 2008

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Exam Computability and Complexity

CSE 105 THEORY OF COMPUTATION

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

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

CpSc 421 Homework 9 Solution

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

CSCC63 Worksheet Turing Machines

Decidability (What, stuff is unsolvable?)

CSE 105 THEORY OF COMPUTATION

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

TURING MAHINES

Final Exam Version A December 16, 2014 Name: NetID: Section: # Total Score

CSE 105 THEORY OF COMPUTATION

CPSC 421: Tutorial #1

Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3

Show that the following problems are NP-complete

Lecture 12: Mapping Reductions

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

1 More finite deterministic automata

CSCI3390-Second Test with Solutions

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

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

Finite Automata. Dr. Neil T. Dantam. Fall CSCI-561, Colorado School of Mines. Dantam (Mines CSCI-561) Finite Automata Fall / 35

CSE 105 THEORY OF COMPUTATION

Non-emptiness Testing for TMs

CSE 555 Homework Three Sample Solutions

CSE 105 Theory of Computation

CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

University of Toronto Scarborough. Aids allowed: None... Duration: 3 hours.

Chapter 6: NFA Applications

Theory Bridge Exam Example Questions

Theory of Computation

Computational Models Lecture 8 1

Computational Models Lecture 8 1

CpSc 421 Final Exam December 15, 2006

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

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

CS/ECE 374 Final Exam Study Problems Fall 2016

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Computational Models Lecture 8 1

CS 154 Introduction to Automata and Complexity Theory

Further discussion of Turing machines

Extended transition function of a DFA

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Solutions to Old Final Exams (For Fall 2007)

Reductions in Computability Theory

Lecture Notes: The Halting Problem; Reductions

CS154, Lecture 13: P vs NP

Decidable and undecidable languages

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

CSE200: Computability and complexity Space Complexity

Theory of Computation Space Complexity. (NTU EE) Space Complexity Fall / 1

Computability and Complexity

CSCI3390-Lecture 6: An Undecidable Problem

Turing Machine Recap

CS 311 Sample Final Examination

CS154, Lecture 13: P vs NP

Computability and Complexity

4.2 The Halting Problem

Computation Histories

CS 154 Formal Languages and Computability Assignment #2 Solutions

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

Undecidable Problems and Reducibility

Decidability: Reduction Proofs

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

CSE 105 THEORY OF COMPUTATION

Finite Automata. Mahesh Viswanathan

CS 361 Meeting 26 11/10/17

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Reducability. Sipser, pages

NP Complete Problems. COMP 215 Lecture 20

Finish K-Complexity, Start Time Complexity

The Unsolvability of the Halting Problem. Chapter 19

Homework Assignment 6 Answers

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

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Theory of Computation

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

Week 3: Reductions and Completeness

CS151 Complexity Theory. Lecture 1 April 3, 2017

False. They are the same language.

Transcription:

CSCE 551 Final Exam, April 28, 2016 Answer Key 1. (15 points) Fix any alphabet Σ containing the symbol a. For any language L Σ, define the language a\l := {w Σ wa L}. Show that if L is regular, then a\l is also regular. Answer: Assume L is regular. Given a DFA D = (Q, Σ, δ, q 0, F ) recognizing L, we define a DFA D as follows: D := (Q, Σ, δ, q 0, F ), where F := {q Q δ(q, a) F }. (Thus D differs from D only in the set of accepting states.) For any w Σ, we have w a\l wa L ˆδ(q 0, wa) F δ(ˆδ(q 0, w), a) F ˆδ(q 0, w) F D accepts w. Thus L(D ) = a\l, and so a\l is regular. 2. (10 points) Fix any language Σ containing 0. Let E be an enumerator (with output alphabet Σ) satisfying two properties when run: For infinitely many integers n 0, E prints 0 n at some point. E never prints a string with fewer 0 s than a previously printed string. (That is, for any strings x, y Σ, if E prints x first and y after, then y has at least as many 0 s as x (it could be the same number or more, but no fewer).) Show that the language enumerated by E is decidable. Answer: Here is a decision procedure M for L(E): M := On input w Σ : (a) Let n be the number of 0 s occurring in w. (b) Run E until either i. E prints w or ii. E prints 0 m for some m > n, whichever comes first. (c) If E prints w first, then accept; else reject. To see that M decides L(E), first suppose that w L(E). Then E eventually prints w. E cannot print any string with more 0 s than w before it prints w, so it cannot print 0 m for any m > n beforehand. Thus M will accept w. If w / L(E), then E never prints w, but it will eventually print 0 m for some m > n, so in this case M (halts and) rejects w. 1

3. (10 points) Let A be any Turing recognizable language such that, for all x Σ there exists y Σ such that x, y A (but there could be more than one such y). Show that there is a computable function f : Σ Σ such that x, f(x) A for all x Σ. [Hint: Use time slicing, a.k.a. dovetailing.] Answer: Here is a proof using an enumerator. Since A is Turing recognizable, there is some enumerator E enumerating A. Consider the following algorithm: M := On input x Σ : (a) Run E. (b) The first time E prints a string of the form x, y for some y Σ, then halt and output y. For each input x, we know that E must eventually print some string of the form x, y. Thus M always halts, and so it computes a function f : Σ Σ. By construction, x, f(x) A, because M only outputs a y such that x, y is printed by E (and thus is in A). (M just outputs the first such y it finds by running E). 4. (15 points) Let L := { M M is a TM that accepts exactly 2016 many strings}. Show that L is undecidable. Argue directly, without appealing to Rice s theorem. Answer: Suppose that L is decidable. Then here is a decision procedure for A TM : D := On input M, w, where M is a TM and w a string: (a) Construct the following TM R, fixing some symbol a in its input alphabet: R := On input x: i. Run M on input w. ii. If M ever accepts, then A. If x = a i for some integer i such that 0 i < 2016, then accept; B. Else, reject. iii. (If M does not accept w, then loop.) (b) If R L then accept; else reject. D is clearly a decider (it uses implicitly an assumed decision procedure for L). For any M and w: If M, w A TM, then M accepts w, and thus R accepts exactly 2016 many strings (namely, ɛ, a, aa, aaa,..., a 2015 ). It follows that R L, and so D accepts M, w. If M, w / A TM, then R loops on all its inputs, not accepting any string. That puts R / L, and hence D rejects M, w. 2

This shows that D is a decision procedure for A TM. Contradiction. Therefore L is undecidable. 5. (15 points) Let FIN NFA := { N N is an NFA and L(N) is finite}. Show that FIN NFA P by giving a polynomial-time decision procedure for FIN NFA. Give a high-level algorithm. Answer: The key idea is that an n-state NFA accepts infinitely many strings if and only if it accepts some string of length n (which is then pumpable to longer accepted strings). So here is a polynomial-time decision procedure for FIN NFA, and it uses something similar to the subset construction: D := On input N, where N is an NFA: (a) Let N = (Q, Σ, δ, q 0, F ), and set n := Q, the number of states of N. (b) Set S 0 := ɛ-closure({q 0 }). (c) For i := 1 to n compute S i := ɛ-closure q S i 1 a Σ {ɛ} δ(q, a) // S i is the set of states reachable by reading any input string of length i. (d) If S n contains an accepting state, or there is some accepting state reachable from a state in S n, then reject; else accept. D runs in polynomial time (particularly, Step (d) can be done via running breadth-first search from each state in S n ). And D accepts N if and only if N does not accept any strings of length n, or equivalently, L(N) is finite. 6. (10 points) Recall that for any positive integer k, we define k-colorability to be the language of all strings G such that G is an undirected graph and there exists a way to color the vertices of G with no more than k colors so that no two adjacent vertices are colored the same. It is clear (and you may assume) that k-colorability is in NP for every k, and we also know that 3-COLORABILITY is NP-hard. For any fixed k 4, show that k-colorability is NP-hard by finding a polynomial reduction from 3-COLORA- BILITY to k-colorability. Answer: Fix some k 4. Here is how we can p-reduce 3-COLORABILITY to k-colorability: Given a graph G, we output in p-time a graph G such that G is k-colorable if and only if G is 3-colorable: 3

(a) Let y 1, y 2,..., y k 3 be k 3 nodes not in G. (b) Add y 1, y 2,..., y k 3 to the vertex set of G. (c) Draw edges connecting each y i to all the vertices of G and to all the other y j for j i. (d) Let G be the resulting graph. Output G. The following proof of correctness is purely optional. Getting the reduction right counts for full credit. This construction can clearly be done in polynomial time. If G has a 3-coloring, then it can be extended to a k-coloring of G by assigning to each y i a unique color not used in G. Conversely, any k-coloring of G must assign distinct colors to y 1,..., y k 3, since they are all pairwise adjacent. Since all the y i are adjacent to all the vertices in G, none of the k 3 colors used for y 1,..., y k 3 can be used inside G. There are only 3 colors left, and so G is 3-colorable. 7. (15 points total) Let ϕ be the quantified Boolean formula ( x 1 )( x 2 )( x 3 )[ (x 1 x 2 x 3 ) (x 2 x 3 ) (x 1 x 3 ) (x 1 x 2 x 3 ) ]. (a) (10 points) Give the instance G, s of GG that ϕ maps to via the polynomial reduction of TQBF to GG described either in the book or in class. Draw the digraph G and label the start vertex s. Note that ϕ having an odd number of quantifiers may only require a slight modification of the construction. (b) (5 points) Is ϕ true? Explain. Answer: (a) Numbering the clauses C 1, C 2, C 3, C 4 from left to right, here is the instance of GG: 4

s C 1 x 1 x 1 C 2 x 2 x 2 C 3 C 4 x 3 x 3 The bottom two nodes represent consecutive dummy moves and may be bypassed completely. (b) ϕ is false. If x 1 = 1, then the formula reduces to (x 2 x 3 ) (x 2 x 3 ) (x 2 x 3 ), whence setting setting x 2 := 0 yields a contradiction. If x 1 = 0, then the formula reduces to (x 2 x 3 ) x 3, which again yields a contradiction when x 2 := 1. 8. (10 points) Prove that if TQBF P, then P = PSPACE. (We already know that P PSPACE unconditionally, so it suffices to show that PSPACE P.) [Note: There is nothing special about TQBF here, except that it is PSPACE-complete; any other PSPACE-complete language would work just as well.] Answer: Suppose TQBF P, and let A be any language in PSPACE. It suffices to show that A P. Since TQBF is PSPACE-hard, we have A p TQBF. It was proved in class and in the book that P is closed under p, which means that, since TQBF P by assumption, we have A P as well. 5