06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

“mcs” — 2017/3/3 — 11:21 — page 257 — #265<br />

8.2. The Halting Problem 257<br />

be some default string procedure—say one that never halts on anything it is applied<br />

to.<br />

Focusing just on string procedures, the general Halting Problem is to decide,<br />

given strings s and t, whether or not the procedure P s recognizes t. We’ll show<br />

that the general problem can’t be solved by showing that a special case can’t be<br />

solved, namely, whether or not P s recognizes s.<br />

Definition 8.2.1.<br />

No-halt WWD fs j P s applied to s does not haltg D fs … lang.P s /g: (8.3)<br />

We’re going to prove<br />

Theorem 8.2.2. No-halt is not recognizable.<br />

We’ll use an argument just like Cantor’s in the proof of Theorem 8.1.12.<br />

Proof. By definition,<br />

s 2 No-halt IFF s … lang.P s /; (8.4)<br />

<strong>for</strong> all strings s 2 ASCII .<br />

Now suppose to the contrary that No-halt was recognizable. This means there is<br />

some procedure P s0 that recognizes No-halt, that is,<br />

Combined with (8.4), we get<br />

No-halt D lang.P s0 / :<br />

s 2 lang.P s0 / iff s … lang.P s / (8.5)<br />

<strong>for</strong> all s 2 ASCII . Now letting s D s 0 in (8.5) yields the immediate contradiction<br />

s 0 2 lang.P s0 / iff s 0 … lang.P s0 / :<br />

This contradiction implies that No-halt cannot be recognized by any string procedure.<br />

<br />

So that does it: it’s logically impossible <strong>for</strong> programs in any particular language<br />

to solve just this special case of the general Halting Problem <strong>for</strong> programs in that<br />

language. And having proved that it’s impossible to have a procedure that figures<br />

out whether an arbitrary program halts, it’s easy to show that it’s impossible to have<br />

a procedure that is a perfect recognizer <strong>for</strong> any overall run time property. 3<br />

3 The weasel word “overall” creeps in here to rule out some run time properties that are easy<br />

to recognize because they depend only on part of the run time behavior. For example, the set of<br />

programs that halt after executing at most 100 instructions is recognizable.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!