Theorem. Certificates and Verifiers [certificates-verifiers]

NP has two main, equivalent definitions:

  1. There exists a nondeterministic polytime TM MM that decides LL.
  2. There exists a deterministic polytime TM VV and a constant cc s.t.:

    • L={xΣ*:yΣ*s.t.|y||x|cVaccepts(x,y)}L = \left\{ {x \in \Sigma \ast :\exists y \in \Sigma \ast \text{s.t.}\ |y| \leq |x|^{c} \land V\ \text{accepts}\ \left( {x,y} \right)} \right\}
    • where xx is the “input”, yy is the “certificate”, VV is the “verifier”

i.e. for the three color graph, give us a colored graph and we can verify it

The certificate yy serves as the verifier VV’s substitute for nondeterminism.

Example. Verifying 3colormap

Claim: 3colormap \in Np (complexity class).

  • {G:Gis 3-colorable}\left\{ {\left\langle G \right\rangle:G\ \text{is 3-colorable}} \right\}
  • Must find a deterministic polytime TM V s.t. 3COLOR={x:y,|y||x|c,Vaccepts(x,y)}\text{3COLOR} = \left\{ {x:\exists y,|y| \leq |x|^{c},V\ \text{accepts}\ \left( {x,y} \right)} \right\}
  • Code for VV: on input (x,y)\left( {x,y} \right)

    • If xx not of form , where is a Graph, reject
    • From yy, extract values color(v){1,2,3}\text{color}(v) \in \left\{ {1,2,3} \right\} for each vVv \in V
    • For every edge {u,v}E\left\{ {u,v} \right\} \in E: if color(u) == color(v), reject
    • Otherwise accept
  • yy does exist, it’s simply a valid coloring of the graph

To show correctness of VV, we need three things:

  1. If x=Gx = \left\langle G \right\rangle and G is 3-colorable: need ys.t.|y||x|c\exists y\ \text{s.t.}\ |y| \leq |x|^{c} and Vaccepts(x,y)V\ \text{accepts}\ \left( {x,y} \right).

    • It does exist, yy can be a valid 3 coloring of GG. Note: |y|=O(n)|y| = O(n) and |x|=Ω(n)|x| = \Omega(n)
  2. If xGx \neq \left\langle G \right\rangle where G is 3-colorable: then no certificate yy should make VV erroneously accept.

    • If xx not of form G\left\langle G \right\rangle: vv definitely rejects.
    • If xx of form G\left\langle G \right\rangle by not 3-colorable, then VV must reject because it always checks that yy is a valid coloring.
  3. Must check that VV runs in time polynomial in |xy||xy|.

Example. Proofs of equivalence of our NP definitions

Proof. (2)(1)(2)\Rightarrow(1)

  • Given verifier VV, must construct a NTM MM deciding LL
  • Inputs to the verifier are xx and yy, with |y||x|c|y| \leq |x|^{c}

  • Code for MM:

    • On input xx, nondeterministically pick yΣ*y \in \Sigma \ast with |y||x|c|y| \leq |x|^{c}
    • Run VV on input (x,y)\left( {x,y} \right)
    • Accept if VV accepts. Reject if VV rejects.

    i.e. Suppose xLys.t.Vaccepts(x,y)there is a leaf whereMacceptsx \in L\Rightarrow\exists y\ \text{s.t.}\ V\ \text{accepts}\ \left( {x,y} \right)\Rightarrow\text{there is a leaf where}\ M\ \text{accepts}. If xLys.t.Vaccepts(x,y)leafx \notin L\Rightarrow\nexists y\ \text{s.t}.V\ \text{accepts}\ \left( {x,y} \right)\Rightarrow\nexists\ \text{leaf}, so MM does not accept xx.

Proof. (1)(2)(1)\Rightarrow(2)

  • Given an NTM MM, you can convert that into a verifier VV for LL.
  • Input to MM is xx, runtime is at most |x|c|x|^{c}
  • Idea: VV simulates the tree, but only on a single branch of configuration tree. yy specifies which branch. nondeterminism comes into play by letting us pick the correct branch.

    • our nondeterminism lets us pick the correct branch: then the cc term is the depth of the path, which is at most polynomial
  • Code for MM:

    • Simulate MM deterministically on input xx, using yy as the sequence of nondeterministic decisions
    • Accept if MM accepts. Reject if MM rejects.