examples of primitive recursive functions
Starting from the simplest primitive recursive functions, we can build more complicated primitive recursive functions by functional
composition and primitive recursion. In this entry, we have listed some basic examples using functional composition alone. In this entry, we list more basic examples, allowing the use of primitive recursion:
-
1.
add(x,y)=x+y: add(x,0)=id(x), and add(x,n+1)=s(add(x,n))
-
2.
mult(x,y)=xy: mult(x,0)=z(x), and mult(x,n+1)=add(x,mult(x,n)).
-
3.
p2(x)=x2, which is just mult(x,x); more generally, pm+1(x)=mult(x,pm(x)), which is primitive recursive by induction
on m
-
4.
expm(x)=mx: expm(0)=s(0), and expm(n+1)=mult(constm(n),expm(n))
-
5.
exp(x,y)=xy: exp(x,0)=const1(x), and exp(x,n+1)=mult(x,exp(x,n))
-
6.
fact(x)=x!: fact(0)=s(0), and fact(n+1)=mult(s(n),fact(n))
-
7.
sub1(x)=x˙-1:= built using and : , and ;
-
8.
more generally, may be defined: .
-
9.
: , and .
-
10.
-
11.
built using and : , and .
-
12.
more generally,
is primitive recursive, for it is .
-
13.
even more generally,
where , is primitive recursive, for it is .
-
14.
which is just .
- 15.
-
16.
To see that is primitive recursive, we use equation
obtained from the division algorithm for integers. Then
Simplify and we get
Thus, by the previous example, we get
Therefore, , and
where takes the case into account.
Remarks.
-
•
All of the functions above are in fact examples of elementary recursive functions.
-
•
Example 3(m) above is a special case of a more general phenomenon. Recall that a subset is called primitive recursive if its characteristic function
is primitive recursive. If we take , then . Furthermore, a predicate
over is primitive recursive if the corresponding set is primitive recursive.
-
•
The technique of bounded maximization may be used to prove the primitive recursiveness of the quotient
and the reminder functions in examples 3(o) and 3(p). See this entry (http://planetmath.org/BoundedMaximization) for more detail.
Title | examples of primitive recursive functions |
---|---|
Canonical name | ExamplesOfPrimitiveRecursiveFunctions |
Date of creation | 2013-03-22 19:05:06 |
Last modified on | 2013-03-22 19:05:06 |
Owner | CWoo (3771) |
Last modified by | CWoo (3771) |
Numerical id | 17 |
Author | CWoo (3771) |
Entry type | Example |
Classification | msc 03D20 |
Related topic | ExamplesOfPrimitiveRecursivePredicates |