0% found this document useful (0 votes)
14 views2 pages

Ch4 AdditionalProofHaltingProblem

Uploaded by

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

Ch4 AdditionalProofHaltingProblem

Uploaded by

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

Sketch of a proof that the Halting Problem is

unsolvable (http://faculty.juniata.edu/rhodes/intro/theory2.htm)
This proof was devised by Alan Turing, 1936

Suppose you have a solution to the halting problem called H.


H takes two inputs:

1. a program P and
2. an input I for the program P.

H generates an output "halt" if H determines that P stops on input I or it outputs


"loop" otherwise.

ASIDE: When an algorithm is coded, it is expressed as a string of characters which


can also be interpreted as a sequence of numbers. We can treat the program as data
and therefore a program can be thought of as input.

For example, compilers take programs as input and generate machine code as output.
Netscape takes a Javascript program and generates output.
So now H can be revised to take P as both inputs (the program and its input) and H
should be able to determine if P will halt on P as its input.

Let us construct a new, simple algorithm K that takes H's output as its input and does
the following

1. if H outputs "loop" then K halts,


2. otherwise H's output of "halt" causes K to loop forever.

That is, K will do the opposite of H's output.

Since K is a program, let us use K as the input to K.

If H says that K halts then K itself would loop (that's how we constructed it).
If H says that K loops then K will halt.

In either case H gives the wrong answer for K. Thus H cannot work in all cases.

We've shown that it is possible to construct an input that causes any solution H to fail.

You might also like