Lecture 13 The Halting Problem - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Lecture 13 The Halting Problem

Description:

A Turing Machine decides the language L if: It accepts all w L ... grep grep /usr/bin/grep. Binary file (standard input) matches $ cat /tmp/example.pl EOP ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 21
Provided by: nickh4
Category:

less

Transcript and Presenter's Notes

Title: Lecture 13 The Halting Problem


1
CSci 4011
INHERENT LIMITATIONS OF COMPUTER PROGRAMS
2
QUIZ 3
A Turing Machine decides the language L if
It accepts all w ? L and rejects all w ? L.
The language L is Turing-recognizable if
There is a TM that accepts all and only the
strings in L.
w M accepts w
If M is a TM then L(M) is the set
3
SET THEORY 101
A function f A ! B is
1-1 (or injective) if
f(x)f(y) ? xy
onto (or surjective) if
?y ?x y f(x)
bijective if it is 1-1 and onto.
f can help us count. If f is
1-1 then A B

onto then A B

bijective then B A.

4
Let S be any set and P(S) be the power set of S
Theorem There is no onto map from S to P(S)
Proof
Assume, for a contradiction, that there is an
onto map f S ? P(S)
We construct an D ? S that cannot be the
output, f(y), for any y ?S.
Let D x ? S x ? f(x)
If D f(y) then
y ? D if and only if y ? D
5
Y
Y
N
Y
(yi 2 D) (yi ? f(yi))
6
The process of constructing a counterexample
by contradicting the diagonal is called
DIAGONALIZATION
7
No matter what, P(S) always has more elements
than S
8
THE CHURCH-TURING THESIS
L is recognized by a program for some
computer , L is recognized by a TM
The computer must be reasonable
9
There are languages over 0,1 that are not
decidable
If we believe the Church-Turing Thesis, this
means there are problems that computers
inherently cannot solve.
We proved this using a simple counting
argument
There are more Languages than Turing Machines.
10
Languages over 0,1
Turing Machines
11
Not all languages over 0,1 are decidable
Turing Machines
Languages over 0,1
Sets of strings of 0s and 1s
Strings of 0s and 1s
S
P(S)
OK, but what does an undecidable language look
like?
12
THE DIAGONAL LANGUAGE
DTM ltMgt M does not accept ltMgt is
undecidable.
Y
Y
N
Y
13
Programs can accept themselves as input
grep grep lt/usr/bin/grep Binary file (standard
input) matches
cat gt /tmp/example.pl ltltEOP !/usr/bin/perl
n print Yippee!\n if // EOP
/tmp/example.pl lt/tmp/example.pl Yippee! Yippee!
Programs can reject themselves as input
/usr/bin/python lt/usr/bin/python SyntaxError
invalid syntax
14
THE ACCEPTANCE PROBLEM
ATM ltM,wgt M is a TM that accepts string w
Theorem ATM is Turing-recognizable but NOT
decidable
ATM is Turing-recognizable
Define TM U as follows On input ltM,wgt, U runs
M on w. If M ever accepts accept. If M ever
rejects reject.
If M(w) loops forever U(ltM,wgt) loops forever.
15
ATM ltM,wgt M is a TM that accepts string w
ATM is undecidable
(proof by contradiction)
Assume TM acceptsInput decides ATM
acceptsInput(M,w)
Construct a new TM LLPF as follows on input ltMgt
run acceptsInput(M,ltMgt) and output the opposite
LLPF
LLPF
LLPF( M )
LLPF
LLPF
LLPF
16
OUTPUT OF acceptsInput(M,N)

M1
M2
M3
M4
LLPF
M1
accept
accept
M2
reject
accept
M3
accept
reject
M4
accept
reject

?
LLPF
reject
accept
reject
accept
17
Theorem ATM is Turing-recognizable (r.e.) but
NOT decidable
Theorem ?ATM is not even Turing-recognizable!
Proof
Suppose ATM is recognized by TM V.
We know ATM is recognized by U.
Build Z to decide ATM run V(M,w) and U(M,w) in
parallel. If V accepts, reject if U accepts,
accept.
18
A language is called Turing-recognizable,
semi-decidable, or recursively enumerable if some
TM recognizes it
A language is called decidable or recursive if
some TM decides it
all languages
19
THE HALTING PROBLEM
HALTTM ltM,wgt M is a TM that halts on string
w
Theorem HALTTM is undecidable
Proof
Assume, for a contradiction, that TM
haltsOnInput decides HALTTM
haltsOnInput(M,w)
liarLiar(ltliarLiargt) halts iff liarLiar(ltliarLiargt
) loops!
20
We can also prove that ATM is undecidable
by reusing the proof that DTM is undecidable.
Theorem. If ATM is decidable, then so is DTM.
Proof Suppose we have a program,
acceptsInput, that decides ATM, e.g.
acceptsInput(M,w) returns true if ltM,wgt ?ATM and
returns false otherwise.
We can build a TM notDiagonal to decide DTM

notDiagonal(ltMgt) return acceptsInput(M,ltMgt)
Theorem. If HALTTM is decidable, then so is ATM.
Proof acceptsInput(M,w) let M M with
qreject replaced by qloop. return
haltsOnInput(M,w)
Write a Comment
User Comments (0)
About PowerShow.com