Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Recursive Function Theory
Abhishek Kr Singh
TIFR Mumbai.
21 August 2014
Primitive Recursive Functions
IInitial Functions.
I s(x) = x + 1I n(x) = 0I uni (x1, ..., xn) = xi , where 1 i n .
IComposition:
I Let h(x1, ...., xn) = f (g1(x1, ....., xn), ....., gk(x1, ...., xn)).I Then h is said to be obtained from f and g1, ....., gk by
composition.
IPrimitive Recursion:
I Let h(x1, ....xn, 0) = f (x1, ....xn) , andh(x1, ....xn, t + 1) = g(t, h(x1, ....xn, t), x1, ....xn).
I Then h is said to be obtained from f and g by primitive
recursion, or simply recursion.
Definition: A function is called primitive recursive if it can be
obtained from the initial functions by a finite number
of applications of composition and recursion.
IBounded Quantifiers:
IIf the predicate P(t, x1, ....., xn) is primitive recursive then
so are the predicates (8t)yP(t, x1, ....., xn) and
(9t)yP(t, x1, ....., xn) .
IBounded Minimalization:
I mintyP(t, x1, ....., xn) is the least value of t y for whichP(t, x1, ....., xn) is true, if such exists; otherwise it assumes thedefault value 0.
I mintP(t, x1, ....., xn) is the unbounded version. However inthis case if there is no value of t for which P is true, thenmintP(t, x1, ....., xn) is undefined.
IIf the predicate P(t, x1, ....., xn) is primitive recursive then
so is the predicate mintyP(t, x1, ....., xn).
ISome Primitive Recursive Functions
1. x + y2. x .y3. x!4. xy
5. p(x) the predecessor function6. x . y7. |x � y |8. ↵(x) the IsZero predicate9. x = y
10. x y11. x < y12. y | x y divides x13. Prime(x)14. bx/yc15. R(x , y)16. pn the nth prime number17. < x , y > the pairing function18. [a1, ..., an] the Godel number19. Lt(x) where x = [a1, ..., an]20. ([a1, ..., an])i
Programs and Computable Functions
IProgramming language S .
I Our concept of computable function will be based onprogramming language S which has following instruction types.
1. V V2. V V + 13. V V � 14. IF V 6= 0 GOTO L
I A program in S is a sequence of labeled or unlabeledinstructions of above type.
ISyntax of the language S
I Conventions:I Input variables X1,X2,X3, ..... .I Output variable Y andI Local Variables Z1,Z2,Z3, .....
I State � and snapshot s = (i ,�) of program P .I A Computation of a program P is defined to be a sequence
s1, s2, s3, .....sk of snapshots of P such that si+1 is thesuccessor of si for each i and sk is the terminal snapshot.
Computable Functions
IFor any program P and any positive integer m, m
P (x1, ...., xm)represents the value of function computed by program P on
input x1, ...., xm.
I A given partial function g is said to be partially computable ifit is computed by some program.
I A function g is called computable if it is both total andpartially computable.
Primitive recursive Vs computable functions.
IEvery primitive recursive function is computable.
ICoding program by numbers
I #(I ) =< a, < b, c >>I #(P) = [#(I1),#(I2), ....,#(Ik)]� 1.
Theorem-1 Universality Theorem:
ILet �n(x1, ...., xn, y) = n
P(x1, ...., xn) , where
#(P) = y .
IThen for each n > 0 , the function
�n(x1, ...., xn, y) is partially computable.
Proof. Existence of a program Un, called the universal
progmam, such that
n+1Un
(x1, ...., xn, xn+1) = �n(x1, ...., xn, xn+1) = nP(x1, ...., xn) ,where xn+1 = #(P).
Theorem-2 Step-Counter Theorem:
ILet STPn(x1, ....., xn, y , t)() Program number
y halts after t or fewer steps on inputs
x1, ......, xn.Then for each n > 0, the predicate
STPn(x1, ....., xn, y , t) is primitive recursive.
Proof STPn(x1, ....., xn, y , t) ()Term(Snapn(x1, ....., xn, y , t), y)
where
Snapn(x1, ....., xn, y , 0) = Initn(x1, ....., xn) and
Snapn(x1, ....., xn, y , i + 1) =Succ(Snapn(x1, ....., xn, y , i), y).
Theorem-3 Normal Form Theorem: Let f (x1, ......, xn) be a
partially computable function. Then there is a
primitive recursive predicate R(x1, ...., xn, y) such that
f (x1, ......, xn) = l(minzR(x1, ...., xn, z)).
Proof. Let y0 = #(P) where P is the program that
computes f .Consider the following predicate, call it
R(x1, ...., xn, z) ,
STPn(x1, ....., xn, y0, r(z))
& (r(Snapn(x1, ....., xn, y0, r(z))))1 = l(z)
Then we have
f (x1, ......, xn) = l(minzR(x1, ...., xn, z))
Note that if there is no value of z for which
minzR(x1, ...., xn, z) is true, then according to the
definition of minimalization minzR(x1, ...., xn, z) is
undefined.
Corollary-3.1 A function is partially computable if and only if it can
be obtained from the initial functions by a finite
number of applications of composition, recursion, and
minimalization.
Corollary-3.2 A function is computable if and only if it can be
obtained from the initial functions by a finite number
of applications of composition, recursion, and proper
minimalization.
IWhen minzR(x1, ...., xn, z) is a total function, we
say that we are applying proper minimalization
to R .
Recursively Enumerable Sets
Definition The set B ⇢ N is called recursively enumerable if
there is a partially computable function g(x) such
that B = {x 2 N|g(x) #}.Definition We write Wn = {x 2 N|�(x , n) #}.
We define K = {n 2 N|n 2Wn}.Therefore, n 2Wn () �(n, n) # () HALT (n, n).
Since we have Godel numbering functions [x1, ...., xm] and (x)i , we
can restrict to the subsets of N in our discussion of Computabilty
theory. Therefore, we have,
Theorem-4 Let C be a PRC class, and let B be a subset of Nm,
m � 1. Then B belongs to C if and only if
B0= {[x1, ...., xm] 2 N|(x1, ...., xm) 2 B} belongs to
C .
Proof. PB0 (x) () (Lt(x) = m)&PB((x)1, ....., (x)m)PB(x1, ...., xm) () PB0([x1, ...., xm])
Theorem-5 Enumeration Theorem: A set B is r.e if and only if
there is an n for which B = Wn.
Theorem-6 The set B is recursive if and only if B and B̄ are both
r.e.
Proof. Let P and Q be the programs coresponding to B and
B̄ . Consider the following program where
p = #(P) and q = #(Q)
[A] If STP(X , p,T ) Goto C
If STP(X , q,T ) Goto E
T T + 1
Goto A
[C ] Y 1
Theorem-7 Let B be an r.e. set. Then there is a primitive
recursive predicate R(x , t) such that
B = {x 2 N|(9t)R(x , t)}.Proof. Let B = Wn. Then B = {x 2 N|(9t) STP(x , n, t)}.
Theorem-8 If B and C are r.e sets so are B [ C and B \ C .
Theorem-9 Let S be a nonempty r.e. set. Then there is a
primitive recursive function f (u) such that
S = {f (n)|n 2 N} = {f (0), f (1), .....}. That is, S is
the range of f .
Proof. By Theorem-7 we can write, S = {x |(9t)R(x , t)}.
Let x0 2 S and u =< x , t > .Consider the following function
f (u) =
(x if R(x , t)
x0 otherwise
That is,
f (< x , t >) = x .R(x , t) + x0. ⇠ R(x , t)Which is same as
f (u) = l(u).R(l(u), r(u)) + x0.↵(R(l(u), r(u))).
Theorem-10 Let f (x) be a partially computable function and let
S = {f (x)|f (x) #}. (That is, S is the range of f .)Then S is r.e.
Proof Let program P computes f and p = #(P).Then we need to demonstrate a program, say Q,
which behaves as follow,
Q stops at x () 9u9t, (STP(u, p, t)& f (u) = x)
() 9 < u, t >, (STP(u, p, t)& f (u) = x)() 9n, (STP(l(n), p, r(n))& f (l(n)) = x)
Thus Q can be the following program,
[A] IF ⇠ STP(l(Z ), p, r(Z )) Goto B
IF f (l(Z )) = X Goto E
[B] Z Z + 1
Goto A
Theorem-11 Suppose that S 6= �. Then the following statements
are all equivalent:
1. S is r.e.
2. S is the range of a primitive recursive function.
3. S is the range of a recursive function.
4. S is the range of a partial recursive function.
Proof. By Theorem-9, (1) =) (2).(2) =) (3) and (3) =) (4) are obvious. By