0% found this document useful (0 votes)
128 views60 pages

Undecidable Problems and Reducibility: CSCI 2670

The document discusses several problems related to Turing machines that are provably undecidable. It introduces the concept of reducibility to show that if problem A can be reduced to problem B and B is decidable, then A is also decidable. However, if A can be reduced to B and A is known to be undecidable, then B must also be undecidable. The document proves several problems about properties of Turing machines and their languages are undecidable using this technique, including whether a machine halts, accepts an input, or has an empty language.

Uploaded by

shyamd4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views60 pages

Undecidable Problems and Reducibility: CSCI 2670

The document discusses several problems related to Turing machines that are provably undecidable. It introduces the concept of reducibility to show that if problem A can be reduced to problem B and B is decidable, then A is also decidable. However, if A can be reduced to B and A is known to be undecidable, then B must also be undecidable. The document proves several problems about properties of Turing machines and their languages are undecidable using this technique, including whether a machine halts, accepts an input, or has an empty language.

Uploaded by

shyamd4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Undecidable Problems and Reducibility

CSCI 2670

University of Georgia

Fall 2014

CSCI 2670 Undecidable Problems and Reducibility


Reducibility
I We show a problem decidable/undecidable by reducing it to another
problem. One type of reduction: mapping reduction.

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.

I A TM computes a function by starting with the input to the function on the


tape and halting with the output of the function on the tape.

CSCI 2670 Undecidable Problems and Reducibility


Reducibility

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.

I The idea here is that if B is decidable, then A must be decidable, too.

I (The proof is shown in the next slide).

I By contraposition, if A is not decidable, then B is not decidable.

Note that A could be decidable and B undecidable (consider what


happens when f is not surjective).

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility

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.

CSCI 2670 Undecidable Problems and Reducibility


Reducibility

I Note that A could be decidable and B undecidable.


I Consider what happens when f is not surjective.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: HALTTM
Recall that the following problem is undecidable.

ATM = {hM, w i|M is a TM and M accepts w }.

I Before, we called this the “halting problem”.


I Really, we should call it the “acceptance problem” for TMs.
I And we should call the language HALTTM below the halting problem.

HALTTM = {hM, w i|M is a TM and M halts on input w } is undecidable.

I We use the acceptance problem to prove HALTTM undecidable.

Theorem
HALTTM is undecidable.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: HALTTM

Theorem
HALTTM = {hM, w i|M is a TM and M halts on input w } is undecidable.

I Suppose we want to decide ATM


I On input hM, w i, if M halts on w , then it’s “safe” to run M on w .
I If M accepts w , then we accept hM, w i.
I If M rejects w , then we reject hM, w i.
I So...
if we could decide whether a TM halts on its input, we could decide ATM .
I That’s the idea in the proof. We reduce ATM to HALTTM .
I We assume HALTTM decidable.
I We then show that a decider for HALTTM can be used to decide ATM .
I Since ATM is undecidable, HALTTM must be undecidable.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: HALTTM

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.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: ETM
I In the previous problem, we reduced ATM to HALTTM .
I Since ATM is undecidable, HALTTM must be undecidable, too.
I This sort of reduction is a standard technique.
I We use it again below.

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.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: ETM

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.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory:
REGULARTM
I For instance, determining whether the language of a TM is regular is
undecidable.

Theorem
REGULARTM = {hMi|M is a TM and L(M) is regular} is undecidable.

I We can prove this by reduction from ATM .


I We assume REGULARTM has decider R and then use it to decide ATM .
I On input hM, w i We construct a new machine M2 such that L(M2 ) is
regular iff w ∈ L(M).
I We then run R on hM2 i.
I Note that we never actually run M2 . We instead use R to decide a
property of M2 .
I The difficult part is knowing how to construct M2 from M and w .

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory:
REGULARTM

Theorem
REGULARTM = {hMi|M is a TM and L(M) is regular} is undecidable.

I Given TM M and string w , construct M2 which operates as follows:


I On input x:
I If x has form 1n 0n , then accept.
I If not, then run M on w (not x) and accept x if M accepts w .
I L(M2 ) = Σ∗ if w ∈ L(M),
I Observe that 1n 0n is nonregular and Σ∗ is regular.
I M2 recognizes a regular language if and only if M accepts w .

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory:
REGULARTM

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.”

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory
Similarly, determining the following properties of TMs is undecidable.

I CFTM = {hMi|M is a TM and L(M) is context free}


I FINITETM = {hMi|M is a TM and L(M) is finite}
I DECIDABLETM = {hMi|M is a TM and L(M) is decidable}

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: EQTM
The idea is simple: if EQTM were decidable, ETM also would be
decidable, by giving a reduction from ETM to EQTM .
Theorem
The following language is undecidable.
EQTM = {hM1 , M2 i|M1 , M2 are TMs and L(M1 ) = L(M2 )}.

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 ) = ∅.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Problems from Language Theory: EQTM
I Recall that EQDFA is decidable.
I EQTM isn’t, as can be proved via reduction from ETM .

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= ∅.”

CSCI 2670 Undecidable Problems and Reducibility


Configuration Histories
I Recall that the state, tape contents, and tape head position of a TM
constitute a configuration.
I Using configurations, we can define computation histories.

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.

I Deterministic TMs have ≤ 1 computation history for an input w .


I Computation histories are useful in proving properties of a restricted type
of TM called a linear bounded automaton.

CSCI 2670 Undecidable Problems and Reducibility


Linear Bounded Automata

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 LBAs are restricted TMs, but they are powerful.


I The languages accepted by LBAs are called context sensitive.
I These are called Type-1 languages in the Chomsky Hierarchy.

Type Description Accepting Machine Grammar


0 Turing Recognizable Turing Machine Unrestricted
1 Context Sensitive LBA Context Sensitive
2 Context Free PDA Context Free
3 Regular DFAs Regular

I Each class n is a proper subset of class n − 1 (there are some caveats).

CSCI 2670 Undecidable Problems and Reducibility


Linear Bounded Automata: ALBA is decidable

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.

So, if M is a LBA and w ∈ L(M) w will be accepted within qng n steps.

CSCI 2670 Undecidable Problems and Reducibility


Linear Bounded Automata: ALBA is decidable

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.

I If the M has not halted within qng n steps, it never will.


I Instead, it will begin to repeat steps it’s previously entered.

CSCI 2670 Undecidable Problems and Reducibility


Linear Bounded Automata: ELBA is undecidable

I Not all problems involving LBAs are decidable.


I Although EDFA and ECFG are decidable, ELBA is not.

Theorem
ELBA = {hMi|M is an LBA and L(M) = ∅} is undecidable.

I The proof is via reduction from ATM to ELBA .


I From input hM, w i, an LBA B is constructed to accept all and only
accepting computation histories of M on w .

1. On input x, B checks that x is C1 #C2 # . . . #Cn , where C1 is the


start configuration of M on w and Cn is an accepting configuration.
If not, it rejects.
2. B then checks to see that each Ci+1 follows from Ci . If so, it
accepts. Otherwise, it rejects.
3. Observe this can all be done by marking symbols on B’s tape, and
without exceeding the tape boundaries.
CSCI 2670 Undecidable Problems and Reducibility
Linear Bounded Automata: ELBA is undecidable

Theorem
ELBA = {hMi|M is an LBA and L(M) = ∅} is undecidable.

I Note that B is constructed from TM M and string w .


I B accepts all and only accepting computation histories of M on w .
I So, if we had a decider R for ELBA we can run it on hBi.
I This could be used to decide ATM .

CSCI 2670 Undecidable Problems and Reducibility


Linear Bounded Automata: ELBA 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.

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Languages: ALLCFG
I Computation histories can be used to show properties of other languages.
I For instance, ALLCFG is undecidable.

Theorem
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } is undecidable.

I To prove this, we show that for a TM M and string w , we can construct a


special PDA D.
I D accepts all and only strings that are not valid accepting computation
histories C1 , C2 , . . . , Cn of M on w .
I For the PDA (for technical reasons), we encode a history with every other
configuration reversed:

C1 #C2R #C3 #C4R . . . #Cn .

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Languages: ALLCFG

Theorem
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } is undecidable.

I From a TM M and an input w , we construct a PDA D that generates all


strings if and only if M does not accept w .
I So, if M does accept w , D does not generate some particular string.
I This particular string is the accepting computation history for M on w .
I That is, D is designed to generate all strings that are not accepting
computation histories for M on w .

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Languages: ALLCFG

I A computation history fails to be an accepting one if:


1. C1 is not the start configuration;
2. Cn is not an accepting configuration;
3. some Ci+1 doesn’t follow from Ci .
PDA D nondeterministically chooses a failure to check.
I To check C1 , D reads through C1 , accepting if the first symbol is
not qstart or if the string between qstart and the first # is not w ..
I To check Cn , D reads through Cn , accepting if a state other than
qaccept appears (or more than one state appears).

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Languages: ALLCFG

I To check for a failure in δ, D selects a Ci to compare to Ci+1 .


I It pushes Ci onto the stack.
I It then reads through Ci+1 , comparing symbols to Ci .
I Ci is reversed relative to Ci+1 . The symbols popped from the
stack should match those read from Ci+1 (except for changes
due to δ).
I D accepts if the transition is invalid.
I Observe that D only rejects accepting computation histories of M on
w.
I And so if D accepts all strings, then there are no such histories (and
so M does not accept w ).
I As such, we could use a decider R for ALLCFG to decide ATM .

CSCI 2670 Undecidable Problems and Reducibility


Undecidable Languages: ALLCFG

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).

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP
The previous problems all dealt with automata. Below is an undecidable
problem involving string manipulation.

(The Post Correspondence Problem (PCP))


Given a set of dominoes P = {[ bt11 ], [ bt22 ], . . ., [ btnn ]}, where each ti and bi
is a string, a match for P is a sequence i1 , i2 , . . . im such that
ti1 ti2 . . . tim = bi1 bi2 . . . bim .
PCP = {hPi|P is a collection of dominoes with a match}

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.

CSCI 2670 Undecidable Problems and Reducibility


In-class Questions???
Find a match in the following instance of the Post Correspondence
Problem.
ab
{[ abab ], [ ba ], [ aba aa
b ], [ a ]}

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP

Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.

I The idea behind showing it undecidable is to reduce ATM to it.


I TM configurations are converted into domino sequences.
I For a given M and w , w ∈ L(M) iff a match exists for the dominoes.
I Since ATM is undecidable, PCP must be, too.

(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.

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP

Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.

The construction of the problem proceeds in stages.

Part 1: Domino [ bt11 ] = [ #q0 w1#...wn # ], where w = w1 . . . wn .


I t1 must be extended using more dominoes to match b1 .
I We add dominoes to simulate moves (parts 2 and 3).
I We also add dominoes for strings unaffected by moves (part 4).

Part 2: For every δ(q, a) = (r , b, R), q 6= qreject , construct [ qa


br ]

Part 3: For every c ∈ Γ and δ(q, a) = (r , b, L), q 6= qreject , construct


[ cqa
rcb ].

Part 4: For every a ∈ Γ, construct [ aa ].

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP

Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.

I Extending t1 forces beginning of a new configuration on the bottom.


I That is, we are forced to simulate the execution of M on w .
I Dominoes are added to fill out the part of the configuration not
affected by a transition.
I To mark configuration ends, we need more dominoes:

# #
Part 5: Add dominoes [ # ] and [ t# ]. The latter allows us to represent
the empty space at the right of the tape.

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP
Suppose a TM M with
I Q = {q0 , q1 , . . . , q7 , qacc }
I Γ = {0, 1, 2, 3, t}
I δ includes the following: δ(q0 , 0) = (q7 , 2, R),
Using steps 1-5, we can construct the following, representing a partial
computation history of M on w = 0100

The first domino is from Part 1, the second from Part 2, and the rest
from part 4 and 5.

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP
Suppose δ(q7 , 1) = (q5 , 0, R). Then we can form...

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP
Suppose δ(q5 , 0) = (q9 , 2, L). Then we can form...

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP

Theorem
PCP = {hPi|P is a collection of dominoes with a match} is undecidable.

I Special dominoes are needed to ensure that the end sequence of


dominoes match.

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 [ # ].

CSCI 2670 Undecidable Problems and Reducibility


The Post Correspondence Problem: PCP
Suppose we have arrived at the following:

Then we can form the following:

Observe that the 0 to the right of qaccept has been “eaten”.


CSCI 2670 Undecidable Problems and Reducibility
The Post Correspondence Problem: PCP
qaccept ##
[ # ] is needed at the very end.

CSCI 2670 Undecidable Problems and Reducibility


In-class Questions???
Find a match in the following instance of the Post Correspondence
Problem.
ab
{[ abab ], [ ba ], [ aba aa
b ], [ a ]}

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility

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.

I Reducibility here hinges on there being a computable function.

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.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
I In previous examples, we reduced one problem A to another B and then
leveraged a property of one to conclude something about the other.
I We can formalize what we’ve been doing in a theorem.

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.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
I A corollary to the previous theorem exists.
I Similarly, The theorem can be reformed for recognizability.

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.

I Suppose we have a recognizer R for B. A recognizer S for A would work


as follows: On input w , compute f (w ) and run R on f (w ). Accept if R
accepts; Reject if R rejects.

Corollary
If A ≤m B and A is not Turing-recognizable, then B is not
Turing-recognizable.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
I If A ≤m B, then there’s a computable function f : Σ∗ → Σ∗ with
w ∈ A if and only if f (w ) ∈ B.
I Observe that this implies
I w∈/ A if and only if f (w ) ∈
/ B.
I w ∈ A if and only if f (w ) ∈ B.
I Thus, if A ≤m B, then A ≤m B.
I The converse is also true.
I And so the following proposition is true.

Proposition
A ≤m B if and only if A ≤m B.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
Show that if A is Turing-recognizable and A ≤m A, then A is decidable.
Proof.
I Suppose that A ≤m A, then A ≤m A via the same mapping
reduction.
I Because A is Turing-recognizable, it implies that A is
Turing-recognizable.
I Then A is Turing-recognizable and co-Turing-recognizable.
I Hence it implies that A is decidable.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
We define a function F showing ATM ≤m EQTM .

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.

I F is really a Turing machine, one that computes a function.


I M1 is trivial to create, and given M, M2 is also easy to create.
I Observe that if w ∈
/ L(M), then M2 doesn’t accept any strings.
I If w ∈ L(M), then L(M2 ) is the set of all strings.
I Thus w ∈ L(M) iff hM1 , M2 i ∈ EQTM (i.e., L(M1 ) 6= L(M2 )).
I This shows ATM ≤m EQTM .
I F is a mapping reduction from ATM to EQTM .

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
We define a function G showing ATM ≤m EQTM .

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.

I F and G are very similar, save that M1 accepts all inputs.


I If w ∈ L(M), then M2 accepts all strings, too.
I If w ∈
/ L(M), then M2 accepts no strings.
I Thus, w ∈ L(M) iff hM1 , M2 i ∈ EQTM (i.e., L(M1 ) = L(M2 )).
I Hence, G is a mapping reduction from ATM to EQTM .

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility

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.

I What does this mean?


I We can’t reliably recognize when pairs of Turing machines have the same
language (EQTM is not Turing recognizable).
I Nor can we reliably recognize when pairs of Turing machines have
different languages (EQTM is not co-Turing recognizable).
CSCI 2670 Undecidable Problems and Reducibility
Mapping Reducibility
Show that EQCFG is co-Turing-recognizable.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
Show that EQCFG is co-Turing-recognizable.
Proof.
We can construct a TM M which recognizes the complement of EQCFG :
M = “On input hG , Hi:
1. For each string x ∈ Σ∗ in lexicographic order:
2. Test whether x ∈ L(G ) and whether x ∈ L(H), using the algorithm
for ACFG .
3. If one of the tests accepts and the other rejects, accept; otherwise,
continue.”

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
Show that EQCFG is undecidable.

CSCI 2670 Undecidable Problems and Reducibility


Mapping Reducibility
Show that EQCFG is undecidable.
Proof.
Suppose that EQCFG were decidable. We can construct a decider M for
ALLCFG = {hG i|G is a CFG and L(G ) = Σ∗ } as follows:
M = “On input hG i:
1. Construct a CFG H such that L(H) = Σ∗ .
2. Run the decider for EQCFG on hG , Hi.
3. If it accepts, accept. If it rejects, reject.”

CSCI 2670 Undecidable Problems and Reducibility


In-class Questions???
Let J = {w |w = 0x for some x ∈ ATM , or w = 1y for some y ∈ ATM }.
Show that neither J nor J is Turing recognizable.

CSCI 2670 Undecidable Problems and Reducibility


Questions for Group Discussion
1. 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.
2. Consider the problem of determining whether a Turing machine M on
input w ever attempts to move its tapehead left at any point while
processing w . Let L = {hM, w i|M attempts moves left at some point
when processing w }. Show that L is decidable.

CSCI 2670 Undecidable Problems and Reducibility


Questions for Group Discussion

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 .”

CSCI 2670 Undecidable Problems and Reducibility


Questions for Group Discussion

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.
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.

CSCI 2670 Undecidable Problems and Reducibility


Questions for Group Discussion

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.”

CSCI 2670 Undecidable Problems and Reducibility


Questions for Group Discussion

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.

CSCI 2670 Undecidable Problems and Reducibility

You might also like