Content deleted Content added
No edit summary |
added example definitions and proof that p.r. functions are a subset of recursive ones; other minor changes. |
||
Line 9:
Primitive recursive functions take [[natural numbers]] as arguments and produce a natural number. A function which takes ''n'' arguments is called ''n''-[[arity|ary]].
Line 19 ⟶ 15:
#The [[constant term|constant]] function 0 is primitive recursive.
#The "successor function" ''S'', which takes one argument and returns the succeeding number
#The "projection functions" ''P''<sub>''i''</sub><sup>''n''</sup>, which take ''n'' arguments and return their ''i''th argument, are primitive recursive.
Line 25 ⟶ 21:
More complex primitive recursive functions can be obtained by applying the [[operators]] given by these axioms:
Line 31 ⟶ 27:
#''Composition'': Given ''f'' a ''k''-ary primitive recursive function and ''k'' ''l''-ary primitive recursive functions ''g''<sub>0</sub>,...,''g''<sub>''k''-1</sub>, the [[composition]] of ''f'' with ''g''<sub>0</sub>,...,''g''<sub>''k''-1</sub>, i.e. the function ''h''(''x''<sub>0</sub>,...,''x''<sub>''l''-1</sub>) = ''f''(''g''<sub>0</sub>(''x''<sub>0</sub>,...,''x''<sub>''l''-1</sub>),...,''g''<sub>''k''-1</sub>(''x''<sub>0</sub>,...,''x''<sub>''l''-1</sub>)), 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,''x''<sub>0</sub>,...,''x''<sub>''k''-1</sub>) = ''f''(''x''<sub>0</sub>,...,''x''<sub>''k''-1</sub>) and ''h''(''S''(''n''),''x''<sub>0</sub>,...,''x''<sub>''k''-1</sub>) = ''g''(
=== Example primitive recursive
;[[Addition]]: Intuitively we would like to define addition recursively as:
::add(0,''x'')=''x''
::add(''n''+1,''x'')=add(''n'',''x'')+1
:In order to fit this into a strict primitive recursive definition, we define:
::add(0,''x'')=''P''<sub>0</sub><sup>1</sup>(''x'')
::add(''n''+1,''x'')=''S''(''P''<sub>0</sub><sup>3</sup>(add(''n'',''x''),''n'',''x''))
:Note that ''P''<sub>0</sub><sup>1</sup> is simply the [[identity function]]; its inclusion is required by the definition of the primitive recursion operator above.
;[[Subtraction]]: We can define ''limited subtraction'', i.e. subtraction that bottoms out at 0 (since we have no concept of negative numbers yet). First we must define the "predecessor" function, which acts as the opposite of the successor function.
:Intuitively we would like to define predecessor as:
::pred(0)=''0''
::pred(''n''+1)=''n''
:To fit this in to a formal primitive recursive definition, we write:
::pred(0)=0
::pred(''n''+1)=''P''<sub>1</sub><sup>2</sup>(pred(''n''),''n'')
:Now we can define subtraction in a very similar way to how we defined addition.
::sub(0,''x'')=''P''<sub>0</sub><sup>1</sup>(''x'')
::sub(''n''+1,''x'')=pred(''P''<sub>0</sub><sup>3</sup>(sub(''n'',''x''),''n'',''x''))
:(note that the arguments have been switched from the "standard" definition to fit the requirements of primitive recursion, i.e. sub(''a'',''b'') corresponds to ''b''-''a''.
Many other familiar functions can be shown to be primitive recursive; some examples include [[conditional|conditionals]], exponentiation, [[primality testing]], and [[Mathematical induction|course-of-values induction]].
Line 63 ⟶ 113:
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 [[Cantors 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, given an index ''x'' and a value ''y'', one can build a [[Turing machine]] to compute the ''x''th 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 ''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 functions that can be enumerated in this way. In other words, any explicit list of the computable functions cannot be complete.
=== Relation to the [[recursive function|recursive functions]] ===
By extending the definition of primitive recursive functions to allow for [[partial function|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 function|recursive]] or [[recursive function|computable]] functions.
|