In mathematical logic and computer science, a general recursive function, partial recursive function, or μ-recursive function is a partial function from natural numbers to natural numbers that is "computable" in an intuitive sense – as well as in a formal one. If the function is total, it is also called a total recursive function (sometimes shortened to recursive function).[1] In computability theory, it is shown that the μ-recursive functions are precisely the functions that can be computed by Turing machines[2] (this is one of the theorems that supports the Church–Turing thesis). The μ-recursive functions are closely related to primitive recursive functions, and their inductive definition (below) builds upon that of the primitive recursive functions. However, not every total recursive function is a primitive recursive function - the most famous example is the Ackermann function.
Other equivalent classes of functions are the functions of lambda calculus and the functions that can be computed by Markov algorithms.
The subset of all total recursive functions with values in is known in computational complexity theory as the complexity class R.
The μ-recursive functions (or general recursive functions) are partial functions that take finite tuples of natural numbers and return a single natural number. They are the smallest class of partial functions that includes the initial functions and is closed under composition, primitive recursion, and the minimization operator .
The smallest class of functions including the initial functions and closed under composition and primitive recursion (i.e. without minimisation) is the class of primitive recursive functions. While all primitive recursive functions are total, this is not true of partial recursive functions; for example, the minimisation of the successor function is undefined. The primitive recursive functions are a subset of the total recursive functions, which are a subset of the partial recursive functions. For example, the Ackermann function can be proven to be total recursive, and to be non-primitive.
Primitive or "basic" functions:
k(x | |
C | |
1,\ldots,x |
k) \stackrel{def
Alternative definitions use instead a zero function as a primitive function that always returns zero, and build the constant functions from the zero function, the successor function and the composition operator.
S(x) \stackrel{def
k | |
P | |
i |
i,k
1\lei\lek
k(x | |
P | |
1,\ldots,x |
k) \stackrel{def
Operators (the domain of a function defined by an operator is the set of the values of the arguments such that every function application that must be done during the computation provides a well-defined result):
\circ
h(x1,\ldots,xm)
g1(x1,\ldots,xk),\ldots,gm(x1,\ldots,xk)
h\circ(g1,\ldots,gm) \stackrel{def
This means that
f(x1,\ldots,xk)
g1(x1,\ldots,xk),\ldots,gm(x1,\ldots,xk),
h(g1(x1,\ldots,xk),\ldots,gm(x1,\ldots,xk))
g(x1,\ldots,xk)
h(y,z,x1,\ldots,xk)
\begin{align}\rho(g,h)& \stackrel{def
This means that
f(y,x1,\ldots,xk)
g(x1,\ldots,xk)
h(z,f(z,x1,\ldots,xk),x1,\ldots,xk)
z<y.
f(y,x1,\ldots,xk)
\mu(f)
\begin{align} \mu(f)(x1,\ldots,xk)=z\stackrel{def
\mu(f)
(x1,\ldots,xk).
While some textbooks use the μ-operator as defined here,[3] [4] others like[5] [6] demand that the μ-operator is applied to total functions only. Although this restricts the μ-operator as compared to the definition given here, the class of μ-recursive functions remains the same, which follows from Kleene's Normal Form Theorem (see below).[3] [4] The only difference is, that it becomes undecidable whether a specific function definition defines a μ-recursive function, as it is undecidable whether a computable (i.e. μ-recursive) function is total.[5]
The strong equality operator
\simeq
f(x1,\ldots,xk)\simeqg(x1,\ldots,xl)
Examples not involving the minimization operator can be found at Primitive recursive function#Examples.
The following examples are intended just to demonstrate the use of the minimization operator; they could also be defined without it, albeit in a more complicated way, since they are all primitive recursive.The following examples define general recursive functions that are not primitive recursive; hence they cannot avoid using the minimization operator.
A general recursive function is called total recursive function if it is defined for every input, or, equivalently, if it can be computed by a total Turing machine. There is no way to computably tell if a given general recursive function is total - see Halting problem.
In the equivalence of models of computability, a parallel is drawn between Turing machines that do not terminate for certain inputs and an undefined result for that input in the corresponding partial recursive function.The unbounded search operator is not definable by the rules of primitive recursion as those do not provide a mechanism for "infinite loops" (undefined values).
A normal form theorem due to Kleene says that for each k there are primitive recursive functions
U(y)
T(y,e,x1,\ldots,xk)
f(x1,\ldots,xk)
f(x1,\ldots,xk)\simeqU(\mu(T)(e,x1,\ldots,xk))
Minsky observes the
U
A number of different symbolisms are used in the literature. An advantage to using the symbolism is a derivation of a function by "nesting" of the operators one inside the other is easier to write in a compact form. In the following the string of parameters x1, ..., xn is abbreviated as x:
e.g. C (r, s, t, u, v, w, x) = 13
e.g. const13 (r, s, t, u, v, w, x) = 13
S(a) = a +1 =def a', where 1 =def 0', 2 =def 0 ' ', etc.
U(x) = id(x) = xi
e.g. U = id (r, s, t, u, v, w, x) = t
If we are given h(x)= g(f1(x), ..., fm(x))
h(x) = S(g, f1, ..., fm)
In a similar manner, but without the sub- and superscripts, B-B-J write:
h(x)= Cn[g, f<sub>1</sub>,..., f<sub>m</sub>](x)
Example: primitive recursion definition of a + b:
R2
Pr
Example: Kleene gives an example of how to perform the recursive derivation of f(b, a) = b + a (notice reversal of variables a and b). He starts with 3 initial functions
induction step: h(b', a) = g(b, h(b, a), a)
He arrives at:
a+b = R2[U{{su|b=1|p=1}}, '''S'''{{su|b=1|p=3}}(S, U{{su|b=2|p=3}}) ]
On pages 210-215 Minsky shows how to create the μ-operator using the register machine model, thus demonstrating its equivalence to the general recursive functions.