Algorithms and Structural Complexity Theory continued

Preview of Things to Come

We will see the following:

Polynomial Reducibility

We say a decision problem D' is polynomial time reducible to a decision problem D if there exists a polynomial time computable function f(x) from instances of D' to instances of D such that x is in D' if f(x) is in D. We write "D' <p D" to mean D' is polynomial time reducible to D.

So, if D' <p D, and we can solve D in time t (with some algorithm), then we can solve D' in time polynomial in t. Let's look at an example:

Problem: HAMILTONIAN-CYCLE
Instance: A graph G = (V, E)
Question: Does G contain a Hamiltonian cycle? That is, is there a path (cycle) going from one vertex of G, through all the other vertices of G exactly once, ending up at the same vertex?
First of all, is this problem in NP? Yes; a certificate for it would be the list of vertices, in order, that make up the cycle. We can check this easily in time polynomial in the size of the graph.

Now recall the problem TSP, as presented in the last lecture. We can use TSP to solve HAMILTONIAN-CYCLE; all we do is let k (the length of the tour we are looking for) be arbitrarily large, weight the edges of G with 1, and see if there is a TSP tour (of any length) through the graph. If there isn't (i.e., there was just no way to get from one vertex to another without going through a third twice, or the graph was not connected), then there is no Hamiltonian cycle. If there is a TSP tour, then there is a Hamiltonian cycle. All of this conversion of the HAMILTONIAN-CYCLE instance into the TSP instance can be done in linear, thus polynomial, time. So we say HAMILTONIAN-CYCLE <p TSP. TSP is "harder" than HAMILTONIAN-CYCLE. Note that the certification of an instance of HAMILTONIAN-CYCLE can also be converted from a certificate for TSP in polynomial time. Note also that, if TSP answers "no," there is no certificate (thus no proof) that the instance isn't in HAMILTONIAN-CYCLE.

It should be noted that two problems can be the same hardness, i.e., D <p D' and D' <p D can both be true at the same time. Also, two problems may not be related at all, so that neither D <p D' nor D' <p D might be true (so <p is a partial order). For convenience and added confusion, I write "harder" when I should write "at least as hard as."

Some problems are harder than all of the problems in NP. One example is the problem HALTING we saw last lecture; it asks whether a C program will ever reach exit(). All we have to do is code up a C program that decides whether our instance is in D, calling exit() if yes, going into an infinite loop if no. This program can be mechanically constructed in polynomial time, then all we have to do is solve HALTING (good luck with that part). So D <p HALTING for all problems in NP.

Definition: A problem D is called NP-hard if, for all problems D' in NP, D' <p D.

So an NP-hard problem is something harder than anything in NP.

Definition: A problem D is called NP-complete if

So an NP-complete problem would in some sense be the hardest problem in NP. Our definition of <p allows problems to be equally hard, so we could have many equally hard NP-complete problems that are all harder than all of the other (alledgedly easier) problems in NP.

It follows that, if D' <p D and D' is an NP-complete problem, and D is in NP, then D must also be NP-complete. So, if we can show just one problem NP-complete, we have a tool to find more NP-complete problems.

Can we show just one NP-complete problem? Yes. Consider the following decision problem:

Problem: CIRCUIT-SATISFIABILITY
Instance: An acyclic (i.e., no cycles), directed graph G whose nodes are logic functions: AND, OR, or NOT, or logical variables. The graph represents a combinatorial logic circuit with n inputs and 1 output.
Question: Is there any assignment to the n input variables that will cause the output to become True?
This problem was shown, in the early 1970s, to be NP-complete in a proof by Cook that became known as Cook's Theorem. It is somewhat involved, but the basic idea is this: any polynomial time certificate system can be transformed into a polynomial sized logic circuit (that's sort of what a computer does, anyway). The circuit encodes the certificate verification algorithm run on a particular instance. The inputs to the circuit are the certificate, and the output is True if the certificate verifies the instance, False otherwise. If there is an assignment that causes the circuit to output True (a satisfying assignment), then this assignment is a certificate verifying the instance. Since every problem in NP has a polynomial time proof system, this technique works for all of them, so CIRCUIT-SATISFIABILITY can be used to solve any problem in NP and is thus NP-complete.

From this foundation, we can build up a library of NP-complete problems that can be used to solved CIRCUIT-SATISFIABILITY or other previously proven NP-complete problems. It turns out that there are thousands of them.

Some fun facts about NP-complete problems: