In computational complexity theory, the Cook–Levin theorem, also known as Cook's theorem, states that the Boolean satisfiability problem is NP-complete. That is, it is in NP, and any problem in NP can be reduced in polynomial time by a deterministic Turing machine to the Boolean satisfiability problem.
The theorem is named after Stephen Cook and Leonid Levin. The proof is due to Richard Karp, based on an earlier proof (using a different notion of reducibility) by Cook.
An important consequence of this theorem is that if there exists a deterministic polynomial-time algorithm for solving Boolean satisfiability, then every NP problem can be solved by a deterministic polynomial-time algorithm. The question of whether such an algorithm for Boolean satisfiability exists is thus equivalent to the P versus NP problem, which is still widely considered the most important unsolved problem in theoretical computer science.
The concept of NP-completeness was developed in the late 1960s and early 1970s in parallel by researchers in North America and the USSR.In 1971, Stephen Cook published his paper "The complexity of theorem proving procedures"[1] in conference proceedings of the newly founded ACM Symposium on Theory of Computing. Richard Karp's subsequent paper, "Reducibility amongcombinatorial problems", generated renewed interest in Cook's paper by providing a list of 21 NP-complete problems. Karp also introduced the notion of completeness used in the current definition of NP-completeness (i.e., by polynomial-time many-one reduction). Cook and Karp each received a Turing Award for this work.
The theoretical interest in NP-completeness was also enhanced by the work of Theodore P. Baker, John Gill, and Robert Solovay who showed, in 1975, that solving NP-problems in certain oracle machine models requires exponential time. That is, there exists an oracle A such that, for all subexponential deterministic-time complexity classes T, the relativized complexity class NPA is not a subset of TA. In particular, for this oracle, PA ≠ NPA.[2]
In the USSR, a result equivalent to Baker, Gill, and Solovay's was published in 1969 by M. Dekhtiar.[3] Later Leonid Levin's paper, "Universal search problems",[4] was published in 1973, although it was mentioned in talks and submitted for publication a few years earlier.
Levin's approach was slightly different from Cook's and Karp's in that he considered search problems, which require finding solutions rather than simply determining existence. He provided six such NP-complete search problems, or universal problems.Additionally he found for each of these problems an algorithm that solves it in optimal time (in particular, these algorithms run in polynomial time if and only if P = NP).
A decision problem is in NP if it can be decided by a non-deterministic Turing machine in polynomial time.
An instance of the Boolean satisfiability problem is a Boolean expression that combines Boolean variables using Boolean operators.Such an expression is satisfiable if there is some assignment of truth values to the variables that makes the entire expression true.
Given any decision problem in NP, construct a non-deterministic machine that solves it in polynomial time. Then for each input to that machine, build a Boolean expression that computes whether when that specific input is passed to the machine, the machine runs correctly, and the machine halts and answers "yes". Then the expression can be satisfied if and only if there is a way for the machine to run correctly and answer "yes", so the satisfiability of the constructed expression is equivalent to asking whether or not the machine will answer "yes".
This proof is based on the one given by .
There are two parts to proving that the Boolean satisfiability problem (SAT) is NP-complete. One is to show that SAT is an NP problem. The other is to show that every NP problem can be reduced to an instance of a SAT problem by a polynomial-time many-one reduction.
SAT is in NP because any assignment of Boolean values to Boolean variables that is claimed to satisfy the given expression can be verified in polynomial time by a deterministic Turing machine. (The statements verifiable in polynomial time by a deterministic Turing machine and solvable in polynomial time by a non-deterministic Turing machine are equivalent, and the proof can be found in many textbooks, for example Sipser's Introduction to the Theory of Computation, section 7.3., as well as in the Wikipedia article on NP).
M=(Q,\Sigma,s,F,\delta)
Q
\Sigma
s\inQ
F\subseteqQ
\delta\subseteq((Q\setminusF) x \Sigma) x (Q x \Sigma x \{-1,+1\})
M
p(n)
n
p
For each input,
I
B
M
I
The Boolean expression uses the variables set out in the following table. Here,
q\inQ
-p(n)\leqi\leqp(n)
j\in\Sigma
0\leqk\leqp(n)
Variables | Intended interpretation | How many?[5] | |
---|---|---|---|
Ti,j,k | True if tape cell i j k | O(p(n)2) | |
Hi,k | True if M i k | O(p(n)2) | |
Qq,k | True if M q k | O(p(n)) |
Define the Boolean expression
B
-p(n)\leqi\leqp(n)
0\leqk\leqp(n)
Expression | Conditions | Interpretation | How many? | |
---|---|---|---|---|
Ti,j,0 | Tape cell i j | Initial contents of the tape. For i>n-1 i<0 I | O(p(n)) | |
Qs,0 | Initial state of M | 1 | ||
H0,0 | Initial position of read/write head. | 1 | ||
\negTi,j,k\lor\negTi,j',k | j ≠ j' | At most one symbol per tape cell. | O(p(n)2) | |
veejTi,j,k | At least one symbol per tape cell. | O(p(n)2) | ||
Ti,j,k\landTi,j',k+1 → Hi,k | j ≠ j' | Tape remains unchanged unless written by head. | O(p(n)2) | |
lnotQq,k\lorlnotQq',k | q ≠ q' | At most one state at a time. | O(p(n)) | |
veeqQq, | At least one state at a time. | O(p(n)) | ||
lnotHi,k\lorlnotHi',k | i ≠ i' | At most one head position at a time. | O(p(n)3) | |
vee-p(n)Hi, | At least one head position at a time. | O(p(n)2) | ||
\begin{array}{l} (Hi,k\landQq,k\landTi,\sigma,k)\to\\ vee((q,(Hi+d, k+1\landQq', k+1\landTi, \sigma', k+1) \end{array} | k<p(n) | Possible transitions at computation step k i | O(p(n)2) | |
vee0veefQf,k | Must finish in an accepting state, not later than in step p(n) | 1 |
If there is an accepting computation for
M
I
B
Ti,j,k
Hi,k
Qi,k
B
M
I
There are
O(p(n)2)
O(logp(n))
O(p(n)3)
B
O(log(p(n))p(n)3)
Only the first table row (
Ti,j,0
I
n
M
M
p(n)
The transformation makes extensive use of the polynomial
p(n)
M
p(n)
M
While the above method encodes a non-deterministic Turing machine in complexity
O(log(p(n))p(n)3)
O(p(n)log(p(n)))
The use of SAT to prove the existence of an NP-complete problem can be extended to other computational problems in logic, and to completeness for other complexity classes.The quantified Boolean formula problem (QBF) involves Boolean formulas extended to include nested universal quantifiers and existential quantifiers for its variables. The QBF problem can be used to encode computation with a Turing machine limited to polynomial space complexity, proving that there exists a problem (the recognition of true quantified Boolean formulas) that is PSPACE-complete. Analogously, dependency quantified boolean formulas encode computation with a Turing machine limited to logarithmic space complexity, proving that there exists a problem that is NL-complete.[12] [13]
The proof shows that every problem in NP can be reduced in polynomial time (in fact, logarithmic space suffices) to an instance of the Boolean satisfiability problem. This means that if the Boolean satisfiability problem could be solved in polynomial time by a deterministic Turing machine, then all problems in NP could be solved in polynomial time, and so the complexity class NP would be equal to the complexity class P.
The significance of NP-completeness was made clear by the publication in 1972 of Richard Karp's landmark paper, "Reducibility among combinatorial problems", in which he showed that 21 diverse combinatorial and graph theoretical problems, each infamous for its intractability, are NP-complete.[14]
Karp showed each of his problems to be NP-complete by reducing another problem (already shown to be NP-complete) to that problem. For example, he showed the problem 3SAT (the Boolean satisfiability problem for expressions in conjunctive normal form (CNF) with exactly three variables or negations of variables per clause) to be NP-complete by showing how to reduce (in polynomial time) any instance of SAT to an equivalent instance of 3SAT.[15]
Garey and Johnson presented more than 300 NP-complete problems in their book Computers and Intractability: A Guide to the Theory of NP-Completeness, and new problems are still being discovered to be within that complexity class.
Although many practical instances of SAT can be solved by heuristic methods, the question of whether there is a deterministic polynomial-time algorithm for SAT (and consequently all other NP-complete problems) is still a famous unsolved problem, despite decades of intense effort by complexity theorists, mathematical logicians, and others. For more details, see the article P versus NP problem.
n
O(p(n))
O(TlogT)
(A\lorB\lorC\lorD)
(A\lorB\lorZ)\land(lnotZ\lorC\lorD)
Z
(A\lorB)
(A\lorB\lorB)