Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Undecidability

Chapter 9

1
Halting
Turing machine halts if it enters a state q and
there is no movement in that situation = (q,X)
is undefined.
2 types:
 Halt and acceptance
 Halt and reject

2
Decidability vs. Undecidability
 There are two types of TMs (based on halting):
(Recursive)
TMs that always halt, no matter accepting or non-
accepting  DECIDABLE PROBLEMS
(Recursively enumerable)
TMs that are guaranteed to halt only on acceptance. If
non-accepting, it may or may not halt (i.e., could loop
forever).

Undecidability:
 Undecidable problems are those that are not
recursive

3
Recursive, RE, Undecidable languages
No TMs exist
TMs that always halt

Non-RE Languages TMs that may or


(all other languages for which may not halt
no TMs can be built)

Enumerable (RE)
Recursively
Regular Context-

sensitive
Context

Recursive
(DFA)
free
(PDA)

“Undecidable” problems
“Decidable” problems
4
Recursive Languages &
Recursively Enumerable (RE)
Languages
 Any TM for a Recursive language is going to
look like this:
“accept”
w
M
“reject”

 Any TM for a Recursively Enumerable (RE)


language is going to look like this:
“accept”
w
M

5
Closure Properties

6
Recursive Languages are closed
under complementation
 If L is Recursive, L is also Recursive

M
“accept” “accept”
w
w M
“reject” “reject”

7
Are Recursively Enumerable
Languages closed under
complementation? (NO)
 If L is RE, L need not be RE

M
“accept” “accept” ?
w
w M
“reject”
?

8
Recursive Languages are
closed under Union
 Let Mu = TM for L1 U L2
 Mu construction: Mu
accept
1. Make 2-tapes and M1 reject
copy input w on both OR
tapes w accept
2. Simulate M1 on tape 1 M2 reject
3. Simulate M2 on tape 2
4. If either M1 or M2
accepts, then Mu
accepts
5. Otherwise, Mu rejects.

9
Recursive Languages are
closed under Intersection
 Let Mn = TM for L1  L2
 Mn construction: Mn
accept
1. Make 2-tapes and M1 reject
copy input w on both AND
AND
tapes w accept
2. Simulate M1 on tape 1 M2 reject
3. Simulate M2 on tape 2
4. If M1 AND M2 accepts,
then Mn accepts
5. Otherwise, Mn rejects.

10
Other Closure Property
Results
 Recursive languages are also closed under:
 Concatenation
 Kleene closure (star operator)
 Homomorphism, and inverse homomorphism
 RE languages are closed under:
 Union, intersection, concatenation, Kleene closure

 RE languages are not closed under:


 complementation

11
The Halting Problem

12
The Halting Problem
 Input − A Turing machine and an
input string w.
 Problem − Does the Turing machine
finish computing of the string w in
a finite number of steps? The
answer must be either yes or no.

13
The Universal Turing Machine
 At first, we will assume that such a Turing machine
exists to solve this problem and then we will show it is
contradicting itself.
 Given TM M & its input w.
 We will build another TM called “H”, that will output:
 “accept” if M accepts w, and
 “reject” otherwise
 An algorithm for H:
 Simulate M on w
accept, if M accepts w
 H(<M,w>) =
reject, if M does does not accept w

14
The Universal Turing Machine

Input w Machine
Will it always halt?
M

“accept”
<M,w>
H
“reject”

let us assume H exists that is always guaranteed to halt


15
Therefore, if H exists  D also should exist.
But can such a D exist? (if not, then H also cannot exist)

HP Proof (step 1)
 Let us construct a new TM D using H as a
subroutine:
 On input <M>:
1. Run H on input <M, <M> >; //(i.e., run M on M itself)
2. Output the opposite of what H outputs;

“accept” “accept”
<M>
<M, “<M>” > H
“reject” “reject”

16
HP Proof (step 2)
 The notion of inputing “<M>” to M itself
 A program can be input to itself (e.g., a compiler is a
program that takes any program as input)
accept, if M does not accept <M>
D (<M>) =
reject, if M accepts <M>
Now, what happens if D is input to itself?

accept, if D does not accept <D>


D (<D>) =
reject, if D accepts <D>

A contradiction!!! ==> Neither D nor H can exist.


17
End

18

You might also like