In computability theory, Kleene's recursion theorems are a pair of fundamental results about the application of computable functions to their own descriptions. The theorems were first proved by Stephen Kleene in 1938 and appear in his 1952 book Introduction to Metamathematics.
The two recursion theorems can be applied to construct fixed points of certain operations on computable functions, to generate quines, and to construct functions defined via recursive definitions. The application to construction of a fixed point of any computable function is known as Rogers' theorem and is due to Hartley Rogers, Jr. (Rogers, 1967).
Contents

Notation 1

Rogers' fixedpoint theorem 2

Proof of the fixedpoint theorem 2.1

Fixedpoint free functions 2.2

Kleene's second recursion theorem 3

Comparison to Rogers' theorem 3.1

Application to elimination of recursion 3.2

Application to quines 3.3

Reflexive programming 3.4

The first recursion theorem 4

Example 4.1

Proof sketch for the first recursion theorem 4.2

Comparison to the second recursion theorem 4.3

Generalized theorem by A.I. Maltsev 5

See also 6

References 7

External links 8
Notation
The statement of the theorems refers to an admissible numbering \varphi of the partial recursive functions, such that the function corresponding to index e is \varphi_e. In programming terms, e is the program and \varphi_e its semantic denotation.
Rogers' fixedpoint theorem
Given a function F, a fixed point of F is, in this context, an index e such that \varphi_e \simeq \varphi_{F(e)}; in programming terms, e is semantically equivalent to F(e).

Rogers' fixedpoint theorem. If F is (total) computable, it has a fixed point.
This theorem is Theorem I in (Rogers, 1967: §11.2) where it is described as "a simpler version" of Kleene's (second) recursion theorem.
Proof of the fixedpoint theorem
The proof uses a particular total computable function h, defined as follows. Given a natural number x, the function h outputs the index of the partial computable function that performs the following computation:

Given an input y, first attempt to compute \varphi_{x}(x). If that computation returns an output e, then compute \varphi_e(y) and return its value, if any.
Thus, for all x, if \varphi_x(x) halts, then \varphi_{h(x)} = \varphi_{\varphi_x(x)}, and if \varphi_x(x) does not halt then \varphi_{h(x)}\, does not halt; this is denoted \varphi_{h(x)} \simeq \varphi_{\varphi_x(x)}. The function h can be constructed from the partial computable function g(x,y)=\varphi_{\varphi_x(x)}(y) and the smn theorem: for each x, h(x) is the index of a program which computes the function y \mapsto g(x,y).
To complete the proof, let F be any total computable function, and construct h as above. Let e be an index of the composition F \circ h, which is a total computable function. Then \varphi_{h(e)} \simeq \varphi_{\varphi_e(e)} by the definition of h. But, because e is an index of F \circ h, \varphi_e(e) = (F \circ h)(e), and thus \varphi_{\varphi_e(e)} \simeq \varphi_{F(h(e))}. By the transitivity of \simeq, this means \varphi_{h(e)} \simeq \varphi_{F(h(e))}. Hence \varphi_n \simeq \varphi_{F(n)} for n = h(e).
This proof is a construction of a partial recursive function which implements the Y combinator.
Fixedpoint free functions
A function F such that \varphi_e \not \simeq \varphi_{F(e)} for all e is called fixed point free. The fixedpoint theorem shows that no computable function is fixed point free, but there are many noncomputable fixedpoint free functions. Arslanov's completeness criterion" states that the only recursively enumerable Turing degree that computes a fixed point free function is 0´, the degree of the halting problem.^{[1]}
Kleene's second recursion theorem
An informal interpretation of the second recursion theorem is that selfreferential programs are acceptable.

The second recursion theorem. For any partial recursive function Q(x,y) there is an index p such that \varphi_p \simeq \lambda y.Q(p,y).
This can be used as follows. Suppose that we have a selfreferential program, namely one that evaluates a computable function Q of two arguments where the first is supposed to be the index of that very program, and the second represents input. By the theorem, we have a program p that does exactly that. Note that p only has y as input; it does not have to be supplied with its own index but satisfies the "self referential" equation by construction.
The theorem can be proved from Rogers' theorem by letting F(p) be a function such that \varphi_{F(p)}(y) = Q(p,y) (a construction described by the Smn theorem ). One can then verify that a fixedpoint of this F is an index p as required.
The theorem is constructive in the sense that a fixed computable function maps an index for Q into the index p.
Comparison to Rogers' theorem
Kleene's second recursion theorem and Rogers' theorem can both be proved, rather simply, from each other (Jones, 1997: p. 229230). However, a direct proof of Kleene's theorem (Kleene 1952: p. 352353) does not make use of a universal program, which means that the theorem holds for certain subrecursive programming systems that do not have a universal program.
Application to elimination of recursion
Suppose that g and h are total computable functions that are used in a recursive definition for a function f:

f(0,y) \simeq g(y),\,

f(x+1,y) \simeq h(f(x,y),x,y),\,
The second recursion theorem can be used to show that such equations define a computable function, where the notion of computability does not have to allow, a priori, for recursive definitions (for example, it may be defined by μrecursion, or by Turing machines). This recursive definition can be converted into a computable function \varphi_{F}(e,x,y) that assumes e is an index to itself, to simulate recursion:

\varphi_{F}(e,0,y) \simeq g(y),\,

\varphi_{F}(e,x+1,y) \simeq h(\varphi_e(x,y),x,y).\,
The recursion theorem establishes the existence of a computable function \varphi_f such that \varphi_f(x,y) \simeq \varphi_{F}(f,x,y). Thus f satisfies the given recursive definition.
Application to quines
A classic example using the second recursion theorem is the function Q(x,y)=x. The corresponding index p in this case yields a computable function that outputs its own index when applied to any value (Cutland 1980: p. 204). When expressed as computer programs, such indices are known as quines.
The following example in Lisp illustrates how the p in the corollary can be effectively produced from the function Q. The function s11
in the code is the function of that name produced by the Smn theorem.
Q
can be changed to any twoargument function.
(setq Q '(lambda (x y) x))
(setq s11 '(lambda (f x) (list 'lambda '(y) (list f x 'y))))
(setq n (list 'lambda '(x y) (list Q (list s11 'x 'x) 'y)))
(setq p (eval (list s11 n n)))
The results of the following expressions should be the same. \varphi p(nil)
Q(p, nil)
Reflexive programming
Reflexive, or reflective, programming refers to the usage of selfreference in programs. Jones (1997) presents a view of the second recursion theorem based on a reflexive language. It is shown that the reflexive language defined is not stronger than a language without reflection (because an interpreter for the reflexive language can be implemented without using reflection); then, it is shown that the recursion theorem is almost trivial in the reflexive language.
The first recursion theorem
The first recursion theorem is related to fixed points determined by enumeration operators, which are a computable analogue of inductive definitions. An enumeration operator is a set of pairs (A,n) where A is a (code for a) finite set of numbers and n is a single natural number. Often, n will be viewed as a code for an ordered pair of natural numbers, particularly when functions are defined via enumeration operators. Enumeration operators are of central importance in the study of enumeration reducibility.
Each enumeration operator Φ determines a function from sets of naturals to sets of naturals given by

\Phi(X) = \{ n \mid \exists A \subseteq X [(A,n) \in \Phi]\}.
A recursive operator is an enumeration operator that, when given the graph of a partial recursive function, always returns the graph of a partial recursive function.
A fixed point of an enumeration operator Φ is a set F such that Φ(F) = F. The first enumeration theorem shows that fixed points can be effectively obtained if the enumeration operator itself is computable.

First recursion theorem. The following statements hold.

For any computable enumeration operator Φ there is a recursively enumerable set F such that Φ(F) = F and F is the smallest set with this property.

For any recursive operator Ψ there is a partial computable function φ such that Ψ(φ) = φ and φ is the smallest partial computable function with this property.
Example
Like the second recursion theorem, the first recursion theorem can be used to obtain functions satisfying systems of recursion equations. To apply the first recursion theorem, the recursion equations must first be recast as a recursive operator.
Consider the recursion equations for the factorial function f:

f(0) = 1,

f(n+1) = (n + 1) · f(n).
The corresponding recursive operator Φ will have information that tells how to get to the next value of f from the previous value. However, the recursive operator will actually define the graph of f. First, Φ will contain the pair ( \varnothing, (0, 1)). This indicates that f(0) is unequivocally 1, and thus the pair (0,1) is in the graph of f.
Next, for each n and m, Φ will contain the pair ( \{ (n, m) \}, (n+1, (n+1)\cdot m)). This indicates that, if f(n) is m, then f(n + 1) is (n + 1)m, so that the pair (n + 1, (n + 1)m) is in the graph of f. Unlike the base case f(0) = 1, the recursive operator requires some information about f(n) before it defines a value of f(n + 1).
The first recursion theorem (in particular, part 1) states that there is a set F such that Φ(F) = F. The set F will consist entirely of ordered pairs of natural numbers, and will be the graph of the factorial function f, as desired.
The restriction to recursion equations that can be recast as recursive operators ensures that the recursion equations actually define a least fixed point. For example, consider the set of recursion equations:

g(0) = 1,

g(n + 1) = 1,

g(2n) = 0.
There is no function g satisfying these equations, because they imply g(2) = 1 and also imply g(2) = 0. Thus there is no fixed point g satisfying these recursion equations. It is possible to make an enumeration operator corresponding to these equations, but it will not be a recursive operator.
Proof sketch for the first recursion theorem
The proof of part 1 of the first recursion theorem is obtained by iterating the enumeration operator Φ beginning with the empty set. First, a sequence F_{k} is constructed, for k = 0, 1, \ldots. Let F_{0} be the empty set. Proceeding inductively, for each k, let F_{k + 1} be F_k \cup \Phi(F_k). Finally, F is taken to be \bigcup F_k. The remainder of the proof consists of a verification that F is recursively enumerable and is the least fixed point of Φ. The sequence F_{k} used in this proof corresponds to the Kleene chain in the proof of the Kleene fixedpoint theorem.
The second part of the first recursion theorem follows from the first part. The assumption that Φ is a recursive operator is used to show that the fixed point of Φ is the graph of a partial function. The key point is that if the fixed point F is not the graph of a function, then there is some k such that F_{k} is not the graph of a function.
Comparison to the second recursion theorem
Compared to the second recursion theorem, the first recursion theorem produces a stronger conclusion but only when narrower hypotheses are satisfied. Rogers [1967] uses the term weak recursion theorem for the first recursion theorem and strong recursion theorem for the second recursion theorem.
One difference between the first and second recursion theorems is that the fixed points obtained by the first recursion theorem are guaranteed to be least fixed points, while those obtained from the second recursion theorem may not be least fixed points.
A second difference is that the first recursion theorem only applies to systems of equations that can be recast as recursive operators. This restriction is similar to the restriction to continuous operators in the Kleene fixedpoint theorem of order theory. The second recursion theorem can be applied to any total recursive function.
Generalized theorem by A.I. Maltsev
Anatoly Maltsev proved a generalized version of the recursion theorem for any set with a precomplete numbering. A Gödel numbering is a precomplete numbering on the set of computable functions so the generalized theorem yields the Kleene recursion theorem as a special case.
Given a precomplete numbering \nu then for any partial computable function f with two parameters there exists a total computable function t with one parameter such that

\forall n \in \mathbb{N} : \nu \circ f(n,t(n)) = \nu \circ t(n).
See also
References

Cutland, N.J., Computability: An introduction to recursive function theory, Cambridge University Press, 1980. ISBN 0521294657


Kleene, Stephen, Introduction to Metamathematics, NorthHolland, 1952. ISBN 0720421039

Rogers, H. Theory of Recursive Functions and Effective Computability, MIT Press, 1967. ISBN 0262680521; ISBN 0070535221

Jones, N.D.J., Computability and Complexity from a programming perspective, MIT Press, 1997. ISBN 0262100649
External links

Recursive Functions entry by Stanford Encyclopedia of Philosophy, 2005.
This article was sourced from Creative Commons AttributionShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, EGovernment Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a nonprofit organization.