CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 6: NP & Reductions Due: One week after shown in slides

Similar documents
CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 3: Diagonalization & Halting Problem Due: One week after shown in slides

Essential facts about NP-completeness:

Theory of Computation Chapter 9

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

SOLUTION: SOLUTION: SOLUTION:

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

Week 3: Reductions and Completeness

Intro to Theory of Computation

CSI 4105 MIDTERM SOLUTION

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

CS 6505, Complexity and Algorithms Week 7: NP Completeness

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

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

Intractable Problems. Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions

Lecture 18: More NP-Complete Problems

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

Introduction to Computational Complexity

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

1 More finite deterministic automata

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.

CSE 421 NP-Completeness

NP Completeness and Approximation Algorithms

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

NP-Completeness. Algorithmique Fall semester 2011/12

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

SAT, NP, NP-Completeness

3130CIT Theory of Computation

CS151 Complexity Theory. Lecture 1 April 3, 2017

Algorithm Design and Analysis

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

NP-Completeness. Subhash Suri. May 15, 2018

6.045 Final Exam Solutions

CSCI3390-Lecture 14: The class NP

NP and NP Completeness

CSCI3390-Second Test with Solutions

Complete problems for classes in PH, The Polynomial-Time Hierarchy (PH) oracle is like a subroutine, or function in

NP-Completeness Part II

NP-Complete Problems. More reductions

CS154, Lecture 13: P vs NP

9.1 HW (3+3+8 points) (Knapsack decision problem NP-complete)

CSC 5170: Theory of Computational Complexity Lecture 9 The Chinese University of Hong Kong 15 March 2010

6.5.3 An NP-complete domino game

NP-Complete Reductions 2

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

NP-Completeness. Sections 28.5, 28.6

Complexity Theory Part II

Umans Complexity Theory Lectures

Non-Approximability Results (2 nd part) 1/19

Design and Analysis of Algorithms

CS154, Lecture 13: P vs NP

PCPs and Inapproximability Gap-producing and Gap-Preserving Reductions. My T. Thai

Introduction. Pvs.NPExample

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

NP-Completeness and Boolean Satisfiability

Lecture Notes Each circuit agrees with M on inputs of length equal to its index, i.e. n, x {0, 1} n, C n (x) = M(x).

1 Primals and Duals: Zero Sum Games

Lecture 3: Nondeterminism, NP, and NP-completeness

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Polynomial-Time Reductions

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

Intractable Problems [HMU06,Chp.10a]

NP Completeness. Richard Karp, 1972.

About the relationship between formal logic and complexity classes

The Complexity of Optimization Problems

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

INAPPROX APPROX PTAS. FPTAS Knapsack P

Time to learn about NP-completeness!

CS21 Decidability and Tractability

More NP-Complete Problems

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Today: NP-Completeness (con t.)

ENEE 459E/CMSC 498R In-class exercise February 10, 2015

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

COMP 382. Unit 10: NP-Completeness

NP and NP-Completeness

Time to learn about NP-completeness!

CS/ECE 374 Final Exam Study Problems Fall 2016

ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

NP-Complete Reductions 1

CSE 105 THEORY OF COMPUTATION

Lecture 16: Time Complexity and P vs NP

452 FINAL- VERSION E Do not open this exam until you are told. Read these instructions:

CS154 Final Examination

Welcome to... Problem Analysis and Complexity Theory , 3 VU

conp, Oracles, Space Complexity

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

1.1 P, NP, and NP-complete

Complexity theory for fellow CS students

Advanced Topics in Theoretical Computer Science

Polynomial-time Reductions

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

1. Introduction Recap

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Midterm II : Formal Languages, Automata, and Computability

NP and Computational Intractability

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Transcription:

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 6: NP & Reductions Due: One week after shown in slides First Person: Second Person: Family Name: Family Name: Given Name: Given Name: Student #: Student #: Email: Email: Guidelines: You are strongly encouraged to work in groups of two. Do not get solutions from other pairs. Though you are to teach & learn from your partner, you are responsible to do and learn the work yourself. Write it up together. Proofread it. Please make your answers clear and succinct. helpful hints. Relevant Readings: NP-Slides NP from Thinking About Algorithms Abstractly This page should be the cover of your assignment. Problem Name Max Mark 1 Software Packages 10 2 NP-Complete Cards 10 3 NP-Complete Vertex Cover 10 4 NP-Complete Bounded Witness 10 5 Purpose of steps 10

CSE 4111/5111/6111 Computability Jeff Edmonds Assignment 6: NP & Reductions Due: One week after shown in slides 1. (a) There is a collection of software packages S 1,...,S n which you are considering buying. These are partitioned into two groups. For those i N [n], the costs of buying it out ways the benefits and hence it effectively costs you a given amount b i 0 to buy it. For those j P [n], the benefits out way the costs of buying it and hence it effectively costs you a given amount b j 0 to not buy it. Some of these packages rely on each other; if S i relies on S j, then you will incur an additional cost of a i,j 0 if you buy S i but not S j. Provide a polytime algorithm to decide the subset S [n] of S 2,...,S n that you should buy. The cost of your solution is cost(s) = i S N b i + j S P b i + i S,j S a i,j. Hint: Do not design a new algorithm but do a reduction to max flow - min cut similar to that done for matching the boys and girls. (b) In the old version, for each i, you will gain an overall benefit of b i if you acquire package S i. Possibly b i is negative. How does this effect the reduction (beyond taking the absolute value). 2. NP-Completeness (a) Is Clique poly 3-Clique true? Is 3-Clique poly Clique true? Give one sentence for each about how you know. (b) The problem Card is defined by the following puzzle. You are given a box and a collection of cards as indicated in the figure. The box and each card has r rows and two columns of positions in the same places. The box contains an s for each row of the left column. In each card at each of these positions (left and right), there is either a hole punched out or there is not. Each card must be placed in the box either face up or flipped over left to right. It has a notch at its top which must be at the top of the box. Box One side The other side First of many cards One side The other side Second of many cards Consider some row in some card. Suppose its left position has a hole but its right position does not. Putting the card in face up does not cover the in the box of this row, because the is on the left and the hole does not cover it. Putting the card in flipped over, however, does cover the. The goal is to cover each and every in the box. A solution specifies for each card whether to flip the card or not. A solution is valid if it covers all the s. Recall, that all the cards are stacked in the box. So saying that each is covered amounts to saying that for each, there is at least one of the cards that is flipped in a way that will cover the. Prove that Card is NP-Complete by reducing it to/from Clause-SAT. Be sure to think about each of the 12 steps. You are to write up steps 0, 5, 6, and 7. For each of these have a clear paragraph with pictures. The problem Clause-SAT is given a set of clauses where each clause is the OR of a set of literals and each literal is either a variable or its negation. The goal is know whether you can set each variable to true or false so that each clause is satisfied. 0) P card NP: 5) InstanceMap: 6) SolutionMap: Map a potitial solution S card of the card problem to a potiential solution S Clause SAT of Clause-Sat. 7) Valid to Valid: Assume that S card is a valid solution, i.e. every rows r has some card c that covers the left in that row. Our goal is to prove that S Clause SAT is a valid solution, i.e. every clause c has some variable x that satisfies it. r c covers(r,c ) c x satisfies(c,x) Such a proof is reminiscent of that in Assignment 0 Quantifiers Question 2c. 2

(c) Repeat the last question except for the following change. The box now has s in both the left and the right columns and the cards must cover all of these s. Hint: Remember that you are able to create the set of cards and you can choose to create one extra card. What is that card that you create? What changes do you have to made to steps 6 and 7 above? Box 3. NP-Completeness: The problem Vertex Cover is given an instance I V C = G,k where G is an undirected graph and k is integer k. A solution S V C is a subset of the nodes of G. It is valid if every edge has at least one of it s nodes is in S V C and S V C k. Prove that V C is NP-Complete by reducing it to/from 3-SAT. Be sure to think about each of the 12 steps. You are to write up steps 0, 5, 6, and 7. For each of these have a clear paragraph with pictures. 0) P V C NP: 5) InstanceMap: 6) SolutionMap: Map a potitial solution S V C of the card problem to a potiential solution S 3 SAT of Clause-Sat. 7) Valid to Valid: Hint: Given the clauses (a or b or c) and ( a or b or c) consider the following graph. 4. Both NP-complete and acceptable-complete problems have a witness that a fairy godmother could provide so that you could verify in poly-time that a given instance is a yes instance. The difference is that for the NP-complete problem, this witness can t be more than polynomially bigger than the instance itself, while the witness for the acceptable-complete (uncomputable) problem can be arbitrarily big. Suppose now that you took an acceptable-complete problem and changed it so that an instance I is a yes instance iff it has a polynomial sized witness. The intuition is that the resulting problem would automatically become NP-complete. This problem examines this idea. A non-deterministic Turing machine is the same as a deterministic one, except that its moves are not deterministic. In a deterministic TM, the transition function δ(q i,c) = q j,c,right states that if the TM is in state q i and sees the character c under its head, then it changes to state q j, writes the character c, and moves the head right. In a non-determinist TM, this transition function is changed to a transition relation δ. If the both the tuples q i,c;q j,c,right and q i,c;q k,c,left are in the relation δ, then when the TM is in state q i and sees the character c under its head, then it has a choice whether to change to state q j, write the character c and move the head right or to change to state q k, write the character c and move the head left. A non-deterministic TM M on input I is said to accept its input if there exists an accepting computation. Note that just as the problem Det-Accept = { M,I the deterministic TM M accepts the input I} is acceptable but uncomputable, so is the problem NDet-Accept = { M, I the non-deterministic TM M accepts the input I}. 3

(a) Give a non-deterministic TM M SAT that takes an and/or/not circuit C as input and accepts it iff it has a satisfying assignment x 1,...,x n. If C has n input wires x i and N gates, what is the running time of your TM? (b) Prove that the problem NDet-Accept = { M,I the non-deterministic TM M accepts the input I in at most n 3 time } is NP-complete. Reduce this problem to SAT. Do the key steps. (c) Recall the Post correspondence problem, PCP, defined in the slides. The input is a finite collection of dominoes P = { ( ( b ca), a ( ab), ca ) ( a, abc ) c }. A solution is a finite sequence of the dominoes with repeats so that the combined string on the top and on the bottom are the same, S = ( )( a b ca )( a )( abc ) ab ca)( a ab c }. The slides prove that this problem is undecidable by reducing it to the problem Det-Accept { M, I the deterministic TM M accepts the input I}. What would change if the reduction was to non-deterministic TM instead of deterministic TMs? (d) Change the PCP problem as stated to PCP in which the dominoes in the input set can be repeated as many times as the user likes but unlike before, the solutions can use each domino as most once. Prove that this new version is NP-complete. Reduce PCP to NDet-Accept. 5. Reductions: The purpose of this question is to learn to appreciate why there are so many steps when doing a reduction. 0) P oracle NP: Prove that problem P oracle is in NP. 5) InstanceMap: Define a polynomial time mapping I oracle = InstanceMap(I alg ). 6) SolutionMap: Define a polynomial time algorithm mapping each potential solution S oracle for I oracle to a potential solution S alg = SolutionMap(S oracle ) for I alg. 7) Valid to Valid: Prove that if S oracle is a valid solution for I oracle, then S alg = SolutionMap(S oracle ) is a valid solution for I alg. 8) ReverseSolutionMap: Define a polynomial time algorithm mapping each potential solution S alg for I alg to a potential solution S oracle = ReverseSolutionMap(S alg ) for I oracle. 9) Reverse Valid to Valid: Prove that if S alg is a valid solution for I alg, then S oracle = ReverseSolutionMap(S alg ) is a valid solution for I oracle. Consider the problem Block whose instance s,k is a 01-string s and an integer k. Such an instance is a yes instance if it has a solution consisting of a block s i,s i+1,...s j of all ones whose length is k. (a) (2 marks) Is this Block problem in NP? If so, what would this mean? (b) (2 marks) Is this Block problem is NP-Complete? What would it mean? (c) (2 marks) Your home work is to prove that Block is NP-complete by proving that 3-SAT ploy Block. You are to work in pairs. Your partner took on step 5 as follows. P alg is 3-SAT. As an example, I 3-SAT = (x or y or z) AND... AND (u or v or w) is an instance of 3-SAT. Given such an instance, he maps it to an instance I Block = s,k where s = 000...0 is the string consisting of n zeros and k is 5. Besides a few hints which he ignored, he noted that he did in fact meet the formal requirements of step 5. Being a bit of a know it all, your partner thought steps 8 and 9 are silly and hence decided to skip them. He left you the task of doing steps 6 and 7. Carefully, review what these steps are and complete them if you can. Careful. (d) Because your previous partner dropped out of school, you got a new one. Having learned, he took a new approach. He decided to map an instance I 3-SAT of 3-SAT to an instance I Block = s,k where s = 111...1 is the string consisting of n 5 ones and k is 5. He went on to do steps 6 and 7 as follows. Given a solution s i,s i+1,...s j to I Block, he instructed how to construct a valid solution to I 3-SAT as follows. For each of the m clauses (x or y or z) of I 3-SAT choose one of the variables. If, like x, it is not negated in the clause then set the variable to true. If, like y, it is negated, then set it to false. Either way the clause is satisfied. Doing this for each clause, satisfies each clause. Hence, the assignment obtained is a valid assignment of the variables. This new partner learned (from the guy who dropped out) the importance of doing steps 8 and 9 so he left them for you to do. 4

i. (2 marks) Carefully, review what these steps are and complete them if you can. Careful. ii. (2 marks) Are you happy with your new partner? Did he follow steps 5, 6, and 7 correctly? Explain. 5