`NP` and `NP`-completeness




CS254

Chris Pollett

Feb 20, 2017

Outline

The class `NP` - Some Intuitions

The Definition of `NP`

Definition. A language `L subseteq {0, 1}^star` is in `NP` if there exists a polynomial `p: NN -> NN` and a polynomial time TM `M` (called the verifier for `L`) such that for every `x in {0, 1}^star`,
`x in L iff exists u in {0, 1}^(p(|x|)) mbox( s. t. ) M(x,u) =1`
If `x in L` we call a `u in {0, 1}^(p(|x|))` such that `M(x,u) =1` a certificate.

Some examples

More Examples

Quiz

Which of the following statements is true?

  1. If `f(x), g(y)` are a primitive recursive functions, then `g(f(x))` will be a primitive recursive function.
  2. The r.e. sets are all decidable.
  3. Our `O(T log T)` universal simulation uses as alphabet `{\Delta, \square, 0, 1 }`.

The Relationship Between `P` and `NP`

Claim. `P subseteq NP subseteq EXP`.

Proof. (`P subseteq NP`) Suppose `L in P` is decided in polynomial-time by a TM `N`. Then `L in NP`, since we can take `N` as the machine `M` from the definition of `NP` and we can take our polynomial `p` from that definition to be the zero polynomial.

(`NP subseteq EXP`) If `L in NP` and `M`, `p()` are as in our definition for `NP`, and `x` is an input to `L` then we can enumerate in exponential time each of the `2^(O(p(|x|)))` strings `u` of length `p(|x|)` and use `M` to check whether `u` is a valid certificate for `x`. This `EXP` machine accepts iff such a `u` is ever found.

Nondeterministic Turing Machines

Definition. For every function `T: NN -> NN` and `L subseteq {0,1}^star`, we say that `L in NTIME(T(n))` if there is a constant `c > 0` and a `c cdot T(n)`-time NDTM `M` such that for every `x in {0, 1}^star`, `x in L iff M(x) = 1`.

The Definitions Coincide

Theorem. `NP = cup_(c in NN)NTIME(n^c)`.

Proof. The main idea is that the sequence of nondeterministic choices made by an accepting computation of an NDTM can be viewed a certificate that the input is in the language, and vice-versa.

Suppose `p: NN -> NN` is a polynomial and `L` is decided by NDTM `N` that runs in time `p(n)`. For every `x in L`, there is a sequence of nondeterministic choices that make `N` reach `q_(a\c\cept)` on input `x`. We can use this sequence as a string `u` in `{0, 1}^(p(|x|))`. This certificate could be used by a deterministic polynomial time machine which simulates the actions of `N` using these choices and verifies that it would have entered `q_(a\c\cept)` after using the choices. Thus, `L in NP`.

Conversely, if `L in NP`, we can come up with an NDTM that decides `L` in the following manner: On input `x`, it uses its ability to make nondeterministic choices to write down on one of its work tapes a string `u` of length `p(|x|)`. Thereafter it runs the deterministic algorithm of the verifier `M` that was used on in the definition of `L in NP`, to check if this is a valid certificate on input `x`. If it is, it enters the state `q_(a\c\cept)`.

Reducibility and NP-completeness

Definition. A language `L in {0,1}^star` is polynomial-time Karp reducible to a language `L' subseteq {0, 1}^star`, denoted by `L le_(p) L'`, if there is a polynomial time computable function `f:{0,1}^star -> {0, 1}^star` such that for every `x in {0, 1}^star`, `x in L` iff `f(x) in L'`.

We say that `L'` is `NP`-hard if `L le_(p) L'` for every `L in NP`. We say that `L'` is `NP`-complete if `L'` is in `NP` and is `NP`-hard.

Properties of Reducibility

Theorem.

  1. If `L \leq_p L'` and `L' \leq_p L''`, then `L \leq_p L''`.
  2. If a language `L` is `NP`-hard and `L in P`, then `P = NP`.
  3. If a language `L` is `NP`-complete, then `L in P` iff `P =NP`.

Proof. (1) Follows because the runtime of the composition of two polynomial time function can be bounded by a polynomial. (2) and (3) Follow from the observation of the last slide.