0% found this document useful (0 votes)
54 views

CS5371 Theory of Computation: Lecture 14: Computability V (Prove by Reduction)

This document discusses several undecidable problems related to Turing machines including the halting problem, emptiness test for TMs, testing if a TM accepts a regular language, equality test for TMs, and emptiness test for linear bounded automata. It proves these problems are undecidable by reducing the acceptability problem for TMs (ATM) to each problem to show that if the problem were decidable, it would contradict the known undecidability of ATM.

Uploaded by

Kamal Walia
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)
54 views

CS5371 Theory of Computation: Lecture 14: Computability V (Prove by Reduction)

This document discusses several undecidable problems related to Turing machines including the halting problem, emptiness test for TMs, testing if a TM accepts a regular language, equality test for TMs, and emptiness test for linear bounded automata. It proves these problems are undecidable by reducing the acceptability problem for TMs (ATM) to each problem to show that if the problem were decidable, it would contradict the known undecidability of ATM.

Uploaded by

Kamal Walia
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/ 45

CS5371

Theory of Computation
Lecture 14: Computability V
(Prove by Reduction)
Objectives
•This lecture shows more undecidable
languages
•Our proof is not based on diagonalization
•Instead, we reduce the problem of
deciding ATM to the problem of deciding
a language B
–Precisely, we show that if we know how to
decide B, then we can decide ATM
Halting Problem
• Recall that ATM is the language
{M, w| M is a TM that accepts w}
... and we have shown that ATM is undecidable

• Let HALTTM be the language


{M, w| M is a TM that halts on w}

Theorem: HALTTM is undecidable


Halting Problem (2)
Proof Idea: By reducing ATM to HALTTM.
I.e., assume HALTTM is decidable, show ATM is decidable.

Firstly, assume we have a TM R that decides


HALTTM. (So, what can R do?)
• R accepts  M, wif and only if M halts
on w.
Question: Can we use R to solve a similar
problem, such that we accept  M, wif and
only if M accepts w?
Halting Problem (3)
Proof Idea: Yes! We design a TM S such
that on the input M, w, S uses R to check
if M halts on w. If not, we can
immediately reject  M, w (why?)
If yes, we run M on w. The execution
must halt, so that there are two cases.
• If M accepts w, S accepts  M, w
• If M rejects w, S rejects  M, w

Question: What are the strings that S accepts??


Halting Problem (4)
The definition of TM S is as follows:
S=“ On input M, w,
1. Run R on input  M, w
2. If R rejects, S rejects
3. If R accepts, simulate M on w
4. If M accepts w, S accepts.
Else, S rejects”
Halting Problem (5)
• So, if R is a decider, S is a decider (why?)
• As no decider S can exist (why?), this
implies no decider R can exist

Thus, HALTTM is undecidable


Emptiness Test for TM

• Let ETM be the language


{M| M is a TM and L(M) = { } }

Theorem: ETM is undecidable


Emptiness Test for TM (2)
Proof Idea: By reducing ATM to ETM.
I.e., Assume ETM is decidable, show ATM is decidable.

Firstly assume we have a TM R that decides


ETM. (So, what can R do?)
• R accepts  Mif and only if L(M) = { }

Question: Can we use R to solve the


problem, such that we accept  M, wif and
only if M accepts w?
Emptiness Test for TM (3)
Proof Idea: Very tricky……

In order to use R, we hope to find a TM M’


based on M, wwith the following property:
• If M accepts w, L(M’ ) is not empty
• If M does not accept w, L(M’ ) is empty
Then, if we can find such M’
, it is easy to
check if M accepts w using R (why?)

Can we find such an M’


??
Emptiness Test for TM (4)
Hint: Find M’with the following property:
• If M accepts w, L(M’) is {w}
• If M does not accept w, L(M’ ) is empty

Answer: Consider the following TM M’ :


M’ =“On input x,
1. If x w, reject
2. Run M on x (= w). If M accepts, accept”
Question: What is L(M’
)?
Emptiness Test for TM (5)

Let us construct the desired TM S:


S=“ On input M, w,
1. Construct M’ based on M, w
2. Run R on M’
3. If R accepts, S rejects 
M, w (why?)
4. If R rejects, S accepts 
M, w”

So, if R is a decider, so is S. (why?) As no


decider for S exists, ETM is undecidable
Test a TM with certain property

Let REGULARTM be the language


{
M| M is a TM and L(M) is regular}

Theorem: REGULARTM is undecidable


Test a TM with certain property

Proof: By reducing ATM to REGULARTM.


I.e., assume REGULARTM is decidable, show ATM is decidable

Let us assume we have a TM R that decides


REGULARTM. (So, what can R do?)

Can we use R to get another TM S that


decides ATM ?
Test a TM with certain property
Proof Idea: In order to use R, we find a TM
M’ based on M, wwith the following
property:
• If M accepts w, L(M’ ) is regular
• If M not accept w, L(M’ ) is not regular
Then, if we can find such M’
, it is easy to
check if M accepts w using R

Can we find such an M’


?
Test a TM with certain property
Hint: Find M’with the following property:
• If M accepts w, L(M’) is {0,1}*
• If M does not accept w, L(M’ ) is {0n1n}
Answer: Consider the following TM M’ :
M’ =“ On input x,
1. If x has the form 0n1n, accept x
2. Else, run M on w. If M accepts, accept x”

Question: What is L(M’


)?
Test a TM with certain property
Let us construct the desired TM S:
S=“ On input M, w ,
1. Construct M’ based on M, w
2. Run R on M’
3. If R accepts, S accepts M, w (why?)
4. If R rejects, S rejects 
M, w”

 if R is a decider, so is S. As no decider
for S exists, REGULARTM is undecidable
Test a TM with certain property
• Thus, the language
{M| M is a TM and L(M) is empty}
or the language
{M| M is a TM and L(M) is regular}
are both undecidable
Rice Theorem
Let P be any specific non-trivial property
describing a language of a TM
Trivial property means: “ All TM has this property”or “All
TM does not have this property”
Non-trivial means: NOT “ all TM has this property”and
NOT “ all TM does not have this property”
Example of trivial: L(M) contains { } as its subset

Rice Theorem (Problem 5.28): The language


{ M| M is a TM and L(M) has property P}
is undecidable
Equality Test for TM

Let EQTM be the language


{
M1, M2| M1, M2 are TMs, L(M1) = L(M1) }

Theorem: EQTM is undecidable


Equality Test for TM (2)

Proof Idea: By reducing ETM to EQTM.


I.e., assume EQTM is decidable, show ETM is decidable.

Let us assume we have a TM R that decides


EQTM. (So, what can R do?)

Can we use R to get another TM S that


decides ETM ?
Equality Test for TM (3)

Proof Idea: In order to use R, we find two


TMs M1 and M2 based on  Mwith the
following property:
• If L(M) is empty, L(M1) = L(M2)
• If L(M) not empty, L(M1) L(M2)

Can we find such M1 and M2?


Equality Test for TM (4)

Very easy!!!

We set M1 = M,
and M2 = a TM that rejects all strings.

Then, M1 and M2 has the desired property:


• If L(M) is empty, L(M1) = L(M2)
• If L(M) not empty, L(M1) L(M2)
Equality Test for TM (5)

Let us construct the desired TM S:


S=“ On input M ,
1. Construct M1 and M2 based on M
2. Run R on M1, M2
3. If R accepts, S accepts M (why?)
4. If R rejects, S rejects 
M”

So, if R is a decider, so is S. As no decider


for S exists, EQTM is undecidable
Linear Bounded Automaton
Let us now look at a new computation model
called linear bounded automaton (LBA)

Definition: LBA is a restricted type of TM


whose tape head is not allowed to move
off the portion of the tape containing the
initial input

Interesting Fact: LBA is equivalent to a TM


that can use memory of size up to a
constant factor of the input length
Linear Bounded Automaton (2)
Theorem: Let M be an LBA with q states and
g symbols in the tape alphabet.
There are exactly qngn distinct
configurations of M for a tape of length n

Proof: By simple counting… Recall that a


configuration specifies the string in the
tape (gn choices in LBA), the position of
tape head (n choices in LBA), and the
current state (q choices in LBA).
Linear Bounded Automaton (3)
Corollary: On an input of length n, if the
LBA M does not halt after qngn steps,
then M cannot accept the input
Proof: The computation of M begins with the
start configuration. When M performs a
step, it goes from one configuration to
another. If M does not halt after qngn
steps, some configuration has repeated.
Then M will repeat this configuration over
and over (why?)  loop
Acceptance by LBA

Let ALBA be the language


{
M, w| M is an LBA and M accepts w }

Theorem: ALBA is decidable


Acceptance by LBA (2)

Proof: Let us construct a decider D:


D=“ On input  M, w ,
1. Simulate M on w for qngn steps (n = |w|)
or until it halts
2. If M halts and accepts w, D accepts
3. Else D rejects
Emptiness Test for LBA

Let ELBA be the language


{M| M is an LBA and L(M) = { } }

Theorem: ELBA is undecidable


Emptiness Test for LBA (2)
Proof Idea: By reducing ATM to ELBA.
I.e., assuming ELBA is decidable, show ATM is decidable.

Let us assume we have a TM R that decides


ELBA. (So, what can R do?)
• R accepts  Mif and only if L(M) = { }

Can we use R to get another TM S that


decides ATM ?
Emptiness Test for LBA (3)
Proof Idea: The old idea …… In order to
use R, we find an LBA B based on M, w
with the following property:
• If M accepts w, L(B) is not empty
• If M does not accept w, L(B) is empty

So, we now want to find a special B, which


accepts some string if and only if M
accepts w
Emptiness Test for LBA (4)
Before we proceed, recall that an accepting
configuration of a TM is a configuration
whose current state is qaccept
Also, recall that an accepting computation
history is a finite sequence of
configurations C0, C1, …, Ck such that
• C0 is the start configuration,
• each Ci follows legally from Ci-1, and
• finally Ck is an accepting configuration
Emptiness Test for LBA (5)
That means, whenever M, wis in ATM, there
must be an accepting computation history
that M can go through when it accepts w

Back to our proof…


We shall construct LBA B to accept some
string if and only if M accepts w
(Guess: what is this special string?)
Emptiness Test for LBA (6)
One special string which is uniquely defined
for M and w, when M accepts w, is the
accepting computation history:
# C0 # C1 # C2 # … # Ck #
Then, we construct B as follows:
B=“ On input x,
1. Test if x is an accepting computation
history for M to accept w
2. If yes, accept x; Else reject x”
Emptiness Test for LBA (7)

Quick Quiz:

Q1: Can B be constructed in finite steps?


Q2: What is L(B)?
Q3: Is B an LBA?
Emptiness Test for LBA (8)

Let us construct the desired TM S for ATM:


S=“ On input M, w,
1. Construct LBA B based on  M, w
2. Run R (LBA emptiness-tester) on B
3. If R accepts, S rejects M, w (why?)
4. If R rejects, S accepts M, w”

So, if R is a decider, so is S. As no decider


for S exists, ELBA is undecidable
CFG Accepting All Strings

Let ALLCFG be the language


{
G| G is a CFG and L(G) = * }

Theorem: ALLCFG is undecidable


CFG Accepting All Strings (2)
Proof Idea: By reducing ATM to ALLCFG.
I.e., assume ALLCFG is decidable, show ATM is decidable.

Let us assume we have a TM R that decides


ALLCFG. (So, what can R do?)
• R accepts  Gif and only if L(G)
accepts all strings.

Can we use R to get another TM S that


accepts M, wif and only if M accepts w?
CFG Accepting All Strings (3)
Proof Idea: The old idea …… In order to
use R, we find a CFG G based on  M, w
with the following property:
• If M accepts w, L(G) is not all strings
• If M does not accept w, L(G)=all strings
(Is there a way to find some special strings and miss them
in L(G), when M accepts w? )
If M accepts w, we want L(G) contains all
but any accepting computation histories
for M to accept w
CFG Accepting All Strings (4)
How can we find this grammar G?
…Very tricky, but here is one way:

Let G generates all strings that:


1. Do not start with C0 [Note: C0 is based on M,w]
2. Do not end with an accepting configuration
3. Some Ci does not follow legally from Ci-1
CFG Accepting All Strings (5)

Quick Quiz:

Q1: Does such a CFG G exist?


Q2: Can G be constructed in finite steps?
Q3: What is L(G)?
L(G) = all but accepting if M accepts w
L(G) = all strings if M not accept w
CFG Accepting All Strings (6)
Let us construct the desired TM S for ATM:
S=“ On input M, w ,
1. Construct CFG G based on  M, w
2. Run R (all-CFG-tester) on 
G
3. If R accepts, S rejects 
M, w
4. If R rejects, S accepts 
M, w”

So, if R is a decider, so is S. As no decider


for S exists, ALLCFG is undecidable
Equality Test for CFG

Let EQCFG be the language


{
G1, G2| G1, G2 are CFGs, and L(G1) = L(G1) }

Theorem: EQCFG is undecidable

How to prove?
Next Time

•Post’
s Correspondence Problem
–An undecidable problem with dominos
•Computable functions
–Another way of looking at reduction

You might also like