# μ-recursive function

In mathematical logic and computer science, the **general recursive functions** (often shortened to **recursive functions**) or **μ-recursive functions** are a class of partial functions from natural numbers to natural numbers that are "computable" in an intuitive sense. In computability theory, it is shown that the μ-recursive functions are precisely the functions that can be computed by Turing machines[1][3](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 μ-recursive function is a primitive recursive function—the most famous example is the Ackermann function.

Other equivalent classes of functions are the λ-recursive functions and the functions that can be computed by Markov algorithms.

The subset of all *total* recursive functions with values in {0,1} is known in computational complexity theory as the complexity class R.

## Definition

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 μ 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:

**Constant functions C**: For each natural number and every_{n}^{k}

- Alternative definitions use instead a
**zero function**as a primitive function that always returns zero, and built the constant functions from the zero function, the successor function and the composition operator.

- Alternative definitions use instead a

**Successor function S:****Projection function**(also called the**Identity function**: For all natural numbers such that :

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):

**Composition operator**(also called the**substitution operator**): Given an m-ary function and m k-ary functions :

- This means that is defined only if and are all defined.

**Primitive recursion operator**: Given the*k*-ary function and*k*+2 -ary function :

- This means that is defined only if and are defined for all

**Minimization operator**: Given a (*k*+1)-ary function , the*k*-ary function is defined by:

- Intuitively, minimisation seeks—beginning the search from 0 and proceeding upwards—the smallest argument that causes the function to return zero; if there is no such argument, of if one encounters an argument for which f is not defined, then the search never terminates, and is not defined for the argument

(*Note*: While some textbooks use the μ-operator as defined here [4][5], others like [6][7] 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 Normalform Theorem [4][5]. The only difference is, that it becomes undecidable whether some text satisfies the requirements given for the base functions and operators as it is not semi-decidable (hence undecidable) whether a computable (i.e. μ-recursive) function is total [6].)

- Intuitively, minimisation seeks—beginning the search from 0 and proceeding upwards—the smallest argument that causes the function to return zero; if there is no such argument, of if one encounters an argument for which f is not defined, then the search never terminates, and is not defined for the argument

The **strong equality** operator can be used to compare partial μ-recursive functions. This is defined for all partial functions *f* and *g* so that

holds if and only if for any choice of arguments either both functions are defined and their values are equal or both functions are undefined.

## Equivalence with other models of computability

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).

## Normal form theorem

A normal form theorem due to Kleene says that for each *k* there are primitive recursive functions and such that for any μ-recursive function with *k* free variables there is an *e* such that

- .

The number *e* is called an **index** or **Gödel number** for the function *f*.[8]^{:52-53} A consequence of this result is that any μ-recursive function can be defined using a single instance of the μ operator applied to a (total) primitive recursive function.

Minsky (1967) observes (as does Boolos-Burgess-Jeffrey (2002) pp. 94–95) that the U defined above is in essence the μ-recursive equivalent of the universal Turing machine:

- To construct U is to write down the definition of a general-recursive function U(n, x) that correctly interprets the number n and computes the appropriate function of x. to construct U directly would involve essentially the same amount of effort,
*and essentially the same ideas*, as we have invested in constructing the universal Turing machine. (italics in original, Minsky (1967) p. 189)

## Symbolism

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 we will abbreviate the string of parameters x_{1}, ..., x_{n} as **x**:

**Constant function**: Kleene uses " C_{q}^{n}(**x**) = q " and Boolos-Burgess-Jeffrey (2002) (B-B-J) use the abbreviation " const_{n}(**x**) = n ":

- e.g. C
_{13}^{7}( r, s, t, u, v, w, x ) = 13 - e.g. const
_{13}( r, s, t, u, v, w, x ) = 13

- e.g. C

**Successor function**: Kleene uses x' and S for "Successor". As "successor" is considered to be primitive, most texts use the apostrophe as follows:

- S(a) = a +1 =
_{def}a', where 1 =_{def}0', 2 =_{def}0 ' ', etc.

- S(a) = a +1 =

**Identity function**: Kleene (1952) uses " U_{i}^{n}" to indicate the identity function over the variables x_{i}; B-B-J use the identity function id_{i}^{n}over the variables x_{1}to x_{n}:

- U
_{i}^{n}(**x**) = id_{i}^{n}(**x**) = x_{i} - e.g. U
_{3}^{7}= id_{3}^{7}( r, s, t, u, v, w, x ) = t

**Composition (Substitution) operator**: Kleene uses a bold-face**S**_{n}^{m}(not to be confused with his S for "successor"**!**). The superscript "m" refers to the m^{th}of function "f_{m}", whereas the subscript "n" refers to the n^{th}variable "x_{n}":

- If we are given h(
**x**)= g( f_{1}(**x**), ... , f_{m}(**x**) )- h(
**x**) =**S**_{m}^{n}(g, f_{1}, ... , f_{m})

- h(

- In a similar manner, but without the sub- and superscripts, B-B-J write:
- h(
*x'*)= Cn[g, f_{1},..., f_{m}](**x**)

- h(

**Primitive Recursion**: Kleene uses the symbol "**R**^{n}(base step, induction step) " where n indicates the number of variables, B-B-J use " Pr(base step, induction step)(**x**)". Given:

- base step: h( 0,
**x**)= f(**x**), and - induction step: h( y+1,
**x**) = g( y, h(y,**x**),**x**)

- base step: h( 0,

- Example: primitive recursion definition of a + b:
- base step: f( 0, a ) = a = U
_{1}^{1}(a) - induction step: f( b' , a ) = ( f ( b, a ) )' = g( b, f( b, a), a ) = g( b, c, a ) = c' = S(U
_{2}^{3}( b, c, a ))

- R
^{2}{ U_{1}^{1}(a), S [ (U_{2}^{3}( b, c, a ) ] } - Pr{ U
_{1}^{1}(a), S[ (U_{2}^{3}( b, c, a ) ] }

- base step: f( 0, a ) = a = U

**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

- S(a) = a'
- U
_{1}^{1}(a) = a - U
_{2}^{3}( b, c, a ) = c - g(b, c, a) = S(U
_{2}^{3}( b, c, a )) = c' - base step: h( 0, a ) = U
_{1}^{1}(a)

- induction step: h( b', a ) = g( b, h( b, a ), a )

He arrives at:

- a+b =
**R**^{2}[ U_{1}^{1},**S**_{1}^{3}(S, U_{2}^{3}) ]

- a+b =

## Examples

## References

- Stanford Encyclopedia of Philosophy, Entry Recursive Functions, Sect.1.7: "[The class of μ-recursive functions]
*turns out to coincide with the class of the Turing-computable functions introduced by Alan Turing as well as with the class of the λ-definable functions introduced by Alonzo Church.*" - Kleene, Stephen C. (1936). "λ-definability and recursiveness".
*Duke Mathematical Journal*.**2**(2): 340–352. doi:10.1215/s0012-7094-36-00227-2. - Turing, Alan Mathison (Dec 1937). "Computability and λ-Definability".
*Journal of Symbolic Logic*.**2**(4): 153–163. JSTOR 2268280. Proof outline on p.153: [2] - Enderton, H. B., A Mathematical Introduction to Logic, Academic Press, 1972
- Boolos, G. S., Burgess, J. P., Jeffrey, R. C., Computability and Logic, Cambridge Univerity Press, 2007
- Jones, N. D., Computability and Complexity: From a Programming Perspective, The MIT Press, Cambridge, Massachusetts, London, England, 1997
- Kfoury, A. J., R. N. Moll, and M. A. Arbib, A Programming Approach to Computability, 2nd ed., Springer-Verlag, Berlin, Heidelberg, NewYork, 1982
- Stephen Cole Kleene (Jan 1943). "Recursive predicates and quantifiers" (PDF).
*Transactions of the American Mathematical Society*.**53**(1): 41–73. doi:10.1090/S0002-9947-1943-0007371-8.

- Kleene, Stephen (1991) [1952].
*Introduction to Metamathematics*. Walters-Noordhoff & North-Holland. ISBN 0-7204-2103-9. - Soare, R. (1999) [1987].
*Recursively enumerable sets and degrees: A Study of Computable Functions and Computably Generated Sets*. Springer-Verlag. ISBN 9783540152996. - Minsky, Marvin L. (1972) [1967].
*Computation: Finite and Infinite Machines*. Prentice-Hall. pp. 210–5. ISBN 9780131654495.

- 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.

- Boolos, George; Burgess, John; Jeffrey, Richard (2002). "6.2 Minimization".
*Computability and Logic*(4th ed.). Cambridge University Press. pp. 70–71. ISBN 9780521007580.