Lecture 23 NPHard Problems Easy to verify problems
Lecture 23 NP-Hard Problems
“Easy to verify” problems: NP • All decision problems such that we can verify the correctness of a solution in polynomial time. • Example: 3 -COLORING input Prover: Yes, the graph can be colored by 3 colors.
“Easy to verify” problems: NP • All decision problems such that we can verify the correctness of a solution in polynomial time. • Example: 3 -COLORING Prover: Yes, the graph can be colored by 3 colors. Verifier: OK, that is indeed a solution.
NP-hard problems • A problem A is NP-hard, if for all problem B in NP, B can be reduced to A in polynomial time. • A is “harder” than all problems in NP, hence NP-hard. • A problem A is NP-complete, if it is in NP and also NP-hard. • NP-hard but not NP-complete? • May not be a decision problem, e. g. longest path. • May be even harder than NP-complete problems.
Relationships NP-hard NP-complete NP P
NP-complete problems • Claim: All NP-complete problems are equally hard. For any two NP-complete problems A, B, A can be reduced to B and B can be reduced to A. • Claim: If any NP-complete problem has a polynomial time algorithm, then P = NP. • Claim: If A can be reduced to B, B can be reduced to C, then A can be reduced to C. • How do we prove a problem is NP-complete?
The first NP-complete problem • Gates • Circuits
CIRCUIT-SAT problem • Given a circuit with n inputs and 1 output, is there a possible input (represented by n-bit binary string) that makes the output 1? • Clearly in NP: • Prover gives the input as an n-bit string, • Verifier follows the circuit and computes the output, check that it is indeed 1. • Theorem[Cook-Levin] CIRCUIT-SAT is NP-complete.
Proof idea of Cook-Levin Verify(color[]) //color[] is an array with 0, 1, 2 FOR each edge (u, v) IF color[u]<>color[v] THEN RETURN FALSE RETURN TRUE NP-hard problem Verifier
Proof idea of Cook-Levin Verify(color[]) //color[] is an array with 0, 1, 2 FOR each edge (u, v) IF color[u]<>color[v] THEN RETURN FALSE RETURN TRUE Input: binary CIRCUIT encoding of color[] Output: SAT instance! Compiler True/False 01010101 0010101011 Machine code
Other NP-hard Problems A NP-Hard Reduction B NP-Hard
INDEPENDENT SET • Given a graph, decide whethere is a set of k vertices, such that no two vertices in the set are connected by an edge.
CLIQUE • Given a graph, decide whethere is a set of k vertices, such that all pairs of vertices in the set are connected by an edge. • Claim: INDEPENDENT SET can be reduced to CLIQUE.
3 -SAT •
Reductions • Claim: CIRCUIT-SAT can be reduced to 3 -SAT. (therefore 3 -SAT is also NP-complete). • Claim: 3 -SAT can be reduced to INDEPENDENT SET. CIRCUIT -SAT NP-complete 3 -SAT NP-complete INDSET NP-complete CLIQUE NP-complete
- Slides: 15