CSC 320 Notes: SAT, the First NP-complete Problem

Steve Cook in 1971 proved that SAT is NP-complete. The SAT problem is defined as follows:


SAT (Satisfiability)

Variables: u1, u2, u3, ... uk.

A literal is a variable or the negation of a variable, commonly denoted by putting a bar on top of the variable name, but I will typeset the negation of u in HTML as ¬ u.

If u is set to true then ¬ u is false and if u is set to false then ¬ u is true.

A clause is a set of literals. A clause is true is one of the literals in the clause is true.
For example: {u1, ¬ u3, u8} is true if u1 or ¬ u3 or u8.

The input to SAT is a collection of clauses.

The output is the answer to: Is there an assignment of true/false to the variables so that every clause is satisfied (satisfied means the clause is true)?

If the answer is yes, such an assignment of the variables is called a truth assignment.


For example:
{ u1, u2, ¬ u4 }
{ ¬ u2, u4, u5 }
{ ¬ u3, ¬ u1, u4, u2 }
{ u1 }
is satisfiable. It is easy to check if both u1 and u4 are true then all the clauses are satisfied regardless of the assignment of true/false to the other variables.

Another example:

{ ¬ u1}
{ u1, u2 }
{ u1, ¬ u2 }
is not satisfiable. The first clause implies that u1 is false. But then the second clause implies that u2 is true. As a result, the last clause is not satisfied.


To check that SAT is NP:
  1. First, SAT is a decision problem (a yes/no question).
  2. Next, it has a nondeterministic polynomial time algorithm as follows:

Sketch of proof that SAT is NP-complete:

Complete details of this proof are available in Garey and Johnson.

Every problem in NP has a nondeterministic polynomial time Turing Machine algorithm. Cook describes how to build up a SAT expression which is polynomial in the size of this TM (a constant for a given problem) plus the size of the input to the problem which is satisfiable if and only if the Turing Machine can "guess" (nondeterministically) a solution to the problem.

Thus if there is a polynomial time algorithm for SAT, you can use the nondeterministic TM for any other problem in NP to design an equivalent SAT problem.


Hundreds of other problems have been proved NP-complete by reduction. A large list can be found in Garey and Johnson.

To use a reduction to prove that a new problem W is NP-complete:

  1. Prove W is in NP.
  2. Choose a similar problem Q already known to be NP-complete.
  3. Prove that if W can be solved in polynomial time, so can Q.

Side Note

If you want to set up a logical expression which is only satisfied if at least one of a collection of k variables u1, u2, u3, ... uk is true you can use { u1, u2, u3, ... uk}.

If you want to have at most one of u1, u2, u3, ... uk set to true in a truth assignment, then for each pair of variables (ui, uj) add a clause {¬ ui, ¬ uj}.

This should help you with the assignment question.


Next: History of NP-Completeness Reductions

Previous: Does P=NP?