Primitive Recursive Predicates Theorem 6 1 Let C


















- Slides: 18
Primitive Recursive Predicates Theorem 6. 1: Let C be a PRC class. If f(t, x 1, …, xn) 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. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 1
Primitive Recursive Predicates Proof I: can be obtained by recursion in the following way: g(0, x 1, …, xn) = f(0, x 1, …, xn) g(t + 1, x 1, …, xn) = g(t, x 1, …, xn) + f(t + 1, x 1, …, xn) Since + is primitive recursive, g belongs to C. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 2
Primitive Recursive Predicates Proof II: can be obtained by recursion in the following way: h(0, x 1, …, xn) = f(0, x 1, …, xn) h(t + 1, x 1, …, xn) = h(t, x 1, …, xn) f(t + 1, x 1, …, xn) Since is primitive recursive, h belongs to C. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 3
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, …, xn) = 0 h(0, x 1, …, xn) = 1 February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 4
Primitive Recursive Predicates As a “by-product” of the preceding idea we obtained the following corollary: Corollary 6. 2: If f(t, x 1, …, xn) belongs to the PRC class C , then so do the following two functions: February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 5
Primitive Recursive Predicates Theorem 6. 3: If the predicate P(t, x 1, …, xn) belongs to some PRC class C, then so do the following two predicates: ( t) y P(t, x 1, …, xn) and ( t) y P(t, x 1, …, xn) Proof: February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 6
Primitive Recursive Predicates Sometimes we may want to use the quantifiers ( t)<y P(t, x 1, …, xn) and ( t)<y P(t, x 1, …, xn). Then Theorem 6. 3 is still valid, which is obvious from the following two relations: ( t)<y P(t, x 1, …, xn) ( t) y [t = y P(t, x 1, …, xn)] ( t)<y P(t, x 1, …, xn) ( t) y [t y & P(t, x 1, …, xn)] February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 7
Primitive Recursive Predicates Example 12: y | x means “y is a divisor of x. ” For example, 4 | 15 is false. 3 | 9 is true. This predicate is primitive recursive because y | x ( t) x (y t = x). February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 8
Primitive Recursive Predicates Example 13: 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)]. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 9
Minimalization Let the predicate P(t, x 1, …, xn) 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. ) February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 10
Minimalization 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, …, xn) is true: P(t, x 1, …, xn) = 0 for t < t 0 P(t 0, x 1, …, xn) = 1. Then Hence, so that g(y, x 1, …, xn) is the least value of t for which P(t, x 1, …, xn) is true. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 11
Minimalization Then we define: Thus, mint y P(t, x 1, …, xn) is the smallest value of t y for which P(t, x 1, …, xn) 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, …, xn) belongs to some PRC Class C and f(y, x 1, …, xn) = mint y P(t, x 1, …, xn), then f also belongs to C. We will call the operation “mint y” bounded minimalization. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 12
Minimalization 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 is primitive recursive as shown by the equation x/y = mint x [(t + 1) y > x] Note that this equation gives us x/0 = 0. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 13
Minimalization Example 15: 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. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 14
Minimalization Example 16: pn Here, for n > 0, pn is the n-th prime number (in order of size). In order to make pn a total function, we set p 0 = 0. Then we have: p 0 = 0 p 1 = 2 p 2 = 3 p 3 = 5 p 4 = 7 February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 15
Minimalization Now consider the following recursion equations: p 0 = 0 pn+1 = mint pn!+1[Prime(t) & t > pn]. To see that these equations are correct, we must verify the following inequality: pn+1 pn! + 1. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 16
Minimalization pn+1 pn! + 1. Note that for 0 < i n we have: (pn! + 1)/pi = pn!/pi + 1/pi = K + 1/pi , where K is an integer. Why is pn! always divisible by pi ? Example: n = 4, i = 2 Then pn! = 1 2 3 4 5 6 7, and pi = 3, so pn!/pi = 1 2 4 5 6 7 = K. In other words, pi is always one of the factors in pn!. According to the equation (pn! + 1)/pi = K + 1/pi , pn! + 1 is not divisible by any of the primes p 1, …, pn. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 17
Minimalization So either pn! + 1 is itself a prime or it is divisible by a prime > pn. In either case there is a prime q such that pn < q pn! + 1, which gives us the inequality that we wanted to verify: pn+1 pn! + 1. February 28, 2019 Theory of Computation Lecture 8: Primitive Recursive Functions III 18