Theory of Computation Lecture 10: A Universal Program I

Slides:



Advertisements
Similar presentations
THE WELL ORDERING PROPERTY Definition: Let B be a set of integers. An integer m is called a least element of B if m is an element of B, and for every x.
Advertisements

Primitive Recursive Functions (Chapter 3)
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.
Bounds on Code Length Theorem: Let l ∗ 1, l ∗ 2,..., l ∗ m be optimal codeword lengths for a source distribution p and a D-ary alphabet, and let L ∗ be.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Induction and recursion
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.
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, …,
Copyright © Cengage Learning. All rights reserved.
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.
Mathematical Maxims and Minims, 1988
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
By: Hector L Contreras SSGT / USMC
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
CS 103 Discrete Structures Lecture 13 Induction and Recursion (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
Mathematical Induction 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.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
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.
Section 1.8. Proof by Cases Example: Let b = max{a, b} = a if a ≥ b, otherwise b = max{a, b} = b. Show that for all real numbers a, b, c
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Proof And Strategies Chapter 2. Lecturer: Amani Mahajoub Omer Department of Computer Science and Software Engineering Discrete Structures Definition Discrete.
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 3 The Real Numbers.
Another Word on PRC Classes
Direct Proof and Counterexample III: Divisibility
Great Theoretical Ideas in Computer Science
Chapter 3 The Logic of Quantified Statements
Theory of Computation Lecture 12: A Universal Program III
Advanced Algorithms Analysis and Design
Theory Of Computer Science
Induction and recursion
Diagonalization and Reducibility
Theory of Computation Lecture 14: A Universal Program V
Recursively Enumerable Sets
Applied Discrete Mathematics Week 4: Number Theory
Theory of Computation Lecture 16: A Universal Program VII
Theory of Computation Lecture 6: Primitive Recursive Functions I
Induction and recursion
Theory Of Computer Science
Direct Proof and Counterexample III
MA/CSSE 474 More Math Review Theory of Computation
Pairing Functions and Gödel Numbers
Advanced Analysis of Algorithms
Diagonalization and Reducibility
Recursively Enumerable Sets
Primitive Recursive Predicates
Theory of Computation Lecture 5: Programs and Computable Functions III
Theory of Computation Lecture 9: A Universal Program I
Number Theory.
Pairing Functions and Gödel Numbers
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
Theory of Computation Lecture 17: Calculations on Strings II
Theory of Computation Lecture 11: A Universal Program III
From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers.
Presentation transcript:

Theory of Computation Lecture 10: A Universal Program I 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. But now look at the recursion again: p0 = 0 pn+1 = mintpn!+1[Prime(t) & t > pn]. This is not exactly how we defined recursion. We should reformulate this definition. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Theory of Computation Lecture 10: A Universal Program I Minimalization To do so, we define the (obviously) primitive recursive function h(y, z) = mint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 p0 = 0 pn+1 = k(pn), So that we can (finally!) conclude that pn is a primitive recursive function. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Theory of Computation Lecture 10: A Universal Program I Minimalization Finally, we want to discuss minimalization without a bound. Let us write miny P(x1, …, xn, 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 miny P(x1, …, xn, y) is undefined. (Note the difference with bounded minimalization.) October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

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

Theory of Computation Lecture 10: A Universal Program I Minimalization Theorem 7.2: If P(x1, …, xn, y) is a computable predicate and if g(x1, …, xn) = miny P(x1, …, xn, y), then g is a partially computable function. Proof: The following program computes g: [A] IF P(X1, …, Xn, Y) GOTO E Y  Y+1 GOTO A October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

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 = 2x(2y + 1) - 1. Obviously, 2x(2y + 1) can never be 0, so we have: x, y + 1 = 2x(2y + 1). October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers x, y + 1 = 2x(2y + 1). If z is any given number, there is a unique solution x, y to the equation x, y = z. x is the largest number such that 2x | (z + 1), and y is the solution of the equation 2y + 1 = (z + 1)/2x. This equation has a unique solution because (z + 1)/2x must be odd (if it were even, we could have chosen a greater x). October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers x, y + 1 = 2x(2y + 1). Examples: x, y = 41 x = 1 y = 10 x, y = 31 x = 5 y = 0 x, y = 36 x = 0 y = 18 x, y = 0 y = 0 October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers This way the equation x, y = z defines functions x = l(z) and y = r(z). x, y = z also implies that x, y < z + 1, and therefore l(z)  z, r(z)  z. Then we can write: l(z) = minxz[(y)z(z = x, y)], r(z) = minyz[(x)z(z = x, y)], showing that l(z) and r(z) are primitive recursive functions. It is also true that x, y = z  x = l(z) & y = r(z). October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers Theorem 8.1 (Pairing Function Theorem): The functions x, y, l(z) and r(z) have the following properties: 1. they are primitive recursive; 2. l(x, y) = x; r(x, y) = y; 3. l(z), r(z) = z; 4. l(z), r(z)  z. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers We now want to develop primitive recursive functions that encode and decode arbitrary finite sequences of numbers. Our method (actually invented by Gödel) will be based on the prime power decomposition of integers. We define the Gödel number of the sequence (a1, …, an) to be the number For example, the Gödel number of the sequence (7, 6, 4, 4, 3) is 27  36  54  74  113. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers For each n, the function [a1, …, an] is clearly primitive recursive. Gödel numbering satisfies the following uniqueness property: Theorem 8.2: If [a1, …, an] = [b1, …, bn] then ai = bi for i = 1, …, n. This follows immediately from the fundamental theorem of arithmetic, i.e., the uniqueness of the factorization of integers into primes. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I

Pairing Functions and Gödel Numbers However, it is important to note that [a1, …, an] = [a1, …, an, 0], because for any n+1, p0n+1 = 1. Actually, we could add any number of 0s to the right end of a sequence without changing its Gödel number. Since we have 1 = 20 = 2030 = 203050 = … , it is useful to define 1 as the Gödel number of the empty sequence of length 0. October 5, 2017 Theory of Computation Lecture 10: A Universal Program I