A Brief Review of the Limits of Computation

The Stopping Problem - Can you write a program that checks other programs for infinite loops?

Remembering that the representation of a program, within a large computer is just a "large integer," we will work with integer psudo-programming language anduse a C-like functional programming notation

f(x){

   //C expressions and statements.

   return y; //x and y integers.

}

 

We write n(f)for the internal integer represention of f.

Theorem: There is no "program" stop(x $_{\text{1}}$,x $_{\text{2}}$) that returns a 1 if the program x $_{\text{1}}$ stops on x $_{\text{2}}$ and returns 0 when x $_{\text{1}}$does not stop(infinite loop) on x $_{\text{2}}$. That is f(x $_{\text{2}}$) returns a value or f(x $_{\text{2}}$) does not return.

Proof:

 

Consider the program

 

f(x){

   while(stop(x,x)==1){

    continue;

   }

   return 2;

}

 

Compute stop(n(f),n(f)):

Suppose stop(n(f),n(f))=1. That is f(n(f)) stops. Looking at the program we see that this

is possible only if stop(n(f),n(f))=0.

 

Suppose stop(n(f),n(f))=0. That is f(n(f)) does not return. Looking at the program we see

that this means that f(n(f)=2. In particular it does return.

ÿ