(6) Then the following program H' would also have to exist.
(6) Then the following program H' would also have to exist.
static void main(String [] args)
TokenReader in = new TokenReader(System.in);
String s = in.readString()
/* Set b==true if s is a program that loops when
given s as input, else set b==false. */
if ( b ) System.out.println(”done");
(7) Now consider program running program H' on input H'. Does it halt or loop? Answer: Neither!
Suppose it halts. Then b must be true. But b is true only if s (i.e., H') loops when given s (i.e., H') as input. Contradiction.
Suppose it loops. Then b must be false. But b is false only if s (i.e., H') does not loop when given s (i.e., H') as input. Contradiction.
(8) Therefore programs H’ and H can not exist.