np-hardness [np-hardness]

— title: NP-Hardness —

Definition 1. NP-hardness [np-hard]

A Language LL is NP-hard if it is at least as hard as every problem in NPNP, i.e., ∀A∈NP,A≤PL\forall A \in NP,A\underset{P}{\leq}L.

There is nothing in this definition that’s really specific to NPNP. We could switch it out for other complexity classes if we’d like.

Note that we don’t require our language to be in NPNP! ATMA_{TM} is NP-hard.

Definition 2. NP-Completeness [NP-complete]

A language LL is NP-complete if LL is NP-hard and L∈NPL \in \text{NP}.

Theorem. Cook-Levin Theorem

SAT is NP-complete.

Corollary.

3SAT is also NP-complete.

Theorem.

If B is NP-complete, C∈NPC \in \text{NP}, and B≤PCB\underset{P}{\leq}C, then CC is NP-complete.

Proof.
  • Need to show: A≤PC,∀A∈NPA\underset{P}{\leq}C,\forall A \in \text{NP}
  • We know A≤PBA\underset{P}{\leq}B, i.e. you can solve AA in terms of BB.

    • So ∃\exists a polytime computable f:x∈A⇔f(x)∈Bf:x \in A\Leftrightarrow f(x) \in B.
  • We know B≤PCB\underset{P}{\leq}C: ∃\exists a polytime computable g:y∈B⇔g(y)∈Cg:y \in B\Leftrightarrow g(y) \in C
  • Let h:Σ*→Σ*h:\Sigma \ast \rightarrow\Sigma \ast be h(x)=g(f(x))h(x) = g\left( {f(x)} \right). This is polytime computable.

    • Has the properties: x∈A⇔f(x)∈B⇔g(f(x)∈Cx \in A\Leftrightarrow f(x) \in B\Leftrightarrow g(f(x) \in C.

Problem. CLIQUE [CLIQUE]

Figure 1: Simple Clique

Given G=(V,E)G = \left( {V,E} \right) and kk, does there exist U⊆VU \subseteq V with |U|≥k|U| \geq k such that {u,v}∈E\left\{ {u,v} \right\} \in E for all distinct vertices u,v∈Uu,v \in U?

CLIQUE={⟨G,K⟩:Ghas a clique of sizek}\text{CLIQUE} = \left\{ {\left\langle {G,K} \right\rangle:G\ \text{has a clique of size}\ k} \right\}

  • No specification on size: in our example above, there are cliques of size 0 through 3
Theorem.

CLIQUE is NP-complete: i.e. CLIQUE is NP-hard, and CLIQUE is in NP.

Proof.

CLIQUE is in NP: because there exists a verifier that can check a possible clique in polytime.

CLIQUE is NP-hard: because 3SAT (known NP-hard problem) reduces to CLIQUE. How can we do that?

Proof. 3SAT≤PCLIQUE\text{3SAT}\underset{P}{\leq}\text{CLIQUE} (reduction)

x∈3SATx \in \text{3SAT} maps to f(x)∈CLIQUEf(x) \in \text{CLIQUE}

  • If x=⟨φ⟩x = \left\langle \varphi \right\rangle where φ\varphi is a satisfiable 3CNF formula, then f(x)=⟨G,k⟩f(x) = \left\langle {G,k} \right\rangle where GG has a clique of size kk.

x∉3SATx \notin \text{3SAT} maps to f(x)∉CLIQUEf(x) \notin \text{CLIQUE}

  • If x=⟨φ⟩x = \left\langle \varphi \right\rangle where φ\varphi has no satisfiable assignments, then f(x)=⟨G,k⟩f(x) = \left\langle {G,k} \right\rangle where GG has no clique of size kk.
  • junk can map to junk
Figure 2: Complex Clique

We can show 3SAT can be solved by finding a clique of size kk.

  • Connect every vertex in a block to every other vertex that is not its inverse.
  • Then, every clique of size kk is a possible satisfiable assignment.
  • We can’t have xix_{i} and xi_x_{i}^{\_} both being true: which is represented by no connecting edges.

We still need to “decode” f(x)∈Bf(x) \in B to x∈Ax \in A… i.e. f(x)∈CLIQUE⇒x∈3SATf(x) \in \text{CLIQUE}\Rightarrow x \in \text{3SAT}.

  • Let UU be a clique of size kk. We must divy it up so that there is exactly one vertex in each group.
  • Given a f(x)∈CLIQUEf(x) \in \text{CLIQUE} constructed from a 3SAT\text{3SAT} problem, then we find a satisfying x∈3SATx \in \text{3SAT}.

Aside: suppose we want to ensure there is a clique of at least size k−1k - 1. We can make a separate, disconnected clique of k−1k - 1 vertices. What’s this useful for? Don’t know yet…

cook-levin

theorem

When desigining a reduction: if you want to show that your reduction is correct, you need to show that:

  1. ff is Polytime computable
  2. x∈A⇒f(x)∈Bx \in A\Rightarrow f(x) \in B
  3. Either:

    • f(x)∈B⇒x∈Af(x) \in B\Rightarrow x \in A (converse)
    • x∉A⇒f(x)∉Bx \notin A\Rightarrow f(x) \notin B (inverse)

In a reduction, it’s more typical to show x∈A⇒f(x)∈Bx \in A\Rightarrow f(x) \in B, as it’s often more straightforward. You often want to “decode” f(x)∈Bf(x) \in B to obtain x∈Ax \in A.

Example. CLIQUE problem

Given G=(V,E)G = \left( {V,E} \right) and kk, does there exist U⊆VU \subseteq V with |U|≥k\left. |U \middle| \geq k \right. such that {u,v}∈E\left\{ {u,v} \right\} \in E for all distinct vertices u,v∈Uu,v \in U?

CLIQUE={⟨G,K⟩:Ghas a clique of sizek}\text{CLIQUE} = \left\{ {\langle G,K\rangle:G\ \text{has a clique of size}\ k} \right\}

  • No specification on size. In our example above, there are cliques of size 00 through 33.

Theorem: …