Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of Computation Lecture 10: A Universal Program I

Similar presentations


Presentation on theme: "Theory of Computation Lecture 10: A Universal Program I"— Presentation transcript:

1 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

2 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

3 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

4 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

5 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

6 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

7 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

8 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

9 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

10 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

11 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

12 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

13 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 = = … , 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


Download ppt "Theory of Computation Lecture 10: A Universal Program I"

Similar presentations


Ads by Google