|
PRIMITIVE RECURSIVE FUNCTION
In computability theory, primitive recursive functions are a class of functions which form an important building block on the way to a full formalization of computability. These functions are also important in proof theory.
The primitive recursive functions are defined using primitive recursion and composition as central operations and are a strict subset of the recursive functions, also known as the computable functions.
Many of the functions normally studied in number theory, and approximations to real-valued functions, are primitive recursive, such as addition, division, factorial, exponential, finding the nth prime, and so on (Brainerd and Landweber, 1974). In fact, it is difficult to devise a function that is not primitive recursive, although some are known (see the section on Limitations below).
The set of primitive recursive functions is known as PR in complexity theory.
Definition
Primitive recursive functions take natural numbers or tuples of natural numbers as arguments and produce a natural number. A function which takes n arguments is called n-ary. The basic primitive recursive functions are given by these axioms:
- The 0-ary constant function 0 is primitive recursive.
- The 1-ary successor function S, which returns the successor of its argument (see Peano postulates), is primitive recursive.
- For every n≥1 and each i with 1≤i≤n, the n-ary projection function Pin, which returns its i-th argument, is primitive recursive.
More complex primitive recursive functions can be obtained by applying the operators given by these axioms:
- Composition: Given f, a k-ary primitive recursive function, and k m-ary primitive recursive functions g1,...,gk, the composition of f with g1,...,gk, i.e. the m-ary function h(x1,...,xm) = f(g1(x1,...,xm),...,gk(x1,...,xm)), is primitive recursive.
- Primitive recursion: Given f, a k-ary primitive recursive function, and g, a (k+2)-ary primitive recursive function, the (k+1)-ary function defined as the primitive recursion of f and g, i.e. the function h where h(0,x1,...,xk) = f(x1,...,xk) and h(S(n),x1,...,xk) = g(h(n,x1,...,xk),n,x1,...,xk), is primitive recursive.
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 projections functions is
.
It follows from the axioms that a function is primitive recursive if it is one of the basic functions above or if it can be obtained from the basic functions by applying the operators a finite number of times.
Examples
Intuitively, addition can be recursively defined with the rules:
- add(0,x)=x,
- add(n+1,x)=add(n,x)+1.
In order to fit this into a strict primitive recursive definition, define:
- add(0,x)=P11(x) ,
- add(S(n),x)=S(P13(add(n,x),n,x)).
Here P13 is the projection function that takes 3 arguments and returns the first one.
P11 is simply the identity function; its inclusion is required by the definition of the primitive recursion operator above; it plays the role of f. The composition of S and P13, which is primitive recursive, plays the role of g.
Because primitive recursive functions use natural numbers rather than integers, and the natural numbers are not closed under subtraction, a limited subtraction function is studied in this context. This limited subtraction function sub(a,b) 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))=P22(pred(n),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)=P11(x),
- sub(S(n),x)=pred(P13(sub(n,x),n,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.
Other primitive recursive functions include exponentiation and primality testing. Given primitive recursive functions e, f, g, and h, a function which returns the value of g when e≤f and the value of h otherwise is primitive recursive.
By using Gödel numbers, 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.
Relationship to recursive functions
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 which has at most one value for each argument but, unlike a total function, does not necessarily have any value for an argument (see domain).
Every primitive recursive function is total recursive, but not all total recursive functions are primitive recursive. A partial recursive function is one which can be computed by a Turing machine. A total recursive function is a partial recursive function which is defined for every input.
The following characterization of the primitive recursive functions as a subset of the total recursive functions holds. 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 Ackermann(m,n) or fewer steps, where n is the sum of the arguments of the primitive recursive function.
Limitations
Primitive recursive functions tend to correspond very closely with our intuition of what a computable function must be. Certainly the initial set of 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 computable function — this can be seen with a variant of Cantor's diagonal argument. This argument provides a computable function which is not primitive recursive. A sketch of the proof is as follows:
- The primitive recursive functions can be computably numerated. This numbering is unique on the definitions of functions, though not unique on the actual functions themselves (as every function can have an infinite number of definitions — consider simply composing by the identity function). The numbering is computable in the sense that it can be defined under formal models of computability such as μ-recursive functions or Turing machines; but an appeal to the Church-Turing thesis is likely sufficient.
- Now consider a matrix where the rows are the primitive recursive functions of one argument under this numbering, and the columns are the natural numbers. Then each element (i, j) corresponds to the ith unary primitive recursive function being calculated on the number j. We can write this as fi(j).
- Now consider the function g(x) = S(fx(x)). g lies on the diagonal of this matrix and simply adds one to the value it finds. This function is computable (by the above), but clearly no primitive recursive function exists which computes it as it differs from each possible primitive recursive function by at least one value. Thus there must be computable functions which are not primitive recursive.
This argument can be applied to any class of computable (total) functions that can be enumerated in this way. Therefore, any such explicit list of computable (total) functions can never be complete, such as those functions computed by a machine that always halts. Note however that the partial computable functions (those which 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 which 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 which is not primitive recursive. Because this function is motivated by Ramsey theory, it is sometimes considered more “natural” than the Ackermann function.
Bibliography
- Brainerd, W.S., Landweber, L.H. (1974), Theory of Computation, Wiley, ISBN 0471095850
See also
|