MIT 6.1220 — Lecture 14
Intractability (Part II)
Definition (Karp Reduction). A Karp reduction from to is a deterministic algorithm such that:
The algorithm takes instances to instances , such that .
The algorithm runs in for some constant .
If exists, we say . In other words, is no harder than .
Claim. Given a Karp reduction from to and an efficient -solver, we have an efficient -solver.
Proof: Duh, obviously.
Note that “Karp” is an abbreviation of “polynomial-time many-one”.
Definition (NP-Hard). A problem is NP-hard if and only if for every , we have .
Definition (NP-Complete). A problem is NP-complete if and only if is NP-hard and .
Claim. Consider Circuit-Sat, which asks whether there is a satisfying assignment to a boolean circuit.
We claim that Circuit-Sat is NP-complete.
Proof: It's obvious that Circuit-Sat is in NP.
Now consider any problem . Because is in NP, it has a verifier algorithm . Implement as a polynomial-sized boolean circuit; that is, express in hardware. Now run Circuit-Sat on this circuit.
More formally, Turing Machine blah blah blah.
Definition (CNF). A formula is in -CNF (Conjunctive Normal Form) if it is an AND of clauses, each of which is an OR of exactly literals—variables and their negations .
Remark. Other definitions exist; for example, some definitions allow and to be literals.
For example, is not in -CNF for any , but is in 2-CNF (but not 3-CNF).
Claim. Consider 3-Sat, which asks whether there is a satisfying assignment for a formula in 3-CNF.
We claim that 3-Sat is NP-complete.
Proof: Obviously it's in NP. Now for any problem , first reduce it to a boolean circuit, and then encode that circuit as a boolean formula.
The point is that 3-CNF is a normal form of all boolean formulas; any boolean formula can be converted into an equisatisfiable 3-CNF formula.
Definition (Vertex Cover). Given a graph, a vertex cover is a set of vertices that contains at least one endpoint from every edge. (Kind of a satisfying assignment to a 2-CNF formula, without negations.)
Remark. To lower-bound the size of a vertex cover by , find disjoint edges…
Claim. Consider Vertex-Cover, which asks whether a graph has a vertex cover of size at most .
We claim that Vertex-Cover is NP-complete.
Proof: Obviously it's in NP. We'll proceed by reducing 3-Sat to Vertex-Cover.

The idea is the following:
Each line segment requires one vertex from .
Each triangle requires two vertices from .
If we have variables and clauses, we'll have line segments and triangles. (Check: poly-time reduction.)
Now set . We must then:
Choose exactly one of for each .
That is, set each variable to either True or False.
Choose exactly two of for each .
That is, designate exactly one literal from each clause to not shade in… so then, by corollary of the green edges—each joining a clause vertex to the vertex of the literal it names—that literal must satisfy .
Formally, a proof goes both ways: 3-Sat Vertex-Cover and Vertex-Cover 3-Sat. Do this!
Remark. We should really be speaking in levels of abstraction; there's two gadgets here, the line segment and the triangle. In general, these two gadgets are good starting points.
Claim. Consider Subset-Sum, which, given a set of positive integers and a target , asks if there is a with .
We claim that Subset-Sum is NP-complete.
Proof: Obviously it's in NP. We'll proceed by reducing Vertex-Cover to Subset-Sum.

Suppose has edges, enumerated , and we seek a vertex cover of size exactly ; padding a smaller cover with arbitrary extra vertices makes this the same question as “at most ”.
For each edge , append to .
For each vertex , append , where is the set of indices of edges connected to .
Set the target sum to .
Of course, we should really be thinking in base . When we select a subset of ,
The -place of the sum encodes the number of vertices we picked.
The -place (for ) where encodes how many of were picked.
Let's write out both directions explicitly this time.
Given a vertex cover , we pick our subset by choosing:
The vertex-elements for all .
The edge-elements for all edges with exactly one of in .
Now for the other direction. Given a subset-sum , just take ; the -place forces . Then for each edge , exactly two of were picked, so at least one of is in , as desired.
We chose as the base so that no regrouping can happen. (Think vector-sum, not subset-sum.)