recursive function
the term "recursive function" in computability seems to be used loosely and defined differently by different books, but the general consensus seems to be that mu-recursive functions (in reference to kleene's mu-operator), aliased partial recursive functions are defined as the complete class of recursive functions which is proved to represent the class of algorithmically computable functions (functions that can be computed by a machine) and the primitive recursive functions are a subset of that class restricted to total functions. the term recursive function usually seems to refer to the more general class of computable functions (the former).
defined previously. we are allowed to build up primitive recursive functions inductively in this way.
-recursive function may not be. there exist total computable functions that are not primitive recursive; one example is Ackermann's function:
[cite:;taken from @kozen_automata_1997 example 36.1]
more primitive recursive functions include:
is the "integer part" of the quotient
. for example,
and
. the equation
shows that
is primitive recursive. note that according to this equation, we are taking
.
[cite:;taken from @computability_davis_1994 chapter 3.7 minimalization]
suppose
is some fixed number and
where
is some given broken link: blk:def-total-func of two variables. then
is said to be obtained from
by primitive recursion, or simply recursion.
the more general case of primitive recursion with multiple variables is shown in broken link: blk:blk-mu-recursive-func-schema-5.
[cite:;taken from @computability_davis_1994 chapter 3.2 recursion]
the definitions recursive_function.html and recursive_function.html are the same, just taken from 2 different books.
the more general case of primitive recursion with multiple variables is shown in broken link: blk:blk-mu-recursive-func-schema-5.
[cite:;taken from @computability_davis_1994 chapter 3.2 recursion]
godel defined a collection of number-theoretic functions
that, according to his intuition, represented all the computable functions. his definition was as follows:
-recursive functions. the functions defined by 1 through 5 only are called the primitive recursive functions.
[cite:;taken from @kozen_automata_1997 lecture 36; the
-recursive functions]
- successor. the function
given by
is computable.
- zero. the function
given by
is computable.
- <<
>>projections. the functions given by
,
, are computable.
- composition. if
and
are computable, then so is the function
that on input
gives
5. <<
>>primitive recursion: if and
are computable,
, then so are the functions
, defined by mutual induction as follows:
where
.
- unbounded minimization. if
is computable, then so is the function
that on input
gives the least
such that
is defined for all
and
if such a
exists and is undefined otherwise. we denote this by
[cite:;taken from @kozen_automata_1997 lecture 36; the
- the constant functions
are primitive recursive:
- addition is primitive recursive, since we can define
- this is a bona fide definition by primitive recursion: in rule broken link: blk:blk-mu-recursive-func-schema-5, take
, and
. then
- multiplication is primitive recursive, since
- exponentiation is primitive recursive, since
- the predecessor function
is primitive recursive
- proper subtraction:
is primitive recursive, and can be defined from predecessor in exactly the same way that addition is defined from successor.
- the sign function is primitive recursive:
- the relations
, and
, considered as (0,1)-valued functions, are all primitive recursive; for example,
- functions can be defined by cases. for example,
is primitive recursive:
- inverses of certain functions can be defined. for example,
is primitive recursive:
, where
and
is from the previous example. the function
just continues to add 1 to its first argument
until the condition
is satisfied. this must happen for some
. inverses of other common functions, such as square root, can be defined similarly.
the term recursion refers to a function
defined by induction. we first define
and hen define
in terms of previously defined functions using as inputs
and
. for example, the factorial function
is defined by the recursion schemes
where we assume that multiplication has been previously defined.
up until the early 1930s, the term "recursive function" meant what we now call a primitive recursive function to distinguish it from the Herbrand-Gödel general recursive function. in 1931 Gödel used primitive recursive functions in the proof of his famous incompleteness theorem and called them simply by the German term "rekursiv." the main property of recursion is the primitive recursion scheme (broken link: blk:def-primitive-recursive-schema-5) below, which yields an inductive definition of
using the preceding value
and previously defined functions
and
. [Kleene 1952] put the primitive recursive functions in the following succinct form which has become standard.
are primitive recursive, including
and limited subtraction
,

up until the early 1930s, the term "recursive function" meant what we now call a primitive recursive function to distinguish it from the Herbrand-Gödel general recursive function. in 1931 Gödel used primitive recursive functions in the proof of his famous incompleteness theorem and called them simply by the German term "rekursiv." the main property of recursion is the primitive recursion scheme (broken link: blk:def-primitive-recursive-schema-5) below, which yields an inductive definition of
the class of primitive recursive functions is he least class
of functions closed under the following schemes (1)-(5).
[kleene 1952] showed that all the usual functions on - the successor function
is in
.
- the constant functions
are in
,
.
- the identity functions
,
, are in
.
- (composition) if
, then
is in
, where
are functions of
variables,
, and
is a function of
variables.
- <<
>>(primitive recursion) if and
, then
where
where
, the
variables treated as parameters, assuming
and
are functions of
and
variables, respectively. and
is a function of
variables. (in case
, a 0-ary function is a constant function which is in
by scheme 2).
the class
of
-recursive (partial) functions is the least class obtained by closing under schemes (1)-(5) for the primitive recursive functions and the following scheme (6).
[cite:;taken from @computability_soare_2016 chapter 17 history of computability]- (unbounded search) if
is a partial function, and
then
is in
. (here
diverges if there is no such
. hence,
may be nontotal.)
the constant function
for all
is primitive recursive.
this may be true by definition when considering recursive_function.html, but not when considering the axioms of recursive_function.html.
we can gain intuition by looking at it in the form of a matrix of functions, in which all items in the same column are equal and each column corresponds to the successor of the value corresponding to the column on its left:

if we write
, we have the recursion equations
we can rewrite these equations as
where
. the functions
, and
are primitive recursive functions; in fact they are initial functions. also,
is a primitive recursive function, since it is obtained by composition of primitive recursive functions. thus, the preceding is a valid application of the operation of recursion to primitive recursive functions. hence
is primitive recursive.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
the recursion equations for
are
this can be rewritten
here,
is the zero function.

is
, and
are projection functions. notice that the functions
, and
are all primitive recursive functions, since they are all initial functions.
is also primitive recursive, so
is a primitive recursive function since it is obtained from primitive recursive functions by composition. finally, we conclude that
is primitive recursive.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
for
, the recursion operations are
more precisely,
, where
and
finally,
is primitive recursive because
and multiplication is already known to be primitive recursive.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
for
, the recursion equations are
note that these equations assign the value 1 to the "indeterminate"
.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
the predecessor function
is defined as follows:
.
the recursion equations for
are simply
hence,
is primitive recursive.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
the recursion equations for
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
the function
is defined as follows:
this function should not be confused with the function
, which is undefined if
. in particular,
is total, while
is not.
we show that
is primitive recursive by displaying the recursion equations:
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
we show that
the function
is defined as the absolute value of the difference between
and
. it can be expressed simply as
and thus is primitive recursive.
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.4 some primitive recursive functions]
[cite:;taken from @computability_davis_1994 chapter 3.7 minimalization]
if
is a primitive recursive relation then
, defined as
is a primitive recursive function.
the function
is primitive recursive
consider the function

is primitive recursive by unbounded_search_operator.html and so
is primitive recursive aswell. and by primitive_recursive_predicate.html the function desired can be defined as:
is primitive recursive too.
the function
is primitive recursive.
consider the function

is primitive recursive because the relation
is.
the function
that generalizes the example
because 3 is 11 in binary form, and 100 is 4 in binary, which gives 11100 in binary which is the binary representation of the decimal 28.
let
denote the length of digits in the binary representation of
. we have
we have
is primitive recursive, and exponentiality is primitive recursive as well as addition and multiplication and so
is primitive recursive by composition.
let
, if we show that
is primitive recursive then we can simply define
.
because we were able to define
in terms of
and other p.r. functions we know
is p.r.