MIT 6.1220 — Lecture 14

Intractability (Part II)

Definition (Karp Reduction). A Karp reduction from QQ to π\pi is a deterministic algorithm RR such that:

If RR exists, we say Q≤PπQ \leq_P \pi. In other words, QQ is no harder than π\pi.

Claim. Given a Karp reduction from QQ to π\pi and an efficient π\pi-solver, we have an efficient QQ-solver.

Proof: Duh, obviously.   ■\blacksquare

Note that “Karp” is an abbreviation of “polynomial-time many-one”.

Definition (NP-Hard). A problem π\pi is NP-hard if and only if for every Q∈NPQ \in \textbf{NP}, we have Q≤PπQ \leq_P \pi.

Definition (NP-Complete). A problem π\pi is NP-complete if and only if π\pi is NP-hard and π∈NP\pi \in \textbf{NP}.

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 Q∈NPQ \in \textbf{NP}. Because QQ is in NP, it has a verifier algorithm AQA_Q. Implement AQA_Q as a polynomial-sized boolean circuit; that is, express AQA_Q in hardware. Now run Circuit-Sat on this circuit.

More formally, Turing Machine blah blah blah.   ■\blacksquare

Definition (CNF). A formula is in kk-CNF (Conjunctive Normal Form) if it is an AND (∧)(\wedge) of clauses, each of which is an OR (∨)(\vee) of exactly kk literals—variables and their negations (¬)(\neg).

Remark. Other definitions exist; for example, some definitions allow 00 and 11 to be literals.

For example, (x1∨¬x2)∧x3(x_1 \vee \neg x_2) \wedge x_3 is not in kk-CNF for any kk, but (x1∨¬x2)∧(x3∨x3)(x_1 \vee \neg x_2) \wedge (x_3 \vee x_3) 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 Q∈NPQ \in \textbf{NP}, 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 kk, find kk disjoint edges…

Claim. Consider Vertex-Cover, which asks whether a graph has a vertex cover of size at most KK.

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:

If we have nn variables and mm clauses, we'll have nn line segments and mm triangles. (Check: poly-time reduction.)

Now set K=n+2mK = n + 2m. We must then:

Formally, a proof goes both ways: 3-Sat →\rightarrow Vertex-Cover and Vertex-Cover →\rightarrow 3-Sat. Do this!   ■\blacksquare

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 SS of positive integers and a target ℓ\ell, asks if there is a T⊆ST \subseteq S with ∑t∈Tt=ℓ\sum_{t \in T} t = \ell.

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 GG has mm edges, enumerated {ei}i=1m\{e_i\}_{i = 1}^m, and we seek a vertex cover of size exactly K≤∣V∣K \leq |V|; padding a smaller cover with arbitrary extra vertices makes this the same question as “at most KK”.

Of course, we should really be thinking in base 44. When we select a subset of {sei}∪{sv}\{s_{e_i}\} \cup \{s_v\},

Let's write out both directions explicitly this time.

Given a vertex cover V′⊆VV' \subseteq V, we pick our subset by choosing:

Now for the other direction. Given a subset-sum T⊆ST \subseteq S, just take V′:={v∈V∣sv∈T}V' := \{v \in V \mid s_v \in T\}; the 4m4^m-place forces ∣V′∣=K|V'| = K. Then for each edge ei=v1↔v2e_i = v_1 \leftrightarrow v_2, exactly two of {ei,v1,v2}\{e_i, v_1, v_2\} were picked, so at least one of {v1,v2}\{v_1, v_2\} is in V′V', as desired.

We chose 44 as the base so that no regrouping can happen. (Think vector-sum, not subset-sum.)   ■\blacksquare