You are on page 1of 35

Theory of Computation

Lecture #10
Sarmad Abbasi
Virtual University

Sarmad Abbasi (Virtual University)

Theory of Computation

1 / 35

Lecture 10: Overview

Undecidability of the Halting Problem


Russells Paradox
Reducibility
Undecidable Problems
Linear bounded automata

Sarmad Abbasi (Virtual University)

Theory of Computation

2 / 35

Acceptance Problem for TMs

Let us define
ATM = {hM, wi : M is a TM that accepts w}.
This is called the acceptance problem for TMs or the halting problem.
We also call this the Halting Problem. We showed that this problem is
undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

3 / 35

Undecidability of the Halting Problem

Theorem
ATM is not decidable.
The language ATM is undecidable. There is no TH H such that on input
hM, wi
1

H accepts if M accepts w.

H rejects if M does not accept w.

Sarmad Abbasi (Virtual University)

Theory of Computation

4 / 35

Undecidability of the Halting Problem

If H exists we can use H to construct D as follows:


1

On input hMi.

Convert hMi into hM, hMii

Run H on hM, hMii.

Output the opposite of what H does; that is


If H accepts reject, if H rejects accept.

Once we have constructed D we will ask how it behaves on its own


description.

Sarmad Abbasi (Virtual University)

Theory of Computation

5 / 35

Undecidability of the Halting Problem

Assume that H exists. We use H to construct D. This is easy D simply


converts its input hMi into hM, hMii and calls H. It returns the answer
that is opposite of the one given by H.
1

H accepts hM, wi exactly when M accepts w.

D rejects hMi exactly when M accepts hMi.

D rejects hDi exactly when D accepts hDi.

This leads to a contradiction.

Sarmad Abbasi (Virtual University)

Theory of Computation

6 / 35

Russells Paradox

In a town called Seville there lives a barber.


A man Seville is shaved by the barber if and only if the man does not
shave himself?"

Question
Does the barber of Seville shaves himself.

Sarmad Abbasi (Virtual University)

Theory of Computation

7 / 35

Russells Paradox

Students are asked to make a list in which they can include the names
of anyone (including themselves) in a class room. Is there a particular
student wrote the names of those people in the class who did not
include their own names in their own list?

Question
Does that particular student write his/her own name on his/her list?

Sarmad Abbasi (Virtual University)

Theory of Computation

8 / 35

Russells Paradox

Is it possible to have an enumerator that enumerates the description of


all the enumerators that do not enumerate their own description.
Suppose such an enumerator F exists.

Question
Does F enumerate its own description?

Sarmad Abbasi (Virtual University)

Theory of Computation

9 / 35

Russells Paradox

D that accepts (the description of) those TMs that do not accept
their own description.

Barber who shaves all those people who do not shave themselves.

Student who lists all those students who do not list themselves.

Enumerator that enumerates (the description of) all those


enumerators that do not enumerate themselves.

Such objects cannot exist.

Sarmad Abbasi (Virtual University)

Theory of Computation

10 / 35

Reducibility

Suppose u have a language B in your mind and you can prove that
If I can make a decider for B the I can make a decider for the halting
problem.

Sarmad Abbasi (Virtual University)

Theory of Computation

11 / 35

Reducibility

Now suppose some one claims that they have a decider for the
language B. Then I can claim that I have a decider for ATM . Which is
absurd.
From this we can conclude that B is also undecidable as we know that
ATM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

12 / 35

Reducibility

HALTTM = {hM, wi : M is a TM that halts on w}.

Theorem
HALTTM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

13 / 35

Reducibility

Suppose that HALTTM is decidable and R decides HALTTM . If we have


R then we have no problem on TM that loop endlessly. We can always
check if a TM will loop endlessly on a given input using R. We can use
R to make a decider for ATM . We know that ATM is undecidable. We
have a contradiction and that is why R cannot exist.

Sarmad Abbasi (Virtual University)

Theory of Computation

14 / 35

Reducibility

Given R we can construct S which decides ATM that operates as


follows:
On input hM, wi
1

Run TM R on input hM, wi.

If R rejects, reject.

If R accepts, simulate M on w until it halts.

If M has accepted w, accept; if M has rejected w, reject.

Note that S will reject hM, wi even if M loops on w.

Sarmad Abbasi (Virtual University)

Theory of Computation

15 / 35

Emptiness problem for TMs

ETM = {hMi : L(M) = }.

Theorem
ETM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

16 / 35

Emptiness problem

Suppose that ETM is decidable and R decides ETM . R accepts hMi if the
language of M is empty. We can use R to make a decider S for ATM .
We know that ATM is undecidable. We have a contradiction and that is
why R cannot exist. How can we construct S?

Sarmad Abbasi (Virtual University)

Theory of Computation

17 / 35

Emptiness problem

S gets hM, wi as an input. The first idea is to run R on input hMi and
check if it accepts. If it does, we know that L(M) is empty and therefore
that M does not accept w. But, if R rejects we only know that the
language of R is not empty. We do not know anything about what it
does on w. So the idea does not work. We have to come up with
another idea.

Sarmad Abbasi (Virtual University)

Theory of Computation

18 / 35

Emptiness problem

Given M and w let us consider M1 :


1

On input x

If x 6= w, reject.

If x = w, run M on input w and accept if M accepts w.

What is L(M1 )?

Sarmad Abbasi (Virtual University)

Theory of Computation

19 / 35

Emptiness problem


L(M1 ) =

Sarmad Abbasi (Virtual University)

,
if M does not accept w;
{w}, if M accepts w.

Theory of Computation

20 / 35

Emptiness problem

Given R we can now we can construct S which decides ATM that


operates as follows:
On input hM, wi
1

Run TM R on input hM, wi.

Construct M1

Run R on hM1 i

If R accepts hM1 i, reject. If it rejects hM1 i accept.

Sarmad Abbasi (Virtual University)

Theory of Computation

21 / 35

Emptiness problem

S is a decider for ATM . Since S does not exist we conclude that R does
not exist. So ETM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

22 / 35

Regular languages and TMs

REGTM = {hMi : L(M) is regular}.

Theorem
REGTM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

23 / 35

Regular languages and TMs

Suppose that REGTM is decidable and R decides REGTM . R accepts all


TMs that accept a regular language and reject all TMs that do not
accept a regular language. How can we use R to construct a decider
for ATM ? Note that S has to get as input hM, wi and has to decide if M
accepts w. The idea is as follows:

Sarmad Abbasi (Virtual University)

Theory of Computation

24 / 35

Regular languages and TMs

S gets hM, wi as an input. Given M and w we will construct a machine


M2 such that

is regular,
if M accpets w;
L(M2 ) =
not regular , if M does not w.

Sarmad Abbasi (Virtual University)

Theory of Computation

25 / 35

Regular languages and TMs

Given M and w let us consider M2 :


1

On input x

If x = 0n 1n then accept.

else run M on input w and accept x if M accepts w.

What is L(M2 )?

Sarmad Abbasi (Virtual University)

Theory of Computation

26 / 35

Regular languages and TMs


L(M2 ) =

Sarmad Abbasi (Virtual University)

{0n 1n : n 0}, if M does not accept w;


{0, 1} ,
if M accepts w.

Theory of Computation

27 / 35

Regular languages and TMs

Given R we can now we can construct S which decides ATM that


operates as follows:
On input hM, wi
1

Construct M2

Run R on hM2 i

If R accepts hM2 i, accept. If it rejects hM2 i reject.

Sarmad Abbasi (Virtual University)

Theory of Computation

28 / 35

Regular languages and TMs

S is a decider for ATM . Since S does not exist we conclude that R does
not exist. So REGTM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

29 / 35

Equivalence problem for TMs

So far we have only used ATM to show that other problems are
undecidable. Let us do something different. Let us define:
EQTM = {hM1 , M2 i : L(M1 ) = L(M2 )}.

Theorem
EQTM is undecidable.

Sarmad Abbasi (Virtual University)

Theory of Computation

30 / 35

Equivalence problem for TMs

Suppose that EQTM is decidable and R decides EQTM . ETM is the


problem of determining whether the language of a TM is empty. EQTM
is the problem of determining whether the languages of two TMs are
the same. If one of these languages is forced to be the empty set, we
end up with the problem of determining whether the language of the
other machine is empty.
ETM is a special case of EQTM .

Sarmad Abbasi (Virtual University)

Theory of Computation

31 / 35

Equivalence problem for TMs

Suppose R decides EQTM . We design S to decide ETM .


S gets hMi as an input. Let M0 be a machine that rejects all inputs.

Sarmad Abbasi (Virtual University)

Theory of Computation

32 / 35

Equivalence problem for TMs

On input hMi
1

Run R on hM, M0 i

If R accepts, accept. If it rejects , reject.

It is easy to see that the language of S is ETM . As, ETM is undecidable


so is EQTM .

Sarmad Abbasi (Virtual University)

Theory of Computation

33 / 35

Linear Bounded Automata


An LBA L is a restricted type of TM. Its tape head is not permitted to
move off the portion of the tape containing the input.
Here is a diagram of an LBA:

Sarmad Abbasi (Virtual University)

Theory of Computation

34 / 35

Linear Bounded Automata

As you can see the input portion of the tape is the only tape that the
LBA is allowed to move its head on.

Sarmad Abbasi (Virtual University)

Theory of Computation

35 / 35

You might also like