- #1
Stoney Pete
- 49
- 1
Hi everybody,
I've been trying to understand the various proofs for the unsolvabilty of the Halting Problem, and I was wondering wether the following somewhat informal reconstruction of one the usual proof strategies is by and large correct. I'd like to get your opinion on this, not just concerning the reasoning but also concerning its overall clarity and the terminology used. Here it goes:
Let A0, A1, A2,... be an enumeration of all possible algorithms.
Then the Halting Problem is the question: Is there an algorithm H(m,n) that decides for each algorithm Am whether Am gives an output (i.e. halts) when given n as input (with m and n from ℕ)? In other words: is the Halting Problem algorithmically solvable?
So H must be such that it says "yes" when Am halts on input n, and "no" otherwise. Let's encode: "yes" = 0 and "no" = 1. So we get H(m,n)=0 if Am(n) is defined, and H(m,n)=1 if Am(n) is undefined.
Now suppose, for reductio, that H exists. Then the self-halting problem must be algorithmically solvable as well.
Here "self-halting" indicates the situation where any algorithm Am halts when fed its own number on the list, m, as input. Since H(m,n) decides algorithmically for any Am whether it halts for input n, with both m and n from ℕ, H must do this also when m=n. That is: H must also decide algorithmically whether Am self-halts.
Now we can show that the self-halting problem is not algorthmically solvable.
For if H exists, then the compound algorithm D exists as well. D is composed of H and a trivial algorithm L which goes goes into an infinite loop when fed 0 as input, and which outputs 1 when fed 1 as input. To be more precise: D(m,n) = L(H(m,n)).
So if Am halts on input n, then H(m,n) will output 0, and 0 will then be fed as input to L, causing D to go into a loop (and thus not to halt). And if Am does not halt on input n, then H(m,n) will output 1, causing L and thereby D to output 1 (and thus to halt).
Now, supposing that H is a possible algorithm, then D is a possible algorithm as well (after all, L is trivially possible; so D=L(H) must be possible as well). So then D must be somewhere on our list of possible algoritms; let's say it's numer d on the list.
To repeat: if H exists, it must also solve the self-halting problem. Thus H must also decide whether D halts when given d as input. That is: H(d,d) must be defined.
But we can see that the execution of H(d,d) leads to contradiction, for the following reasons.
Remember: H(d,d) decides whether D halts on input d. Now there are only two possibilities:
Either D(d) is defined (i.e. D halts on d). Then H(d,d)=0. But D is so constructed that when H outputs 0, D goes into a loop. So if D halts on d, then it doesn't halt. Contradiction.
Or D(d) is not defined, i.e. D does not halt on d. Then H(d,d)=1. But D is so constructed then when H outputs 1, D outputs 1 as well and therefore halts. So if D doen't halt on d, it does halt. Again a contradiction.
So the self-halting problem is not algorithmically solvable.
Thus H cannot decide whether D will self-halt. But IF the Halting Problem is algorithmcally solvable (i.e. if H is possible), THEN the self-halting problem must be algorithmically solvable as well. But we just saw that the consequent of this conditial is false. Therefore the antecedent must be false as well: the Halting Problem is algorithmically unsolvable.
I've been trying to understand the various proofs for the unsolvabilty of the Halting Problem, and I was wondering wether the following somewhat informal reconstruction of one the usual proof strategies is by and large correct. I'd like to get your opinion on this, not just concerning the reasoning but also concerning its overall clarity and the terminology used. Here it goes:
Let A0, A1, A2,... be an enumeration of all possible algorithms.
Then the Halting Problem is the question: Is there an algorithm H(m,n) that decides for each algorithm Am whether Am gives an output (i.e. halts) when given n as input (with m and n from ℕ)? In other words: is the Halting Problem algorithmically solvable?
So H must be such that it says "yes" when Am halts on input n, and "no" otherwise. Let's encode: "yes" = 0 and "no" = 1. So we get H(m,n)=0 if Am(n) is defined, and H(m,n)=1 if Am(n) is undefined.
Now suppose, for reductio, that H exists. Then the self-halting problem must be algorithmically solvable as well.
Here "self-halting" indicates the situation where any algorithm Am halts when fed its own number on the list, m, as input. Since H(m,n) decides algorithmically for any Am whether it halts for input n, with both m and n from ℕ, H must do this also when m=n. That is: H must also decide algorithmically whether Am self-halts.
Now we can show that the self-halting problem is not algorthmically solvable.
For if H exists, then the compound algorithm D exists as well. D is composed of H and a trivial algorithm L which goes goes into an infinite loop when fed 0 as input, and which outputs 1 when fed 1 as input. To be more precise: D(m,n) = L(H(m,n)).
So if Am halts on input n, then H(m,n) will output 0, and 0 will then be fed as input to L, causing D to go into a loop (and thus not to halt). And if Am does not halt on input n, then H(m,n) will output 1, causing L and thereby D to output 1 (and thus to halt).
Now, supposing that H is a possible algorithm, then D is a possible algorithm as well (after all, L is trivially possible; so D=L(H) must be possible as well). So then D must be somewhere on our list of possible algoritms; let's say it's numer d on the list.
To repeat: if H exists, it must also solve the self-halting problem. Thus H must also decide whether D halts when given d as input. That is: H(d,d) must be defined.
But we can see that the execution of H(d,d) leads to contradiction, for the following reasons.
Remember: H(d,d) decides whether D halts on input d. Now there are only two possibilities:
Either D(d) is defined (i.e. D halts on d). Then H(d,d)=0. But D is so constructed that when H outputs 0, D goes into a loop. So if D halts on d, then it doesn't halt. Contradiction.
Or D(d) is not defined, i.e. D does not halt on d. Then H(d,d)=1. But D is so constructed then when H outputs 1, D outputs 1 as well and therefore halts. So if D doen't halt on d, it does halt. Again a contradiction.
So the self-halting problem is not algorithmically solvable.
Thus H cannot decide whether D will self-halt. But IF the Halting Problem is algorithmcally solvable (i.e. if H is possible), THEN the self-halting problem must be algorithmically solvable as well. But we just saw that the consequent of this conditial is false. Therefore the antecedent must be false as well: the Halting Problem is algorithmically unsolvable.