Primitive Recursive Predicates

Slides:



Advertisements
Similar presentations
Primitive Recursive Functions (Chapter 3)
Advertisements

Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Induction and recursion
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
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.
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.
Mathematical Maxims and Minims, 1988
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
SECTION 3.5 REAL ZEROS OF A POLYNOMIAL FUNCTION REAL ZEROS OF A POLYNOMIAL FUNCTION.
Copyright © 2009 Pearson Education, Inc. CHAPTER 4: Polynomial and Rational Functions 4.1 Polynomial Functions and Models 4.2 Graphing Polynomial Functions.
Chap 3 –A theorem is a statement that can be shown to be true –A proof is a sequence of statements to show that a theorem is true –Axioms: statements which.
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
Section 4.3 Polynomial Division; The Remainder and Factor Theorems Copyright ©2013, 2009, 2006, 2001 Pearson Education, Inc.
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
1 CMSC 250 Chapter 3, Number Theory. 2 CMSC 250 Introductory number theory l A good proof should have: –a statement of what is to be proven –"Proof:"
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Direct Proof and Counterexample I Lecture 11 Section 3.1 Fri, Jan 28, 2005.
Mathematical Induction I Lecture 19 Section 4.2 Mon, Feb 14, 2005.
1 Section 4.4 Inductive Proof What do we believe about nonempty subsets of N? Since  N, <  is well-founded, and in fact it is linear, it follows that.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
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.
Chapter 1 Logic and Proof.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
The Foundations: Logic and Proofs
Direct Proof and Counterexample IV: Division into Cases and the Quotient-Remainder Theorem For each of the following values of n and d, find integers q.
CS 2210:0001 Discrete Structures Logic and Proof
Another Word on PRC Classes
Theory of Computation Lecture 10: A Universal Program I
Direct Proof and Counterexample III: Divisibility
Advanced Algorithms Analysis and Design
Theory Of Computer Science
Chapter 3 The Real Numbers.
Induction and recursion
Diagonalization and Reducibility
Theory of Computation Lecture 14: A Universal Program V
Recursively Enumerable Sets
Hubert Chan (Chapters 1.6, 1.7, 4.1)
ELEMENTARY NUMBER THEORY AND METHODS OF PROOF
Theory of Computation Lecture 16: A Universal Program VII
Polynomial Division; The Remainder Theorem and Factor Theorem
Theory of Computation Lecture 6: Primitive Recursive Functions I
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Proving Existentials A proof of a statement of the form x P(x) is called an existence proof. If the proof demonstrates how to actually find or construct.
Induction and recursion
COUNTING AND PROBABILITY
Follow me for a walk through...
Theory Of Computer Science
Mathematical Induction I
MA/CSSE 474 More Math Review Theory of Computation
Applied Discrete Mathematics Week 9: Integer Properties
Elementary Number Theory & Proofs
Follow me for a walk through...
Advanced Analysis of Algorithms
Diagonalization and Reducibility
Recursively Enumerable Sets
Numerical Representation of Strings
Follow me for a walk through...
Theory of Computation Lecture 9: A Universal Program I
Theory of Computation Lecture 6: Primitive Recursive Functions I
Some Primitive Recursive Functions
Theory of Computation Lecture 13: A Universal Program V
Recursively Enumerable Sets
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Theory of Computation Lecture 17: Calculations on Strings II
Presentation transcript:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Theory of Computation Lecture 9: Primitive Recursive Functions IV Minimalization Then we define: Thus, minty P(t, x1, …, xn) is the smallest value of ty for which P(t, x1, …, 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, x1, …, xn) belongs to some PRC Class C and f(y, x1, …, xn) = minty P(t, x1, …, xn), then f also belongs to C . We will call the operation “minty” bounded minimalization. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV

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 = mintx [(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

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

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

Theory of Computation Lecture 9: Primitive Recursive Functions IV Minimalization Now consider the following recursion equations: p0 = 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. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV

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! = 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 p1, …, pn. October 3, 2017 Theory of Computation Lecture 9: Primitive Recursive Functions IV

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