np completeness
play

NP Completeness Lecture 3 September 3, 2013 Sariel (UIUC) CS573 - PowerPoint PPT Presentation

CS 573: Algorithms, Fall 2013 NP Completeness Lecture 3 September 3, 2013 Sariel (UIUC) CS573 1 Fall 2013 1 / 36 Part I . NP Completeness . Sariel (UIUC) CS573 2 Fall 2013 2 / 36 Certifiers . Definition . An algorithm C ( ,


  1. CS 573: Algorithms, Fall 2013 NP Completeness Lecture 3 September 3, 2013 Sariel (UIUC) CS573 1 Fall 2013 1 / 36

  2. Part I . NP Completeness . Sariel (UIUC) CS573 2 Fall 2013 2 / 36

  3. Certifiers . Definition . An algorithm C ( · , · ) is a certifier for problem X if for every s ∈ X there is some string t such that C ( s , t ) = ”yes”, and conversely, if for some s and t , C ( s , t ) = ”yes” then s ∈ X . The string t is called a certificate or proof for s . . . Definition (Efficient Certifier.) . A certifier C is an efficient certifier for problem X if there is a polynomial p ( · ) such that for every string s , we have that ⋆ s ∈ X if and only if ⋆ there is a string t : . . . | t | ≤ p ( | s | ) , 1 . . . C ( s , t ) = ”yes”, 2 . . . and C runs in polynomial time. 3 . Sariel (UIUC) CS573 3 Fall 2013 3 / 36

  4. NP-Complete Problems . Definition . A problem X is said to be NP-Complete if . . X ∈ NP , and 1 . . (Hardness) For any Y ∈ NP , Y ≤ P X . 2 . Sariel (UIUC) CS573 4 Fall 2013 4 / 36

  5. Solving NP-Complete Problems . Proposition . Suppose X is NP-Complete . Then X can be solved in polynomial time if and only if P = NP . . . Proof. . ⇒ Suppose X can be solved in polynomial time . . . Let Y ∈ NP . We know Y ≤ P X . 1 . . . We showed that if Y ≤ P X and X can be solved in polynomial 2 time, then Y can be solved in polynomial time. . . . Thus, every problem Y ∈ NP is such that Y ∈ P ; NP ⊆ P . 3 . . . Since P ⊆ NP , we have P = NP . 4 ⇐ Since P = NP , and X ∈ NP , we have a polynomial time algorithm for X . . Sariel (UIUC) CS573 5 Fall 2013 5 / 36

  6. NP-Hard Problems . Definition . A problem X is said to be NP-Hard if . . (Hardness) For any Y ∈ NP , we have that Y ≤ P X . 1 . An NP-Hard problem need not be in NP ! Example: Halting problem is NP-Hard (why?) but not NP-Complete . Sariel (UIUC) CS573 6 Fall 2013 6 / 36

  7. Consequences of proving NP-Complete ness If X is NP-Complete . . Since we believe P ̸ = NP , 1 . . and solving X implies P = NP . 2 X is unlikely to be efficiently solvable. At the very least, many smart people before you have failed to find an efficient algorithm for X . (This is proof by mob opinion — take with a grain of salt.) Sariel (UIUC) CS573 7 Fall 2013 7 / 36

  8. Consequences of proving NP-Complete ness If X is NP-Complete . . Since we believe P ̸ = NP , 1 . . and solving X implies P = NP . 2 X is unlikely to be efficiently solvable. At the very least, many smart people before you have failed to find an efficient algorithm for X . (This is proof by mob opinion — take with a grain of salt.) Sariel (UIUC) CS573 7 Fall 2013 7 / 36

  9. Consequences of proving NP-Complete ness If X is NP-Complete . . Since we believe P ̸ = NP , 1 . . and solving X implies P = NP . 2 X is unlikely to be efficiently solvable. At the very least, many smart people before you have failed to find an efficient algorithm for X . (This is proof by mob opinion — take with a grain of salt.) Sariel (UIUC) CS573 7 Fall 2013 7 / 36

  10. Consequences of proving NP-Complete ness If X is NP-Complete . . Since we believe P ̸ = NP , 1 . . and solving X implies P = NP . 2 X is unlikely to be efficiently solvable. At the very least, many smart people before you have failed to find an efficient algorithm for X . (This is proof by mob opinion — take with a grain of salt.) Sariel (UIUC) CS573 7 Fall 2013 7 / 36

  11. NP-Complete Problems . Question . Are there any problems that are NP-Complete ? . . Answer . Yes! Many, many problems are NP-Complete . . Sariel (UIUC) CS573 8 Fall 2013 8 / 36

  12. Circuits . Definition . A circuit is a directed acyclic graph with . Output: ∧ Input vertices (without 1 incoming edges) labelled with 0 , 1 or a distinct variable. ¬ ∧ . . Every other vertex is labelled 2 ∨ , ∧ or ¬ . ∧ ∨ ∨ . . Single node output vertex 3 with no outgoing edges. Inputs: 1 ? ? 0 ? . Sariel (UIUC) CS573 9 Fall 2013 9 / 36

  13. Cook-Levin Theorem . Definition (Circuit Satisfaction ( CSAT ).) . Given a circuit as input, is there an assignment to the input variables that causes the output to get value 1 ? . . Theorem (Cook-Levin) . CSAT is NP-Complete . . Need to show . . CSAT is in NP . 1 . . every NP problem X reduces to CSAT . 2 Sariel (UIUC) CS573 10 Fall 2013 10 / 36

  14. CSAT : Circuit Satisfaction . Claim . CSAT is in NP . . . . Certificate: Assignment to input variables. 1 . . Certifier: Evaluate the value of each gate in a topological sort of 2 DAG and check the output gate value. Sariel (UIUC) CS573 11 Fall 2013 11 / 36

  15. CSAT : Circuit Satisfaction . Claim . CSAT is in NP . . . . Certificate: Assignment to input variables. 1 . . Certifier: Evaluate the value of each gate in a topological sort of 2 DAG and check the output gate value. Sariel (UIUC) CS573 11 Fall 2013 11 / 36

  16. CSAT is NP -hard: Idea Need to show that every NP problem X reduces to CSAT . What does it mean that X ∈ NP ? X ∈ NP implies that there are polynomials p () and q () and certifier/verifier program C such that for every string s the following is true: . . If s is a YES instance ( s ∈ X ) then there is a proof t of length 1 p ( | s | ) such that C ( s , t ) says YES. . . If s is a NO instance ( s ̸∈ X ) then for every string t of length 2 at p ( | s | ) , C ( s , t ) says NO. . . C ( s , t ) runs in time q ( | s | + | t | ) time (hence polynomial time). 3 Sariel (UIUC) CS573 12 Fall 2013 12 / 36

  17. Reducing X to CSAT X is in NP means we have access to p () , q () , C ( · , · ) . What is C ( · , · ) ? It is a program or equivalently a Turing Machine! How are p () and q () given? As numbers. Example: if 3 is given then p ( n ) = n 3 . Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or a TM . Sariel (UIUC) CS573 13 Fall 2013 13 / 36

  18. Reducing X to CSAT Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or TM . Problem X: Given string s , is s ∈ X ? Same as the following: is there a proof t of length p ( | s | ) such that C ( s , t ) says YES. How do we reduce X to CSAT ? Need an algorithm A that . . takes s (and ⟨ p , q , C ⟩ ) and creates a circuit G in polynomial 1 time in | s | (note that ⟨ p , q , C ⟩ are fixed). . . G is satisfiable if and only if there is a proof t such that 2 C ( s , t ) says YES. Sariel (UIUC) CS573 14 Fall 2013 14 / 36

  19. Reducing X to CSAT Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or TM . Problem X: Given string s , is s ∈ X ? Same as the following: is there a proof t of length p ( | s | ) such that C ( s , t ) says YES. How do we reduce X to CSAT ? Need an algorithm A that . . takes s (and ⟨ p , q , C ⟩ ) and creates a circuit G in polynomial 1 time in | s | (note that ⟨ p , q , C ⟩ are fixed). . . G is satisfiable if and only if there is a proof t such that 2 C ( s , t ) says YES. Sariel (UIUC) CS573 14 Fall 2013 14 / 36

  20. Reducing X to CSAT Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or TM . Problem X: Given string s , is s ∈ X ? Same as the following: is there a proof t of length p ( | s | ) such that C ( s , t ) says YES. How do we reduce X to CSAT ? Need an algorithm A that . . takes s (and ⟨ p , q , C ⟩ ) and creates a circuit G in polynomial 1 time in | s | (note that ⟨ p , q , C ⟩ are fixed). . . G is satisfiable if and only if there is a proof t such that 2 C ( s , t ) says YES. Sariel (UIUC) CS573 14 Fall 2013 14 / 36

  21. Reducing X to CSAT Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or TM . Problem X: Given string s , is s ∈ X ? Same as the following: is there a proof t of length p ( | s | ) such that C ( s , t ) says YES. How do we reduce X to CSAT ? Need an algorithm A that . . takes s (and ⟨ p , q , C ⟩ ) and creates a circuit G in polynomial 1 time in | s | (note that ⟨ p , q , C ⟩ are fixed). . . G is satisfiable if and only if there is a proof t such that 2 C ( s , t ) says YES. Sariel (UIUC) CS573 14 Fall 2013 14 / 36

  22. Reducing X to CSAT Thus an NP problem is essentially a three tuple ⟨ p , q , C ⟩ where C is either a program or TM . Problem X: Given string s , is s ∈ X ? Same as the following: is there a proof t of length p ( | s | ) such that C ( s , t ) says YES. How do we reduce X to CSAT ? Need an algorithm A that . . takes s (and ⟨ p , q , C ⟩ ) and creates a circuit G in polynomial 1 time in | s | (note that ⟨ p , q , C ⟩ are fixed). . . G is satisfiable if and only if there is a proof t such that 2 C ( s , t ) says YES. Sariel (UIUC) CS573 14 Fall 2013 14 / 36

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend