Presentation is loading. Please wait.

Presentation is loading. Please wait.

Another Word on PRC Classes

Similar presentations


Presentation on theme: "Another Word on PRC Classes"— Presentation transcript:

1 Another Word on PRC Classes
A class of total functions C is called a PRC class if the initial functions n, s, and u belong to C and a function obtained from functions belonging to C by recursion or composition also belongs to C. Notice that this definition does not demand all functions in C to be obtained from n, s, and u by recursion or composition. There could be other functions in C, say p and q, that cannot be obtained from n, s, and u. According to the definition, C is then still a PRC class if all functions obtained from n, s, u, p, and q by recursion or composition are also in C. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

2 Another Word on PRC Classes
Now look at the definition of primitive recursive functions: 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. So here no additional functions such as p and q are allowed – all primitive recursive functions can be obtained from n, s, and u. Therefore, the class of primitive recursive functions is the minimal PRC class. All primitive recursive functions are contained in every PRC class. However, PRC classes can contain additional functions (see previous slide). September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

3 Some Primitive Recursive Functions
So we have learned that every primitive recursive function is computable. We will now look at some examples of primitive recursive functions. In order to prove that a function is primitive recursive, we have to show how that function can be derived from the initial functions by using composition and recursion. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

4 Some Primitive Recursive Functions
Remember? The recursive definition of a function looks like this: h(x1, …, xn, 0) = f(x1, …, xn) h(x1, …, xn, t + 1) = g(t, h(x1, …, xn, t), x1, …, xn) . If f is a function of k variables, g1, …, gk are functions of n variables, and h(x1, …, xn) = f(g1(x1, …, xn), …, gk(x1, …, xn)). Then h is said to be obtained from f and g1, …, gk by composition. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

5 Some Primitive Recursive Functions
We defined the following initial functions: s(x) = x + 1 n(x) = 0 uin(x1, …, xn) = xi , 1 ≤ i ≤ n. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

6 Some Primitive Recursive Functions
Example 1: f(x, y) = x + y We can transform this into a recursive definition: f(x, 0) = x f(x, y + 1) = f(x, y) + 1 This can be rewritten as: f(x, 0) = u11(x) f(x, y + 1) = g(y, f(x, y), x) where g(x1, x2, x3) = s(u23(x1, x2, x3)). Obviously, u11(x), u23(x1, x2, x3), and s(x) are primitive recursive functions – they are initial functions. g(x1, x2, x3) is obtained by composition of primitive recursive functions, so it is primitive recursive itself. Therefore, f(x, y) = x + y is primitive recursive. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

7 Some Primitive Recursive Functions
Example 2: h(x, y) = x  y We can obtain the following recursive definition: h(x, 0) = 0 h(x, y + 1) = h(x, y) + x This can be rewritten as: h(x, 0) = n(x) h(x, y + 1) = g(y, h(x, y), x) where f(x1, x2) = x1 + x2 and g(x1, x2, x3) = f(u23(x1, x2, x3), u33(x1, x2, x3)). Obviously, these are all primitive recursive functions. Therefore, h(x, y) = x  y is primitive recursive. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

8 Some Primitive Recursive Functions
Example 3: h(x) = x! Here are the recursion equations: h(0) = 1 h(t + 1) = h(t)  s(t) This can be rewritten as: h(0) = s(n(t)) h(t + 1) = g(t, h(t)) where g(x1, x2) = s(x1)  x2 , which can be written as: g(x1, x2) = s(u12(x1, x2))  u22(x1, x2). Multiplication is already known to be primitive recursive. Therefore, h(x) = x! is primitive recursive. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

9 Some Primitive Recursive Functions
In the following examples, we just show the recursive mechanism without developing the precise form of the recursion equations. Example 4: xy The recursion equations are: x = 1 xy+1 = xy  x September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

10 Some Primitive Recursive Functions
Example 5: The predecessor function p(x) It is defined as follows: p(x) = x – 1 if x  0 = if x = 0 The recursion equations are: p(0) = 0 p(t + 1) = t September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

11 Some Primitive Recursive Functions
Example 6: x - y (monus) It is defined as follows: x - y = x – y if x  y = if x < y The recursion equations are: x - = x x - (t + 1) = p(x - t) September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

12 Some Primitive Recursive Functions
Example 7: | x – y | The function | x – y | is defined as the absolute value of the difference between x and y. It can be written as follows: | x – y | = (x - y) + (y - x) Therefore, | x – y | is primitive recursive. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

13 Some Primitive Recursive Functions
Example 8: (x) (“negation”) The function (x) is defined as follows: (x) = 1 if x = 0 = 0 if x  0 (x) is primitive recursive, because: (x) = 1 - x If we prefer, we can just write down the recursion equations: (0) = 1 (t + 1) = 0 September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

14 Primitive Recursive Predicates
Example 9: x = y We can describe this predicate by the function d(x, y): d(x, y) = 1 if x = y = 0 if x  y d(x, y) is primitive recursive because of the following equation: d(x, y) = (|x – y|) September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

15 Primitive Recursive Predicates
Example 10: x  y Again, we can describe this predicate by the function d(x, y): d(x, y) = 1 if x  y = 0 if x > y d(x, y) is primitive recursive because of the following equation: d(x, y) = (x – y) September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

16 Primitive Recursive Predicates
Theorem 5.1: Let C be a PRC class. If P, Q are predicates that belong to C , then so are P, PQ, and P&Q. Proof: Since P = (P), it follows that P belongs to C . Since P&Q = PQ, it follows that P&Q belongs to C . Since PQ = (P & Q), it follows that PQ belongs to C . September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

17 Primitive Recursive Predicates
We already know two different PRC classes, namely the class of all primitive recursive functions, and the class of all computable functions. Correspondingly, we have the following corollaries: Corollary 5.2: If P, Q are primitive recursive predicates, then so are P, PQ, and P&Q. Corollary 5.3: If P, Q are computable predicates, then so are P, PQ, and P&Q. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III

18 Primitive Recursive Predicates
Example 11: x < y So far, we only know that x  y and x = y are primitive recursive predicates (Examples 9 and 10). Since we have the tautology x < y  x  y & (x = y) or even simpler: x < y  (y  x) , according to Corollary 5.2, x < y is also a primitive recursive predicate. September 28, 2017 Theory of Computation Lecture 8: Primitive Recursive Functions III


Download ppt "Another Word on PRC Classes"

Similar presentations


Ads by Google