the halting problem is undecidable--an easy proof

the halting problem is undecidable--an easy proof

Ignore the picture for a moment; we'll get to it shortly. The program H(a,b)H(a,b) is supposed to be a halt tester: when we give HH an input of a program aa (think of aa as the listing of a program) and anything at all for bb, H(a,b)H(a,b) acts as follows

  1. If the program represented by aa halts when given bb as input, H(a,b)H(a,b) will answer "yes". On the other hand, if the program described by aa runs forever when given input bb then H(a,b)H(a,b) will answer "no".
  2. Importantly, program HH will always halt and give the correct answer for any pairs (a,b)(a,b).

The argument that HH is impossible to build relies on the action of a particular "perverse" program, PP, one which uses HH as a subroutine. PP takes as its input a listing of any program, xx, and does the following:

P(x) =
  run H(x, x)
  if H(x, x) answers "yes"
      loop forever
  else
      halt

 

It's not hard to see that

P(x)P(x) will halt if and only if the program xx will run forever when given its own description as an input.

So far so good: PP will certainly be a program as long as its subroutine HH is a program.

Now return to the picture. What happens if PP is given its own description as input? The picture describes just that scenario: Let pp be the description of program PP, then, substituting into the highlighted part above, we'll have

P(p)P(p) will halt if and only if the program P(p)P(p) will run forever.

Clearly, this paradoxical behavior is impossible, so we're forced to the conclusion that the subroutine HH cannot be a halt tester, since it fails in the one case, where it's given (p,p)(p,p) as input. There might be other cases where HH works as it should, but since HH fails in at least one situation, it cannot be a complete halt tester, as required.

中文理解版:

  假设有一个TM,能够输入b时执行程序a,可以accept或者reject也就是图灵可识别的,但是总能够halt,但是根据图灵可识别,TM在regect下可能进入无线枚举,从而everloop.但根据设定,我们的H总能halt

  若是H进入everloop则H输出"No", 若H能够halt住,则输出"Yes"

接着有一个P机器,H作为P的子程序,并且向P中输入一个x,P(H, x),规定如果H回答"Yes",那么P进入循环,若H回答"No",那么P就halt,

现在将P自己作为输入,即x=P.

若P作为halt状态输入P(H, P), 那么H会回答yes那么P则loopforever,

当H回答No时P才会停机,而H回答No的条件是H的程序runs forever,这表明P就是无限循环的,这和P停机时才会无限循环称为argument.

在下面reference中,http://www.elecfans.com/rengongzhineng/610327_a.html又更严谨的数学证明,证明时基于AM.Truing的论文,下面给出图片:

the halting problem is undecidable--an easy proof

 

在电子发烧友网站的大神写的证明粘过来:

http://www.elecfans.com/rengongzhineng/610327_a.html

reference:

https://en.wikipedia.org/wiki/Turing_machine

http://www.elecfans.com/rengongzhineng/610327_a.html

https://www.quora.com/What-is-the-difference-between-Turing-recognizeable-and-Turing-decideable-language

https://*.com/questions/8394455/how-does-this-proof-that-the-halting-problem-is-undecidable-work

https://zh.wikipedia.org/wiki/%E5%8F%AF%E6%95%B8%E9%9B%86

上一篇:Jira安装-windows7


下一篇:Qt中实现进程通信