Editing 1266: Halting Problem
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 8: | Line 8: | ||
==Explanation== | ==Explanation== | ||
− | In 1936 {{w|Alan Turing}} proved that it's not possible | + | In 1936 {{w|Alan Turing}} proved that it's not possible to decide whether an arbitrary program will eventually halt, or run forever. This was later called the {{w|Halting problem}} by {{w|Martin Davis}}. The official definition of the problem is to write a program (actually, a {{w|Turing Machine}}) that accepts as parameters a program and its parameters. That program needs to decide, in finite time, whether that program will ever halt running these parameters. |
The halting problem is a cornerstone problem in computer science. It is used mainly as a way to prove a given task is impossible, by showing that solving that task will allow one to solve the halting problem. | The halting problem is a cornerstone problem in computer science. It is used mainly as a way to prove a given task is impossible, by showing that solving that task will allow one to solve the halting problem. | ||
Line 16: | Line 16: | ||
From a '''physical''' perspective, according to our current understanding of physics, this is right. Given enough time, any program will halt. This is due to factors external to the actual program. Sooner or later, electricity will give out, or the memory containing the program will get corrupted by cosmic rays, or corrosion will eat away the silicon in the CPU, or the {{w|second law of thermodynamics}} will lead to the {{w|Heat death of the universe}}. Nothing lasts forever, and this includes a running program. | From a '''physical''' perspective, according to our current understanding of physics, this is right. Given enough time, any program will halt. This is due to factors external to the actual program. Sooner or later, electricity will give out, or the memory containing the program will get corrupted by cosmic rays, or corrosion will eat away the silicon in the CPU, or the {{w|second law of thermodynamics}} will lead to the {{w|Heat death of the universe}}. Nothing lasts forever, and this includes a running program. | ||
− | From a '''mathematical''' point of view, this is not true: a Turing machine will never have a hardware failure because it's not a physical machine. It's a theoretical construct, and it's '''defined''' mathematically, independent of any physical hardware. Similarly, ⅓ + ⅓ + ⅓ = 1 no matter what any physical hardware you are computing it on claims | + | From a '''mathematical''' point of view, this is not true: a Turing machine will never have a hardware failure because it's not a physical machine. It's a theoretical construct, and it's '''defined''' mathematically, independent of any physical hardware. Similarly, ⅓ + ⅓ + ⅓ = 1 no matter what any physical hardware you are computing it on claims. |
− | |||
− | |||
From a '''practical''' point of view, there are of course times that a programmer would want to return "false", since some programs can be mathematically shown to run forever. | From a '''practical''' point of view, there are of course times that a programmer would want to return "false", since some programs can be mathematically shown to run forever. | ||
− | The title text further relates to this issue by claiming to have found a case where something need not die, but Randall does not know how to actually show it to anyone, because just the fact everyone will die sooner than it doesn't prove it will not die. The wording of the title text might also be a reference to {{w|Fermat's Last Theorem}}. | + | The title text further relates to this issue by claiming to have found a case where something need not die, but Randall does not know how to actually show it to anyone, because just the fact everyone will die sooner than this thing it doesn't prove it will not die. The wording of the title text might also be a reference to {{w|Fermat's Last Theorem}}. |
It should be noted that Randall's solution, barring its unsoundness, solves more than the halting problem in the form it is usually stated. The halting problem requires two parameters (a program and its parameters), while Randall's function only accepts one (the program). The question of whether a program halts for every input can be shown to be even harder to solve than the halting problem, meaning that even if a Turing machine had an additional instruction allowing it to check whether a program halts with given parameters, it still could not always confirm that a given program that halts for all parameters does so. | It should be noted that Randall's solution, barring its unsoundness, solves more than the halting problem in the form it is usually stated. The halting problem requires two parameters (a program and its parameters), while Randall's function only accepts one (the program). The question of whether a program halts for every input can be shown to be even harder to solve than the halting problem, meaning that even if a Turing machine had an additional instruction allowing it to check whether a program halts with given parameters, it still could not always confirm that a given program that halts for all parameters does so. | ||
The code in this comic is written in {{w|pseudocode}}, to demonstrate the "algorithm" rather than an implementation in some existing programming language. The syntax resembles a mix of {{w|C (programming language)|C}} and {{w|Python (programming language)|Python}}. | The code in this comic is written in {{w|pseudocode}}, to demonstrate the "algorithm" rather than an implementation in some existing programming language. The syntax resembles a mix of {{w|C (programming language)|C}} and {{w|Python (programming language)|Python}}. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Transcript== | ==Transcript== | ||
− | :[ | + | :[Today's strip is in the form of a short computer program.] |
'''Define''' DoesItHalt(program): | '''Define''' DoesItHalt(program): | ||
{ | { | ||
− | ''' | + | '''return''' true; |
} | } | ||
− | |||
:The big picture solution to the halting problem. | :The big picture solution to the halting problem. | ||