What Is the Hardest Problem in NP? Question: We do not know if problems in NP have polynomial time deterministic algorithms. Can we at least point out to some problem(s) in NP that are the most difficult ones to solve? Computability and Complexity Answer: This is indeed possible and SAT is one example of such a problem. In fact there are many other problems are in NP and difficult for the class NP (CLIQUE, HAMPATH, SUBSET-SUM, 3SAT, . . . ). We call them NP-complete problems. Lecture 12 NP-completeness Cook-Levin Theorem (SAT is NP-complete) given by Jiri Srba Lecture 12 Computability and Complexity Consequence: If just one NP-complete problem can be solved in P then all other problems in NP will be solvable in P (hence P=NP). If P 6= NP then none of the NP-complete problems is solvable in deterministic polynomial time. 1/12 NP-Completeness Lecture 12 Computability and Complexity 2/12 Cook-Levin Theorem Definition (NP-Completeness) Cook-Levin Theorem The language SAT is NP-complete. A language B is NP-complete iff 1 B ∈ NP (containment in NP), and 2 for every A ∈ NP we have A ≤P B (NP-hardness). Proof: SAT is clearly in NP. We have to show that SAT is NP-hard: Every language A ∈ NP is poly-time reducible to SAT. Theorem If B is NP-complete and B ∈ P, then P = NP. Let us assume any given A ∈ NP, so there is a nondeterm. decider M for A running in time O(nk ). Proof: We know that if A ≤P B and B ∈ P then A ∈ P. Our aim: for any input string w construct in polynomial time a Boolean formula φ such that Theorem If B is NP-complete, B ≤P C , and C ∈ NP, then C is NP-complete. M accepts w if and only if φ is satisfiable. Proof: Because ≤P is transitive (see the tutorial). Lecture 12 Computability and Complexity Lecture 12 3/12 Table of Configurations of M Run on ababa Computability and Complexity 4/12 Boolean Formula Describing Table of Configurations Assume a table of configurations when M is run on w = w1 . . . wn . We will construct a formula φ such that M accepts w iff φ ∈ SAT . def φ = φcell ∧ φstart ∧ φaccept ∧ φmove The set of variables contains: xi,j,s where 1 ≤ i, j ≤ nk and s ∈ C is a tape symbol or a control state. Note: There are only polynomially many variables w.r.t. to n. Intuition: Variable xi,j,s is true if and only if cell[i, j] contains the symbol s. Lecture 12 Computability and Complexity 5/12 Lecture 12 Computability and Complexity 6/12 Definition of φcell Definition of φstart Every cell[i, j] contains exactly one symbol s. def φcell = h _ ^ 1≤i,j≤nk xi,j,s ^ ∧ s∈C The first row contains the initial configuration q0 w1 . . . wn . i (xi,j,s ∨ xi,j,t ) def φstart = x1,1,# ∧ x1,2,q0 ∧ x1,3,w1 ∧ x1,4,w2 ∧ . . . x1,n+2,wn ∧ s,t∈C ,s6=t x1,n+3,t ∧ . . . x1,nk −1,t ∧ x1,nk ,# Note: φstart is of polynomial size w.r.t. to n. Note: φcell is of polynomial size w.r.t. to n. Lecture 12 Computability and Complexity Lecture 12 7/12 Definition of φaccept Computability and Complexity 8/12 Definition of φmove Every window in the table is legal. Let LW denote the set of all legal windows. There is an accepting configuration in the table. def φmove = _ def φaccept = ^ legal-window(i, j) 1≤i<nk ,1<j<nk xi,j,qaccept 1≤i,j≤nk def legal-window(i, j) = _ xi,j−1,a1 ∧xi,j,a2 ∧xi,j+1,a3 ∧xi+1,j−1,a4 ∧xi+1,j,a5 ∧xi+1,j+1,a6 Note: φaccept is of polynomial size w.r.t. to n. a1 ,a2 ,a3 ∈LW a4 ,a5 ,a6 Note: φmove is of polynomial size w.r.t. to n. Lecture 12 Computability and Complexity Lecture 12 9/12 Cook-Levin Theorem — Summary Computability and Complexity 10/12 Exam Questions Let A ∈ NP be decided by poly-time nondeterministic TM M. For every w ∈ Σ∗ we constructed in polynomial time a def formula φ = φcell ∧ φstart ∧ φaccept ∧ φmove . We argued that M accepts w if and only if φ is satisfiable. Definition of NP-completeness. Hence SAT is NP-hard. Theorems about NP-completeness. Clearly SAT is in NP. SAT and 3SAT are NP-complete. Conclusion: SAT is NP-complete. Corollary The language 3SAT is NP-complete. Proof: A small modification of the proof for SAT. Lecture 12 Computability and Complexity 11/12 Lecture 12 Computability and Complexity 12/12
© Copyright 2026 Paperzz