MIT 18.404 — Lecture 6

TM Variants, Church-Turing Thesis

Grades for PSET 1 have been released on Gradescope. We have a quiz next Tuesday (October 6th) from 7:30 PM to 9:00 PM in Walker; sample questions will be posted on the course website.

§ Turing Machines (Recap) & The Church-Turing Thesis

Recall the definition of a Turing machine from Lecture 5. Importantly, for any word ww, a Turing machine MM can either:

ACCEPT   (enter qaccq_{\mathrm{acc}})     ∥\parallel     REJECT BY HALTING   (enter qrejq_{\mathrm{rej}})     ∥\parallel     REJECT BY LOOPING   (never halt)

The Turing machine will be our model for a general-purpose computer.

Question. Why is a one-tape TM our choice of model? Why not anything else?
(Recall that a PDA with two stacks is strictly more powerful than a PDA with just one stack.)

Answer: As we'll eventually show in this course, it turns out that a one-tape TM is equally as powerful as, say, Python or Java, because one can compile code in any one of these “languages” into any other. In fact…

Theorem. (The Church-Turing Thesis) Any function computable by an “algorithm” is computable by a Turing machine.

(The Church-Turing thesis is more of a heuristic than a theorem.)

Definition. Also recall from Lecture 5 the following properties of languages and TMs.

§ Multi-Tape Turing Machines

Definition. We say that a multitape Turing machine MM is a TM with multiple tapes, naturally.

In particular, the transition function of a multitape Turing machine with kk tapes has type δ ⁣:Q×Γk→Q×Γk×{L,R}k\delta \colon Q \times \Gamma^k \to Q \times \Gamma^k \times \{\mathrm{L}, \mathrm{R}\}^k.

Theorem. (Multitape = Single Tape) A language AA is Turing-recognizable if and only if A=L(M)A = L(M) for some multitape TM MM.

Proof: The   ⟹  \implies direction is obvious. For the   ⟸  \impliedby direction, a one-tape TM SS can simulate a multitape TM MM like so.

The idea is to simply store the concatenation of all kk tapes in a single tape.

Details omitted, but they're not hard to implement.   ■\blacksquare

Remark. It follows that “a PDA with 100 stacks plus a tape” is equally as powerful as “an FA plus a tape”.

§ Nondeterministic Turing Machines

Definition. We say that a nondeterministic Turing machine (NTM) MM is a TM that's nondeterministic, naturally. The transition function has type δ ⁣:Q×Γ→P(Q×Γ×{L,R})\delta \colon Q \times \Gamma \to \mathcal{P}(Q \times \Gamma \times \{\mathrm{L}, \mathrm{R}\}).

Theorem. (NTM = TM) A language AA is Turing-recognizable if and only if A=L(N)A = L(N) for some NTM NN.

Proof: The   ⟹  \implies direction is obvious.

For the   ⟸  \impliedby direction, the idea is for a one-tape TM MM to BFS through the tree of computation paths of NN.

In the single tape of MM, we simply store the state of all threads of NN, moving down one layer at a time.

As before, threads are separated with #\str{\#}, and tape heads are indicated by the ∙\bullet in c∙\str{c}^{\bullet}. Furthermore, each block begins with a cell that stores the FA state that the thread lands at (e.g., q2q_2, q3q_3, or q5q_5, as shown above).

So the TM should BFS through all threads layer-by-layer and return ACCEPT\str{ACCEPT} if any thread returns ACCEPT\str{ACCEPT}. (Details omitted.)   ■\blacksquare

§ Enumerators (Turing Machines with Printers)

Definition. We say that an enumerator EE is a Turing machine that takes no inputs and prints outputs. Specifically,

We let L(E)L(E) denote the set of strings that EE eventually prints.

Theorem. (Enumerator = TM) A language AA is Turing-recognizable if and only if A=L(E)A = L(E) for some enumerator EE.

Proof: We first consider the   ⟸  \impliedby direction: given any AA for which A=L(E)A = L(E), we construct a TM MM for which A=L(M)A = L(M).

Solution: On input ww, simply simulate EE on a blank tape. During the simulation, check everything it prints for whether it matches ww. If there's ever a match, return ACCEPT\str{ACCEPT}.   □\square

Now for the   ⟹  \implies direction: given any MM for which A=L(M)A = L(M), we construct an enumerator EE that prints out AA.

Solution: The rough idea is brute force: for each x∈Σ∗x \in \Sigma^*, simulate MM on xx, and print xx if MM accepts. There are two issues:

  • If we try to simulate one x∈Σ∗x \in \Sigma^* at a time, then we might fail if a simulation of MM on xx loops.

  • If we try to simulate one layer at a time, then we'll never get past the first layer because Σ∗\Sigma^* is infinite.

(In a rough sense, the former is DFS, and the latter is BFS—but this time, they both fail.)

The fix is similar to how we prove ∣Q∣=∣N∣|\mathbb{Q}| = |\mathbb{N}|; do a “zig-zag” across both Σ∗\Sigma^* and layers, like so.

More formally, in the ithi^{\text{th}} step, run (x1,x2,…,xi)(x_1, x_2, \dots, x_i) up to the ithi^{\text{th}} layer, and do this for all i∈Ni \in \mathbb{N}.   □\square

This completes the proof of both directions. (Again, many details omitted.)   ■\blacksquare