Theorem 1 (circuits simulate TMs): Let be functions.
If a language is decidable by a TM that runs in time and uses space, then is decidable by a circuit family that has size and depth .
Moreover, the construction of the circuit family can be done in time .
Proof: See written notes.
We are now ready to establish our first natural -complete language, and to prove the Cook-Levin Theorem.
To do so, we need to introduce the following language:
Definition 1 (Circuit-SAT): The language is defined as follows:
where by a satisfiable boolean circuit we mean a boolean circuit such that there exists an assignment of the input variables that makes the output gate of output .
We can use theorem 1 to show that is -complete.
Theorem 2: is -complete.
Proof: Membership in is clear, since given a circuit , a certificate is a satisfying assignment for , and we can check in polynomial time if the certificate is correct by evaluating the circuit.
To show that is -hard, we will show a polynomial-time (Karp) reduction from any language to .
More precisely, we need to give a polynomial-time computable function such that for all , we have .
Since , there exists a poly-time TM and a polynomial such that for all , we have
Let be the function that maps to the description of the circuit that simulates on input and certificate .
Since the TM runs in time polynomial on , there is a polynomial such that runs in time .
In particular, also uses at most space, and by theorem 1, we can construct a circuit that simulates on input and certificate using at most gates and depth .
Moreover, this construction can be done in polynomial time.
Note that , as desired.
The language is a natural -complete language, but one could ask if we need to consider general boolean circuits, or if we could restrict our attention to a simpler class of circuits while preserving -completeness.
The answer is affirmative, and we can consider the following language:
Definition 2 (3-SAT): The language is defined as follows:
where by a satisfiable 3-CNF formula we mean a 3-CNF formula such that there exists an assignment of the variables that makes true.
We can now prove the Cook-Levin Theorem, which states that is -complete.
Theorem 3 (Cook-Levin Theorem): is -complete.
Proof: It is clear that is in , since given a 3-CNF formula , a certificate is a satisfying assignment for , and we can check in polynomial time if the certificate is correct by evaluating on it.
To show that is -hard, we will show a polynomial-time (Karp) reduction from to .
Let be a boolean circuit, where are the input variables, and are the gates of .
The idea is to add extra variables to encode the computation of the circuit as a 3-CNF formula .
Our formula will have the following structure:
- each gate of the circuit will be represented by a variable in . Thus, we will have the variables representing the input variables, and representing the gates of .
- We will add clauses to to ensure that the output of each gate is computed correctly. This is done as follows:
- If is a NOT gate with input , then we add the clauses
- If is an AND gate with inputs , then we add the clauses
- If is an OR gate with inputs , then we add the clauses
- Lastly, we will add the clause to ensure that is satisfiable if and only if the circuit is satisfiable.
Remark: we can make sure that the formula is a 3-CNF formula (i.e., each clause has exactly 3 literals) by adding extra (dummy) variables and clauses to .
The main point is that each clause has at most 3 literals, and the construction can be done in polynomial time.
The above construction shows that is satisfiable if and only if is satisfiable, and hence reduces to in polynomial time.
Acknowledgements & References
This lecture was based on these resources: