Title: MuRecursive Functions
1Chapter 13
2Recursive Functions
- Functions that can be computed by at least one
computational system, regardless of the
implementation execution of the system. - Recursive function theory
- i) Start w/ a collection of initial functions,
which are computable - ii) Combine the initial functions to form more
functions which are also computable
3Partial Functions Total Functions
- A partial function f X ? Y is a relation on X ?
Y such that y1 y2 whenever (x, y1) ? f (x,
y2) ? f. - x ? X is said to be defined in f if ?y ?Y such
that (x, y) ? f o.w., x is undefined in f. - If the domain of f is the entire set X, then f is
a total function on X. - A total function can be a one-to-one, onto, or
bijection function.
4Primitive Recursive Functions
- Are more complex functions than the basic
primitive recursive functions, which include - i) the successor function S S(X) X 1
- ii) the zero function Z Z(X) 0
- iii) the projection functions Pi(n) Pi(n)(X1,
..., Xn) Xi, 1 ? i ? n. - These functions form the foundation of the
hierarchy of computable functions. - Can be constructed from the basic functions by
applications of - i) composition the composition of two
computable functions g h, i.e., f g
? h, is a (computable) function (that
applies the outputs of h as inputs of g ) - ii) primitive recursion
5Primitive Recursive Functions
- Defn. 13.1.1 (Primitive Recursion). Let g h be
total functions w/ n n2 variables,
respectively. The n1-variable function f is
defined by - i) f(X1, ..., Xn, 0) g(X1, ..., Xn)
- ii) f(X1, ..., Xn, y1) h(X1, ..., Xn, y,
f (X1, ..., Xn, y)) - is said to be obtained from g h by primitive
recursion, where Xi s (1 ? i ? n) are called the
parameters y the recursive variable. - By definition, f (X1, ..., Xn, y1) is obtained
by the sequence of computations - f (X1, ..., Xn, 0) g(X1, ..., Xn)
- f (X1, ..., Xn, 1) h(X1, ..., Xn, 0, f (X1,
..., Xn, 0)) - f (X1, ..., Xn, 2) h(X1, ..., Xn, 1, f (X1,
..., Xn, 1)) -
- f (X1, ..., Xn, y1) h(X1, ..., Xn, y, f
(X1, ..., Xn, y))
6Primitive Recursive Function
- A function is primitive recursive (P.R.) if it
can be obtained from the successor, zero
projection functions by a finite number of
applications of composition primitive
recursion. - e.g., let add be the function defined by P.R.
from g(x) x h(x, y, z) z 1. Then - add(x, 0) g(x) x
- add(x, y1) h(x, y, add(x, y))
add(x, y) 1 - Hence, add is P.R. since g P1(1) h S ?
P3(3)
7Primitive Recursive Function
- e.g., add(2, 4) add(2, 3) 1
- (add(2, 2) 1) 1
- ((add(2, 1) 1) 1) 1
- (((add(2, 0) 1) 1) 1) 1
- 2 1 1 1 1
- 6
- Example. 13.1.3 Let g h be the total
functions g z h add ? (P3(3), P1(3)),
mult, i.e., ?, can be defined by primitive
recursion from g h as - mult(x, 0) g(x) 0
- mult(x, y1) h(x, y, mult(x, y))
mult(x, y) x
8Primitive Recursive Function
- Example 13.1.4 Let fact be the factorial
function defined by - 1 if y 0
- fact(y) o.w.
-
- fact is p.r. Let h(x, y) mult ? (P2(2),
S?P1(2)) y ? (x1). - Then, fact can be defined using p.r.
from h by - fact(0) 1 fact(y1) h(y, fact(y))
fact(y) ? (y1) - hence, fact(0) 1,
- fact(1) fact(0) ? 1 1
- fact(2) fact(1) ? 2 2,
- fact(3) fact(2) ? 3 6
- fact(4) fact(3) ? 4 24,
-
- h, the function used in a p.r. function, can be
any function that has previously be shown to be
p.r.
9Table 13.2.1 Primitive Recursive Arithmetic
Functions
- Description Function Definition
- Addition add(x, y) add(x, 0) x
- x y add(x, y1) add(x, y) 1
- Multiplication mult(x, y) mult(x,0)
0 - x ? y mult(x, y1) mult(x, y) x
- Predecessor pred(y) pred(0) 0
- pred(y1) y
- Proper sub(x, y) sub(x, 0) x
- Subtraction x - y sub(x, y1)
pred(sub(x, y)) - Exponentation exp(x, y) exp(x, 0) 1
- xy exp(x, y1) exp(x, y) ? x
.
10- TABLE 13.2.2 Primitive Recursive Predicates
- Description Predicate Definition
- Sign sg(x) sg(0) 0
- sg(y 1) 1
- Sign Complement cosg(x) cosg(0) 1
- cosg(y 1) 0
- Less than lt(x, y) sg(y - x)
- Greater than gt(x, y) sg(x -
y) - Equal to eq(x, y) cosg(lt(x,
y) gt(x, y)) - Not equal to ne(x, y)
cosg(eq(x, y))
.
.
11Primitive Recursive Function
- Table 13.2.1. Primitive Recursive Arithmetic
Functions - Theorem 13.1.3. Every p.r. function is Turing
computable - Example Let f be the function defined by
- x 1 if x is even
- x - 1 o.w.
- a) Give the state transitive diagram of a TM M
that computes f - b) Show that f is p.r.
b) oe(x) add(mult(ev(x), s(x)),
mult(cosq(ev(x)), pred(x)))
where ev(0) 1 s z
ev(x1) h(x, ev(x))
eq(P2(2)(x, ev(x)), 0) (eq is defined
in Table 13.2.2)
12Primitive Recursive Function
- Theorem 13.2.1 Let g be a p.r. function f a
total function that is identical to g for all
but a finite of input values. Then f is p.r. - Proof Let f be defined by
- y1 if x n1
- y2 if x n2
- f(x)
- yk if x nk
- g(x) o.w.
- f is p.r. since f can be written as
- f(x) eq(x, n1) y1 eq(x, n2) y2 ...
eq(x, nk) yk ne(x, n1) ne(x, n2)
... ne(x, nk) g(x)
13Tabular Functions
- Output values are listed along w/ their
corresponding input values, and a single common
value is associated w/ all other inputs, i.e., - g1(x1, ..., xn) if P1 (x1, ...,
xn) - f(x1, ..., xn)
- gm(x1, ..., xn) if Pm (x1, ...,
xn) - gm1(x1, ..., xn) o.w.
- f is p.r. because f can be expressed in the form
- f(x1, ..., xn) g1(x1, ..., xn) C1 (x1, ...,
xn) ... - gm(x1, ..., xn) Cm (x1,
..., xn) - gm1(x1,...,xn) cosq(C1 (x1,..., xn) ...
Cm(x1, ..., xn)) - where
- 1 if Pp(x1,
..., xn) holds - 0 o.w.
- Cp is called the characteristic function
Cp(x1, ..., xn)
14Computable Partial Functions
- All primitive recursive functions are total, but
not vice versa. - Example The Ackermans function is computable
total, but not p.r. - A(0, y) y 1
(basis) - A(x1, 0) A(x, 1)
- A(x1, y1) A(x, A(x1, y))
- To illustrate, consider
- A(2,1) A(1, A(2,0))
- A(1, A(1,1)) A(1,1) A(0, A(1,
0)) - A(1,3) A(0, A(0,
1)) - A(0, A(1,2)) A(0,
2) - A(0, A(0, A(1,1)))
3 - A(0, A(0, 3))
- A(0, 4)
- 5
15Computable Partial Functions
- Theorem There is a computable total function
from N to N that is not primitive recursive. - Proof. Each p.r. function from N to N can be
defined by a finite string of symbols. Thus, we
can assign an order to the p.r. functions by
arranging their definitions according to their
lengths (short strings first) w/ the strings of
the same length by alphabetical order, i.e., f1,
f2, ..., fn, ... - Let f(n) fn(n) 1 be a function from N
to N. f is total computable. However, f is
not p.r. (If it were, f would have to be fm, for
some m ? N. But then f(m) would be equal to
fm(m), which cannot be true since f(m) fm(m)
1.)
16Partial Recursive Functions
- The class of partial recursive functions is the
class of partial functions that can be
constructed from the initial (i.e., basic)
functions by applying a finite number of
compositions, primitive recursions,
minimalizations. - minimalization allows us to construct a function
f Nn ? N from function g Nn1 ? N .?. f( ) is
the smallest y ? N, g( , y) 0 g( , z) is
defined for all z (? N) lt y, written f( )
µyg( , y) 0. - e.g., g(0,0) 2 g(1,0) 3 g(2,0)
8 g(3,0) 2 - g(0,1) 3 g(1,1) 4 g(2,1) 3
g(3,1) 6 - g(0,2) 1 g(1,2) 0 g(2,2)
undefined g(3,2) 7 - g(0,3) 5 g(1,3) 2 g(2,3) 6
g(3,3) 2 - g(0,4) 0 g(1,4) 0 g(2,4) 0
g(3,4) 8 - g(0,5) 1 g(1,5) 0 g(2,5) 1
g(3,5) 4 -
- ? f(0) 4 ? f(1) 2 ? f(2)
is undefined
17Partial Recursive Functions
- Example. Let f N ? N be defined as f(x)
µyplus(x, y) 0. Thus f(0) 0, but f(x) is
undefined for ?x gt 0 - Example. Let div N2 ? N be defined as
- integer portion
of x/y, if y ? 0 - undefined, if y 0
- using minimalization, div can be constructed as
- div(x, y) µt((x 1) - (mult(t, y) y)) 0
.
18?-Recursive Functions
- ?-recursive functions yield a family of
computable partial recursive functions. - Defn.13.6.3. The family of ?-recursive functions
is defined as - i) The successor, zero, projection
functions are ?-recursive - ii) If h is an n-variable ?-recursive function
g1, ..., gn are k- variable
?-recursive functions, then f h (g1, ...,
gn) is
?-recursive. - iii) If g h are n n2 variable ?-recursive
functions, then f defined from g h by
primitive recursion is ?-recursive. - iv) If p(x1, ..., xn, y) is a total ?-recursive
predicate, then f ?z p(x1, ..., xn,
z) is ?-recursive - v) Each ?-recursive function can be obtained
from i) by a finite number of
applications of the rules in ii), iii) iv) - Theorem 13.6.4. Every ?-recursive function is
Turing computable - Theorem 13.7.1. Every Turing computable function
is ?-recursive