Primitive recursive functions take 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:
More complex primitive recursive functions can be obtained by applying the operators? given by these axioms:
(Note that the projection functions allow us to get around the apparent rigidity in terms of the arity of the functions above, as via composition we can pass any subset of the arguments.)
A function is primitive recursive if it is one of the basic functions above, or can be obtained from one of the basic functions by applying the operations a finite number of times.
Many other familiar functions can be shown to be primitive recursive; some examples include conditionals, exponentiation?, [primality testing]?, and course-of-values induction.
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 diagonalization 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 numbered. 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 operator). The numbering is computable in the sense that one can build a a Turing machine that, given an index x and a value y, computes the value of the xth primitive recursive function on input y (though an appeal to the Church-Turing thesis is likely sufficient to make the case).
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) correponds 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.
Note that this argument can be applied to any class of functions that can be enumerated in this way. In other words, any explicit list of the computable functions cannot be complete.
One can also explicitly exhibit a simple 1-ary computable function which is recursively defined for any natural number, but which is not primitive recursive, see Ackermann function.
By extending the definition of primitive recursive functions to allow for partial functions and by adding the concept of an unbounded search operator (see [Recursive function]?), we arrive at a full formal model of computability -- the recursive? or computable? functions.