Halting problem

Yesterday i accounted a very fun problem which has a mathematically incomputable solution. Meaning; the solution cannot and will never be able to be stated as a mathematical formula. Let me take this from the begining. There is a known problem called "The halting problem".

The first thing we ask ourselves; Is it generally possible to prove that a program has bugs in it or not, for all possible inputs?
The answer is False, this is impossible and here's another view of the problem;

Is it generally possible to prove that a program will eventually halt or weather it will loop forever, for all possible inputs?
Same answer here, this is False

We have this function public boolean Halts(string program, object[] arguments);

And now we have
public static void UhOh(string program) { if (Halts(program)) for(;;); else return; }

What happens when the argument is the program itself? Then the result will be:
If i Halt: Loop forever
If i loop: Halt
Which takes us back to square one, this problem is impossible to solve.

This is called The halting problem, read more here: http://en.wikipedia.org/wiki/Halting_problem

Now, of course there is a solution, why else would i bother repeating this? :)

The Busy Beaver Set is the solution to our problem, this Set of numbers will help us, however, the Busy Bever Set is impossible to compute with mathematics. Which makes this theory impossible to prove. Im not gonna state how the BBS works but it will generally help us try out 4 > 5 instruction long sequences which makes it possible to try over billions of inputs. Its still not infinity though.

Special thanks to Chris from Glasgow, Software Engineere.

Kommentarer

Kommentera inlägget här:

Namn:
Kom ihåg mig?

E-postadress:

URL:

Kommentar:

Trackback