Nondeterministic TMs, Universal Turing Machines, Diagonalization




CS154

Chris Pollett

Apr. 22, 2013

Outline

Nondeterministic Turing Machines

Simulation of Nondeterministic Turing Machines

Theorem Any language decidable by an NTM is decidable by a 3-tape deterministic TM. Further, `\mbox{NTIME}(f(n))` is contained in `cup_{c > 1}\mbox{TIME}(c^{f(n)})`.

Proof: Let `N` be a NTM that recognizes some language. We will make a Turing Machine `D` to simulate `N`. The idea is to have `D` try all possible branches of `N`'s computation. If `D` ever finds an accept state of `N` on any of the branches then `D` accepts. So that we don't get stuck on infinite branches we will do our simulation in an iterated deepening, breadth first manner. `D` will have three tapes: the input tape, a simulation tape, and an address tape. `D` operates as follows:

  1. Initially the input tape has the input and the other two tapes are blank.
  2. `D` copies the input tape to the simulation tape.
  3. `D` then simulate `N` according to the nondeterministic choices on the address tape.
  4. Let `c` be the finite maximum number of choices in any given state reading a given symbol for a next state.
  5. On the address tape we are going to write strings over the alphabet `0, 1, 2, ldots, c-1`, starting with the empty string and proceeding in lexicographical order
  6. If the address tape is blank, `D` checks to see if `N` immediately accepts. Otherwise, `D` writes a `0` on the address tape and simulates `N` one step using the first possible nondeterministic choice. If this doesn't accept, then `D` writes a `1`, erases the simulation tape, and simulate `N` according to the second nondeterministic choice. Once we have tried all single step computations, we then cycle over computations of length 2, etc.

Notice the runtime of this algorithm to simulate `f(n)` steps is `O(1 + c + c^2 + ...+ c^{f(n)}) = O(c^{f(n)+1}) = O(c^{f(n)})` so will be in `mbox{TIME}(c^{f(n)})` by linear speed-up.

Quiz (Sec 1)

Which of the following is true?

  1. To simulate a usual TM with a stay-put TM requires a quadratic slow-down.
  2. Testing whether a string is a Palindrome cannot be done by a single tape TM.
  3. The RAM computational model can simulate a TM with at most a linear slow-down.

Quiz (Sec 3)

Which of the following is true?

  1. Our simulation of a k-tape Turing machine by a 1-tape TM involved a quadratic slowdown.
  2. The RAM model presented in class uses 64 bit registers.
  3. Our simulation of a usual TM with a semi-infinite tape TM only added one new tape alphabet symbol.

Decidability and Encodings

More Decidability

Universal Turing Machines -- Take 1

Universal Turing Machines -- Take 2

Diagonalization

Example Use of the Diagonalization Theorem

Corollary. A countable set `A` is not the same size as its `P(A)`.

Proof. Let `f:A -> P(A)` be a supposed bijection. Since `A` is countable, we have some function `a(k)` to list out its elements `a(0), a(1), a(2), ldots`. An element `X={a(2), a(5), ldots} in P(A)` can be view as an binary sequence `(0, 0, 1, 0, 0, 1, ldots)` where we have a `1` if `a(i)` is in `X` and a 0 otherwise. So `f` satisfies the Diagonalization theorem. A complement of the diagonal for `f` will still be in `P(A)` but not mapped to by `f`.

Non-Recursively Enumerable Languages

Another corollary to the Diagonalization Theorem is the following (recall Turing Recognizable, recursively enumerable, and computably enumerable all mean the same thing):

Corollary. Some languages are not recursive enumerable.

Proof. The set of infinite sequences over `{0,1}` is uncountable, as we just indicated in the last proof there is a bijection between this set and `P(NN)`. On the other hand, each encoding `langle M rangle` of a Turing Machine is a finite string over a finite alphabet. The set of finite strings over an alphabet is countable: a map from the natural numbers first maps to strings of length `0` in lex order, then strings of length `1`, etc.

`A_{TM}` is not Recursive

Theorem. The language `A_{TM}={ langle M,w rangle | mbox{M is a TM and M accepts w}}` is not recursive.

Proof. Suppose `A` is a decider for `A_{TM}`. Fix `M_i` and consider `w's` of the form `langle M_j rangle` for some other TM, `M_j`. Then listing out encodings of TM's in lex order `langle M_0 rangle, langle M_1 rangle, ldots` we can create an infinite binary sequence where we have a `1` in the `j`th slot if `langle M_j rangle` causes `M_i` to halt and a `0` otherwise. If `A` is a decider for `A_{TM}` then we can consider a variant on the complement of the diagonal of the map
`f: langle M_i rangle |-> (A(langle M_i,langle M_0 rangle), A(langle M_i, langle M_1 rangle rangle), ldots)`.
In particular, we can let `D` be the machine:
`D=`"On input `langle M rangle`, where `M` is a TM:

Since `A` is supposed to be a decision procedure for `A_{TM}`, `A` halts on all inputs. Now consider `D(langle D rangle)`. Machine `D` halts if and only if `A` on input `langle D, langle D rangle rangle` rejects. But `A` on input `langle D, langle D rangle rangle` rejects means that `D` did not halt on input `langle D rangle`. This is contradictory. A similar argument can be made about if `D` does not halt `langle D rangle`. Since assuming the existence of `A` leads to a contradiction, hence `A` must not exist. Q.E.D.

Another way to look at this is if you give an `A` which purports to be a decider for `A_{TM}` then we can give a specific input, `langle D, langle D rangle rangle`, which is calculated based on `A` on which `A` fails.