Kleene's Recursion Theorem in TOC



The Kleene's Recursion Theorem is a fundamental concept in computability theory. In this chapter, we will see basics of this theorem and its implications, and a practical example for a better understanding.

Kleene's Recursion Theorem

The Kleene's Recursion Theorem states that for any acceptable numbering of partial recursive functions and any total recursive function, there exists a task that behaves the same way before and after the application of the total recursive function.

Formally, we can state the theorem like the following −

Let φ(k, n) be an acceptable numbering of partial recursive functions. For any total recursive function f, there exists an n such that −

$$\mathrm{\phi(k,\: n) \:=\: \phi(k,\: f(n))}$$

It seems complex, but we are breaking it down in steps.

Important Concepts

Before entering into the details of Kleenes Recursion Theorem, let us see some key concepts −

  • Partial Recursive Functions − These are functions that may not be defined for all inputs.
  • Total Recursive Functions − These are functions that are defined for all inputs and always terminate.
  • Acceptable Numbering − This is a way of assigning unique numbers to all partial recursive functions.

The Virus Analogy

To understand Kleene's Recursion Theorem better, let us recall an interesting idea that we have also covered in some previous article, the virus analogy.

The Virus Scenario

Imagine a scenario where a company called A wants to create a virus (A-Virus) that affects every program in a competing programming system. The virus is supposed to compute a total recursive function v such that for each n and k

$$\mathrm{\phi(k,\: n)\: \neq \:\phi(k,\: v(n))}$$

In other words, the virus aims to change the behaviour of every program in the system.

The Continuous Line Analogy

Another analogy is continuous line analogy. In this scenario, it is similar to trying to draw a continuous line across a unit square without touching the diagonal. It is impossible because the diagonal is always "in the way".

Similarly, Kleene's Recursion Theorem shows that it's impossible to create a virus that affects every program.

Proof of Kleene's Recursion Theorem

We start with an acceptable numbering of partial recursive functions, called φ(k, n).

We consider an arbitrary total recursive function f(our "virus").

The Table Analogy

Imagine a two-dimensional table where each cell T[n, m] contains the function φ(φ(n, m), x).

  • The Diagonal of the Table − The diagonal of this table (φ(φ(0, 0), x), φ(φ(1, 1), x), φ(φ(2, 2), x), ...) is actually a row of the table itself.
  • Constructing the Fixed Point − Using the universal property and s-m-n theorem, we can construct a total recursive function g such that:

$$\mathrm{\phi\:(\phi\:(j,\: n),\: x) \:=\: \phi\:(\phi\:(n,\: n),\: x)}$$

$$\mathrm{\text{where }\: \phi(j) \:=\: g}$$

Applying the Virus

When we apply our "virus" f to this function g, we find that there's a point where −

$$\mathrm{\phi(f(g(n)),\: x) \:=\: \phi\:(\phi(n,\: n),\: x) \:=\: \phi(g(n),\: x)}$$

It means that the behaviour of the index g(n) is unaffected by f, proving the theorem.

Applications of Kleene's Recursion Theorem

Kleene's Recursion Theorem has several applications including −

  • Self-Referential Programs − One interesting application is the creation of self-referential programs, like a program that prints its own source code.
  • Formal Proofs − The theorem allows us to formally prove properties of recursive functions without relying on the Church-Turing thesis.
  • Limitations of Viruses − As our analogy showed, the theorem proves that it's impossible to create a virus that affects every program in a system.

Example of Self-Printing Program

Let us see one interesting example for the theorem. The example is to create a self-printing program.

At first, creating a self-printing program seems simple. We might think we could just write −

print(program)

But this will not work because it would print "program", not the actual program itself.

Solution

Using Kleene's Recursion Theorem, we can create a truly self-referential program. Here's how:

  • We start with a projection function p(2, 2).
  • We apply the s-m-n theorem to get a function s.
  • We compose this with a constant function to get a total recursive function g.
  • Applying the Recursion Theorem, we get an m such that φ(m) = φ(g(m)).
  • This m is our self-referential program!

Conclusion

In this chapter, we explained the Kleene's Recursion Theorem in detail. We started with the basics, explaining what the theorem states and the key concepts involved. We then used an interesting analogy of a computer virus to illustrate the theorem's implications.

We understood the simplified proof of the theorem, using the concept of a two-dimensional table of functions and showing how the diagonal of this table relates to the theorem. We discussed the implications and applications of the theorem, including its use in creating self-referential programs and its role in formal proofs.

Advertisements