np-hardness
[np-hardness]
np-hardness [np-hardness]
— title: NP-Hardness —
Definition 1. NP-hardness
[np-hard]
Definition 1. NP-hardness [np-hard]
A Language is NP-hard if it is at least as hard as every problem in , i.e., .
There is nothing in this definition that’s really specific to . We could switch it out for other complexity classes if we’d like.
Note that we don’t require our language to be in ! is NP-hard.
Definition 2. NP-Completeness
[NP-complete]
Definition 2. NP-Completeness [NP-complete]
A language is NP-complete if is NP-hard and .
- Theorem. Cook-Levin Theorem
-
SAT is NP-complete.
- Corollary.
-
3SAT is also NP-complete.
- Theorem.
-
If B is NP-complete, , and , then is NP-complete.
- Proof.
-
- Need to show:
We know , i.e. you can solve in terms of .
- So a polytime computable .
- We know : a polytime computable
Let be . This is polytime computable.
- Has the properties: .
Problem. CLIQUE
[CLIQUE]
Problem. CLIQUE [CLIQUE]
Given and , does there exist with such that for all distinct vertices ?
- 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. (reduction)
-
maps to
- If where is a satisfiable 3CNF formula, then where has a clique of size .
maps to
- If where has no satisfiable assignments, then where has no clique of size .
- junk can map to junk
We can show 3SAT can be solved by finding a clique of size .
- Connect every vertex in a block to every other vertex that is not its inverse.
- Then, every clique of size is a possible satisfiable assignment.
- We can’t have and both being true: which is represented by no connecting edges.
We still need to “decode” to … i.e. .
- Let be a clique of size . We must divy it up so that there is exactly one vertex in each group.
- Given a constructed from a problem, then we find a satisfying .
Aside: suppose we want to ensure there is a clique of at least size . We can make a separate, disconnected clique of 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:
- is Polytime computable
Either:
- (converse)
- (inverse)
In a reduction, it’s more typical to show , as it’s often more straightforward. You often want to “decode” to obtain .
Example. CLIQUE problem
Given and , does there exist with such that for all distinct vertices ?
- No specification on size. In our example above, there are cliques of size through .
Theorem: …