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.

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.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
October 8, 2009Theory of Computation Lecture 10: A Universal Program II 1 Pairing Functions and Gödel Numbers This way the equation  x, y  = z defines.
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.
(CSC 102) Discrete Structures Lecture 10.
By: Hector L Contreras SSGT / USMC
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms.
Great Theoretical Ideas in Computer Science.
Chapter 4 More on Directed Proof and Proof by Contrapositive 4.1 Proofs Involving Divisibility of Integers 4.2 Proofs Involving Congruence of Integers.
Chinese Remainder Theorem Dec 29 Picture from ………………………
Chinese Remainder Theorem. How many people What is x? Divided into 4s: remainder 3 x ≡ 3 (mod 4) Divided into 5s: remainder 4 x ≡ 4 (mod 5) Chinese Remainder.
Chapter 10 Computable Functions Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
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
Lesson 11-2 Remainder & Factor Theorems Objectives Students will: Use synthetic division and the remainder theorem to find P(r) Determine whether a given.
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
Direct Proof and Counterexample I Lecture 11 Section 3.1 Fri, Jan 28, 2005.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Hubert Chan (Chapters 1.6, 1.7, 4.1)
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
Great Theoretical Ideas in Computer Science
Advanced Algorithms Analysis and Design
Theory of Computation Lecture 12: A Universal Program III
Theory Of Computer Science
Aim: What are the remainder and factor theorem?
Diagonalization and Reducibility
Theory of Computation Lecture 14: A Universal Program V
Recursively Enumerable Sets
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Analytic Number Theory MTH 435
Theory of Computation Lecture 5: Programs and Computable Functions III
3.2 Solve Linear Systems Algebraically
Modular Arithmetic II Lecture 10: Oct 6.
Theory of Computation Lecture 6: Primitive Recursive Functions I
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.
Prime Factorization Course
Theory Of Computer Science
Great Theoretical Ideas in Computer Science
MA/CSSE 474 More Math Review Theory of Computation
I. Finite Field Algebra.
Lecture 37 Section 7.2 Tue, Apr 3, 2007
Some Simple Tips and Reminders
Pairing Functions and Gödel Numbers
One-to-One and Onto, Inverse Functions
One-to-One and Onto, Inverse Functions
Diagonalization and Reducibility
Primitive Recursive Predicates
Theory of Computation Lecture 5: Programs and Computable Functions III
Numerical Representation of Strings
Theory of Computation Lecture 9: A Universal Program I
Pairing Functions and Gödel Numbers
Theory of Computation Lecture 6: Primitive Recursive Functions I
Algebra 5 Congruence Classes.
Some Primitive Recursive Functions
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 11: A Universal Program III
Presentation transcript:

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 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 4, 2016Theory of Computation Lecture 9: A Universal Program I 2Minimalization Example 16: p n Here, for n > 0, p n is the n-th prime number (in order of size). In order to make p n a total function, we set p 0 = 0. Then we have: p0 =p0 =p0 =p0 = 0 p1 =p1 =p1 =p1 =2 p2 =p2 =p2 =p2 =3 p3 =p3 =p3 =p3 =5 p4 =p4 =p4 =p4 =7

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 3Minimalization Now consider the following recursion equations: p 0 = 0 p n+1 = min t  p n !+1 [Prime(t) & t > p n ]. To see that these equations are correct, we must verify the following inequality: p n+1  p n ! + 1.

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 4Minimalization p n+1  p n ! + 1. Note that for 0 < i  n we have: (p n ! + 1)/p i = p n !/p i + 1/p i = K + 1/p i, where K is an integer. Why is p n ! always divisible by p i ? Example: n = 4, i = 2 Then p n ! = 1  2  3  4  5  6  7, and p i = 3, so p n !/p i = 1  2  4  5  6  7 = K. In other words, p i is always one of the factors in p n !. According to the equation (p n ! + 1)/p i = K + 1/p i, p n ! + 1 is not divisible by any of the primes p 1, …, p n.

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 5Minimalization So either p n ! + 1 is itself a prime or it is divisible by a prime > p n. In either case there is a prime q such that p n < q  p n ! + 1, which gives us the inequality that we wanted to verify: p n+1  p n ! + 1. But now look at the recursion again: p 0 = 0 p n+1 = min t  p n !+1 [Prime(t) & t > p n ]. This is not exactly how we defined recursion. We should reformulate this definition.

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 6Minimalization To do so, we define the (obviously) primitive recursive function h(y, z) = min t  z [Prime(t) & t > y] Then we set k(x) = h(x, x! + 1), which is another primitive recursive function. Then our recursion equations reduce to p 0 = 0 p n+1 = k(p n ), So that we can (finally!) conclude that p n is a primitive recursive function.

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 7Minimalization Finally, we want to discuss minimalization without a bound. Let us write min y P(x 1, …, x n, y) for the least value of y for which the predicate P is true if there is such a value. If there is no such value of y, then min y P(x 1, …, x n, y) is undefined. (Note the difference with bounded minimalization.)

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 8Minimalization Obviously, unbounded minimalization of a predicate can produce a function that is not total. Example: The function x – y = min z [y + z = x] is undefined for x < y. We will see later that there are primitive recursive predicates P(x, y) such that min y P(x, y) is a total function which is not primitive recursive.

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 9Minimalization Theorem 7.2: If P(x 1, …, x n, y) is a computable predicate and if g(x 1, …, x n ) = min y P(x 1, …, x n, y), then g is a partially computable function. Proof: The following program computes g: [A]IF P(X 1, …, X n, Y) GOTO E Y  Y+1 GOTO A

October 4, 2016Theory of Computation Lecture 9: A Universal Program I 10 Pairing Functions and Gödel Numbers How can we code pairs of numbers by single numbers? Let us define the following primitive recursive function:  x, y  = 2 x (2y + 1) -  1. Obviously, 2 x (2y + 1) can never be 0, so we have:  x, y  + 1 = 2 x (2y + 1).