Reducibility 1
Reducibility 1
Reducibility
Bow-Yaw Wang
Academia Sinica
Spring 2012
Theorem 1
HALTTM is undecidable.
Proof.
We would like to reduce the acceptance problem to the halting
problem. Suppose a TM R decides HALTTM . Consider
S = “On input hM, wi where M is a TM and w is a string:
1 Run TM R on the input hM, wi.
2 If R rejects, reject.
3 If R accepts, simulate M on w until it halts.
4 If M accepts, accept; if M rejects, reject.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 4 / 32
Emptiness Problem for Turing Machines
Consider ETM = {hMi : M is a TM and L(M) = ∅}.
Theorem 2
ETM is undecidable.
Proof.
We reduce the acceptance problem to the emptiness problem. Let the
TM R decides ETM . Consider
S = “On input hM, wi where M is a TM and w a string:
1 Use hMi to construct
M1 = “On input x:
1 If x 6= w, reject.
2 If x = w, run M on the input x. If M accepts x, accept.”
2 Run R on the input hM1 i.
3 If R accepts, reject; otherwise, accept.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 5 / 32
Regularity Problem for Turing Machines
Consider
REGULARTM = {hMi : M is a TM and L(M) is regular}.
Theorem 3
REGULARTM is undecidable.
Proof.
Let R be a TM deciding REGULARTM . Consider
S = “On input hM, xi where M is a TM and x a string:
1 Use hMi to construct
M2 = “On input x:
1 If x is of the form 0n 1n , accept.
2 Otherwise, run M on the input w. If M accepts w, accepts.”
2 Run R on the input M2 .
3 If R accepts, accept; otherwise, reject.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 6 / 32
Rice’s Theorem
Theorem 4
Let P be a language consisting of TM descriptions such that
1 P is not trivial (P 6= ∅ and there is a TM M with hMi 6∈ P);
2 If L(M1 ) = L(M2 ), hM1 i ∈ P iff hM2 i ∈ P.
Then P is undecidable.
Proof.
Let R be a TM deciding P. Let T∅ be a TM with L(T∅ ) = ∅. WLOG, assume hT∅ i 6∈ P.
Moreover, pick a TM T with hTi ∈ P. Consider
S = “On input hM, wi where M is a TM and w a string:
1 Use hMi to construct
Mw = “On input x:
1 Run M on w. If M halts and rejects, reject.
2 If M accepts w, run T on x.”
2 Run R on hMw i.
3 If R accepts, accept; otherwise, reject.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 7 / 32
Language Equivalence Problem for Turing Machines
Consider
Theorem 5
EQTM is undecidable.
Proof.
We reduce the emptiness problem to the language equivalence
problem this time. Let the TM R decide EQTM and TM M1 with
L(M1 ) = ∅. Consider
S = “On input hMi where M is a TM:
1 Run R on hM, M1 i.
2 If R accepts, accept; otherwise, reject.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 8 / 32
Computation History
Definition 6
Let M be a TM and w an input string. An accepting computation
history for M on w is a sequence of configurations C1 , C2 , . . . , Cl where
C1 is the start configuration of M on w;
Cl is an accepting configuration of M; and
Ci yields Ci+1 in M for 1 ≤ i < l.
A rejecting computation history for M on w is similar, except Cl is a
rejecting configuration.
control
0 0 1 0 1 1 1 0
Figure: Schematic of Linear Bounded Automata
Definition 7
A linear bounded automaton is a Turing machine whose tape head is
not allowed to move off the portion of its input. If an LBA tries to
move its head off the input, the head stays.
With a larger tape alphabet than its input alphabet, an LBA is able
to increase its memory up to a constant factor.
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 10 / 32
Acceptance Problem for Linear Bounded Automata
Consider
Lemma 8
Let M be an LBA with q states and g tape symbols. There are exactly qngn
different configurations of M for a tape of length n.
Proof.
Consider
L = “On input hM, wi where M is an LBA and w a string:
1 Simulate M on w for qngn steps or until it halts. (q, n, and g are
obtained from hMi and w.)
2 If M does not halt in qngn steps, reject.
3 If M accepts w, accept; if M rejects w, reject.”
Theorem 10
ELBA is undecidable.
Proof.
We reduce the acceptance problem for TM’s to the emptiness problem
for LBA. Let R be a TM deciding ELBA . Consider
S = “On input hM, wi where M is a TM and w a string:
1 Use hMi to construct the following LBA:
B = “On input hC1 , C2 , . . . , Cl i where Ci ’s are configurations of M:
1 If C1 is not the start configuration of M on w, reject.
2 If Cl is not an accepting configuration, reject.
3 For each 1 ≤ i < l, if Ci does not yield Ci+1 , reject.
4 Otherwise, accept.”
2 Run R on hBi.
3 If R rejects, accept; otherwise, reject.”
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 13 / 32
Universality of Context-Free Grammars
Proof.
We reduce the acceptance problem for TM’s to the universalty problem. We construct
a nondeterministic PDA D that accepts all strings if and only if M does not accept w.
The input and stack alphabets of D contain symbols to encode M’s configurations.
D = “On input #x1 #x2 # · · · #xl #:
1 Do one of the following branches nondeterministically:
I If x1 6= hC1 i where C1 is the start configuration of M on w, accept.
I If xl 6= hCl i where Cl is a rejecting configuration of M, accept.
I Choose odd i nondeterministically. If xi 6= hCi, xRi+1 6= hC0 i, or C
does not yield C0 (C, C0 are configurations of M), then accept.”
I Choose even i nondeterministically. If xRi 6= hCi, xi+1 6= hC0 i, or C
does not yield C0 (C, C0 are configurations of M), then accept.”
M accepts w iff the accepting computation history of M on w is not in L(D) iff
CFG(D) 6∈ ALLCFG .
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 15 / 32
Post Correspondence Problem (PCP)
t
A domino is a pair of strings:
b
t1 t2 tk
A match is a sequence of dominos ··· such
b1 b2 bk
that t1 t2 · · · tk = b1 b2 · · · bk .
The Post correspondence problem is to test whether there is a
match for a given set of dominos.
PCP = {hPi : P is an instance of the PCP with a match}
Consider
b a ca abc
P= , , ,
ca ab a c
A match in P:
a b ca a abc
ab ca a ab c
Bow-Yaw Wang (Academia Sinica) Decidability Spring 2012 16 / 32
The Modified Post Correspondence Problem
Theorem 12
PCP is undecidable.
Proof idea.
We reduce the acceptance problem for TM’s to PCP. Given a TM M and
a string w, we first construct an MPCP P0 such that hP0 i ∈ MPCP if and
only if M accepts w. The MPCP P0 encodes an accepting computation
history of M on w. Finally, we reduce MPCP P0 to PCP P.
Proof.
Let the TM R decide MPCP. Let M = (Q, Σ, Γ, δ, q0 , qaccept , qreject ) be the given TM and
w = w1 w2 · · · wn the input. The set P0 of dominos has
#
as the first domino. Begin with the start configuration
#q0 w1 w2 · · · wn #
(bottom).
# q0 w1 w2 ··· wn #
Proof (cont’d).
qa
if δ(q, a) = (r, b, R) with q 6= qreject . Reads a at state q (top); writes b and
br
moves right (bottom).
cqa
if δ(q, a) = (r, b, L) with q 6= qreject . Reads a at state q (top); writes b and
rcb
moves left (bottom).
a
if a ∈ Γ. Keeps other symbols intact.
a
# q0 0 1 0 0
# q0 0 1 0 0 # 2 q7 1 0 0
δ(q0 , 0) = (q7 , 2, R)
Proof (cont’d).
# #
and Matches previous # (top) with a new # (bottom). Adds xy
# xy#
when M moves out of the right end.
# q0 0 1 0 0 #
# q0 0 1 0 0 # 2 q7 1 0 0 #
Proof (cont’d).
aqaccept qaccept a
and if a ∈ Γ. Eats up tape symbols around qaccept .
qaccept qaccept
qaccept ##
. Completes the match.
#
# 2 1 qaccept 0 0 # # qaccept # #
··· ···
Proof (cont’d).
So far, we have reduced the acceptance problem of TM’s to MPCP. To complete the
proof, we need to reduce MPCP to PCP.
Let u = u1 u2 · · · un . Define
?u = ∗ u1 ∗ u2 ∗ ··· ∗ un
u? = u1 ∗ u2 ∗ ··· ∗ un ∗
?u? = ∗ u1 ∗ u2 ∗ ··· ∗ un ∗
Given a MPCP P0 :
t1 t2 tk
, ,...,
b1 b2 bk
Construct a PCP P:
?t1
?t2 ?tk ∗♦
, ,..., ,
b2 ?
?b1 ? bk ? ♦
?t1
Any match in P must start with the domino .
?b1 ?
Definition 13
f : Σ∗ → Σ∗ is computable if some Turing machine M, on input w, halts
with f (w) on its tape.
Definition 14
A language A is mapping reducible (or many-one reducible) to a
languate B (written A ≤m B) if there is a computable function
f : Σ∗ → Σ∗ such that
Theorem 15
If A ≤m B and B is decidable, A is decidable.
Proof.
Let the TM M decide B and f the reduction of A to B. Consider
N = “On input w:
1 Construct f (w).
2 Run M on f (w).
3 If M accepts, accept; otherwise reject.
Corollary 16
If A ≤m B and A is undecidable, then B is undecidable.
Example 17
Give a mapping reduction of ATM to HALTTM .
Proof.
We need to show a computable function f such that hM, wi ∈ ATM if
and only if hM0 , w0 i ∈ HALTTM whenever hM0 , w0 i = f (hM, wi).
Consider
F = “On input hM, wi:
1 Use hMi and w to construct
M0 = “On input x:
1 Run M on x.
2 If M accepts, accept.
3 If M rejects, loop.”
2 Output hM0 , wi.”
Example 18
Give a mapping reduction from ETM to EQTM .
Proof.
The proof of Theorem 5 gives such a reduction. The reduction maps
the input hMi to hM, M1 i where M1 is a TM with L(M1 ) = ∅.
Lemma 19
If A ≤m B and B ≤m C, A ≤m C.
Proof.
Let f and g be the reductions of A to B and B to C respectively. g ◦ f is a
reduction of A to C.
Example 20
Give a mapping reduction from ATM to PCP.
Proof.
The proof of Theorem 12 gives such a reduction. We first show
ATM ≤m MPCP. Then we show MPCP ≤m PCP.
Theorem 21
If A ≤m B and B is Turing-recognizable, then A is Turing-recognizable.
Proof.
Similar to the proof of Theorem 15 except that M and N are TM’s, not
deciders.
Corollary 22
If A ≤m B and A is not Turing-recognizable, then B is not
Turing-recognizable.
Theorem 23
EQTM is neither Turing-recognizable nor co-Turing-Recognizable.
Proof.
We first show ATM ≤m EQTM . Consider
F = “On input hM, wi where M is a TM and w a string:
1 Construct
M1 = “On input x:
1 Reject.”
M2 = “On input x:
1 Run M on w. If M accepts, accept.”
2 Output hM1 , M2 i.”
Proof (cont’d).
Next we show ATM ≤m EQTM . Consider
G = “On input hM, wi where M is a TM and w a string:
1 Construct
M1 = “On input x:
1 Accept.”
M2 = “On input x:
1 Run M on w.
2 If M accepts w, accept.”
2 Output hM1 , M2 i.”