Nondeterminism and Complexity
Recall that for finite automata (and stack automata, too) that nondeterminism occurs when a state has more than one defined behaviour for a given input. In Turing machines, nondeterminism occurs when a program can branch into two paths from the same program and memory state (of the tape head).
  ├ p.goto y
  └ q.goto z
The word "verifier" comes from what one might stretch to consider a physical interpretation of nondeterministic Turing machines. One way to interpret nondeterminism is as a kind of search procedure, more specifically "search-for-an-answer". Each time a path through a Turing machine proceeds down one branch instead of another upon arriving at a nondeterministic state, the machine is "taking a guess" at which path ends in the correct result. A halting path is then interpreted as a "check", in the sense that it checks the resulting string on the tape to see if the guesses it made along the way result in the desied output.
So far, we have assumed that all Turing machines are deterministic. To make it clear that we are no longer making this assumption, from here on out when we want to allow a Turing machine to be nondeterministic (not require, but allow), we will call it a general Turing machine.
- every run of \(\mathcal T\) starting from \(x\) is finite (there are no unending loops), and
- for any \(w \in A^*\), \(w \in L\) if and only if there is a halting run starting from \(x\) on input \(w\) that accepts (returns the string \(1\)).
The family of verifiable languages is written \(\mathsf{Ver}\).
if _ : write 1.goto v
if 1 : move right.goto z
if 0 :
  ├ move right.goto u
  └ move right.goto z
state u
if _ : write 1.halt
if 0 : erase.move right.goto u
if 1 : erase.move right.goto u
state z
if _ : halt
if 0 : erase.move right.goto z
if 1 : erase.move right.goto z
The worst-case runtime of a verifier is also a guess-and-check procedure, but it is less idealistic about the difficulty of finding an accepting run.
There are analogous families of languages for the complexity of verification.
The family of all languages that are verifiable in polynomial time is written \(\mathsf{NP}\).
\(\mathsf{P}\) versus \(\mathsf{NP}\)
If you will recall from the theory of regular languages, Kleene's theorem implied that nondeterministic automata are equal in expressiveness as total deterministic automata: they can decide the same family of languages. This actually doesn't hold for context-free languages: there are context-free languages that cannot be decided with any deterministic stack automaton. You have already spent time with a famous example of this, namely \(\{ww^{op} \mid w \in \{0,1\}^*\}\). It might therefore come as a surprise that in fact, general Turing machines are equal in expressivity to deterministic ones.
Every decision procedure is a verifier, so we immediately see that \[ \mathsf{Dec} \subseteq \mathsf{Ver} \] The opposite inclusion takes much more work to arrive at.
We failed to mention this in the Church-Turing thesis section. Why? We focused on \(k\)-tape Turing machines, multiple-symbols-to-two-symbols conversion, and even Turing machines that run on sheets because, if these run in polynomial time, then the deterministic Turing machine that simulates them also runs in polynomial time (this is not obvious, but it is true). This raises a very important problem with the deterministic Turing machine constructed in the proof above: even if the original (general) Turing program runs in polynomial time, it is likely that the constructed deterministic Turing machine runs in at least exponential time. This is simply because the number of paths that the deterministic Turing machine simulating the verifier has to sift through is in the worst case \(\mathcal O(b^{n^k})\) if there is a state that branches into \(b\) different paths somewhere in \(\mathcal V\) and the state runs in (nondeterministically) \(\mathcal O(n^k)\)-time. This immediately leads us to the following definition and theorem.
This figure is not to scale! There are problems solvable in exponential time that are not in \(\mathsf{NP}\). And in reality, there are many complexity classes between \(\mathsf{EXP}\) and \(\mathsf{Dec}\).
The proof of the Determinism Suffices theorem does not tell us that a given language \(L \in \mathsf{NP}\) cannot be decided in polynomial time, it just doesn't give us a way of showing that it is. This is actually the subject of (probably) one of the most important open problems in modern mathematics.
Solving this "bonus problem" above is an incredibly active area of research! Since we don't know the answer, we prefer instead to find solace in the techniques we do have.
- Draw an instance of the reachability problem.
- Come up with a faithful string representation of the reachability problem.
- Show that the reachability problem is in \(\mathsf{NP}\).