Chapter 2 Reductions and NP

Chapter 2 Reductions and NP

Chapter 2 Reductions and NP NEW CS 473: Theory II, Fall 2015 August 27, 2015 2.1 Total recall... 2.1.0.1 Polynomial-time reductions YES IX IY R AY NO AX (A) Algorithm is efficient if it runs in polynomial-time. (B) Interested only in polynomial-time reductions. (C) X ≤P Y : Have polynomial-time reduction from problem X to problem Y . (D) AY : poly-time algorithm for Y . (E) =) Polynomial-time/efficient algorithm for X. 2.2 Polynomial time reductions 2.2.0.1 Polynomial-time reductions and instance sizes Proposition R: a polynomial-time reduction from X to Y . Then, for any instance IX of X, the size of the instance IY of Y produced from IX by R is polynomial in the size of IX . Proof: R is a polynomial-time algorithm and hence on input IX of size jIX j it runs in time p(jIX j) for some polynomial p(). IY is the output of R on input IX . R can write at most p(jIX j) bits and hence jIY j ≤ p(jIX j). Note: Converse is not true. A reduction need not be polynomial-time even if output of reduction is of size polynomial in its input. 1 2.2.0.2 Polynomial-time Reduction Definition 2.2.2. X ≤P Y : polynomial time reduction from a decision problem X to a decision problem Y is an algorithm A such that: (A) Given an instance IX of X, A produces an instance IY of Y . (B) A runs in time polynomial in jIX j.(jIY j = size of IY ). (C) Answer to IX YES () answer to IY is YES. Proposition If X ≤P Y then a polynomial time algorithm for Y implies a polynomial time algorithm for X. This is a Karp reduction. 2.2.1 Composing polynomials... 2.2.1.1 A quick reminder (A) f and g monotone increasing. Assume that: (A) f(n) ≤ a ∗ nb (i.e., f(n) = O(nb)) (B) g(n) ≤ c ∗ nd (i.e., g(n) = O(nd)) a; b; c; d: constants. (B) g f(n) ≤ ga ∗ nb ≤ c ∗ a ∗ nbd ≤ c · ad ∗ nbd (C) =) g(f(n)) = O nbd is a polynomial. (D) Conclusion: Composition of two polynomials, is a polynomial. 2.2.1.2 Transitivity of Reductions Proposition X ≤P Y and Y ≤P Z implies that X ≤P Z. (A) Note: X ≤P Y does not imply that Y ≤P X and hence it is very important to know the FROM and TO in a reduction. (B) To prove X ≤P Y you need to show a reduction FROM X TO Y (C) ...show that an algorithm for Y implies an algorithm for X. 2.3 Independent Set and Vertex Cover 2.3.0.1 Vertex Cover Given a graph G = (V; E), a set of vertices S is: (A) A vertex cover if every e 2 E has at least one endpoint in S. 2 2.3.0.2 The Vertex Cover Problem Problem 2.3.1 (Vertex Cover). Input: A graph G and integer k. Goal: Is there a vertex cover of size ≤ k in G? Can we relate Independent Set and Vertex Cover? 2.3.1 Relationship between... 2.3.1.1 Vertex Cover and Independent Set Proposition Let G = (V; E) be a graph. S is an independent set () V n S is a vertex cover. Proof: ()) Let S be an independent set (A) Consider any edge uv 2 E. (B) Since S is an independent set, either u 62 S or v 62 S. (C) Thus, either u 2 V n S or v 2 V n S. (D) V n S is a vertex cover. (() Let V n S be some vertex cover: (A) Consider u; v 2 S (B) uv is not an edge of G, as otherwise V n S does not cover uv. (C) =) S is thus an independent set. 2.3.1.2 Independent Set ≤P Vertex Cover (A) (G; k): instance of the Independent Set problem. G: graph with n vertices. k: integer. (B) G has an independent set of size ≥ k () G has a vertex cover of size ≤ n − k (C) (G; k) is an instance of Independent Set , and (G; n − k) is an instance of Vertex Cover with the same answer. (D) We conclude: (A) Independent Set ≤P Vertex Cover. (B) Vertex Cover ≤P Independent Set. (Because same reduction works in other direction.) 2.4 Vertex Cover and Set Cover 2.4.0.1 The Set Cover Problem Problem 2.4.1 (Set Cover). Input: Given a set U of n elements, a collection S1;S2;:::Sm of subsets of U, and an integer k. Goal: Is there a collection of at most k of these sets Si whose union is equal to U? Example 2.4.2. <2->Let U = f1; 2; 3; 4; 5; 6; 7g, k = 2 with S1 = f3; 7g <3− > S2 = f3; 4; 5g S3 = f1g S4 = f2; 4g S5 = f5g <3− > S6 = f1; 2; 6; 7g fS2;S6g is a set cover 3 2.4.0.2 Vertex Cover ≤P Set Cover (A) Instance of Vertex Cover: G = (V; E) and integer k. (B) Construct an instance of Set Cover as follows: (A) Number k for the Set Cover instance is the same as the number k given for the Vertex Cover instance. (B) U = E. (C) We will have one set corresponding to each vertex; Sv = fe j e is incident on vg. (C) Observe that G has vertex cover of size k if and only if U; fSvgv2V has a set cover of size k. (Exercise: Prove this.) 2.4.0.3 Vertex Cover ≤P Set Cover: Example 3 3 c d e c d e Let U = fa; b; c; d; e; f; gg, k = 2 with 1 2 4 1 2 4 S1 = fc; gg S2 = fb; dg <3− > S = fc; d; eg S = fe; fg g b f g b f 3 4 S5 = fag <3− > S6 = fa; b; f; gg 6 5 6 5 a a fS3;S6g is a set cover f3; 6g is a vertex cover 2.4.0.4 Proving Reductions To prove that X ≤P Y you need to give an algorithm A that: (A) Transforms an instance IX of X into an instance IY of Y . (B) Satisfies the property that answer to IX is YES () IY is YES. (A) typical easy direction to prove: answer to IY is YES if answer to IX is YES (B) typical difficult direction to prove: answer to IX is YES if answer to IY is YES (equiva- lently answer to IX is NO if answer to IY is NO). (C) Runs in polynomial time. 2.4.0.5 Summary (A) polynomial-time reductions. (A) If X ≤P Y + have efficient algorithm for Y =) efficient algorithm for X. (B) If X ≤P Y + no efficient algorithm for X =) no efficient algorithm for Y . (B) Examples of reductions between Independent Set, Clique, Vertex Cover, and Set Cover. 2.5 The Satisfiability Problem (SAT) 2.5.0.1 Propositional Formulas Definition 2.5.1. Consider a set of boolean variables x1; x2; : : : xn. (A) literal: boolean variable xi or its negation :xi (also written as xi). (B) clause: a disjunction of literals. Example: x1 _ x2 _:x4. (C) conjunctive normal form (CNF) = propositional formula which is a conjunction of clauses 4 (A) (x1 _ x2 _:x4) ^ (x2 _:x3) ^ x5 is a CNF formula. (D) A formula ' is a 3CNF: A CNF formula such that every clause has exactly 3 literals. (A) (x1 _ x2 _:x4) ^ (x2 _:x3 _ x1) is a 3CNF formula, but (x1 _ x2 _:x4) ^ (x2 _:x3) ^ x5 is not. 2.5.0.2 Satisfiability SAT Instance:A CNF formula '. Question: Is there a truth assignment to the variable of ' such that ' evaluates to true? 3SAT Instance:A 3CNF formula '. Question: Is there a truth assignment to the variable of ' such that ' evaluates to true? 2.5.0.3 Satisfiability SAT Given a CNF formula ', is there a truth assignment to variables such that ' evaluates to true? Example 2.5.2. (A) (x1 _ x2 _:x4) ^ (x2 _:x3) ^ x5 is satisfiable; take x1; x2; : : : x5 to be all true (B) (x1 _:x2) ^ (:x1 _ x2) ^ (:x1 _:x2) ^ (x1 _ x2) is not satisfiable. 3SAT Given a 3CNF formula ', is there a truth assignment to variables such that ' evaluates to true? (More on 2SAT in a bit...) 2.5.0.4 Importance of SAT and 3SAT (A) SAT, 3SAT: basic constraint satisfaction problems. (B) Many different problems can reduced to them: simple+powerful expressivity of constraints. (C) Arise in many hardware/software verification/correctness applications. (D) ... fundamental problem of NP-Completeness. 2.5.1 Converting a boolean formula with 3 variables to 3SAT 2.5.1.1 Converting z = x ^ y to 3SAT z x y z = x ^ y z _ x _ y z _ x _ y z _ x _ y z _ x _ y 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 00 1 1 1 1 0 0 0 1 00 1 1 1 0 1 0 1 1 00 1 1 1 0 0 1 1 1 00 1 1 1 1 1 1 1 1 5 z = x ^ y ≡ (z _ x _ y) ^ (z _ x _ y) ^ (z _ x _ y) ^ (z _ x _ y) 2.5.1.2 Converting z = x ^ y to 3SAT z x y z = x ^ y clauses 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 00 z _ x _ y 1 0 0 00 z _ x _ y 1 0 1 00 z _ x _ y 1 1 0 00 z _ x _ y 1 1 1 1 z = x ^ y ≡ (z _ x _ y) ^ (z _ x _ y) ^ (z _ x _ y) ^ (z _ x _ y) 2.5.2 Converting z = x _ y to 3SAT 2.5.2.1 Simplify further if you want to (A) Using that (x _ y) ^ (x _ y) = x, we have that: (A) z _ x _ u ^ z _ x _ y = z _ x (B) z _ x _ y ^ z _ x _ y = z _ y (B) Using the above two observation, we have that our formula ≡ z _ x _ y ^ z _ x _ y ^ z _ x _ y ^ z _ x _ y is equivalent to ≡ z _ x _ y ^ z _ x ^ z _ y Lemma 2.5.3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us