How does this proof, that the halting problem is undecidable, work?

后端 未结 2 572
不思量自难忘°
不思量自难忘° 2021-01-31 04:47

I\'m going over the proof for The Halting Problem in Intro to the Theory of Computation by Sipser and my main concern is about the proof below:

If TM M doesn\'

相关标签:
2条回答
  • 2021-01-31 05:34

    After reading this and trying to visualize the proof I came up with this code which is a simplified version of the code in this answer to a related question:

    function halts(func) {
      // Insert code here that returns "true" if "func" halts and "false" otherwise.
    }
    
    function deceiver() {
      if(halts(deceiver))
        while(true) { }
    }
    

    If halts(deceiver) returns true, deceiver will run forever, and if it returns false, deceiver will halt, which contradicts the definition of halts. Hence, the function halts is impossible.

    0 讨论(0)
  • 2021-01-31 05:36

    This is a "proof by contradiction", a reductio ad absurdum. (Latin phrases are always good in theory classes... as long as they make sense, of course.)

    This program H is just a program with two inputs: a string representing a program for some machine, and an input. For purposes of the proof, you simply assume the program H is correct: it simply will halt and accept if M accepts with w. You don't need to think about how it would do that; in fact, we're about to prove it can't, that no such program H can exist, ...

    BECAUSE

    if such a program existed, we could immediately construct another program H' that H couldn't decide. But, by the assumption, there is no such program: H can decide everything. So, we're forced to conclude that no program defined as we defined H is possible.

    By the way, the reductio method of proof is more controversial than you might expect, considering how often its used, especially in Computer Science. You shouldn't be embarrassed to find it a little odd. The magic term is "non-constructive" and if you feel really ambitious, ask one of your professors about Errett Bishop's critique of non-constructive mathematics.

    0 讨论(0)
提交回复
热议问题