COMS W3261 CS Theory
Lecture 15: The Diagonalization Language
1. Reducing One Problem to Another
- Suppose we have an algorithm A to transform instances of one
problem P_{1}
to instances of another problem P_{2} in such a way
that a string w is in P_{1} if and only if
the transformed string A(w) is in P_{2}.
What this implies is that we can solve instances of problem P_{1}
by converting them to instances of problem P_{2} and then
using the solution to problem P_{2} to answer the original question.
If we can do this, then we will say that A is a reduction of
P_{1} to P_{2}.
- Note that a reduction from P_{1} to P_{2} must turn
every instance of P_{1} with a yes answer to an instance of
P_{2} with a yes answer, and every instance of P_{1}
with a no answer to an instance of P_{2} with a no answer.
- We will frequently use this technique to show that problem P_{2}
is as hard as problem P_{1}.
- The direction of the reduction is important.
- For example, if there is a reduction from P_{1} to P_{2}
and if P_{1} is not recursive, then P_{2}
cannot be recursive. (Why?)
- Similarly, if there is a reduction from P_{1} to P_{2}
and if P_{1} is not recursively enumerable, then P_{2}
cannot be recursively enumerable. (Why?)
2. Enumerating the Binary Strings
- In many proofs involving Turing machines, we need to enumerate the binary strings and
encode Turing machines so that we can refer to the ith
binary string as w_{i}
and the ith Turing machine as M_{i}.
- The binary strings are easy to enumerate. If w is a binary string, we shall
treat 1w as the binary integer i so we can call w the
ith string.
- Using this encoding, the empty string is the first string, 0 the second, 1 the third,
00 the fourth, 01 the fifth, and so on. Henceforth
we will refer to the ith string as w_{i}.
3. Codes for Turing machines
- We will now define a binary code for all Turing machines with the input alphabet {0, 1}
so that each Turing machine can be represented by a binary string.
This will allow us to talk about the ith Turing machine
as M_{i}. We will adopt the following conventions:
- We assume the states are q_{1}, q_{2}, . . . ,
q_{r} for some r. We assume q_{1}
will always be the start state. We assume q_{2} will be the only
accepting state. We need only one accepting state if we assume the Turing machine
halts whenever it enters an accepting state.
- We assume the tape symbols are X_{1}, X_{2}, . . . ,
X_{s} for some s. We assume X_{1}
is 0, X_{2} is 1, and X_{3} is the blank.
- We assign integers D_{1} and D_{2}
to the tape head directions left and right.
- Now we can encode a transition rule
δ(q_{i}, X_{j}) =
(q_{k}, X_{l}, D_{m})
as a binary string C of the form
0^{i}10^{j}10^{k}
10^{l}10^{m}
- Suppose there are n transition rules.
The binary code for the entire Turing machine will be the concatenation of the
codes for all of the transitions (in some order) separated by pairs of 1's:
C_{1}11C_{2}11 …
C_{n-1}11C_{n}
- Note that there can be many encodings for the same Turing machine.
- We can encode a pair (M_{i}, w) consisting of a Turing machine
and a string by appending 111 to the encoding of the Turing machine and then appending
the string w.
4. The Diagonalization Language L_{d} is not Recursively Enumerable
- We define L_{d}, the diagonalization language, as follows:
- Let w_{1}, w_{2}, w_{3}, . . .
be an enumeration of all binary strings.
- Let M_{1}, M_{2}, M_{3}, . . .
be an enumeration of all Turing machines.
- Let L_{d} = { w_{i} |
w_{i} is not in L(M_{i}) }.
- Theorem: L_{d} is not a recursively enumerable language.
Proof:
- Suppose L_{d} = L(M_{i}) for some TM
M_{i}.
- This gives rise to a contradiction. Consider what M_{i}
will do on an input string w_{i}.
- If M_{i} accepts w_{i}, then by definition
w_{i} cannot be in L_{d}.
- If M_{i} does not accepts w_{i}, then
by definition w_{i} is in L_{d}.
- Since w_{i} can neither be in L_{d} nor not be in
L_{d}, we must conclude there is no Turing machine that
can define L_{d}.
5. Complements of Recursive and Recursively Enumerable Languages
- A recursive language is one that is accepted by a TM that halts on all inputs.
- The complement of a recursive language is recursive.
- If a language L and its complement are RE, then L is recursive.
- A language can be RE but its complement need not be RE.
6. Practice Problems
- Prove that if there is a reduction from problem P_{1} to
problem P_{2}
and if P_{1} is not recursive, then P_{2}
is not recursive.
- Prove that if there is a reduction from P_{1} to P_{2}
and if P_{1} is not recursively enumerable, then P_{2}
is not recursively enumerable.
- Show that the language L =
{ w_{i} | w_{i} is not accepted by
M_{2i} }
is not recursively enumerable.
- Show that the language L =
{ w_{i} | w_{2i} is not accepted by
M_{i} }
is not recursively enumerable.
7. Reading
- HMU: Sections 8.1.3, 9.1, 9.2.1, 9.2.2, 9.3.1
aho@cs.columbia.edu
verma@cs.columbia.edu