One of several equivalent definitions of a computable function
Inmathematical logic andcomputer science, ageneral recursive function,partial recursive function, orμ-recursive function is apartial function fromnatural numbers to natural numbers that is "computable" in an intuitive sense – as well as in aformal one. If the function istotal, it is also called atotal recursive function (sometimes shortened torecursive function).[1] Incomputability theory, it is shown that the μ-recursive functions are precisely the functions that can be computed byTuring machines[2][4] (this is one of the theorems that supports theChurch–Turing thesis). The μ-recursive functions are closely related toprimitive 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 theAckermann function.
Other equivalent classes of functions are the functions oflambda calculus and the functions that can be computed byMarkov algorithms.
Theμ-recursive functions (orgeneral 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 theminimization operatorμ.
The smallest class of functions including the initial functions and closed under composition and primitive recursion (i.e. without minimisation) is the class ofprimitive 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, theAckermann function can be proven to be total recursive, and to be non-primitive.
Primitive or "basic" functions:
Constant functionsCk n: For each natural numbern and everyk
Alternative definitions use instead azero 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.
Successor function S:
Projection function (also called theIdentity function): For all natural numbers such that:
Operators (thedomain of a function defined by an operator is the set of the values of the arguments such that everyfunction application that must be done during the computation provides a well-defined result):
Composition operator (also called thesubstitution 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 thek-ary function andk+2 -ary function:
This means that is defined only if and are defined for all
Minimization operatorμ: Given a (k+1)-ary function, thek-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, or if one encounters an argument for whichf is not defined, then the search never terminates, and is not defined for the argument
While some textbooks use the μ-operator as defined here,[5][6] others[7][8] demand that the μ-operator is applied tototal functionsf 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 (seebelow).[5][6] 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.[7]
Thestrong equality relation can be used to compare partial μ-recursive functions. This is defined for all partial functionsf andg so that
holdsif and only if for any choice of arguments either both functions are defined and their values are equal or both functions are undefined.
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.
Theinteger square root ofx can be defined as the leastz such that. Using the minimization operator, a general recursive definition is, whereNot,Gt, andMul arelogical negation, greater-than, and multiplication,[9] respectively. In fact, is0 if, and only if, holds. Hence is the leastz such that holds. The negationjunctorNot is needed sinceGt encodes truth by1, whileμ seeks for0.
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 calledtotal recursive function if it is defined for every input, or, equivalently, if it can be computed by atotal Turing machine. There is no way to computably tell if a given general recursive function is total - seeHalting problem.
This sectionneeds expansion. You can help byadding to it.(February 2010)
In theequivalence of models of computability, a parallel is drawn betweenTuring 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).
Anormal form theorem due to Kleene says that for eachk there are primitive recursive functions and such that for any μ-recursive function withk free variables there is ane such that
.
The numbere is called anindex orGödel number for the functionf.[10]: 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.
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[11]
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 is abbreviated as:
Constant function: Kleene uses "" and Boolos-Burgess-Jeffrey (2002) (B-B-J) use the abbreviation "":
e.g.
e.g.
Successor function: Kleene uses and for "Successor". As "successor" is considered to be primitive, most texts use the apostrophe as follows:
, where
,
, etc.
Identity function: Kleene (1952) uses to indicate theidentity function over the variables; B-B-J use the identity function over the variables to:
e.g.
Composition (Substitution) operator: Kleene uses a bold-face (not to be confused with his for "successor"!). The superscript refers to the function, whereas the subscript refers to the variable:
If we are given
then
In a similar manner, but without the sub- and superscripts, B-B-J write:
Primitive Recursion: Kleene uses the symbol where n indicates the number of variables; B-B-J use. Given:
base step:
induction step:
Example: primitive recursion definition of
base step:U1 1(a)
induction step:
Example: Kleene gives an example of how to perform the recursive derivation of (notice reversal of variables and). He starts with initial functions
^"Recursive Functions".The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University. 2021.
^Stanford Encyclopedia of Philosophy, EntryRecursive 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."
On pages 210-215 Minsky shows how to create the μ-operator using theregister machine model, thus demonstrating its equivalence to the general recursive functions.