5

It's well-known that the language $A_{TM} = \{\langle M,w\rangle: \text{M is a turing machine that accepts w} \}$ is undecidable.

There's a standard proof that's presented in Sipser's "Introduction to the theory of Computation" (and in a number of other online sources I've checked). It's often claimed that the proof uses Cantor's diagonalisation method. I'm not sure I agree, and I was wondering if I've missed something.

The standard proof proceeds as follows. Assume there's a Turing Machine $T$ that decides $A_{TM}$. If $\langle M \rangle$ is an encoding of some turing machine $M$, we can make a second machine $D$ that rejects $\langle M \rangle$ iff $M$ accepts $\langle M \rangle$ and vice versa. $D$ runs by applying $T$ to $\langle M, \langle M \rangle \rangle$ and negating the output. We then observe that $D$ accepts $\langle M \rangle$ iff $M$ rejects $\langle M \rangle$, and in particular $D$ accepts $\langle D \rangle$ iff $D$ rejects $\langle D \rangle$, a contradiction.

It seems to me that this self-referential argument avoids the need to use diagonalisation. The diagonalisation argument should be something like this:

Let $\{M_1, M_2, ...\}$ be a enumeration of the set of Turing machines. Let $\{w_1, w_2, ... \}$ be an enumeration of all inputs. As above, let $T$ decide $A_{TM}$ and use $T$ to construct a machine $D$ that accepts $w_i$ iff $M_i$ rejects $w_i$. By construction, $D$ is not in our list since it disagrees with all other machines on at least one input. This contradicts the assertion that we had enumerated all Turing machines. Therefore $D$ cannot exist.

Note that we can use any sequence of words here: $w_i$ does not need to be a description of $M_i$, unlike in the self-referential proof. So it seems like we can prove non-existence of $D$ either using self-reference (first proof) or by showing it doesn't live in our enumeration of Turing machines (second proof, diagonalization). Is this correct, or have I made a mistake somewhere?

Simon Lyons
  • 151
  • 3

2 Answers2

14

Self-reference and diagonalisation are very closely related. The diagonalisation in your first argument appears when you apply $M$ to $\langle M \rangle$; in the most general sense, diagonalisation is the morphism $X \to X \times X$ given by duplicating the variable: $\lambda x. (x, x)$.

Lawvere's fixed point theorem offers a unifying perspective on these things: see A Universal Approach to Self-Referential Paradoxes, Incompleteness and Fixed Points.

8

You are essentially right that the first proof does not directly use diagonalization, though since it uses a self-referential argument (calling $M$ on input $\langle M \rangle$) it can be thought of as equivalent to diagonalization.

Naïm Favier offers an abstract view of why this is the case; let me be a bit more concrete. Similar to your second proof, let's make an infinite table where the rows are $M_1, M_2, M_3, \ldots$ and the columns are $\langle M_1 \rangle, \langle M_2 \rangle, \langle M_3 \rangle, \ldots$. Now enter a $1$ in the cell at row $i$, column $j$ if $M_i$ accepts $\langle M_j \rangle$ and a $0$ otherwise. For example:

$$ \begin{array}{ccccc} & \langle M_1 \rangle & \langle M_2 \rangle & \langle M_3 \rangle & \cdots \cr M_1 & 1 &&& \cdots \cr M_2 && 0 && \cdots \cr M_3 &&& 1 & \cdots \cr \vdots & \vdots & \vdots & \vdots & \ddots \end{array} $$

If $T$ recognizes $A_{TM}$, then $T$ must accept $\langle M_i, \langle M_j \rangle \rangle$ iff there is a $1$ in row $i$ column $j$. Then we can construct the sequence that differs along the diagonal: the $i$th value is $0$ if $(i, i)$ is $1$ and $1$ otherwise (this is exactly the machine $D$ in your first proof); e.g., $0, 1, 0, \ldots$ in our example above. Due to the fact $T$ is decidable, this sequence is also decidable. But by the diagonal argument this sequence does not appear in any row, which is a contradiction.

Caleb Stanford
  • 7,298
  • 2
  • 29
  • 50