Primitive recursive function: Difference between revisions

Content deleted Content added
Bethenco (talk | contribs)
m make source more readable, and fix some surprise links
Line 1:
'''Primitive recursive functions''' are a class of functions which form an important building block on the way to a full formalization of computability. They are defined using [[recursion]] and [[operatorFunction composition|composition]] as central operations. The primitive recursive functions are a strict [[subset]] of the [[recursive function|recursive functions]]s (which are exactly those functions
which we call "[[recursive functioncomputability|computable]]"; see [[Church-Turing thesis]]).
 
=== Definition ===
 
Primitive recursive functions take [[natural numbers]] or [[tuple]]s of natural numbers as arguments and produce a natural number. A function which takes ''n'' arguments is called ''n''-[[arity|ary]]. The basic primitive recursive functions are given by these [[axiom|axioms]]s:
 
#The [[constant term|constant function]] 0 is primitive recursive.
Line 53:
:(Note that for the sake of simplicity, the order of the arguments has been switched from the "standard" definition to fit the requirements of primitive recursion, i.e. sub(''a'',''b'') corresponds to ''b''-''a''. This could easily be rectified using composition with suitable projections.)
 
Many other familiar functions can be shown to be primitive recursive; some examples include [[conditional|conditionals]]s, [[exponentiation]], [[primality test|primality testing]]ing, and [[Mathematical induction|course-of-valuesmathematical induction]], and the primitive recursive functions can be extended to operate on other objects such as integers and rational numbers.
 
=== Limitations of the primitive recursive functions ===
 
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|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 function|identity operator]]). The numbering is computable in the sense that it can be defined under formal models of computability such as [[Recursiverecursive function|recursive functions]]s or [[Turing machine|Turing machines]]s; 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'') correponds to the ''i''th unary primitive recursive function being calculated on the number ''j''. We can write this as ''f''<sub>''i''</sub>(''j'').
 
Now consider the function ''g''(''x'') = S(''f''<sub>''x''</sub>(''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 computable (total) functions that can be enumerated in this way. Therefore, any such explicit list of computable (total) functions can never be complete. 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.
Line 73:
The set of primitive recursive functions does not encompass everything that we think of as computable. Nevertheless they form an important class and many of the functions normally studied in number theory, and approximations to real-valued functions, are primitive recursive.
 
In order to formalize the full class of computable functions, we must allow for [[partial function|partial functions]]s and introduce an additional operator to the above: the ''unbounded search'' operator (see [[Recursiverecursive function]]).