Download presentation
Presentation is loading. Please wait.
1
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 1 Primitive Recursive Predicates Theorem 6.1: Let C be a PRC class. If f(t, x 1, …, x n ) belongs to C, then so do the functions To prove this theorem, we will show that g and h can be obtained from f by primitive recursion.
2
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 2 Primitive Recursive Predicates Proof I: can be obtained by recursion in the following way: g(0, x 1, …, x n ) = f(0, x 1, …, x n ) g(t + 1, x 1, …, x n ) = g(t, x 1, …, x n ) + f(t + 1, x 1, …, x n ) Since + is primitive recursive, g belongs to C.
3
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 3 Primitive Recursive Predicates Proof II: can be obtained by recursion in the following way: h(0, x 1, …, x n ) = f(0, x 1, …, x n ) h(t + 1, x 1, …, x n ) = h(t, x 1, …, x n ) f(t + 1, x 1, …, x n ) Since is primitive recursive, h belongs to C.
4
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 4 Primitive Recursive Predicates In some cases we might want to begin the iteration at 1 instead of 0: Then we just need to replace the initial recursion equations: g(0, x 1, …, x n ) = 0 h(0, x 1, …, x n ) = 1
5
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 5 Primitive Recursive Predicates As a “by-product” of the preceding idea we obtained the following corollary: Corollary 6.2: If f(t, x 1, …, x n ) belongs to the PRC class C, then so do the following two functions:
6
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 6 Primitive Recursive Predicates Theorem 6.3: If the predicate P(t, x 1, …, x n ) belongs to some PRC class C, then so do the following two predicates: ( t) y P(t, x 1, …, x n ) and ( t) y P(t, x 1, …, x n ) Proof:
7
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 7 Primitive Recursive Predicates Sometimes we may want to use the quantifiers ( t) <y P(t, x 1, …, x n ) and ( t) <y P(t, x 1, …, x n ). Then Theorem 6.3 is still valid, which is obvious from the following two relations: ( t) <y P(t, x 1, …, x n ) ( t) y [t = y P(t, x 1, …, x n )] ( t) <y P(t, x 1, …, x n ) ( t) y [t y & P(t, x 1, …, x n )]
8
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 8 Primitive Recursive Predicates Example 12: y | x y | x means “y is a divisor of x.” For example, 4 | 15 is This predicate is primitive recursive because y | x ( t) x (y t = x). false. 3 | 9 is true.
9
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 9 Primitive Recursive Predicates Example 13: Prime(x) Prime(x) is the predicate “x is a prime.” It is primitive recursive since Prime(x) x > 1 & ( t) x [t = 1 t = x (t | x)].
10
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 10Minimalization Let the predicate P(t, x 1, …, x n ) belong to some PRC class C. Then by Theorem 6.1 the function also belongs to C. (Remember the primitive recursive “negation” function we defined earlier.)
11
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 11Minimalization Let us take a closer look at the function Let us assume that there is a value t 0 that is the smallest value of t y for which P(t, x 1, …, x n ) is true: P(t, x 1, …, x n ) = 0 for t < t 0 P(t 0, x 1, …, x n ) = 1. Then Hence, so that g(y, x 1, …, x n ) is the least value of t for which P(t, x 1, …, x n ) is true.
12
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 12Minimalization Then we define: Thus, min t y P(t, x 1, …, x n ) is the smallest value of t y for which P(t, x 1, …, x n ) is true, if such t y exists, otherwise it is 0. Using Theorems 5.4 and 6.3, we have: Theorem 7.1: If P(t, x 1, …, x n ) belongs to some PRC Class C and f(y, x 1, …, x n ) = min t y P(t, x 1, …, x n ), then f also belongs to C. We will call the operation “min t y ” bounded minimalization.
13
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 13Minimalization Example 14: x/y is the floor function. For example, 8/3 = 2. So x/y is the integer part of the quotient x/y. x/y is primitive recursive as shown by the equation x/y = min t y [(t + 1) y > x] Note that this equation gives us x/0 = 0.
14
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 14Minimalization Example 15: R(x, y) R(x, y) is the remainder when x is divided by y. We can also write R(x, y) = x mod y (“modulo”). Obviously, it is true that x/y = x/y + R(x, y)/y Therefore, we can write: R(x, y) = x - (y x/y ) This shows that R(x, y) is primitive recursive. Note that R(x, 0) = x.
15
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 15Minimalization Example 16: p n Here, for n > 0, p n is the n-th prime number (in order of size). In order to make p n a total function, we set p 0 = 0. Then we have: p0 =p0 =p0 =p0 = 0 p1 =p1 =p1 =p1 =2 p2 =p2 =p2 =p2 =3 p3 =p3 =p3 =p3 =5 p4 =p4 =p4 =p4 =7
16
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 16Minimalization Now consider the following recursion equations: p 0 = 0 p n+1 = min t p n !+1 [Prime(t) & t > p n ]. To see that these equations are correct, we must verify the following inequality: p n+1 p n ! + 1.
17
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 17Minimalization p n+1 p n ! + 1. Note that for 0 < i n we have: (p n ! + 1)/p i = p n !/p i + 1/p i = K + 1/p i, where K is an integer. Why is p n ! always divisible by p i ? Example: n = 4, i = 2 Then p n ! = 1 2 3 4 5 6 7, and p i = 3, so p n !/p i = 1 2 4 5 6 7 = K. In other words, p i is always one of the factors in p n !. According to the equation (p n ! + 1)/p i = K + 1/p i, p n ! + 1 is not divisible by any of the primes p 1, …, p n.
18
October 1, 2009Theory of Computation Lecture 8: Primitive Recursive Functions IV 18Minimalization So either p n ! + 1 is itself a prime or it is divisible by a prime > p n. In either case there is a prime q such that p n < q p n ! + 1, which gives us the inequality that we wanted to verify: p n+1 p n ! + 1.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.