Intro to Theory of Computation

Slides:



Advertisements
Similar presentations
Complexity Classes: P and NP
Advertisements

Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
CSCI 256 Data Structures and Algorithm Analysis Lecture 22 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Piyush Kumar (Lecture 7: Reductions)
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 27.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Sailesh Prabhu Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2013.
1 Chapter 8 NP and Computational Intractability Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 29.
28.
NPC.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness A problem is NP-complete if: It is in NP
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Chapter 10 NP-Complete Problems.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Polynomial-Time Reduction
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
Intro to Theory of Computation
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
Chapter 8 NP and Computational Intractability
Richard Anderson Lecture 28 NP Completeness
NP-Complete Problems.
Prabhas Chongstitvatana
CS154, Lecture 13: P vs NP.
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CSE 6408 Advanced Algorithms.
NP-Completeness Yin Tat Lee
CS154, Lecture 16: More NP-Complete Problems; PCPs
NP-Completeness Lecture for CS 302.
CSE 589 Applied Algorithms Spring 1999
Richard Anderson Lecture 25 NP Completeness
Instructor: Aaron Roth
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Intro to Theory of Computation
Lecture 23 NP-Hard Problems
Presentation transcript:

Intro to Theory of Computation LECTURE 25 Last time Class NP Today Polynomial-time reductions CS 464 Adam Smith; Sofya Raskhodnikova 11/13/2018

The classes P and NP P is the class of languages decidable in polynomial time on a deterministic 1-tape TM: 𝑷= 𝑘 𝑇𝐼𝑀𝐸 𝑛 𝑘 . NP is the class of languages that have polynomial-time verifiers. 11/13/2018

Classes P, NP, EXP P. Languages for which there is a poly-time algorithm. EXP. Languages for which there is an exponential-time algorithm. NP. Languages for which there is a poly-time verifier. Lemma. P  NP. Lemma. NP  EXP. Lemma. A language L is in NP iff L can be decided by a polynomial-time nondeterministic TM. 11/13/2018

P vs. NP Does P = NP? [Cook 1971, Edmonds, Levin, Yablonski, Gödel] Is the decision problem as easy as the verification problem? Clay $1 million prize. If yes: Efficient algorithms for HamPath, SAT, TSP, factoring Cryptography is impossible* Creativity is automatable If no: No efficient algorithms possible for these problems. Consensus opinion on P = NP? Probably no. EXP NP EXP EXP=NP P P = NP P If P  NP If P = NP If P  NP and NP=EXP 11/13/2018

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.

Polynomial-time reductions 𝑓: Σ ∗ → Σ ∗ is polynomial-time computable if there is a poly-time TM that, on every input 𝑤∈ Σ ∗ halts with just 𝑓(𝑤) on its tape. 𝑓: Σ ∗ → Σ ∗ is a polynomial-time mapping reduction from language A to language B if: 𝑓 is polytime computable For all 𝑤∈ Σ ∗ : 𝑤∈𝐴⇔𝑓 𝑤 ∈𝐵 When such a reduction exists, write 𝐴 ≤ 𝑃 𝐵 Polynomial-time reductions are the major tool we have to understand P and NP 11/13/2018

Polynomial-time reduction Given languages A and B, A ≤ 𝑝 B if there is a poly-time computable function 𝑓, such that for all strings 𝑤, 𝑤∈ 𝐴 iff 𝑓(𝑤)∈𝐵. A B 𝒇 11/13/2018

Implication of poly-time reductions Theorem. If A ≤ 𝑝 B and B∈𝐏 then A∈𝐏. (So, if A ≤ 𝑝 B and A∉𝐏 then B∉𝐏.) Theorem. If A ≤ 𝑝 B and B ≤ 𝑝 C then A ≤ 𝑝 C. (Poly-time reductions compose.) 11/13/2018

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

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 Application: find set of mutually non-conflicting points

Vertex Cover Given an undirected graph G, a vertex cover in G is a set of nodes, which includes at least one 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 Application: find set of mutually non-conflicting points

Independent Set and Vertex Cover Claim. S is an independent set iff V  S is a vertex cover.  Let S be any independent set. Consider an arbitrary edge (u, v). S is independent  u  S or v  S  u  V  S or v  V  S. Thus, V  S covers (u, v).  Let V  S be any vertex cover. Consider two nodes u  S and v  S. Then (u, v)  E since V  S is a vertex cover. Thus, no two nodes in S are joined by an edge  S independent set. ▪

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.

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.

Set Cover Given a set U, called a universe, and a collection of its subsets 𝑆 1 , 𝑆 2 ,…, 𝑆 𝑚 , a set cover of U is a subcollection of subsets whose union is U. SET COVER={ 𝑈, 𝑆 1 , 𝑆 2 ,…, 𝑆 𝑚 ;𝑘 ∣ 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}

VERTEX COVER reduces to SET COVER Theorem. VERTEX-COVER  P SET-COVER. Proof. “On input 𝐺,𝑘 , where 𝐺=(𝑉,𝐸) is an undirected graph and 𝑘 is an integer, Output 𝑈, 𝑆 1 , 𝑆 2 ,…, 𝑆 𝑚 ;𝑘 , 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. .

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

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} Any logical formula can be expressed in CNF. each corresponds to a different variable Ex: Yes: x1 = true, x2 = true x3 = false.

3SAT reduces to INDEPENDENT SET Theorem. 3-SAT  P INDEPENDENT-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 clauses in G.” G k = 3

3SAT reduces to INDEPENDENT SET Correctness. Let k = # of clauses and ℓ= # of literals in .  is satisfiable iff 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(𝑘+ ℓ 2 ), i.e. polynomial in the input size.

Summary Basic reduction strategies. Simple equivalence: INDEPENDENT-SET  P VERTEX-COVER. Special case to general case: VERTEX-COVER  P SET-COVER. Encoding with gadgets: 3-SAT  P INDEPENDENT-SET. Transitivity.If X  P Y and Y  P Z, then X  P Z. Proof idea. Compose the two algorithms. Ex: 3-SAT  P INDEPENDENT-SET  P VERTEX-COVER  P SET-COVER. Proof idea for transitivity: compose the two algorithms. Given an oracle for Z, can solve instance of X: run the algorithm for X using a oracle for Y each time oracle for Y is called, simulate it in a polynomial number of steps by using algorithm for Y, plus oracle calls to Z