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.

Slides:



Advertisements
Similar presentations
Cognitive Computing 2012 Consciousness and Computation: computing machinery and intelligence 2. ON NORMA AND nCODING Mark Bishop.
Advertisements

Lecture 3 Universal TM. Code of a DTM Consider a one-tape DTM M = (Q, Σ, Γ, δ, s). It can be encoded as follows: First, encode each state, each direction,
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.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Basic properties of the integers
Induction and recursion
1.2 Row Reduction and Echelon Forms
Applied Discrete Mathematics Week 12: Trees
CS5371 Theory of Computation
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.
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) 
Patterns and Sequences
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.
5  Systems of Linear Equations: ✦ An Introduction ✦ Unique Solutions ✦ Underdetermined and Overdetermined Systems  Matrices  Multiplication of Matrices.
Introduction to AEP In information theory, the asymptotic equipartition property (AEP) is the analog of the law of large numbers. This law states that.
(CSC 102) Discrete Structures Lecture 10.
Induction and recursion
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!
2.4 Sequences and Summations
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Great Theoretical Ideas in Computer Science.
Adding Integers. Zero Pair = 0 Why it works… __________ Property says you can add or subtract zero without changing the value of an expression.
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.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Theory of Computation Lecture 5: Primitive Recursive Functions I
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Models of Computation: Automata and Formal Languages Sam M. Kim.
On computable numbers, with an application to the ENTSCHEIDUNGSPROBLEM COT 6421 Paresh Gupta by Alan Mathison Turing.
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
Agenda Review:  Relation Properties Lecture Content:  Divisor and Prime Number  Binary, Octal, Hexadecimal Review & Exercise.
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.
Theory of Computation Lecture 10: A Universal Program I
Direct Proof and Counterexample III: Divisibility
11.2 Arithmetic Sequences.
5 Systems of Linear Equations and Matrices
Theory of Computation Lecture 12: A Universal Program III
Diagonalization and Reducibility
Theory of Computation Lecture 14: A Universal Program V
Numerical Representation of Strings
Chapter 3 Graphing.
Theory of Computation Lecture 22: Turing Machines III
Great Theoretical Ideas in Computer Science
Mathematical Induction Recursion
Induction and recursion
Theory Of Computer Science
Direct Proof and Counterexample III
The Programming Language L
Applied Discrete Mathematics Week 9: Integer Properties
Pairing Functions and Gödel Numbers
Diagonalization and Reducibility
Recursively Enumerable Sets
The Programming Language L
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
Theory of Computation Lecture 13: A Universal Program V
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
Presentation transcript:

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 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) = min x  z [(  y)  z (z =  x, y  )], r(z) = min y  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 8, 2009Theory of Computation Lecture 10: A Universal Program II 2 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 8, 2009Theory of Computation Lecture 10: A Universal Program II 3 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 (a 1, …, a n ) to be the number For example, the Gödel number of the sequence (7, 6, 4, 4, 3) is 2 7  3 6  5 4  7 4  11 3.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 4 Pairing Functions and Gödel Numbers For each n, the function [a 1, …, a n ] is clearly primitive recursive. Gödel numbering satisfies the following uniqueness property: Theorem 8.2: If [a 1, …, a n ] = [b 1, …, b n ] then a i = b i 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 8, 2009Theory of Computation Lecture 10: A Universal Program II 5 Pairing Functions and Gödel Numbers However, it is important to note that [a 1, …, a n ] = [a 1, …, a n, 0], because for any n+1, p 0 n+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 = 2 0 = = = …, it is useful to define 1 as the Gödel number of the empty sequence of length 0.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 6 Pairing Functions and Gödel Numbers Obviously, adding a zero to the left of the sequence will lead to a Gödel number different from the initial one. Examples: [1, 4] = 2 1  3 4 = 162 [1, 4, 0] = 2 1  3 4  5 0 = 162 [0, 1, 4] = 2 0  3 1  5 4 = 1875

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 7 Pairing Functions and Gödel Numbers We will now define a primitive recursive function (x) i so that if x = [a 1, …, a n ], then (x) i = a i. We set (x) i = min t  x (  p i t+1 | x). Then we define the length Lt(x) of the sequence for the Gödel number x: Lt(x) = min i  x ((x) i  0 & (  j)  x (j  i  (x) j = 0)). Example: If x = 20 = 2 2  5 1 = [2, 0, 1], then (x) 1 = 2, (x) 2 = 0, (x) 3 = 1, (x) 4 = (x) 5 = … 0, Lt(x) = 3.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 8 Pairing Functions and Gödel Numbers If x > 1 and Lt(x) = n, then p n divides x but no prime greater than p n divides x. Note that Lt([a 1, …, a n ]) = n if and only if a n  0. Theorem 8.3 (Sequence Number Theorem): a. ([a 1, …, a n ]) i = a i if 1  i  n b. ([(x) 1, …, (x) n ]) = x if n  Lt(x)

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 9 Coding Programs by Numbers After having developed appropriate coding techniques, it will be our goal to enumerate all programs of the language L. In other words, each program P of L will receive a number #( P ) so that the program can be retrieved from its number. Let us first arrange the variables in the following order: Y X 1 Z 1 X 2 Z 2 X 3 Z 3 … And also the labels: A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 …A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 …A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 …A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 A3 …

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 10 Coding Programs by Numbers We write #(V), #(L) for the position of a given variable or label in the appropriate ordering. For example, #(X 2 ) = 4, #(Z) = 3, #(C 2 ) = 8. Now let I be an instruction (labeled or unlabeled) of the language L.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 11 Coding Programs by Numbers Then we write #(I) =  a,  b, c , where 1.if I is unlabeled, then a = 0; if I is labeled L, then a = #(L); 2.if the variable V is mentioned in I, then c = #(V) – 1; 3.if the statement in I is V  V, V  V+1, or V  V-1, then b = 0, 1, or 2, respectively; 4.if the statement in I is IF V  0 GOTO L’ then b = #(L’) + 2.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 12 Coding Programs by Numbers Examples: The number of the unlabeled instruction X  X-1 is  0,  2, 1  =  0, 11  = 22. The number of the instruction [A] X  X-1 is  1,  2, 1  =  1, 11  = 45.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 13 Coding Programs by Numbers Note that for any given number q there is a unique instruction I with #(I) = q. We first calculate l(q). If l(q) = 0, I is unlabeled; otherwise I has the l(q)-th label in our list. To find the variable mentioned in I, we compute i = r(r(q)) + 1 and locate the i-th variable V in our list. Then the statement will be V  V, V  V+1, or V  V-1, if l(r(q)) = 0, 1, or 2, respectively; otherwise, it will be the statement IF V  0 GOTO L, where L is the j-th label in our list and j = l(r(q)) –2.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 14 Coding Programs by Numbers Finally, for a program P that consists of the instructions I 1, I 2, …, I k, we set #( P ) = [#(I 1 ), #(I 2 ), …, #(I k )] – 1. This way we associated every possible program in L with a unique number.

October 8, 2009Theory of Computation Lecture 10: A Universal Program II 15 Coding Programs by Numbers Gödel numbers are usually very large, even for small programs. Let us look at the following example: [A]X  X+1 IF X  0 GOTO A #(I 1 ) =  1,  1, 1  =  1, 5  = 21 #(I 2 ) =  0,  3, 1  =  0, 23  = 46 So the number of our small program is 2 21  3 46 – 1.