← back to Theory of Computation

Complexity

Maheshwari & Smid · Ch. 8 · Introduction to Theory of Computation

P is the class of problems solvable in polynomial time. NP is the class whose solutions can be verified in polynomial time. Whether P = NP is the central open question. The Cook-Levin theorem proves that SAT is NP-complete: every NP problem reduces to it in polynomial time.

NP P sorting, shortest path matching, primality NP-complete SAT, 3-COL TSP, Clique P = NP ?

P: efficiently solvable

P contains problems where an algorithm runs in O(nk) time for some constant k. Sorting, shortest path, matching, primality testing: all in P.

NP: efficiently verifiable

NP contains problems where a proposed solution (certificate) can be checked in polynomial time. Finding a solution may be hard, but verifying one is fast. Every problem in P is also in NP (just solve it and check).

Scheme

Polynomial-time reductions

Problem A reduces to problem B (A ≤P B) if instances of A can be transformed to instances of B in polynomial time. If B is in P and A reduces to B, then A is in P too. Reductions let us compare hardness.

NP-completeness

A problem is NP-complete if it is in NP and every NP problem reduces to it. NP-complete problems are the hardest in NP. If any one of them is in P, then P = NP and all of them are in P.

Cook-Levin theorem

The wpCook-Levin theorem (1971) proves that SAT (boolean satisfiability) is NP-complete. The proof encodes the computation of any NP Turing machine as a boolean formula. Every step, state, and tape cell becomes a variable. The formula is satisfiable if and only if the machine accepts. Since any NP problem can be encoded this way, SAT is the universal NP-complete problem.

Scheme
Neighbors