CSE 555 HW 5 SAMPLE SOLUTION. Question 1.

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

Lecture 20: PSPACE. November 15, 2016 CS 1010 Theory of Computation

Computability and Complexity CISC462, Fall 2018, Space complexity 1

SOLUTION: SOLUTION: SOLUTION:

1 PSPACE-Completeness

Space Complexity. Huan Long. Shanghai Jiao Tong University

Introduction to Computational Complexity

Space Complexity. The space complexity of a program is how much memory it uses.

Announcements. Friday Four Square! Problem Set 8 due right now. Problem Set 9 out, due next Friday at 2:15PM. Did you lose a phone in my office?

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

CS154, Lecture 17: conp, Oracles again, Space Complexity

Tecniche di Verifica. Introduction to Propositional Logic

Lecture 22: PSPACE

CSCI 1590 Intro to Computational Complexity

Lecture 19: Finish NP-Completeness, conp and Friends

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

CS154, Lecture 13: P vs NP

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

6.045 Final Exam Solutions

Comp487/587 - Boolean Formulas

Theory of Computation Time Complexity

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

6.045: Automata, Computability, and Complexity (GITCS) Class 15 Nancy Lynch

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

Notes on Complexity Theory Last updated: October, Lecture 6

NP Complete Problems. COMP 215 Lecture 20

De Morgan s a Laws. De Morgan s laws say that. (φ 1 φ 2 ) = φ 1 φ 2, (φ 1 φ 2 ) = φ 1 φ 2.

Time and space classes

an efficient procedure for the decision problem. We illustrate this phenomenon for the Satisfiability problem.

Definition: conp = { L L NP } What does a conp computation look like?

Introduction to Complexity Theory. Bernhard Häupler. May 2, 2006

Lecture 8. MINDNF = {(φ, k) φ is a CNF expression and DNF expression ψ s.t. ψ k and ψ is equivalent to φ}

CS154, Lecture 13: P vs NP

A Lower Bound for Boolean Satisfiability on Turing Machines

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

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.

The Cook-Levin Theorem

CSE 135: Introduction to Theory of Computation NP-completeness

CSE200: Computability and complexity Space Complexity

conp, Oracles, Space Complexity

15.1 Proof of the Cook-Levin Theorem: SAT is NP-complete

NP-Completeness Part II

The Polynomial Hierarchy

Intro to Theory of Computation

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

CS 6505, Complexity and Algorithms Week 7: NP Completeness

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

TIME COMPLEXITY AND POLYNOMIAL TIME; NON DETERMINISTIC TURING MACHINES AND NP. THURSDAY Mar 20

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

SAT, NP, NP-Completeness

CISC 4090 Theory of Computation

6.840 Language Membership

A brief introduction to Logic. (slides from

DRAFT. Diagonalization. Chapter 4

Umans Complexity Theory Lectures

NP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard

6.841/18.405J: Advanced Complexity Wednesday, February 12, Lecture Lecture 3

Recap from Last Time

Advanced Topics in Theoretical Computer Science

Show that the following problems are NP-complete

CSCI3390-Second Test with Solutions

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

CSE 555 Homework Three Sample Solutions

INPUT INDEPENDENCE AND COMPUTATIONAL COMPLEXITY

CS5371 Theory of Computation. Lecture 23: Complexity VIII (Space Complexity)

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

PSPACE COMPLETENESS TBQF. THURSDAY April 17

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

Lecture 20: conp and Friends, Oracles in Complexity Theory

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

Essential facts about NP-completeness:

NP-Completeness and Boolean Satisfiability

CSCE 551 Final Exam, April 28, 2016 Answer Key

Finish K-Complexity, Start Time Complexity

On the Computational Hardness of Graph Coloring

3130CIT Theory of Computation

Lecture 8: Complete Problems for Other Complexity Classes

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Lecture 7: Polynomial time hierarchy

Part 1: Propositional Logic

UNIT-IV SPACE COMPLEXITY

Propositional Logic: Models and Proofs

Space is a computation resource. Unlike time it can be reused. Computational Complexity, by Fu Yuxi Space Complexity 1 / 44

CSE 105 THEORY OF COMPUTATION

Lecture 23: More PSPACE-Complete, Randomized Complexity

Correctness of Dijkstra s algorithm

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

NP Completeness and Approximation Algorithms

A Collection of Problems in Propositional Logic

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

Computability and Complexity Theory: An Introduction

Chapter 7: Time Complexity

CS21 Decidability and Tractability

Advanced Topics in LP and FP

BBM402-Lecture 11: The Class NP

Transcription:

CSE 555 HW 5 SAMPLE SOLUTION Question 1. Show that if L is PSPACE-complete, then L is NP-hard. Show that the converse is not true. If L is PSPACE-complete, then for all A PSPACE, A P L. We know SAT PSPACE from Sipser Example 8.3, so SAT P L. A language is NP-hard if every language in NP is polynomial time reducible to it. SAT is NP-complete and SAT P L, so for all B NP, B P SAT P L, so L is NP-hard. To see that the converse is not true, first show that A NT M is NP-hard, as follows. (Our definition of A T M is for deterministic TMs. A NT M is the version of A T M for non-deterministic TMs.) Take an arbitrary A N P and let M be the NTM that decides A in nondeterministic polynomial time. There is a polynomial time computable function f : Σ Σ so that w A f(w) A NT M ; specifically, f(w) = M, w. Construct F, the TM that computes function f, from M as follows: F = On input w: (1) Write M, w to the tape and halt. Writing M to the tape takes constant time regardless of the length of w, so the function is computed in O( w ) time. Then, for all A NP, A P A NT M so A NT M is NP-hard. But A NT M is undecidable. Because every deterministic TM is also an NTM, if A NT M were decidable, a decider for A NT M could be to decide A T M. Therefore, A NT M cannot be in PSPACE, so A NT M is not PSPACE-complete. Question 2. Show that ALL NF A = { M : L(M)Σ for the NFA M whose input alphabet is Σ} is in PSPACE. Sipser provides an algorithm for ALL NF A that runs in nondeterministic space O(n), so ALL NF A NPSPACE, and NPSPACE = PSPACE by Savitch s theorem. Because ALL NF A is in copspace, and the deterministic space complexity classes are closed under complement, ALL NF A is in PSPACE. Question 3. A string w = w 1...w n with w i Σ for 1 i n yields 1

2 CSE 555 HW 5 SAMPLE SOLUTION (a) the string w = w 1..., w i 1, a, w i+1...w n with a Σ by a substitution, and (b) the string w = w 1..., w i 1, w i+1...w n by a deletion. (You can substitute or delete any single symbol w i.) Let L Σ be an arbitrary language and suppose that w, w Σ. We say that there is a deletion-substitution chain in L from w to w if there is a finite integer l so that there exist strings (z 0,..., z l ) with each z i L for which z 0 = w, z l = w 0, and z i is obtained from z i 1 by a deletion or substitution for each 1 i l. Show that, when L is regular, DSC L = { w, w : a deletion-substitution chain from w to w L} is in PSPACE. Since PSPACE = NPSPACE, showing that DSC L NPSPACE is equivalent to showing that DSC L PSPACE. We devise an NTM, N L, that decides DSC L. Because L is regular, there is a DFA D such that L(D) = L; N L can have D hardcoded into it in order to decide when w L. Simulating D on w can be performed using a constant amount of space, because we only need to keep track of the state D is currently in. We need to compute and store l so we know when our algorithm can terminate (when no chain can exist). Notice that, in a deletion-substitution chain, no z i can ever be longer than w, but it may be required to perform several substitutions before a deletion can be performed. The maximum length of a possible chain is the number of all possible z i such that z i w. Then, w l = Σ i = Σ w +1 1 i=0 The magnitude of l is exponential in the size of w, but if we store l in base Σ, then the storage required is w + 1. We also store i in base Σ, so the space complexity for this is also O( w ). Then N L follows: N L = On input w, w : (1) If w < w, reject (there cannot be a substitution-deletion chain) (2) Simulate D on w and reject if D does. (3) Simulate D on w and reject if D does. (4) Compute and store l on the tape (as explained above). (5) For 1 i l: (a) Nondeterministically select one symbol in w and nondeterministically delete it or substitute another symbol from Σ. (b) If w = w, accept. (c) Simulate D on w and reject if D does.

CSE 555 HW 5 SAMPLE SOLUTION 3 (6) No chain with length 1 i l has been found so reject. If a chain exists with the specified properties, N L will find it because there is a sequence of nondeterministic choices leading to acceptance. (The space for w is reused for each substitution or deletion, so this requires no additional space.) We only need O(1) space to store the current state of D during simulations, and O( w ) space to store i and l, so the algorithm has space complexity O( w ) NPSPACE = PSPACE. Question 4. We say that language L is in conp if and only if language L is in NP. By direct analogy with the definition of NP-completeness, precisely define conp-completeness. (Use polynomialtime reducibility.) A tautology is a logical formula that is always true. Show that { ψ : ψ is an unquantified boolean formula that is a tautology} is conp-complete. A language L is conp-complete if it satisfies two conditions: (1) L is in conp. (L is in NP) (2) every language in conp is polynomial time reducible to L. (The complement of every language in NP is poly reduce to not L) Let T = { ψ : ψ is an unquantified boolean formula that is a tautology}. T conp T NP. T is the language of strings that are either not unquantified Boolean formulas or there is some truth assignment to the variables of ψ such that the formula is false. To see that T NP, we provide a polynomial time verifier, V. The certificate, c, is the truth assignment that makes the formula false. Let n be the length of ψ, c and l be the number of variables in ψ. We use the standard convention of 0 = false, 1 = true. V = On input ψ, c : (1) If ψ has any quantifiers or ψ is not a Boolean formula, accept. (2) Scan the tape and replace the variables of ψ with the assignment c. If the literal x appears in the formula, replace it with its truth value. If x appears, replace it with the opposite truth value. If c is not a truth assignment to the variables of ψ (if c l or it is improperly formatted), accept. (3) Repeat until there is either a single 0 or 1 on the tape: (a) Evaluate the formula by collapsing binary logical operators, based on their rules and the truth value to the left and right, respecting precedence dictated by parentheses, and shifting the rest of the formula left after collapsing. (4) If 1 is on the tape, reject. If 0 is on the tape, accept. Step 1 is completed in O(n) steps. Step 2 can be completed by zigzagging across the tape. For each pass, we replace at least 1 variable, or accept, so step 2 takes O(ln) steps. During

4 CSE 555 HW 5 SAMPLE SOLUTION step 3, we are guaranteed to collapse at least one truth value for each iteration, but may have to shift almost n tape symbols left, so this step takes O(ln) steps. Step 4 is completed in constant time, so the verifier runs in time O(ln). To show that T is conp-complete, we either need to show that every language in conp is polynomial time reducible to T, or we need to show that another conp-complete problem is polynomial time reducible to T. For the second approach, we need a first conp-complete problem. Consider SAT and consider the reduction from A to SAT presented in the proof of the Cook-Levin theorem. Let A be an arbitrary language in NP and let φ be the formula that simulates the NTM for A. We know that w A φ SAT. We also have that w A φ SAT, or w A φ SAT. As A NP A conp, we have that every conp language is polynomial time reducible to SAT. Now we show SAT P T. Notice that if ψ is a tautology, then its negation is always false (it is unsatisfiable). Then, ψ SAT ψ T. This is already a boolean formula. However, we can carry this further to rewrite the formula to avoid the global negation, if desired. We define a recursive routine, NEGATE, that performs negation of an unquantified Boolean formula to show that the reduction can be performed in polynomial time. NEGATE = On input ψ: (1) If ψ = ψ a ψ b, replace with and call NEGATE(ψ a ), NEGATE (ψ b ). (2) If ψ = ψ a ψ b, replace with and call NEGATE(ψ a ), NEGATE (ψ b ). (3) If ψ is a literal, x, replace x with x and return. (4) If ψ is a negated literal, x, replace x with x and return. To see that NEGATE runs in polynomial time, let k be the number of Boolean log ical operators in ψ and n the length of ψ. Each time NEGATE is called, it changes exactly one symbol, so it runs in O(1) time. NEGATE is called twice for each of the k logical operators, so there are 2k < 2n = O(n) total calls, so this NEGATE runs in polynomial time. Then SAT P T and T conp, so T is conp-complete. Question 5. A boolean formula is in disjunctive normal form (DNF) if it is the disjunction of clauses, where each clause is the conjunction of literals (variables or their negations). We consider totally quantified boolean formulas of the form Q 1 x 1...Q m x m [ψ] where ψ is in disjunctive normal form. Show that the language of true TQBFs in DNF is PSPACE-complete. Call this problem DNF-TQBF. DNF-TQBF PSPACE because every instance of DNF- TQBF is an instance of TQBF. So modify the algorithm in Sipser theorem 8.9 by checking that the formula given is in DNF before the rest of the algorithm executes. This step checks

CSE 555 HW 5 SAMPLE SOLUTION 5 if (1) each clause is a conjunction of literals and (2) the entire formula is a disjunction of clauses and rejects if either condition is violated. The modified algorithm uses no more space than the original, and so DNF-TQBF PSPACE. To see that DNF-TQBF is PSPACE-complete, we might try to reduce TQBF to DNF- TQBF by converting any arbitrary φ to φ DNF form. However, this can cause φ to be exponentially larger, and we cannot run in less time than the amount of space we must use, so this may take exponential time. (For example, if φ is in 3-CNF with c clauses, then φ will have 3 c terms, as there are 3 ways to pick the literal to satisfy each of the c clauses.) Instead we follow the proof of Theorem 8.9 and make the necessary revisions. That proof constructs a quantified formula φ in which the unquantified boolean formula ψ is a conjunction of boolean formulas arising exactly as in the proof of the Cook-Levin theorem (Theorem 7.37 in Sipser). The argument in Corollary 7.42 of Sipser shows that we can assume that ψ is in conjunctive normal form. Most of the quantifiers in φ concern only individual variables, but as given in Theorem 8.9 the formula is not in prenex normal form because of the appearance of ( weird ) quantifiers like (c 3, c 4 ) {(c 1, m 1 ), (m 1, c 2 )}. Recall that each of c 1, c 2, c 3, c 4, m 1 represent O(n k ) boolean variables. Let s get rid of these weird quantifiers. For each weird quantifier, make a new boolean variable s. When s is true, we make O(n k ) clauses in CNF that require that if s is true then (c 3, c 4 ) = (c 1, m 1 ). To do this, for each boolean variable a from c 1 and the corresponding boolean variable b from c 3, form clauses (s a b) (s a b). Do the same for the boolean variables from c 4 and m 1. Now repeat this process using s in place of s with the boolean variables from c 3 and m 1, and from c 4 and c 2. Finally replace the weird quantifier with c 3 c 4 s, and add all of the clauses so produced as conjunctions to ψ. This eliminates a weird quantifier while keeping ψ in CNF, and adding O(n k ) clauses to ψ. Repeat this on the O(n k ) weird quantifiers to get a formula θ in prenex normal form in which ψ is in CNF, so that θ and φ are logically equivalent. Consider θ, the negation of θ. Changing every to exists and every to in θ, and complementing ψ (using NEGATE above), we obtain the formula for θ. Now ψ is in disjunctive normal form because ψ is in conjunctive normal form. Having earlier eliminated the weird quantifiers, θ is in prenex normal form with a DNF boolean formula. Now θ DNF-TQBF if and only if φ TQBF. Hence DNF-TQBF is PSPACE-complete. (Technically, we should conclude that it is copspace-complete, but these classes coincide.)