Theorem. Cook-Levin Theorem
[cook-levin]
Theorem. Cook-Levin Theorem [cook-levin]
- Theorem.
-
SAT is in NP (you can construct a verifier that runs in polynomial time)
- Corollary.
-
SAT is NP-complete.
- Proof.
-
To prove this, we must show that .
- What do we know about ? It’s in NP, i.e., there is a nondeterministic Turing machine that decides in polytime
Idea: given a deterministic Turing machine and an input , we can create a circuit such that accepts if and only if evaluates to
true.That’s great, but we really want to construct it for a nondeterministic Turing machine : how can we do that?
- Given and an input , construct a boolean formula with variables as inputs such that accepts if and only if is satisfiable.
- i.e. the nondeterminism is each permutation of the variables, then it’s deterministic to satisfy it
Recall: Behavior of a deterministic Turing machine
- Start = Config(1)
- Config(2) = …
- Config(3) = …
- Config(i) uniquely determines Config(i+1)
- The total amount of configurations we have to look at is , and the total amount of tape we have to look at is also .
Simulating a Turing machine with a tableau
[cpsc/tm-tableau]
Simulating a Turing machine with a tableau [cpsc/tm-tableau]
Main idea: an algorithm can be converted to a Boolean circuit
…table…
M accepts w if and only if the tableau can be filled such that:
- The first row is the starting configuration of M on input w
- configuration follows from the configuration
- Eventually reach an accepting configuration
So how can this tableau be converted into a boolean formula? We’ll come up with some boolean variables to represent what is happening in the cells.
Let refer to the according tableau entry.
- Note: row i: time step, column j: head position,
- Our cell entries are not boolean values: but we still want to encode them as such!
- Create boolean variables where and
For a nondeterministic Turing machine:
- The same table as the deterministic Turing machine:
- only the configuration follows from the configuration using some nondeterministic choice
- : check if any cell is accepting
Window[i,j]: six cells of the table (six cells is convenient: 3x2, we need three to read the current, state, and next items)
- i.e. the window is size 3x2 because that’s exactly what we need to check that it is valid
note: pull examples, when there is no head the last two columns cannot change
… online lecture …