Workaround for Halting Problem

Let's assume that we do not have a DoesHalt(program) function, but DoesHalt() function inside runtime of program, which is able to signal true or false. It is also able to hang.

At first, the case that DoesHalt() will stop the program when called, continue afterwards and send program no additional input, will remove some uncertainties.

At second - the case that DoesHalt() can hang, will remove the impossible task from it - to return something when there is no way to communicate it. It can be implied that for any time timespan one can say (say, 1000 seconds) there must be infinite number of DoesHalt() methods, which take longer - otherwise one could get the output signal by waiting a given amount of time. Thus, the program run must take longer with more complex problems and with a specific set of problems, it must run into infinity - does not halt.

Now, the method leaves us, anyway, a workaround - the case DoesHalt() sees it's own code instance in code together with tricky program, it can detect this condition that it itself will hang. At least we haven't proven that it can't.

Lets see it in action:

DoesHalt(). - will signal true if the current process will eventually halt and false otherwise. Will hang if undecidable.

Program() {
  if DoesHalt(), run forever; otherwise halt.
}

Proxy() {
  if DoesHalt(), print "Running..."; otherwise halt.
  Program().
}

We see the general flow of events here:

If we call Program(), we will wait forever for output. That's not what we want - but that's neither bad. We could hypothesise about a halt checker, which runs always less than second in case program itself runs less than time passed from Big Bang or left to Big Collapse (there might not be one, but to show the principle). In such case we would never need to wait more than second.

If we call Proxy, which contains DoesHalt(), which will check the program code including DoesHalt() and the whole code for a paradox, it possibly could detect the whole situation. It must, of course, also detect the signal sent from inner DoesHalt(). There is no logical reason, why it should not be able to recognize all three situations as inner DoesHalt() will always hang in problematic cases without even reaching the puzzles and logical paradoxes. It will start looping through some metalevel set of different answers without being able to detect it's loop - possibly because each round becomes more complex. But an observer seeing both DoesHalt() and the tricky code using it's results might as well instantly understand, what's the case.

Proxy, in here, is also an example of the classical halting test program - it does not have impossible task now, because DoesHalt() inside will know the appropriate behaviour - hang when needed. Or at least it will fall into that behaviour.

Old NID
69293

Latest reads

Article teaser image
Donald Trump does not have the power to rescind either constitutional amendments or federal laws by mere executive order, no matter how strongly he might wish otherwise. No president of the United…
Article teaser image
The Biden administration recently issued a new report showing causal links between alcohol and cancer, and it's about time. The link has been long-known, but alcohol carcinogenic properties have been…
Article teaser image
In British Iron Age society, land was inherited through the female line and husbands moved to live with the wife’s community. Strong women like Margaret Thatcher resulted.That was inferred due to DNA…