2

I read the book Computers and Intractability - A Guide to the Theory of NP-Completeness by Garey and Johnson for my algorithms course; however, upon reviewing the material a year later, I realized that I never really understood Cook's Theorem.

In regards to the proof, I understand why SAT is first shown to be in NP first (first requirement of NP-complete), but am struggling through the technicalities of showing that the "other" NP-complete problems under a "genetic" polynomial transform to SAT.

I was wondering if someone could explain this in a more watered down manner, that would perhaps clarify an additional reading of this section.

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
m.n
  • 47
  • 4
  • This looks like a better fit on [CS Exchange](http://cs.stackexchange.com/). However a *very* short description is: If a problem is NP, then it is solvable in poly-time by some nondet Turing Machine. The argument then goes that we can simulate said Turing Machine by a SAT problem, by encoding the state machine and the memory in the logic. You then proceed to prove that the resulting formulas length is polynomial in the characteristics of the Turing Machine, and hence - in the input length. – Ordous Oct 02 '14 at 18:58

1 Answers1

4

The proof that SAT is NP-hard (that is, that there's a polynomial-time reduction from every NP problem to SAT) is nontrivial. I'm going to try to give an intuition for how it works, but I'm not going to attempt to go over all the details. For that, you probably want to consult a textbook.

Let's start off by taking any NP language L. By definition, the fact that L is an NP language means that there is a nondeterministic, polynomial-time Turing machine M for the language L. This means that the machine M accepts a string w if and only if w belongs to L, and on top of this the runtime of M is some polynomial p(n). The reduction from L to SAT will work by showing that you can build a propositional formula that essentially simulates the operation of M on some particular string w. That formula has the property that M accepts w (that is, w belongs to L) if and only if the resulting propositional formula is satisfiable.

It's not at all clear that it's possible to do this at all. To see how it works, we'll use a standard technique for reducing problems involving TMs to one another. Think about the operation of M on the string w. Since M is a Turing machine, when we start up M with w, it begins with w written on the tape (surrounded by infinitely many blanks), in some state q0, and with the tape head over the first character of w. Each step of the Turing machine causes the machine to move the tape head left or right, to replace the symbol under the tape head, and to move the tape head left or right.

Right before each step of the TM, we can take a "snapshot" of the state of the machine. That snapshot will include the tape after trimming off the infinitely many blanks from both sides, the position of the tape head, and the current state of the TM. This "snapshot" is more properly called an instantaneous description or ID of the machine. You can think of it as a tuple of (tape contents, state, position).

Because M is a polynomial-time NTM, we know that it can't run for more than p(|w|) steps when run on the input string w, where p is some polynomial. Therefore, when M runs, the computation will have at most p(|w|) + 1 instantaneous descriptions, one for each step. Consequently, you can think of any execution of M as a series of this ID's, written out one after the other, as (tape0, state0, position0), (tape1, state1, position1), ..., (tapeK, stateK, positionK).

Two observations are in order about these IDs. First, these IDs can't be totally arbitrary. We know what the first ID is going to be - it's going to be an ID where the tape holds w, the state is q0, and the tape head is over the start of string w. As a result, there are only a few possible choices for what the second ID will be, based on each of the nondeterministic choices that the TM can make for its first step. Similarly, the number of choices for the third ID is finite, since that ID has to be formed by starting with some legal second ID and applying one move of the TM. More generally, each ID has to follow from a legal TM move starting with the previous ID.

Second, notice that if M accepts w, then there is some possible chain of IDs such that the last ID in the chain will be on in which the state is the machine's accepting state. Conversely, if M doesn't accept w, then no possible chain of IDs will legally end with the machine in accepting state.

The reduction from L to SAT therefore works by, essentially, building up a gigantic propositional formula. Each variable corresponds to some piece of one of the IDs in the chain (either the contents of some specific tape cell, or what state the machine would be in, or where the tape head would be). The formula then encodes the rules about the IDs: the first ID has to be one where the machine starts up state q0 with the tape head scanning the first character of the input string w, each ID has to follow from the previous one, etc. There's one last part to the formula - the machine has to end in an accepting state. Actually building up all of these pieces of the formula is pretty tricky (that's why you should look at a textbook). However, the net result is that if the formula is satisfiable, there's a series of IDs that show that M accepts w (so w is in L(M)), and if it's unsatisfiable then there is no way for M to accept w.

Hope this helps!

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065