Theory of Computation Lecture 6: Primitive Recursive Functions I

Slides:



Advertisements
Similar presentations
Primitive Recursive Functions (Chapter 3)
Advertisements

October 13, 2009Theory of Computation Lecture 11: A Universal Program III 1 Coding Programs by Numbers Gödel numbers are usually very large, even for small.
Mu-Recursive Functions
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
November 10, 2009Theory of Computation Lecture 16: Computation on Strings I 1Diagonalization Another example: Let TOT be the set of all numbers p such.
December 8, 2009Theory of Computation Lecture 22: Turing Machines IV 1 Turing Machines Theorem 1.1: Any partial function that can be computed by a Post-
September 24, 2009Theory of Computation Lecture 6: Primitive Recursive Functions II 1 Homework Questions Question 1: Write a program P that computes 
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 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.
November 3, 2009Theory of Computation Lecture 14: A Universal Program VI 1 Recursively Enumerable Sets Definition: We write: W n = {x  N |  (x, n) 
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
December 1, 2009Theory of Computation Lecture 21: Turing Machines II 1 Simulation of L n in T We will now construct a Post-Turing program Q that simulates.
3 DERIVATIVES.  Remember, they are valid only when x is measured in radians.  For more details see Chapter 3, Section 4 or the PowerPoint file Chapter3_Sec4.ppt.
September 29, 2009Theory of Computation Lecture 7: Primitive Recursive Functions III 1 Some Primitive Recursive Functions Example 3: h(x) = x! Here are.
Theory of Computation Lecture 5: Primitive Recursive Functions I
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
Equivalence Relations Lecture 45 Section 10.3 Fri, Apr 8, 2005.
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
October 4, 2016Theory of Computation Lecture 9: A Universal Program I 1Minimalization Example 15: R(x, y) R(x, y) is the remainder when x is divided by.
Equivalence Relations
Cardinality with Applications to Computability
Another Word on PRC Classes
Theory of Computation Lecture 10: A Universal Program I
Chapter 5 Limits and Continuity.
Theory of Computation Lecture 12: A Universal Program III
2.7 Combining Functions.
DIFFERENTIATION RULES
Theory Of Computer Science
Copyright © Cengage Learning. All rights reserved.
Chapter 7 Integration.
A power series with center c is an infinite series where x is a variable. For example, is a power series with center c = 2.
Diagonalization and Reducibility
Theory of Computation Lecture 23: Turing Machines IV
Theory of Computation Lecture 14: A Universal Program V
Recursively Enumerable Sets
Numerical Representation of Strings
Theory of Computation Lecture 22: Turing Machines III
Theory of Computation Lecture 16: A Universal Program VII
Theory of Computation Lecture 5: Programs and Computable Functions III
Theory of Computation Lecture 6: Primitive Recursive Functions I
Copyright © Cengage Learning. All rights reserved.
Unification Algorithm ChuChen
The Composition of Functions
Theory Of Computer Science
Numerical Analysis Lecture 26.
Applied Discrete Mathematics Week 9: Integer Properties
Recap lecture 26 Example of nonregular language, pumping lemma version I, proof, examples,
Proposed in Turing’s 1936 paper
2.6 Operations on Functions
Pairing Functions and Gödel Numbers
3.5 Operations on Functions
Theory of Computation Lecture 21: Turing Machines II
Numerical Representation of Strings
Diagonalization and Reducibility
Recursively Enumerable Sets
Primitive Recursive Predicates
Theory of Computation Lecture 4: Programs and Computable Functions II
Numerical Representation of Strings
Theory of Computation Lecture 9: A Universal Program I
Equivalence Relations
Pairing Functions and Gödel Numbers
Some Primitive Recursive Functions
Theory of Computation Lecture 22: Turing Machines II
Theory of Computation Lecture 13: A Universal Program V
Recursively Enumerable Sets
Theory of Computation Lecture 17: Calculations on Strings II
Theory of Computation Lecture 12: A Universal Program IV
Theory of Computation Lecture 11: A Universal Program III
Theory of Computation Lecture 23: Turing Machines III
12 Chapter Chapter 2 Exponential and Logarithmic Functions.
Presentation transcript:

Theory of Computation Lecture 6: Primitive Recursive Functions I Composition Let us combine computable functions in such a way that the output of one becomes an input to another. For example, we could combine the functions f and g to obtain a new function h: h(x) = f(g(x)) Let us now take a more general view: Definition: Let f be a function of k variables and let g1, …, gk be functions of n variables. Let h(x1, …, xn) = f(g1(x1, …, xn), …, gk(x1, …, xn)). Then h is said to be obtained from f and g1, …, gk by composition. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Composition Theorem 1.1: If h is obtained from the (partially) computable functions f, g1, …, gk by composition, then h is (partially) computable. Proof: The following program obviously computes h: Z1 ← g1(X1, …, Xn) : Zk ← gk(X1, …, Xn) Y ← f(Z1, …, Zk) If f, g1, …, gk are not only partially computable but are also total, then so is h. ■ February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Composition Example: We know that f(x1, x2) = x1 + x2 is a computable function. We also know that g1(x) = x2 and g2(x) = 3x are computable functions. According to Theorem 1.1, the following function h(x) must then also be computable: h(x) = f(g1(x), g2(x)) = f(x2, 3x) = x2 + 3x February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Recursion Let k be some fixed number and h(0) = k h(t + 1) = g(t, h(t)) , where g is some given total function of two variables. Then we say that h is obtained from g by primitive recursion, or simply recursion. Theorem 2.1: Let h be obtained as shown above, and let g be computable. Then h is also computable. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Recursion Proof: Obviously, the function f(x) = k is computable. The program computing f(x) simply consists of k times the instruction Y ← Y+1. This gives us the macro Y ← k. Now we can write a program that computes h(x): Y ← k [A] IF X=0 GOTO E Y ← g(Z, Y) Z ← Z+1 X ← X-1 GOTO A ■ February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Recursion Here is a similar, but more complicated type of recursion: h(x1, …, xn, 0) = f(x1, …, xn) h(x1, …, xn, t + 1) = g(t, h(x1, …, xn, t), x1, …, xn) . Here we say that that the function h of n + 1 variables is obtained by primitive recursion (or recursion) from the functions f (of n variables) and g (of n + 2 variables). Theorem 2.2: Let h be obtained from f and g as shown above, and let f and g be computable. Then h is also computable. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I Recursion Proof: The following program computes h(x1, …, xn, xn+1): Y ← f(X1, …, Xn) [A] IF Xn+1=0 GOTO E Y ← g(Z, Y, X1, …, Xn) Z ← Z+1 Xn+1 ← Xn+1-1 GOTO A ■ February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes Now that we have learned about composition and recursion, let us consider the functions that can be constructed with these operations. Let us define the following initial functions: s(x) = x + 1 n(x) = 0 uin(x1, …, xn) = xi , 1 ≤ i ≤ n. The functions uin are called projection functions. For example, u23(x1, x2, x3) = x2. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes Definition: A class of total functions C is called a PRC (primitive recursively closed) class if the initial functions belong to C , a function obtained from functions belonging to C by either composition or recursion also belongs to C. Theorem 3.1: The class of computable functions is a PRC class. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes Proof: We already know through Theorems 1.1, 2.1, and 2.2 that applying composition or recursion to computable functions results in further computable functions. Therefore, we only have to show that the initial functions are computable. Obviously, s(x) = x + 1 is computed by Y ← X Y ← Y+1, n(x) is computed by the empty program, and uin(x1, …, xn) is computed by Y ← Xi ■ February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes 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. Obviously, it follows that: Corollary 3.2: The class of primitive recursive functions is a PRC class. Furthermore, we have: Theorem 3.3: A function is primitive recursive if and only if it belongs to every PRC class. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes Proof: Part I: If a function belongs to every PRC class, then, by Corollary 3.2, it belongs to the class of primitive recursive functions. Part II: Let f be a primitive recursive function and let C be some PRC class. We want to show that f belongs to C. Since f is a primitive recursive function, there is a list f1, f2, …, fn of functions such that fn = f and each fi in the list is either an initial function or can be obtained from preceeding functions in the list by composition or recursion. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

Theory of Computation Lecture 6: Primitive Recursive Functions I PRC Classes Obviously, the initial functions belong to the PRC class C. Applying composition or recursion to functions in C results in another function belonging to C. Thus each function in the list f1, …, fn belongs to C. Since fn = f, f belongs to C. ■ Corollary 3.4: Every primitive recursive function is computable. Proof: By the theorem just proved, every primitive recursive function belongs to the PRC class of computable functions. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

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. February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I

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). February 21, 2019 Theory of Computation Lecture 6: Primitive Recursive Functions I