Cook-Levin Theorem and NP-Complete Problems

Cook-Levin Theorem and NP-Complete Problems
Slide Note
Embed
Share

Dive into the realm of computational complexity theory with Lecture 3 covering the Cook-Levin theorem, NP-complete problems, examples of Class NP, and the intriguing question of whether P equals NP. Explore Polynomial Time Reduction, NP-Completeness, and the significance of NP-hard and NP-complete languages in theoretical computer science.

  • Complexity theory
  • NP-complete
  • Cook-Levin theorem
  • Polynomial time reduction
  • Theoretical computer science

Uploaded on Feb 25, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Computational Complexity Theory Lecture 3: Cook-Levin theorem, Some NP-complete problems Indian Institute of Science

  2. Recap: Class P and NP A language L {0,1}* is in P if There s a (deterministic)poly-time TMM such that for every x {0,1}*, x L iff M(x) = 1 A language L {0,1}* is in NP if There s a poly-time TMM (verifier) such that x L iff there s a poly(|x|)-size certificate u s.t M(x,u) = 1 Note that verifier cannot be fooled.

  3. Class NP : Examples Vertex cover (NP-complete) 0/1 integer programming (NP-complete) Integer factoring (??) Graph isomorphism (Quasi-P) Primality testing (P) Linear programming (P)

  4. Is P = NP ? Obviously, P NP. Whether or not P = NP is an outstanding open question in theoretical computer science! Mathematics has gained much from attempts to prove such negative statements Galois theory, Godel s incompleteness, Fermat s Last Theorem, Turing s undecidability, Continuum hypothesis etc.

  5. Recap: Polynomial time reduction Definition. We say a language L1 {0,1}* is polynomial time (Karp) reducible to a language L2 {0,1}* if there s a polynomial time computable function f s.t. x L1 f(x) L2 f(L1) L1 L2 L2 L1 f(L1)

  6. Recap: Polynomial time reduction Definition. We say a language L1 {0,1}* is polynomial time (Karp) reducible to a language L2 {0,1}* if there s a polynomial time computable function f s.t. x L1 f(x) L2 Notation. L1 p L2 Observe. If L1 p L2 and L2 p L3 then L1 p L3 .

  7. Recap: NP-completeness Definition. A language L is NP-hard if for every L in NP, L pL . Further, L is NP-complete if L is in NP and is NP-hard. Observe. If L is NP-hard and L is in P then P = NP. If L is NP-complete then L in P if and only if P = NP. Hardest problems inside NP in the sense that if one NPC problem is in P then all problems in NP is in P. NPC NP P

  8. Recap: NP-completeness Definition. A language L is NP-hard if for every L in NP, L pL . Further, L is NP-complete if L is in NP and is NP-hard. Observe. If L is NP-hard and L is in P then P = NP. If L is NP-complete then L in P if and only if P = NP. Exercise. Let L1 {0,1}* be any language and L2 be a language in NP. If L1 p L2 then L1 is also in NP.

  9. Few words on reductions As to how we define a reduction from one language to the other (or one function to the other) is usually guided by a question on whether two complexity classes are different or identical. For polynomial time reductions, the question is whether P equals NP. Reductions help us define complete problems (the hardest problems in a class) which in turn help us compare the complexity classes under consideration.

  10. NP-complete problem: First example Let L = { ( , x, 1m, 1t ) : there exists a u {0,1}m s.t. M accepts (x, u) in t steps } Observation. L is NP-complete. The language L involves Turing machine in its definition. Next, we ll see an example of an NP-complete problem that is arguably more natural.

  11. A natural NP-complete problem Definition. A boolean formula on variables x1, , xn consists of AND, OR and NOT operations. e.g. = (x1 x2) (x3 x2 ) Definition. A boolean formula is satisfiable if there s a {0,1}-assignment to its variables that makes evaluate to 1.

  12. A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. = (x1 x2) (x3 x2 ) clauses

  13. A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. = (x1 x2) (x3 x2 ) literals

  14. A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. = (x1 x2) (x3 x2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae.

  15. A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. = (x1 x2) (x3 x2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae. Theorem. (Cook-Levin) SAT is NP-complete.

  16. A natural NP-complete problem Definition. A boolean formula is in Conjunctive Normal Form (CNF) if it is an AND of OR of literals. e.g. = (x1 x2) (x3 x2 ) Definition. Let SAT be the language consisting of all satisfiable CNF formulae. Theorem. (Cook-Levin) SAT is NP-complete. Easy to see that SAT is in NP. Need to show that SAT is NP-hard.

  17. Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and this step can be implemented by a small CNF formula.

  18. Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and this step can be implemented by a small CNF formula. Let L NP. We intend to come up with a polynomial time computable function f: x x s.t., x L x SAT

  19. Cook-Levin theorem: Proof Main idea: Computation is local; i.e. every step of computation looks at and changes only constantly many bits; and this step can be implemented by a small CNF formula. Let L NP. We intend to come up with a polynomial time computable function f: x x s.t., x L x SAT Notation: | x| := size of x = number of or in x

  20. Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x L u {0,1}p(|x|) s.t. M(x, u) = 1

  21. Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x L u {0,1}p(|x|) s.t. M(x, u) = 1 Idea: Capture the computation of M(x, ..) by a CNF x such that u {0,1}p(|x|) s.t. M(x, u) = 1 x is satisfiable

  22. Cook-Levin theorem: Proof Language L has a poly-time verifier M such that x L u {0,1}p(|x|) s.t. M(x, u) = 1 Idea: Capture the computation of M(x, ..) by a CNF x such that u {0,1}p(|x|) s.t. M(x, u) = 1 x is satisfiable For any fixed x, M(x, ..) is a deterministic TM that takes u as input and runs in time polynomial in |u|.

  23. Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on every input u of length n, and outputs 0/1. Then,

  24. Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on every input u of length n, and outputs 0/1. Then, 1. There s a CNF of size poly(T(n)) such that (u, additional variables ) is satisfiable if and only if N(u) =1.

  25. Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on every input u of length n, and outputs 0/1. Then, 1. There s a CNF of size poly(T(n)) such that (u, additional variables ) is satisfiable if and only if N(u) =1. 2. is computable in time poly(T(n)).

  26. Cook-Levin theorem: Proof Theorem. Let N be a deterministic TM that runs in time T(n) on every input u of length n, and outputs 0/1. Then, 1. There s a CNF of size poly(T(n)) such that (u, additional variables ) is satisfiable if and only if N(u) =1. 2. is computable in time poly(T(n)). Cook-Levin theorem follows from above!

  27. Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation.

  28. Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation. A step of computation of N consists of Changing the content of the current cell Changing state Changing head position

  29. Cook-Levin theorem: Proof Assume (w.l.o.g) that N has a single tape and it writes its output on the first cell at the end of computation. A step of computation of N consists of Changing the content of the current cell Changing state Changing head position Think of a compound tape: every cell stores the current state, a bit content and head indicator.

  30. Cook-Levin theorem: Proof . . a cell A compund tape

  31. Cook-Levin theorem: Proof h Q b . . a cell A compund tape

  32. Cook-Levin theorem: Proof h = 1 if head points to this cell = 0 otherwise h Q b . . a cell A compund tape

  33. Cook-Levin theorem: Proof 0/1 bit content of this cell h Q b . . a cell A compund tape

  34. Cook-Levin theorem: Proof Current state when h = 1; otherwise we don t care h Q b . . a cell A compund tape

  35. Cook-Levin theorem: Proof Computation of N can be completely described by a sequence of T(n) compound tapes, the i-th of which captures a `snapshot of N s computation at the i-th step. . . a cell A compund tape

  36. Cook-Levin theorem: Proof . . qstart u1 1 a cell 1 A compund tape first input bit

  37. Cook-Levin theorem: Proof . . qstart u1 0 2 . . qstart u1 1 a cell 1 A compund tape

  38. Cook-Levin theorem: Proof T(n) . . qaccept o/p 1 . . . . . qstart u1 0 2 . . qstart u1 1 a cell 1 A compund tape

  39. Cook-Levin theorem: Proof T(n) cells T(n) . . qaccept o/p 1 . . . . . qstart u1 0 2 . . qstart u1 1 a cell 1 A compund tape

  40. Cook-Levin theorem: Proof hi,j = 1 iff head points to cell j at i-th step bi,j = bit content of cell j at i-th step . . qi,j bi,j hi,j i cell j

  41. Cook-Levin theorem: Proof hi,j = 1 iff head points to cell j at i-th step bi,j = bit content of cell j at i-th step qi,j = a sequence of log |Q| bits which contains the current state info if hi,j = 1; otherwise we don t care . . qi,j bi,j hi,j i cell j

  42. Cook-Levin theorem: Proof Think of hi,j, bi,j and the bits of qi,j as formal boolean variables. . . qi,j bi,j hi,j i cell j

  43. Cook-Levin theorem: Proof Locality of computation: The variables hi,j, bi,j and qi,j depend only on the variables hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , and hi-1,j+1 , bi-1,j+1 ,qi-1,j+1 . . qi,j bi,j hi,j i cell j . . qi-1,j-1 bi-1,j-1 hi-1,j-1 qi-1,j bi-1,j hi-1,j qi-1,j+1 bi-1,j+1 hi-1,j+1 i-1 cell j-1 cell j cell j+1

  44. Cook-Levin theorem: Proof Hence, bij = Bij(hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , hi-1,j+1 , bi-1,j+1 ,qi-1,j+1) = a fixed function of the arguments depending only on N s transition function .

  45. Cook-Levin theorem: Proof Hence, bij = Bij(hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , hi-1,j+1 , bi-1,j+1 ,qi-1,j+1) = a fixed function of the arguments depending only on N s transition function . The above equality can be captured by a constant size CNF ij . Also, ij is easily computable from .

  46. Cook-Levin theorem: Proof Similarly, hij = Hij(hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , hi-1,j+1 , bi-1,j+1 ,qi-1,j+1) = a fixed function of the arguments depending only on N s transition function . The above equality can be captured by a constant size CNF ij . Also, ij is easily computable from .

  47. Cook-Levin theorem: Proof Similarly, qijk = Cijk(hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , hi-1,j+1 , bi-1,j+1 ,qi-1,j+1) = a fixed function of the arguments depending only on N s transition function . The above equality can be captured by a constant size CNF ijk . Also, ijk is easily computable from .

  48. Cook-Levin theorem: Proof k-th bit of qij where 1 k log |Q| Similarly, qijk = Cijk(hi-1,j-1 , bi-1,j-1 ,qi-1,j-1 , hi-1,j , bi-1,j ,qi-1,j , hi-1,j+1 , bi-1,j+1 ,qi-1,j+1) = a fixed function of the arguments depending only on N s transition function . The above equality can be captured by a constant size CNF ijk . Also, ijk is easily computable from .

  49. Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if ij , ij and ijk are satisfied for all i, j and k.

  50. Cook-Levin theorem: Proof Observe that a computation of N is valid if and only if ij , ij and ijk are satisfied for all i, j and k. i [1, T(n)] , j [1, T(n)] , and k [1, log |Q|]

More Related Content