Download presentation
Presentation is loading. Please wait.
1
Primitive Recursive Predicates
Theorem 5.4: Let C be a PRC class. Let the functions g, h and the predicate P belong to C . Let f(x1, …, xn) = g(x1, …, xn) if P(x1, …, xn) = h(x1, …, xn) otherwise. Then f belongs to C . Proof: f obviously belongs to C , because it can be written as: f(x1, …, xn) = g(x1, …, xn)P(x1, …, xn) h(x1, …, xn)(P(x1, …, xn)) October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
2
Primitive Recursive Predicates
Corollary 5.5: Let C be a PRC class. Let n-ary functions g1, …, gm, h and predicates P1, …, Pm belong to C , and let Pi(x1, …, xn) & Pj(x1, …, xn) = 0 for all 1 i < j m and all x1, …, xn. If f(x1, …, xn) = g1(x1, …, xn) if P1(x1, …, xn) = g2(x1, …, xn) if P2(x1, …, xn) : : = gm(x1, …, xn) if Pm(x1, …, xn) = h(x1, …, xn) otherwise. Then f belongs to C . October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
3
Primitive Recursive Predicates
Proof: The idea is to use induction on the variable m. Theorem 5.4 provides the case for m = 1, so we just have to do the inductive step. Let f(x1, …, xn) = g1(x1, …, xn) if P1(x1, …, xn) : : = gm+1(x1, …, xn) if Pm+1(x1, …, xn) = h(x1, …, xn) otherwise, and let h’(x1, …, xn) = gm+1(x1, …, xn) if Pm+1(x1, …, xn) = h(x1, …, xn) otherwise. Then = gm(x1, …, xn) if Pm(x1, …, xn) = h’(x1, …, xn) otherwise. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
4
Primitive Recursive Predicates
The previous steps showed that f belongs to C for m = 1 whenever f belongs to C for a particular m, then f also belongs to C for m + 1. Conclusion: f belongs to C for any natural number m. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
5
Primitive Recursive Predicates
Theorem 6.1: Let C be a PRC class. If f(t, x1, …, 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. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
6
Primitive Recursive Predicates
Proof I: can be obtained by recursion in the following way: g(0, x1, …, xn) = f(0, x1, …, xn) g(t + 1, x1, …, xn) = g(t, x1, …, xn) + f(t + 1, x1, …, xn) Since + is primitive recursive, g belongs to C . October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
7
Primitive Recursive Predicates
Proof II: can be obtained by recursion in the following way: h(0, x1, …, xn) = f(0, x1, …, xn) h(t + 1, x1, …, xn) = h(t, x1, …, xn) f(t + 1, x1, …, xn) Since is primitive recursive, h belongs to C . October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
8
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, x1, …, xn) = 0 h(0, x1, …, xn) = 1 October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
9
Primitive Recursive Predicates
As a “by-product” of the preceding idea we obtained the following corollary: Corollary 6.2: If f(t, x1, …, xn) belongs to the PRC class C , then so do the following two functions: October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
10
Primitive Recursive Predicates
Theorem 6.3: If the predicate P(t, x1, …, xn) belongs to some PRC class C, then so do the following two predicates: (t)y P(t, x1, …, xn) and (t)y P(t, x1, …, xn) Proof: October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
11
Primitive Recursive Predicates
Sometimes we may want to use the quantifiers (t)<y P(t, x1, …, xn) and (t)<y P(t, x1, …, xn). Then Theorem 6.3 is still valid, which is obvious from the following two relations: (t)<y P(t, x1, …, xn) (t)y [t = y P(t, x1, …, xn)] (t)<y P(t, x1, …, xn) (t)y [t y & P(t, x1, …, xn)] October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
12
Primitive Recursive Predicates
Example 12: y | x 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). October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
13
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)]. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
14
Theory of Computation Lecture 9: Primitive Recursive Functions IV
Minimalization Let the predicate P(t, x1, …, 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.) October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
15
Theory of Computation Lecture 9: Primitive Recursive Functions IV
Minimalization Let us take a closer look at the function Let us assume that there is a value t0 that is the smallest value of t y for which P(t, x1, …, xn) is true: P(t, x1, …, xn) = 0 for t < t0 P(t0, x1, …, xn) = 1. Then Hence, so that g(y, x1, …, xn) is the least value of t for which P(t, x1, …, xn) is true. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
16
Theory of Computation Lecture 9: Primitive Recursive Functions IV
Minimalization Then we define: Thus, minty P(t, x1, …, xn) is the smallest value of ty for which P(t, x1, …, xn) is true, if such ty exists, otherwise it is 0. Using Theorems 5.4 and 6.3, we have: Theorem 7.1: If P(t, x1, …, xn) belongs to some PRC Class C and f(y, x1, …, xn) = minty P(t, x1, …, xn), then f also belongs to C . We will call the operation “minty” bounded minimalization. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
17
Theory of Computation Lecture 9: Primitive Recursive Functions IV
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. x/y is primitive recursive as shown by the equation x/y = mintx [(t + 1) y > x] Note that this equation gives us x/0 = 0. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
18
Theory of Computation Lecture 9: Primitive Recursive Functions IV
Minimalization 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. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
19
Theory of Computation Lecture 9: Primitive Recursive Functions IV
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 p0 = 0. Then we have: p0 = p1 = 2 p2 = 3 p3 = 5 p4 = 7 October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
20
Theory of Computation Lecture 9: Primitive Recursive Functions IV
Minimalization Now consider the following recursion equations: p0 = 0 pn+1 = mintpn!+1[Prime(t) & t > pn]. To see that these equations are correct, we must verify the following inequality: pn+1 pn! + 1. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
21
Theory of Computation Lecture 9: Primitive Recursive Functions IV
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! = 1234567, and pi = 3, so pn!/pi = 124567 = 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 p1, …, pn. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
22
Theory of Computation Lecture 9: Primitive Recursive Functions IV
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. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.