Undecidable Problems and Reducibility: CSCI 2670
Undecidable Problems and Reducibility: CSCI 2670
CSCI 2670
University of Georgia
Fall 2014
Definition
I Let A, B be languages over Σ. A is mapping reducible to B, written
A ≤m B, if there is a computable function f : Σ∗ → Σ∗ such that
w ∈ A if and only if f (w ) ∈ B.
I Function f is called the reduction of A to B.
Definition
A function f : Σ∗ → Σ∗ is a computable function if some Turing
machine M, on every input w , halts with just f (w ) on its tape.
Definition
I Let A, B be languages over Σ. A is mapping reducible to B, written
A ≤m B, if there is a computable function f : Σ∗ → Σ∗ such that
w ∈ A if and only if f (w ) ∈ B.
I Function f is a reduction from A to B.
Theorem
If A ≤m B and B is decidable, then A is decidable.
Proof.
I Suppose A ≤m B and B is decidable. Then there exists a TM M to
decide B, and there is a computable function f such that w ∈ A if
and only if f (w ) ∈ B.
I We construct a decider N for A that acts as follows:
I On input w , compute f (w ).
I Run M on f (w ).
I If M accepts f (w ), then accept. Otherwise, reject.
Theorem
HALTTM is undecidable.
Theorem
HALTTM = {hM, w i|M is a TM and M halts on input w } is undecidable.
Theorem
HALTTM = {hM, w i|M is a TM and M halts on input w } is undecidable.
Proof.
I Suppose for a proof by contradiction that HALTTM is decidable.
Then it has a TM R that decides it.
I We construct a TM S to decide ATM :
I On input hM, w i:
I Run R on input hM, w i.
I If R rejects, then reject.
I If R accepts, then run M on input w .
I Note that M must halt on w .
I If M accepts w , then accept. Otherwise reject.
I S clearly decides ATM . But ATM is undecidable....
I A contradiction, and so HALTTM is not decidable.
Theorem
ETM = {hMi|M is a TM and L(M) = ∅} is undecidable.
I The idea is to assume ETM is decidable and then use that to decide ATM .
I Given a decider R for ETM , we use it in a decider S for ATM .
I Note that if the input to S is hM, w i, we can create a new TM M 0 that
only accepts w or else nothing.
I This is the secret to constructing S.
Theorem
ETM = {hMi|M is a TM and L(M) = ∅} is undecidable.
Proof.
I Suppose ETM is decidable and let R be a decider for it.
I From R, we construct a decider S for ATM , which works as follows.
I On input hM, w i:
1. Construct TM M 0 : On any input v , if v 6= w , then reject.
Otherwise, run M on v . If M accepts, then accept.
Note: v ∈ L(M 0 ) if and only if v = w and w ∈ L(M).
2. Run R on hM 0 i.
3. If R accepts hM 0 i, then L(M 0 ) = ∅ (meaning w ∈ / L(M)), and
so reject.
4. If R rejects hM 0 i, then L(M 0 ) = {w } (meaning w ∈ L(M)), and
so accept.
I S decides ATM . A contradiction!
I And so ETM must be undecidable.
CSCI 2670 Undecidable Problems and Reducibility
Rice’s Theorem
I Rice’s theorem asserts that all “nontrivial” properties of Turing machines
are undecidable. (To determine whether a given Turing machine’s
language has property P is undecidable.)
Theorem
I Let P be a language consisting of TM descriptions such that
1. P is nontrivial-it contains some, but not all, TM descriptions.
2. P is a property of the TM’s language (Here, M1 and M2 are
any TMs.)
Whenever L(M1 ) = L(M2 ), we have hM1 i ∈ P iff hM2 i ∈ P.
I Then P is undecidable.
Theorem
REGULARTM = {hMi|M is a TM and L(M) is regular} is undecidable.
Theorem
REGULARTM = {hMi|M is a TM and L(M) is regular} is undecidable.
Theorem
REGULARTM = {hMi|M is a TM and L(M) is regular} is undecidable.
Proof.
Let R be a TM that decides REGULARTM and construct TM S to decide ATM .
S = “On input hM, w i, where M is a TM and w is a string:
1. Construct the following TM M2 .
2. M2 = “On input x:
I If x has the form 1n 0n , accept.
I If x does not have this form, run M on input w and accept if M
accepts w .”
3. Run R on input hM2 i.
4. If R accepts, accept; if R rejects, reject.”
I The ETM problem is a special case of the EQTM problem wherein one of
the machines is fixed to recognize the empty language.
I The idea here is to construct a TM M2 such that L(M2 ) = ∅.
I Then use this to determine whether L(M1 ) = ∅.
Theorem
The following language is undecidable.
EQTM = {hM1 , M2 i|M1 , M2 are TMs and L(M1 ) = L(M2 )}.
Proof.
I Suppose that EQTM is decidable and let R be a decider for it.
I We construct a TM S to decide ETM as follows.
I S = “On Input hMi, where M is a TM:
1. Run R on input hM, M1 i, where M1 is a TM that rejects all
inputs.
2. If R accepts hM, M1 i, then accept (L(M) = L(M1 ) = ∅);
3. if R rejects hM, M1 i, then reject (L(M) 6= ∅.”
Definition
An accepting computation history of TM M on string w is a finite
sequence of configurations C1 , . . ., Cn , where
I C1 is the start configuration of M on w ,
I Cn is an accepting configuration, and
I for each 1 ≤ i < n Ci+1 follows from Ci via M’s transition function.
A rejecting computation history is defined similarly, save that Cn is a
rejecting configuration.
Definition
A Linear Bounded Automaton is a Turing machine that may only use the
portion of tape originally occupied by the input string w . Its tapehead cannot
move beyond the left- or rightmost tape cells. Hence we say that for an input
of length n, the amount of memory available is linear in n.
I Recall that the following were decidable: ADFA , ACFG . (In fact, they
are decidable by LBAs).
I The language ATM was not decidable.
I The language ALBA is, however.
Theorem
ALBA = {hM, w i|M is an LBA and w ∈ L(M)} is decidable.
To prove this we need the following lemma, which asserts that there is a
finite number of configurations for an LBA with input length n.
Lemma
I Let M be an LBA with |Q| = q, |Γ| = g , and let w ∈ Σ∗ .
I For a tape of length n, there are qng n possible configurations of M.
Theorem
ALBA = {hM, w i|M is an LBA and w ∈ L(M)} is decidable.
Proof.
We construct a TM L to decide ALBA . On input hM, w i:
I Run M on w , counting how many steps have been taken.
I If M accepts (rejects) w before qng n steps, then accept (reject).
I If M has not halted within qng n steps, then reject.
Theorem
ELBA = {hMi|M is an LBA and L(M) = ∅} is undecidable.
Theorem
ELBA = {hMi|M is an LBA and L(M) = ∅} is undecidable.
Theorem
ELBA = {hMi|M is an LBA and L(M) = ∅} is undecidable.
Proof.
I Suppose ELBA is decidable, and let R be a decider for it.
I We construct a decider S for ATM as follows.
I On input hM, w i,
I Construct B as in the previous slide.
I Run R on hBi.
1. If R accepts, then reject (there are no accepting computation
histories of M on w ).
2. If R rejects, then accept (there is an accepting computation
history of M on w ).
I Observe that B is never actually executed. It’s just input into R.
Theorem
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } is undecidable.
Theorem
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } is undecidable.
Theorem
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } is undecidable.
Proof.
Suppose ALLCFG is decidable and let R be a decider for it. We use it to
construct a TM S deciding ATM .
On input hM, w i:
I Construct a PDA D from M and w as described in the previous slide.
I Convert D into a CFG G .
I Run R on hG i.
I If R accepts hG i, then reject (there are no accepting histories).
I If R rejects hG i, then accept (an accepting history exists).
Example
b a
If P = {[ ca ], [ ab ], [ ca abc
a ], [ c ]}, then the following is a match.
a b ca a abc
[ ab ][ ca ][ a ][ ab ][ c ]
Note that duplicates are possible.
Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.
(Some restrictions)
For the sake of the problem, we will assume:
I The TM M never attempts to move beyond the left of the tape.
I If w = ε, string t is used for w .
I The match always begins with [ bt11 ].
These restrictions can all be done away with.
Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.
Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.
# #
Part 5: Add dominoes [ # ] and [ t# ]. The latter allows us to represent
the empty space at the right of the tape.
The first domino is from Part 1, the second from Part 2, and the rest
from part 4 and 5.
Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.
aq
accept q a
Part 6: For each a ∈ Γ, add dominoes [ qaccept ] and [ qaccept
accept
].
(This is a technical step, intended to remove symbols around qaccept until
it is adjacent only to #).
qaccept ##
Part 7: add dominoes [ # ].
Definition
I Let A and B be languages over Σ.
I A is mapping reducible to B, written A ≤m B, if there is a
computable function f : Σ∗ → Σ∗ such that
w ∈ A if and only if f (w ) ∈ B.
I Function f is a reduction from A to B.
Definition
A function f : Σ∗ → Σ∗ is a computable function if there exists a
Turing machine M such that on every input w ∈ Σ∗ , M halts with just
f (w ) on its tape.
I From the definition, one sees that a function is computable if and only if
there is some algorithm that computes it.
CSCI 2670 Undecidable Problems and Reducibility
Mapping Reducibility
Show that ≤m is a transitive relation.
Proof.
Suppose that A ≤m B and B ≤m C . Then there are computable
functions f and g such that x ∈ A ⇐⇒ f (x) ∈ B and
y ∈ B ⇐⇒ g (y ) ∈ C .
Consider that composition function h(x) = g (f (x)). We can build a TM
that computes h as follows:
1. Simulate a TM for f (such a TM exists because we assumed that f
is computable) on input x and call the output y .
2. Simulate a TM for g on y . The output is h(x) = g (f (x)).
Therefore h is a computable function. Moreover, x ∈ A ⇐⇒ h(x) ∈ C .
Hence A ≤m C via the reduction function h.
Theorem
If A ≤m B and B is decidable, then A is decidable.
Proof.
I Suppose A ≤m B and B is decidable. Then there exists a TM M to
decide B, and there is a computable function f such that w ∈ A if
and only if f (w ) ∈ B.
I We construct a decider N for A that acts as follows:
I On input w , compute f (w ).
I Run M on f (w ).
I If M accepts f (w ), then accept. Otherwise, reject.
Corollary
If A ≤m B and A is undecidable, then B is undecidable.
Theorem
If A ≤m B and B is Turing-recognizable, then A is Turing-recognizable.
Corollary
If A ≤m B and A is not Turing-recognizable, then B is not
Turing-recognizable.
Proposition
A ≤m B if and only if A ≤m B.
F:
I On input hM, w i construct TMs M1 and M2 .
I M1 : On any input x, reject.
I M2 : On any input x, run M on w . Accept x if M accepts w .
I Output hM1 , M2 i.
G:
I On input hM, w i construct TMs M1 and M2 .
I M1 : On any input x, accept.
I M2 : On any input x, run M on w . Accept x if M accepts w .
I Output hM1 , M2 i.
Theorem
EQTM is neither Turing recognizable nor co-Turing recognizable.
Proof.
I We have ATM ≤m EQTM and ATM ≤m EQTM (earlier slides).
I From this, ATM ≤m EQTM and ATM ≤m EQTM .
I Since ATM is not Turing recognizable, neither EQTM nor EQTM is.
I Since EQTM is not recognizable, then EQTM is not co-recognizable.
I This follows by definition of co-recognizability.
A state in an automaton is useless if it is never entered on any input string. Consider the language
UPDA = {hPi|P is a PDA with useless states}. Show that it is decidable. Hint: If given a PDA P
with state q, consider modifying P so that q is the only accept state of P.
Proof.
ECFG is decidable and so has decider N. We create a decider M for UPDA .
M = “On input w :
I Scan w . Reject if it is not a valid representation of a PDA P.
I Identify the states q1 , q2 , . . . , qn of P, and for each qi do the following:
I Modify P so that qi is its only accept state (call the modified
PDA Pqi ).
I Convert Pqi to an equivalent CFG Gqi using techniques from
Chapter 2.
I Run N on hGqi i.
I If N accepts, then accept w .
I If N rejects, then continue.
I If each qi has been processed without accepting, reject w .”
Proof.
N accepts hGqi i iff L(Gqi ) is empty. However, since L(Pqi ) = L(Gqi ), it
must be that qi is never entered (because qi ) is the only accept state of
Pqi . So if N accepts on some Pqi , then P has a useless state, and so
w = hPi should be accepted. Above, M rejects only if N rejects on every
hPqi i.
Let L = {hM, w i|M attempts moves left at some point when processing w }. Show
that L is decidable.
Proof.
We construct a decider R for L. It works as follows:
R = “On input x:
1. Scan x, checking whether it is of the form hM, w i, where M is a TM and
w a string. If not, reject. Otherwise continue.
2. Run M on w for |w | + |Q| + 1 steps. If M ever moves left within that
number of steps, then accept. Otherwise reject.”
Let L = {hM, w i|M attempts moves left at some point when processing w }. Show
that L is decidable.
Proof.
The idea here is that if M does not move left within w steps, then it must have
moved right, moving passed input string w . At that point, it will read only
blank spaces. It can move from one state to another, reading blanks, but at
some point, it must return to a state it has previously been in (that point is
|w | + |Q| + 1 steps). And so, if it hasn’t moved left within |w | + |Q| + 1 steps,
the machine will simply repeat states (reading blanks forever). It will never
move left.