In computability theory, a **primitive recursive function** is roughly speaking a function that can be computed by a computer program whose loops are all "for" loops (that is, an upper bound of the number of iterations of every loop can be determined before entering the loop). Primitive recursive functions form a strict subset of those general recursive functions that are also total functions.

- Definition
- Role of the projection functions
- Weak primitive recursion
- Converting predicates to numeric functions
- Computer language definition
- Examples
- Addition
- Subtraction
- Other operations on natural numbers
- Operations on integers and rational numbers
- Use in first-order Peano arithmetic
- Relationship to recursive functions
- Limitations
- Some common primitive recursive functions
- Additional primitive recursive forms
- Finitism and consistency results
- History
- See also
- Notes
- References

The importance of primitive recursive functions lies on the fact that most computable functions that are studied in number theory (and more generally in mathematics) are primitive recursive. For example, addition and division, the factorial and exponential function, and the function which returns the *n*th prime are all primitive recursive.^{ [1] } In fact, for showing that a computable function is primitive recursive, it suffices to show that its time complexity is bounded above by a primitive recursive function of the input size. It follows that it is difficult to devise a computable function that is *not* primitive recursive, although some are known (see § Limitations below).

The set of primitive recursive functions is known as PR in computational complexity theory.

The primitive recursive functions are among the number-theoretic functions, which are functions from the natural numbers (nonnegative integers) {0, 1, 2, ...} to the natural numbers. These functions take *n* arguments for some natural number *n* and are called *n*-ary.

The basic primitive recursive functions are given by these axioms:

**Constant function**: The 0-ary constant function 0 is primitive recursive.**Successor function**: The 1-ary successor function*S*, which returns the successor of its argument (see Peano postulates), is primitive recursive. That is,*S*(*k*) =*k*+ 1.**Projection function**: A pair*i*≥1 and*n*≥*i*, defines an*n*-ary function:*P*_{i}^{n}(*x*_{1},...,x_{n}) =*x*_{i}, such a function is primitive recursive.

More complex primitive recursive functions can be obtained by applying the operations given by these axioms:

**Composition**: Given a*k*-ary primitive recursive function*f*, and*k*number of*m*-ary primitive recursive functions*g*_{1},...,*g*_{k}, the composition of*f*with*g*_{1},...,*g*_{k}, i.e. the*m*-ary function is primitive recursive.

Example. We take *f*(*x*) as the *S*(*x*) defined above. This f is a 1-ary primitive recursive function. And so is *g*(*x*) = *S*(*x*). So *h*(*x*) defined as *f*(*g*(*x*)) = *S*(*S*(*x*)) is a primitive recursive 1-ary function too. Informally speaking, *h*(*x*) is the function that turns *x* into *x*+2.

**Primitive recursion**: Given*f*, a*k*-ary primitive recursive function, and*g*, a (*k*+2)-ary primitive recursive function, the (*k*+1)-ary function*h*is defined as the primitive recursion of*f*and*g*, i.e. the function*h*is primitive recursive when

Example. Suppose *f*(*x*) = *P*_{1}^{1}(*x*) = *x* and *g*(*x*,*y*,*z*)= *S*(*P*_{2}^{3}(*x*,*y*,*z*)) = *S*(*y*). Then *h*(0,*x*) = *x* and *h*(*S*(*y*),*x*) = *g*(*y*,*h*(*y*,*x*),*x*) = *S*(*h*(*y*,*x*)). Now *h*(0,1) = 1, *h*(1,1) = *S*(*h*(0,1)) = 2, *h*(2,1) = *S*(*h*(1,1)) = 3. This *h* is a 2-ary primitive recursive function. We can call it 'addition'.

Interpretation. The function *h* acts as a for loop from 0 up to the value of its first argument. The rest of the arguments for *h*, denoted here with *x*_{i}’s (*i* = 1, ..., *k*), are a set of initial conditions for the For loop which may be used by it during calculations but which are immutable by it. The functions *f* and *g* on the right side of the equations which define *h* represent the body of the loop, which performs calculations. Function *f* is only used once to perform initial calculations. Calculations for subsequent steps of the loop are performed by *g*. The first parameter of *g* is fed the “current” value of the For loop’s index. The second parameter of *g* is fed the result of the For loop’s previous calculations, from previous steps. The rest of the parameters for *g* are those immutable initial conditions for the For loop mentioned earlier. They may be used by *g* to perform calculations but they will not themselves be altered by *g*.

The **primitive recursive** functions are the basic functions and those obtained from the basic functions by applying these operations a finite number of times.

The projection functions can be used to avoid the apparent rigidity in terms of the arity of the functions above; by using compositions with various projection functions, it is possible to pass a subset of the arguments of one function to another function. For example, if *g* and *h* are 2-ary primitive recursive functions then

is also primitive recursive. One formal definition using projection functions is

The 1-place predecessor function is primitive recursive. It follows immediately from starting functions S and *P*_{1}^{2} by the rule of primitive recursion. Fischer, Fischer & Beigel ^{ [2] } removed the implicit predecessor from the recursion rule, replacing it by the weaker rule

They proved that the predecessor function still could be defined, and hence that "weak" primitive recursion also defines the primitive recursive functions.

In some settings it is natural to consider primitive recursive functions that take as inputs tuples that mix numbers with truth values (that is *t* for true and *f* for false), or that produce truth values as outputs.^{ [3] } This can be accomplished by identifying the truth values with numbers in any fixed manner. For example, it is common to identify the truth value *t* with the number 1 and the truth value *f* with the number 0. Once this identification has been made, the characteristic function of a set *A*, which always returns 1 or 0, can be viewed as a predicate that tells whether a number is in the set *A*. Such an identification of predicates with numeric functions will be assumed for the remainder of this article.

An example of a primitive recursive programming language is one that contains basic arithmetic operators (e.g. + and −, or ADD and SUBTRACT), conditionals and comparison (IF-THEN, EQUALS, LESS-THAN), and bounded loops, such as the basic for loop, where there is a known or calculable upper bound to all loops (FOR i FROM 1 TO n, with neither i nor n modifiable by the loop body). No control structures of greater generality, such as while loops or IF-THEN plus GOTO, are admitted in a primitive recursive language.

The LOOP language, introduced in a 1967 paper by Albert R. Meyer and Dennis M. Ritchie,^{ [4] } is such a language. Its computing power coincides with the primitive recursive functions. A variant of the LOOP language is Douglas Hofstadter's BlooP in * Gödel, Escher, Bach *. Adding unbounded loops (WHILE, GOTO) makes the language general recursive and Turing-complete, as are all real-world computer programming languages.

The definition of primitive recursive functions implies that their computation halts on every input (after a finite number of steps). On the other hand, the halting problem is indecidable for general recursive functions, even if they are total. That is, there are programs that halt on every input, but for which this can not be verified by an algorithm.

Most number-theoretic functions definable using recursion on a single variable are primitive recursive. Basic examples include the addition and truncated subtraction functions.

Intuitively, addition can be recursively defined with the rules:

- ,

To fit this into a strict primitive recursive definition, define:

Here S(*n*) is "the successor of *n*" (i.e., *n*+1), *P*_{1}^{1} is the identity function, and *P*_{2}^{3} is the projection function that takes 3 arguments and returns the second one. Functions *f* and *g* required by the above definition of the primitive recursion operation are respectively played by *P*_{1}^{1} and the composition of *S* and *P*_{2}^{3}.

Because primitive recursive functions use natural numbers rather than integers, and the natural numbers are not closed under subtraction, a truncated subtraction function (also called "proper subtraction") is studied in this context. This limited subtraction function sub(*a*, *b*) [or *b* ∸ *a*] returns *b* - *a* if this is nonnegative and returns *0* otherwise.

The **predecessor function** acts as the opposite of the successor function and is recursively defined by the rules:

- pred(0) = 0,
- pred(
*n*+ 1) =*n*.

These rules can be converted into a more formal definition by primitive recursion:

- pred(0) = 0,
- pred(S(
*n*)) =*P*_{1}^{2}(*n*, pred(*n*)).

The limited subtraction function is definable from the predecessor function in a manner analogous to the way addition is defined from successor:

- sub(0,
*x*) =*P*_{1}^{1}(*x*), - sub(S(
*n*),*x*) = pred(*P*_{2}^{3}(*n*, sub(*n*,*x*),*x*)).

Here sub(*a*, *b*) corresponds to *b* ∸ *a*; for the sake of simplicity, the order of the arguments has been switched from the "standard" definition to fit the requirements of primitive recursion. This could easily be rectified using composition with suitable projections.

Exponentiation and primality testing are primitive recursive. Given primitive recursive functions *e*, *f*, *g*, and *h*, a function that returns the value of *g* when *e*≤*f* and the value of *h* otherwise is primitive recursive.

By using Gödel numberings, the primitive recursive functions can be extended to operate on other objects such as integers and rational numbers. If integers are encoded by Gödel numbers in a standard way, the arithmetic operations including addition, subtraction, and multiplication are all primitive recursive. Similarly, if the rationals are represented by Gödel numbers then the field operations are all primitive recursive.

In first-order Peano arithmetic, there are infinitely many variables (0-ary symbols) but no k-ary non-logical symbols with k>0 other than S, +, *, and ≤. Thus in order to define primitive recursive functions one has to use the following trick by Gödel.

By using a Gödel numbering for sequences, for example Gödel's β function, any finite sequence of numbers can be encoded by a single number. Such a number can therefore represent the primitive recursive function until a given n.

Let *h* be a 1-ary primitive recursion function defined by:

where C is a constant and *g* is an already defined function.

Using Gödel's β function, for any sequence of natural numbers (k_{0}, k_{1}, …, k_{n}), there are natural numbers b and c such that, for every i ≤ n, β(b, c, i) = k_{i}. We may thus use the following formula to define *h*; more precisely, *m*=*h*(*n*) is a shorthand for the following:

and the equating to *g*, being already defined, is in fact shorthand for some other already defined formula (as is β, whose formula is given here).

The generalization to any k-ary primitive recursion function is trivial.

The broader class of partial recursive functions is defined by introducing an unbounded search operator. The use of this operator may result in a partial function, that is, a relation with *at most* one value for each argument, but does not necessarily have *any* value for any argument (see domain). An equivalent definition states that a partial recursive function is one that can be computed by a Turing machine. A total recursive function is a partial recursive function that is defined for every input.

Every primitive recursive function is total recursive, but not all total recursive functions are primitive recursive. The Ackermann function *A*(*m*,*n*) is a well-known example of a total recursive function (in fact, provable total), that is not primitive recursive. There is a characterization of the primitive recursive functions as a subset of the total recursive functions using the Ackermann function. This characterization states that a function is primitive recursive if and only if there is a natural number *m* such that the function can be computed by a Turing machine that always halts within A(*m*,*n*) or fewer steps, where *n* is the sum of the arguments of the primitive recursive function.^{ [5] }

An important property of the primitive recursive functions is that they are a recursively enumerable subset of the set of all total recursive functions (which is not itself recursively enumerable). This means that there is a single computable function *f*(*m*,*n*) that enumerates the primitive recursive functions, namely:

- For every primitive recursive function
*g*, there is an*m*such that*g*(*n*) =*f*(*m*,*n*) for all*n*, and - For every
*m*, the function*h*(*n*) =*f*(*m*,*n*) is primitive recursive.

*f* can be explicitly constructed by iteratively repeating all possible ways of creating primitive recursive functions. Thus, it is provably total. One can use a diagonalization argument to show that *f* is not recursive primitive in itself: had it been such, so would be *h*(*n*) = *f*(*n*,*n*)+1. But if this equals some primitive recursive function, there is an *m* such that *h*(*n*) = *f*(*m*,*n*) for all *n*, and then *h*(*m*) = *f*(*m*,*m*), leading to contradiction.

However, the set of primitive recursive functions is not the *largest* recursively enumerable subset of the set of all total recursive functions. For example, the set of provably total functions (in Peano arithmetic) is also recursively enumerable, as one can enumerate all the proofs of the theory. While all primitive recursive functions are provably total, the converse is not true.

Primitive recursive functions tend to correspond very closely with our intuition of what a computable function must be. Certainly the initial functions are intuitively computable (in their very simplicity), and the two operations by which one can create new primitive recursive functions are also very straightforward. However, the set of primitive recursive functions does not include every possible total computable function—this can be seen with a variant of Cantor's diagonal argument. This argument provides a total computable function that is not primitive recursive. A sketch of the proof is as follows:

The primitive recursive functions of one argument (i.e., unary functions) can be computably enumerated. This enumeration uses the definitions of the primitive recursive functions (which are essentially just expressions with the composition and primitive recursion operations as operators and the basic primitive recursive functions as atoms), and can be assumed to contain every definition once, even though a same *function* will occur many times on the list (since many definitions define the same function; indeed simply composing by the identity function generates infinitely many definitions of any one primitive recursive function). This means that the *n*-th definition of a primitive recursive function in this enumeration can be effectively determined from *n*. Indeed if one uses some Gödel numbering to encode definitions as numbers, then this *n*-th definition in the list is computed by a primitive recursive function of *n*. Let *f*_{n} denote the unary primitive recursive function given by this definition. *ev* were primitive recursive, then the unary function *g* defined by *g*(*i*) = S(*ev*(*i*,*i*)) would also be primitive recursive, as it is defined by composition from the successor function and *ev*. But then *g* occurs in the enumeration, so there is some number *n* such that *g* = *f*_{n}. But now *g*(*n*) = S(*ev*(*n*,*n*)) = S(*f*_{n}(*n*)) = S(*g*(*n*)) gives a contradiction.

Now define the "evaluator function" *ev* with two arguments, by *ev*(*i*,*j*) = *f*_{i}(*j*). Clearly *ev* is total and computable, since one can effectively determine the definition of *f*_{i}, and being a primitive recursive function *f*_{i} is itself total and computable, so *f*_{i}(*j*) is always defined and effectively computable. However a diagonal argument will show that the function *ev* of two arguments is not primitive recursive.

This argument can be applied to any class of computable (total) functions that can be enumerated in this way, as explained in the article Machine that always halts. Note however that the *partial* computable functions (those that need not be defined for all arguments) can be explicitly enumerated, for instance by enumerating Turing machine encodings.

Other examples of total recursive but not primitive recursive functions are known:

- The function that takes
*m*to Ackermann(*m*,*m*) is a unary total recursive function that is not primitive recursive. - The Paris–Harrington theorem involves a total recursive function that is not primitive recursive.
- The Sudan function
- The Goodstein function

- The following examples and definitions are from Kleene (1952) pp. 223–231 — many appear with proofs. Most also appear with similar names, either as proofs or as examples, in Boolos-Burgess-Jeffrey 2002 pp. 63–70; they add the logarithm lo(x, y) or lg(x, y) depending on the exact derivation.

In the following we observe that primitive recursive functions can be of four types:

*functions*for short: "number-theoretic functions" from { 0, 1, 2, ...} to { 0, 1, 2, ...},*predicates*: from { 0, 1, 2, ...} to truth values { t =true, f =false },*propositional connectives*: from truth values { t, f } to truth values { t, f },*representing functions*: from truth values { t, f } to { 0, 1, 2, ... }. Many times a predicate requires a representing function to convert the predicate's output { t, f } to { 0, 1 } (note the order "t" to "0" and "f" to "1" matches with ~sg( ) defined below). By definition a function φ(**x**) is a "representing function" of the predicate P(**x**) if φ takes only values 0 and 1 and produces*0*when P is true".

In the following the mark " ' ", e.g. a', is the primitive mark meaning "the successor of", usually thought of as " +1", e.g. a +1 =_{def} a'. The functions 16-20 and #G are of particular interest with respect to converting primitive recursive predicates to, and extracting them from, their "arithmetical" form expressed as Gödel numbers.

- Addition: a+b
- Multiplication: a×b
- Exponentiation: a
^{b} - Factorial a! : 0! = 1, a'! = a!×a'
- pred(a): (Predecessor or decrement): If a > 0 then a-1 else 0
- Proper subtraction a ∸ b: If a ≥ b then a-b else 0
- Minimum(a
_{1}, ... a_{n}) - Maximum(a
_{1}, ... a_{n}) - Absolute difference: | a-b | =
_{def}(a ∸ b) + (b ∸ a) - ~sg(a): NOT[signum(a)]: If a=0 then 1 else 0
- sg(a): signum(a): If a=0 then 0 else 1
- a | b: (a divides b): If b=k×a for some k then 0 else 1
- Remainder(a, b): the leftover if b does not divide a "evenly". Also called MOD(a, b)
- a = b: sg | a - b | (Kleene's convention was to represent
*true*by 0 and*false*by 1; presently, especially in computers, the most common convention is the reverse, namely to represent*true*by 1 and*false*by 0, which amounts to changing sg into ~sg here and in the next item) - a < b: sg( a' ∸ b )
- Pr(a): a is a prime number Pr(a) =
_{def}a>1 & NOT(Exists c)_{1<c<a}[ c|a ] - p
_{i}: the i+1-st prime number - (a)
_{i}: exponent of p_{i}in a: the unique x such that p_{i}^{x}|a & NOT(p_{i}^{x'}|a) - lh(a): the "length" or number of non-vanishing exponents in a
- lo(a, b): (logarithm of a to base b): If a, b > 1 then the greatest x such that b
^{x}| a else 0

*In the following, the abbreviation***x**=_{def}x_{1}, ... x_{n}; subscripts may be applied if the meaning requires.

- #A: A function φ definable explicitly from functions Ψ and constants q
_{1}, ... q_{n}is primitive recursive in Ψ. - #B: The finite sum Σ
_{y<z}ψ(**x**, y) and product Π_{y<z}ψ(**x**, y) are primitive recursive in ψ. - #C: A
*predicate*P obtained by substituting functions χ_{1},..., χ_{m}for the respective variables of a predicate Q is primitive recursive in χ_{1},..., χ_{m}, Q. - #D: The following
*predicates*are primitive recursive in Q and R:

- NOT_Q(
**x**) . - Q OR R: Q(
**x**) V R(**x**), - Q AND R: Q(
**x**) & R(**x**), - Q IMPLIES R: Q(
**x**) → R(**x**) - Q is equivalent to R: Q(
**x**) ≡ R(**x**)

- NOT_Q(

- #E: The following
*predicates*are primitive recursive in the*predicate*R:

- (Ey)
_{y<z}R(**x**, y) where (Ey)_{y<z}denotes "there exists at least one y that is less than z such that" - (y)
_{y<z}R(**x**, y) where (y)_{y<z}denotes "for all y less than z it is true that" - μy
_{y<z}R(**x**, y). The operator μy_{y<z}R(**x**, y) is a*bounded*form of the so-called minimization- or mu-operator: Defined as "the least value of y less than z such that R(**x**, y) is true; or z if there is no such value."

- (Ey)

- #F: Definition by cases: The function defined thus, where Q
_{1}, ..., Q_{m}are mutually exclusive*predicates*(or "ψ(**x**) shall have the value given by the first clause that applies), is primitive recursive in φ_{1}, ..., Q_{1}, ... Q_{m}:

- φ(
**x**) =- φ
_{1}(**x**) if Q_{1}(**x**) is true, - . . . . . . . . . . . . . . . . . . .
- φ
_{m}(**x**) if Q_{m}(**x**) is true - φ
_{m+1}(**x**) otherwise

- φ

- φ(

- #G: If φ satisfies the equation:

- φ(y,
**x**) = χ(y, COURSE-φ(y; x_{2}, ... x_{n}), x_{2}, ... x_{n}then φ is primitive recursive in χ. The value COURSE-φ(y;**x**_{2 to n}) of the course-of-values function encodes the sequence of values φ(0,**x**_{2 to n}), ..., φ(y-1,**x**_{2 to n}) of the original function.

- φ(y,

Some additional forms of recursion also define functions that are in fact primitive recursive. Definitions in these forms may be easier to find or more natural for reading or writing. Course-of-values recursion defines primitive recursive functions. Some forms of mutual recursion also define primitive recursive functions.

The functions that can be programmed in the LOOP programming language are exactly the primitive recursive functions. This gives a different characterization of the power of these functions. The main limitation of the LOOP language, compared to a Turing-complete language, is that in the LOOP language the number of times that each loop will run is specified before the loop begins to run.

The primitive recursive functions are closely related to mathematical finitism, and are used in several contexts in mathematical logic where a particularly constructive system is desired. Primitive recursive arithmetic (PRA), a formal axiom system for the natural numbers and the primitive recursive functions on them, is often used for this purpose.

PRA is much weaker than Peano arithmetic, which is not a finitistic system. Nevertheless, many results in number theory and in proof theory can be proved in PRA. For example, Gödel's incompleteness theorem can be formalized into PRA, giving the following theorem:

- If
*T*is a theory of arithmetic satisfying certain hypotheses, with Gödel sentence*G*_{T}, then PRA proves the implication Con(*T*)→*G*_{T}.

Similarly, many of the syntactic results in proof theory can be proved in PRA, which implies that there are primitive recursive functions that carry out the corresponding syntactic transformations of proofs.

In proof theory and set theory, there is an interest in finitistic consistency proofs, that is, consistency proofs that themselves are finitistically acceptable. Such a proof establishes that the consistency of a theory *T* implies the consistency of a theory *S* by producing a primitive recursive function that can transform any proof of an inconsistency from *S* into a proof of an inconsistency from *T*. One sufficient condition for a consistency proof to be finitistic is the ability to formalize it in PRA. For example, many consistency results in set theory that are obtained by forcing can be recast as syntactic proofs that can be formalized in PRA.

Recursive definitions had been used more or less formally in mathematics before, but the construction of primitive recursion is traced back to Richard Dedekind's theorem 126 of his *Was sind und was sollen die Zahlen?* (1888). This work was the first to give a proof that a certain recursive construction defines a unique function.^{ [6] }^{ [7] }^{ [8] }

Primitive recursive arithmetic was first proposed by Thoralf Skolem ^{ [9] } in 1923.

The current terminology was coined by Rózsa Péter (1934) after Ackermann had proved in 1928 that the function which today is named after him was not primitive recursive, an event which prompted the need to rename what until then were simply called recursive functions.^{ [7] }^{ [8] }

- ↑ Brainerd and Landweber, 1974
- ↑ Fischer, Fischer & Beigel 1989.
- ↑ Kleene [1952 pp. 226–227]
- ↑ Meyer, Albert R.; Ritchie, Dennis M. (1967).
*The complexity of loop programs*. ACM '67: Proceedings of the 1967 22nd national conference. doi:10.1145/800196.806014. - ↑ This follows from the facts that the functions of this form are the most quickly growing primitive recursive functions, and that a function is primitive recursive if and only if its time complexity is bounded by a primitive recursive function. For the former, see Linz, Peter (2011),
*An Introduction to Formal Languages and Automata*, Jones & Bartlett Publishers, p. 332, ISBN 9781449615529 . For the latter, see Moore, Cristopher; Mertens, Stephan (2011),*The Nature of Computation*, Oxford University Press, p. 287, ISBN 9780191620805 - ↑ Peter Smith (2013).
*An Introduction to Gödel's Theorems*(2nd ed.). Cambridge University Press. pp. 98–99. ISBN 978-1-107-02284-3. - 1 2 George Tourlakis (2003).
*Lectures in Logic and Set Theory: Volume 1, Mathematical Logic*. Cambridge University Press. p. 129. ISBN 978-1-139-43942-8. - 1 2 Rod Downey, ed. (2014).
*Turing's Legacy: Developments from Turing's Ideas in Logic*. Cambridge University Press. p. 474. ISBN 978-1-107-04348-0. - ↑ Thoralf Skolem (1923) "The foundations of elementary arithmetic" in Jean van Heijenoort, translator and ed. (1967)
*From Frege to Gödel: A Source Book in Mathematical Logic, 1879-1931*. Harvard Univ. Press: 302-33.

In computability theory, the **Ackermann function**, named after Wilhelm Ackermann, is one of the simplest and earliest-discovered examples of a total computable function that is not primitive recursive. All primitive recursive functions are total and computable, but the Ackermann function illustrates that not all total computable functions are primitive recursive. After Ackermann's publication of his function, many authors modified it to suit various purposes, so that today "the Ackermann function" may refer to any of numerous variants of the original function. One common version, the two-argument **Ackermann–Péter function**, is defined as follows for nonnegative integers *m* and *n*:

**Recursion** occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics to logic. The most common application of recursion is in mathematics and computer science, where a function being defined is applied within its own definition. While this apparently defines an infinite number of instances, it is often done in such a way that no infinite loop or infinite chain of references can occur.

In computability theory, **Rice's theorem** states that all non-trivial, semantic properties of programs are undecidable. A semantic property is one about the program's behavior, unlike a syntactic property. A property is *non-trivial* if it is neither true for every partial computable function, nor false for every partial computable function.

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. If the function is total, it is also called a **total recursive function**. In computability theory, it is shown that the μ-recursive functions are precisely the functions that can be computed by Turing machines. 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.

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*. A related theorem, which constructs fixed points of a computable function, is known as **Rogers's theorem** and is due to Hartley Rogers, Jr..

In mathematical logic, the **arithmetical hierarchy**, **arithmetic hierarchy** or **Kleene–Mostowski hierarchy** classifies certain sets based on the complexity of formulas that define them. Any set that receives a classification is called **arithmetical**.

In computability theory, a set *S* of natural numbers is called **computably enumerable (c.e.)**, **recursively enumerable (r.e.)**, **semidecidable**, **partially decidable**, **listable**, **provable** or **Turing-recognizable** if:

In the foundations of mathematics, **von Neumann–Bernays–Gödel set theory** (**NBG**) is an axiomatic set theory that is a conservative extension of Zermelo–Fraenkel-Choice set theory (ZFC). NBG introduces the notion of class, which is a collection of sets defined by a formula whose quantifiers range only over sets. NBG can define classes that are larger than sets, such as the class of all sets and the class of all ordinals. Morse–Kelley set theory (MK) allows classes to be defined by formulas whose quantifiers range over classes. NBG is finitely axiomatizable, while ZFC and MK are not.

In computational complexity theory, the complexity class **ELEMENTARY** of **elementary recursive functions** is the union of the classes

In computability theory, the **μ-operator**, **minimization operator**, or **unbounded search operator** searches for the least natural number with a given property. Adding the μ-operator to the five primitive recursive operators makes it possible to define all computable functions.

**Computable functions** are the basic objects of study in computability theory. Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do the job of the function, i.e. given an input of the function domain it can return the corresponding output. Computable functions are used to discuss computability without referring to any concrete model of computation such as Turing machines or register machines. Any definition, however, must make reference to some specific model of computation but all valid definitions yield the same class of functions. Particular models of computability that give rise to the set of computable functions are the Turing-computable functions and the general recursive functions.

In computability theory, a **machine that always halts**, also called a **decider** or a **total Turing machine**, is a Turing machine that eventually halts for every input.

In computability theory the ** S m**, is a basic result about programming languages. It was first proved by Stephen Cole Kleene (1943). The name

n theorem

n

In mathematical logic, an **arithmetical set** is a set of natural numbers that can be defined by a formula of first-order Peano arithmetic. The arithmetical sets are classified by the arithmetical hierarchy.

In computability theory, **course-of-values recursion** is a technique for defining number-theoretic functions by recursion. In a definition of a function *f* by course-of-values recursion, the value of *f*(*n*) is computed from the sequence .

In computer science, **recursion** is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. Such problems can generally be solved by iteration, but this needs to identify and index the smaller instances at programming time. Recursion solves such recursive problems by using functions that call themselves from within their own code. The approach can be applied to many types of problems, and recursion is one of the central ideas of computer science.

The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions.

**Primitive recursive arithmetic** (**PRA**) is a quantifier-free formalization of the natural numbers. It was first proposed by Skolem as a formalization of his finitist conception of the foundations of arithmetic, and it is widely agreed that all reasoning of PRA is finitist. Many also believe that all of finitism is captured by PRA, but others believe finitism can be extended to forms of recursion beyond primitive recursion, up to ε_{0}, which is the proof-theoretic ordinal of Peano arithmetic. PRA's proof theoretic ordinal is ω^{ω}, where ω is the smallest transfinite ordinal. PRA is sometimes called **Skolem arithmetic**.

In computability theory, the **T predicate**, first studied by mathematician Stephen Cole Kleene, is a particular set of triples of natural numbers that is used to represent computable functions within formal theories of arithmetic. Informally, the *T* predicate tells whether a particular computer program will halt when run with a particular input, and the corresponding *U* function is used to obtain the results of the computation if the program does halt. As with the s_{mn} theorem, the original notation used by Kleene has become standard terminology for the concept.

The **Grzegorczyk hierarchy**, named after the Polish logician Andrzej Grzegorczyk, is a hierarchy of functions used in computability theory. Every function in the Grzegorczyk hierarchy is a primitive recursive function, and every primitive recursive function appears in the hierarchy at some level. The hierarchy deals with the rate at which the values of the functions grow; intuitively, functions in lower levels of the hierarchy grow slower than functions in the higher levels.

In mathematical logic, **Gödel's β function** is a function used to permit quantification over finite sequences of natural numbers in formal theories of arithmetic. The

- Brainerd, W.S., Landweber, L.H. (1974),
*Theory of Computation*, Wiley, ISBN 0-471-09585-0 - Fischer, Michael J.; Fischer, Robert P.; Beigel, Richard (November 1989). "Primitive Recursion without Implicit Predecessor".
*ACM SIGACT News*.**20**(4): 87–91. doi:10.1145/74074.74089. - Robert I. Soare,
*Recursively Enumerable Sets and Degrees*, Springer-Verlag, 1987. ISBN 0-387-15299-7 - Stephen Kleene (1952)
*Introduction to Metamathematics*, North-Holland Publishing Company, New York, 11th reprint 1971: (2nd edition notes added on 6th reprint). In Chapter XI. General Recursive Functions §57 - George Boolos, John Burgess, Richard Jeffrey (2002),
*Computability and Logic: Fourth Edition*, Cambridge University Press, Cambridge, UK. Cf pp. 70–71. - Robert I. Soare 1995
*Computability and Recursion*http://www.people.cs.uchicago.edu/~soare/History/compute.pdf - Daniel Severin 2008,
*Unary primitive recursive functions*, J. Symbolic Logic Volume 73, Issue 4, pp. 1122–1138 arXiv projecteuclid

This page is based on this Wikipedia article

Text is available under the CC BY-SA 4.0 license; additional terms may apply.

Images, videos and audio are available under their respective licenses.

Text is available under the CC BY-SA 4.0 license; additional terms may apply.

Images, videos and audio are available under their respective licenses.