Handout 11
Handout 11
11.1 Infinite sets. Two sets A and B have the same size if there exists a bijective (i.e., one-to-one
and onto) function f : A → B. A set A is countable if it is finite or it has the same size as the natural
numbers N; in this case, the bijection f : N → A is called an enumeration of A. Here are examples of
countable and uncountable infinite sets:
1. The set Σ∗ of finite words is countable for every finite alphabet Σ (proof by enumeration).
2. The set of infinite words over {0, 1} is uncountable (proof by diagonalization).
11.2 Two decision problems. We consider the following two languages associated with decision
problems about Turing machines:
Membership: ATM = {hM, wi | M is a DTM and w ∈ L(M )}.
Emptiness: ETM = {hM i | M is a DTM and L(M ) = ∅}.
11.3 TM membership is r.e. (The universal Turing machine) Here is a high-level description of a
Turing machine Muniversal which accepts ATM :
11.4 TM emptiness is co-r.e. We now argue that ETM is co-r.e. Here is a high-level description of a
Turing machine MTMemptiness which accepts E TM :
Input: hM i, where M is a TM.
Let f : N → Σ∗ be an enumeration of all words in Σ∗ .
For j = 0, 1, 2, . . . do
for i = 0 to j do
if M accepts f (i) in j steps then accept.
Note that if L(M ) = ∅, then MTMemptiness loops. Note also that while ATM is not recursive, it can be
decided if a TM M accepts an input w in a given number j of steps.
11.5 TM membership is not recursive. (proof by contradiction) We show that ATM is not recursive.
It follows that also ATM is not recursive, but while ATM is r.e., ATM is co-r.e. To see that ATM is not
recursive, we assume that there is a Turing decider H that accepts ATM , and derive a contradiction.
(Since the existence of H will be our only assumption and leads to a contradiction, such an H cannot
exist.) From H we construct another Turing decider D, with the following high-level description:
1
c T.A. Henzinger, G. Théoduloz
Input: hM i.
Simulate H on hM, hM ii
If H accepts then reject; otherwise accept.
Note that D uses H as a subroutine, which is possible because H never loops. Now consider how D
behaves on input w = hDi, i.e., the input to D is an encoding of D itself. If hD, hDii ∈ L(H), then D
rejects, i.e., hDi 6∈ L(D); if hD, hDii 6∈ L(H), then D accepts, i.e., hDi ∈ L(D). But this means that H
does not accept ATM , a contradiction.
11.6 Reductions. We used a proof by contradiction to show that the membership problem for DTMs
is not recursive. Since it is r.e., it cannot be co-r.e. (why?). Hence we have a non-co-r.e. problem (DTM
membership), and a non-r.e. problem (DTM non-membership). From these, we can prove that other
problems are not co-r.e., respectively not r.e., by a fundamental technique called reduction. A function
f : Σ∗ → Σ∗ is computable if there exists a Turing decider that accepts all input words w, and when
entering qa , has f (w) on the tape. For two languages A, B ⊆ Σ∗ , we say that A mapping reduces to B,
written A ≤m B, if there exists a computable function f : Σ∗ → Σ∗ such that for all w ∈ Σ∗ , we have
w ∈ A iff f (w) ∈ B. If A ≤m B, then:
recursive recursive
– If B is r.e. , then A is r.e. .
co-r.e. co-r.e.
recursive recursive
– If A is not r.e. , then B is not r.e. .
co-r.e. co-r.e.
11.7 TM emptiness is not recursive. (proof by reduction) We argue that ETM is not recursive.
Since ETM is co-r.e., we reduce from ATM (rather than from ATM ). In order to show that ATM ≤m ETM ,
given a pair hM, wi of a DTM M and a word w, we need to construct a TM M 0 such that w 6∈ L(M ) iff
L(M 0 ) = ∅. Here is a high-level description of M 0 :
Input: w0 .
If w0 6= w then reject.
Simulate M on the input (which is w) until
(1) M accepts (then accept), or
(2) M rejects (then reject).
Note that if M loops on input w, then so does M 0 . If w ∈ L(M ), then L(M 0 ) = {w}; if w 6∈ L(M ), then
L(M 0 ) = ∅. It follows that ETM is not r.e., and therefore not recursive.
2
c T.A. Henzinger, G. Théoduloz