Hacker News new | ask | show | jobs
by jstanley 21 days ago
The standard argument is:

Assume H(P,i) to be a program that tells you whether the program P will halt on input i. Returns true if it halts and false if it doesn't.

Define a new program G(x) that halts if x does not halt on itself as input and loops forever if x halts on itself as input:

  def G(x):
    if H(x,x):
      while True:
        pass
    else:
      return
Does G(G) halt?

If G(G) halts then H(G,G) is true so we end up in the infinite loop, a contradiction. If G(G) does not halt then it returns without looping, also a contradiction.

So our halting oracle H does not exist, so there can not be a function that tells you whether another function will halt on itself as input, so there can not be a function that tells you in the general case whether some other computation will halt, QED.