34.4 NP-completeness proofs

Document last modified: 

A language L ⊆ {0, 1}* is NPC if:

  1. L ∈ NP and

  2. L' p L, ∀ L' ∈ NP

This seems to say that we have to show that all L' ∈ NP have to be reduced to L in order to show L is in NPC. 

But this is not so:

because of transitivity, by reducing a known NP-complete Language L' to L, we implicitly reduce every language in NP to L.

 

NP-hard - A language L that satisfies L' ≤p L, ∀ L' ∈ NP (means every language in NP can be reduced in polynomial time to L).

Lemma 34.8

Given: L is a language such that L' p L for some L' ∈ NPC

Proof

L'' p L', ∀ L'' ∈ NP                     property 2 in NPC definition L' ∈ NPC

L is NP-hard                               By transitivity, L'' p L'p L, so L' ≤p L, ∀ L' ∈ NP.
                                                 Satisfies property 2 of NPC.

L ∈ NPC                                     If L ∈ NP then satisfies property 1 of NPC definition.

Means that by reducing a known NP-complete language L' to L, we implicitly can reduce every language in NP to L.

The General Method for proving L ∈ NPC

  1. Prove L ∈ NP by showing that a solution can be verified in polynomial time.

  2. Select a known NPC language L' (e.g. CIRCUIT-SAT)

  3. Describe an algorithm that computes a function f that maps every instance of x ∈ {0, 1}* of L' to an instance f(x) ∈ L

  4. Prove that the function f satisfies x ∈ L' iff f(x) ∈ L, ∀ x ∈ {0, 1}*

  5. Prove that F runs in polynomial time (F is the algorithm that computes the function f)

Example - Prove Formula satisfiability is NPC

SAT = { <φ>: φ is an instance of a Boolean formula}

φ is composed of:

Example Formula: φ = ((x1 → x2) v ¬((¬x1 ↔ x3) v x4)) ^ ¬x2

n = 4, m = 8

Overall Steps for Showing SAT ∈ NPC

  1. Show SAT ∈ NP

    ASAT(φ,y) = 1

    ASAT runs in polynomial time by just replacing each xi with its corresponding value from y and evaluating expression. Simulate φ to verify certificate.

  2. Show CIRCUIT-SAT p SAT

    1. Select a known NPC language L' (i.e. choose CIRCUIT-SAT)

    2. Describe an algorithm F that computes a function f, mapping every instance of x ∈ {0, 1}* of CIRCUIT-SAT to an instance f(x) ∈ SAT

      See below.

    3. Prove that the function f satisfies: x ∈ CIRCUIT-SAT iff  f(x) ∈ SAT, ∀ x ∈ {0, 1}*

    4. Prove that F computes f in polynomial time

CIRCUIT-SAT p SAT has been shown.

 

SAT ∈ NP and CIRCUIT-SAT p SAT

Hence SAT ∈ NPC

By Lemma 34.8, if L is a language such that L' p L for some L' ∈ NPC, then L is NP-hard. Also, if L ∈ NP then L ∈ NPC.

That is: if SAT is a language such that CIRCUIT-SAT p SAT for CIRCUIT-SAT ∈ NPC, then SAT is NP-hard. Also, if SAT ∈ NP then SAT ∈ NPC.

What is the function f ?
  • Convert the circuit to a φ

    Example: φ = ((x1 → x2) v ¬((¬x1 ↔ x3) v x4)) ^ ¬x2

  • Label each wire in the circuit x1, x2, x3, ..., xn, these become φ's Boolean variables.
  • Write a formula for each gate expressed in terms of all the wires incident on that gate.
    For example:

       (x4 ↔ ¬x3)    i.e., x4 is true iff ¬x3 is true

Figure 34-10 from Cormen

 

What This Reduction Shows

CIRCUIT-SAT p SAT

So we can construct a machine as follows:
  • A1 is CIRCUIT-SAT ∈ NPC
  • A2 is SAT
  • F is the polynomial-time reduction algorithm that computes the function f
  • x is a problem instance of CIRCUIT-SAT
  • f(x) is a problem instance of SAT

Figure 34.5 from Cormen