1 / 23

Intro to Theory of Computation

L ECTURE 26 Last time Polynomial-time reductions Today Polynomial-time reductions NP-completeness. Intro to Theory of Computation. CS 464. Sofya Raskhodnikova. Classify Problems.

laken
Download Presentation

Intro to Theory of Computation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LECTURE26 • Last time • Polynomial-time reductions • Today • Polynomial-time reductions • NP-completeness Intro to Theory of Computation CS 464 Sofya Raskhodnikova S. Raskhodnikova; based on slides by N. Hopper and K. Wayne.

  2. Classify Problems • Desiderata:classify problems according to those that can be solved in polynomial-time and those that cannot. • Some problems provably require exponential time (next month): • Given a Turing machine, does it halt in at most k steps? • Given a board position in an n-by-n generalization of chess, can black guarantee a win? • Frustrating news: huge number of fundamental problems have defied classification for decades. • Chapters 7.4-7.5 (NP-completeness):Show that these fundamental problems are "computationally equivalent" and appear to be different manifestations of one really hard problem.

  3. Polynomial-time reduction Given languages A and B, AB if there is a poly-time computable function such that for all strings , iff . A B

  4. Implication of poly-time reductions Theorem. If A B and Bthen A. (So, if A B and Athen B.) Theorem. If AB and BC then AC. (Poly-time reductions compose.)

  5. Reduction by simple equivalence Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets.

  6. Independent Set Given an undirected graph G, an independent set in G is a set of nodes, which includes at most one endpoint of every edge. INDEPENDENT SET = { is an undirected graph which has an independent set with nodes} • Is there an independent set of size  6? • Yes. • Is there an independent set of size  7? • No. independent set

  7. Vertex Cover Given an undirected graph G, a vertex coverin G is a set of nodes, which includes at leastone endpoint of every edge. VERTEX COVER= { is an undirected graph which has a vertex cover with nodes} • Is there vertex cover of size  4? • Yes. • Is there a vertex cover of size  3? • No. vertex cover

  8. INDEPENDENT SET reduces to VERTEX COVER Theorem.INDEPENDENT-SET VERTEX-COVER. Proof.“On input , where is an undirected graph and is an integer, • Output where is the number of nodes in ” Correctness: • G has an independent set of size iff it has a vertex cover of size . • Reduction runs in linear time.

  9. Reduction from special case to general case Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets.

  10. Set Cover Given a set U, called a universe, and a collection of its subsets , a set cover of U is a subcollection of subsets whose union is U. • SET COVER={ U has a set cover of size • Sample application. • m available pieces of software. • Set U of n capabilities that we would like our system to have. • The th piece of software provides the set Si U of capabilities. • Goal: achieve all capabilities using fewest pieces of software. U = { 1, 2, 3, 4, 5, 6, 7 }k = 2 S1 = {3, 7} S4 = {2, 4} S2 = {3, 4, 5, 6} S5 = {5}S3 = {1} S6 = {1, 2, 6, 7}

  11. VERTEX COVER reduces to SET COVER Theorem.VERTEX-COVER PSET-COVER. Proof.“On input , where is an undirected graph and is an integer, • Output where U=E and Sv = {e  E : e incident to v }” Correctness: • G has a vertex cover of size k iff U has a set cover of size k. • Reduction runs in linear time. .

  12. Reduction by encoding with gadgets Basic reduction strategies Reduction by simple equivalence. Reduction from special case to general case. Reduction by encoding with gadgets.

  13. Satisfiability • Boolean variables: variables that can take on values T/F (or 1/0) • Boolean operations: and • Boolean formula: expression with Boolean variables and ops SAT = { is a satisfiable Boolean formula} • Literal:A Boolean variable or its negation. • Clause:OR of literals. • Conjunctive normal form (CNF):AND of clauses. 3SAT = { is a satisfiable Boolean CNF formula, where each clause contains exactly 3 literals} each corresponds to a different variable Ex: Yes: x1 = true, x2 = true x3 = false.

  14. 3SAT reduces to INDEPENDENT SET Theorem.3-SAT  PINDEPENDENT-SET. Proof.“On input , where is a 3CNF formula, • Construct graph G from • G contains 3 vertices for each clause, one for each literal. • Connect 3 literals in a clause in a triangle. • Connect literal to each of its negations. • Output where is the number of c” G k = 3

  15. 3SAT reduces to INDEPENDENT SET Correctness. Let k = # of clauses and = # of literals in .  is satisfiableiff G contains an independent set of size k|. •  Given satisfying assignment, select one true literal from each triangle. This is an independent set of size k. •  Let S be an independent set of size k. • S must contain exactly one vertex in each triangle. • Set these literals to true, and other literals in a consistent way. • Truth assignment is consistent and all clauses are satisfied. Run time. O(), i.e. polynomial in the input size.

  16. Summary of reduction strategies • Basic reduction strategies. • Simple equivalence: INDEPENDENT-SET PVERTEX-COVER. • Special case to general case: VERTEX-COVER PSET-COVER. • Encoding with gadgets: 3-SAT PINDEPENDENT-SET. • Composition. If X  P Y and Y  P Z, then X  P Z. Ex: 3SAT PINDEPENDENT-SET  PVERTEX-COVER  PSET-COVER.

  17. Hardest problems in NP A language B is NP-complete if B B is NP-hard,i.e., every language in NP is poly-time reducible to B. NP P B

  18. Implication of poly-time reductions NP P C B Theorem. If B is NP-complete, Cand BC thenC is NP-complete.

  19. Implication of NP-completeness Theorem. If B is NP-complete and Bthen . (So, if B is NP-completeand then there is no poly-time algorithm for B.)

  20. An NP-complete problem BANTM= {〈M,x,t〉 | M is an NTM that accepts x in at most t steps} Technical detail: n denotes 1n. Theorem. BANTM is NP-Complete. 1. BANTM NP: The list of guesses M makes to accept x in t steps is the certificate that 〈M,x,t〉 BANTM. 2. For all A  NP, A ≤P BANTM. ANP iff there is an NTM N for A that runs in time O(nk). Let fA(w) = 〈N,w,c |w|k〉. 〈N,w, c |w|k〉 BANTMiff N accepts w, iff w  A.

  21. Circuit Satisfiability output    yes: 1 0 1    1 0 ? ? ? inputs hard-coded inputs A circuit is built out of AND, OR and NOT gates. A circuit is satisfiable if one can set the circuit inputs, so that the output is 1. CIRCUIT-SAT = { is a satisfiable circuit}.

  22. The "First" NP-Complete Problem Theorem. CIRCUIT-SAT is NP-complete. [Cook 1971, Levin 1973] Proof sketch. CIRCUIT-SAT is in NP certificate: input on which circuit is 1.

  23. The "First" NP-Complete Problem Theorem. CIRCUIT-SAT is NP-complete. [Cook 1971, Levin 1973] Proof sketch. • For all A  NP, A ≤PCIRCUIT-SAT. • A TM that takes a fixed number of bits as input can be represented by a circuit.Moreover, if algorithm takes poly-time, then circuit is of poly-size. • Consider some problem A NP. It has a poly-time verifier V(w, c).To determine whether wA, need to know if there exists a certificate c of length p(|w|) such that V(w, c) accepts. • View V(w, c) as an algorithm on |w| + p(|c|) bits (input w, certificate c) and convert it into a poly-size circuit C. • first |w| bits are hard-coded with w • remaining p(|s|) bits represent bits of t Correctness: Circuit C is satisfiableiffV(w, c) accepts.

More Related