NP-completeness

Intro

A decision problem XX is NP-complete (NPC) if XNPX \in NP and XNPhardX \in NP-hard.

Certificate and Certifier

Algorithm C(s,t)C(s, t) is a certifier for problem XX if \forall string s, sXs \in X iff \exists a string t (certificate) such that C(s,t)=yesC(s, t) = yes.

Ex. 3-SAT Given a CNF formula ϕ\phi, is there a satisfying assignment?

  • Certifier:

    Check each clause in ϕ\phi has least one true literal

  • Certificate:

    a solution (assignment to boolean variables) that

    satisfies ϕ\phi

  • instance ss: ϕ=(x1x2x3)(x1x2x3)(x1x2x4)\phi = (\overline{x_1} \lor x_2 \lor x_3) \land (x_1 \lor \overline{x_2} \lor x_3) \land (\overline{x_1} \lor x_2 \lor x_4)

  • certificate t: x1=true,x2=true,x3=false,x4=falsex_1 = true, x_2 = true, x_3 = false, x_4 = false

Reduction

A reduction from problem A \rightarrow problem B is to construct a polynomial time algorithm that converts A inputs \rightarrow equivalent B inputs (same yes/no answer). If we know how to solve B, then we know how to solve A. So if BPB \in P, then APA \in P. If BNPB \in NP, then ANPA \in NP. B is at least as hard as A. (A p\leq_pB)

Prove NPC

It's good to know so we can give up on searching a polynomial algorithm for this problem ᵔᴥᵔ. So how do we prove a problem XX is NP-complete? 1. XNPX \in NP (give a certificate and a ploy-time certifier) 2. reduce from a known NPC problem (3-SAT is a good choice for almost anything)

Cook and Levin did all the ground work to prove Circuit-SAT and 3-SAT are NPC. Here we are just gonna show NPC with reduction.

Prove 3-SAT is NPC

We need a poly-time certifier to check a certificate of 3-SAT. Therefore, 3SAT NP\in NP.

Now we need to pick a known NPC problem and show 3-SAT is harder. We decide to reduce from Circuit-SAT to 3-SAT (Circuit-SAT p\leq_p3-SAT). We want to construct a poly-time algorithm that converts C-S inputs to 3-SAT inputs such that a 3-SAT instance ϕ\phi is satisfiable iff the C-S inputs have an output of 1.

The conversion algorithm has 3 steps.

Reduction Proof Let KK be any circuit

\Leftarrow there are inputs of KK that have output 1. can convert input values to create values at all nodes of KK. This input satisfies ϕ\phi.

\Rightarrow ϕ\phi is satisfiable. 3-SAT clauses were designed to ensure the values assigned to all nodes in KK match exactly what the circuit would compute.

Reference

Algorithm Design Chapter 8 Intractability

Last updated