• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Theory of Computation: Lecture 17
 

Theory of Computation: Lecture 17

on

  • 722 views

1) Pairing Functions...

1) Pairing Functions
2) Godel Numbers
3) Access Functions for Godel Numbers
4) Lengths of Natural Numbers
5) Toward Formal Foundations of Program Compilation and
Interpretation (Execution)
6) Class home page is at http://vkedco.blogspot.com/2011/08/theory-of-computation-home.html

Statistics

Views

Total Views
722
Views on SlideShare
583
Embed Views
139

Actions

Likes
0
Downloads
0
Comments
0

19 Embeds 139

http://vkedco.blogspot.com 89
http://vkedco.blogspot.in 21
http://vkedco.blogspot.co.uk 4
http://vkedco.blogspot.cz 3
http://www.vkedco.blogspot.com 2
http://vkedco.blogspot.mx 2
http://vkedco.blogspot.fr 2
http://vkedco.blogspot.jp 2
http://vkedco.blogspot.co.il 2
http://vkedco.blogspot.nl 2
http://vkedco.blogspot.it 2
http://vkedco.blogspot.gr 1
http://vkedco.blogspot.ca 1
http://vkedco.blogspot.com.br 1
http://vkedco.blogspot.com.ar 1
http://vkedco.blogspot.ch 1
http://vkedco.blogspot.ie 1
http://vkedco.blogspot.co.at 1
http://vkedco.blogspot.de 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Theory of Computation: Lecture 17 Theory of Computation: Lecture 17 Presentation Transcript

    • CS 5000: Theory of Computation Lecture 17 Vladimir Kulyukin Department of Computer Science Utah State Universitywww.youtube.com/vkedco www.vkedco.blogspot.com
    • Outline ● Review ● Pairing Functions ● Gödel Numbers ● Access Functions for Gödel Numbers ● Lengths of Natural Numbers ● Toward Formal Foundations of Program Compilation and Interpretation (Execution)www.youtube.com/vkedco www.vkedco.blogspot.com
    • Reviewwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: Pairing Functions • x, y = 2 ( 2 y + 1) − 1 x • 2 ( 2 y + 1) − 1 ≥ 0 x x, y + 1 = 2 ( 2 y + 1) xwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: Equation 8.1 (Ch. 3) If z is a a natural number, there is a unique solution for x, y to the following equation : x, y = zwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: Splitting Natural Numbers Equation 8.1 defines two functions : l ( z ) and r ( z ) , z ∈ N . l ( z ) = l ( x, y ) = x. r ( z ) = r ( x, y ) = y. Examples : l (10 ) = l ( 0,5 ) = 0; r (10) = r ( 0,5 ) = 5. l (19 ) = r ( 2,2 ) = 2; r (19 ) = r ( 2,2 ) = 2.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: l(z) and r(z) are primitive recursive If z ∈ N , then z = x, y , x ≤ z , y ≤ z. Thus, l ( z ) = min[( ∃y ) ≤ z [ z = x, y ]] x≤z r ( z ) = min[( ∃x ) ≤ z [ z = x, y ]] y≤zwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Gödel Numberswww.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: Gödel Numbers Let ( a1 ,..., an ) be a sequence of numbers. n We define [ a1 ,..., an ] = ∏ p , where pi is the i - th prime. ai i i =1 [a1 ,..., an ] is the Gödel number (G-number) of this sequence.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Review: Example Suppose we have the following sequence (1,3,2 ). The G - number of this sequence is [1,3,2] = p 1 1 ⋅ p ⋅ p = 2 ⋅3 ⋅5 . 3 2 2 3 1 3 2www.youtube.com/vkedco www.vkedco.blogspot.com
    • Lemma For each n, [ a1 ,..., a n ] is primitive recursivewww.youtube.com/vkedco www.vkedco.blogspot.com
    • Proof pi is primitive recursive. y ai x is primitive recursive so p is primitive recursive. i n ∏p i =1 ai i is primitive recursive, because the bounded product of a primitive recursive function is primitive recursive, by Corollary 6.2, Ch. 3.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Note 1 on Theorem 8.2 (Ch. 3) In general, we can add any number of zero s to the right of the sequence without changing its G - number. For example, [ a1 ,..., a n ] = [ a1 ,..., a n ,0,0], because [ a1 ,..., a n ] = p ⋅ ... ⋅ p a1 1 an n = p ⋅ ... ⋅ p ⋅ 1 ⋅ 1 = p ⋅ ... ⋅ p ⋅ p a1 1 an n a1 1 an n 0 n +1 ⋅p 0 n+2 .www.youtube.com/vkedco www.vkedco.blogspot.com
    • Note 2 on Theorem 8.2 (Ch. 3) We cannot add zero s to the left of the sequence without changing its G - number. In general, [ a1 ,..., an ] ≠ [ 0, a1 ,..., an ], because p ⋅ ... ⋅ p a1 1 an n ≠ p ⋅ p ⋅ ... ⋅ p 0 1 a1 2 an n +1 . For example, [1,2] ≠ [ 0,1,2], because [1,2] = 21 ⋅ 32 = 18 ≠ [ 0,1,2] = 20 ⋅ 31 ⋅ 52 = 75.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Access Function for Gödel Numberswww.youtube.com/vkedco www.vkedco.blogspot.com
    • Motivation ● Suppose we have a Gödel number n ● By definition, n is a sequence of numbers each of which is the power of the corresponding prime ● We can think of n as an array of numbers and, as with arrays in other programming languages, we need access to their individual elements ● In our context, we would like to access those individual prime powerswww.youtube.com/vkedco www.vkedco.blogspot.com
    • Access Function for Gödel Numbers Let x = [ a1 ,..., a n ]. We want to define a primitive recursive function ( x ) i = a i , 1 ≤ i ≤ n. For example, if x = [ 2,4,3], then ( x ) 1 = 2; ( x ) 2 = 4; ( x ) 3 = 3.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Access Function for Gödel Numbers ( x ) i = min[¬( p t ≤x t +1 i |x )] Note that 1. ( x ) 0 = 0, for all x; 2. ( 0 ) i = 0, for all i.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Example 1 Let 18 = [1,2] = p ⋅ p = 2 ⋅ 3 . Then 1 1 2 2 1 2 (18) 1 = min[¬ ( p t ≤18 t +1 1 )] | 18 = 1, because p1 = 2; and 2 t =0 | 18; 2 ( | 18), so t = 1. t =1 | 18; but ¬ 2 t =2 (18) = min[¬ ( p | 18)] = 2, because p = 3; and 2 t ≤18 t +1 2 2 3 | 18; 3 | 18; 3 | 18; but ¬ (3 | 18), so t = 2. t =0 t =1 t =2 t =3www.youtube.com/vkedco www.vkedco.blogspot.com
    • Example 2 Let 108 = [ 2,3] = p ⋅ p = 2 ⋅ 3 = 4 ⋅ 27. Then 1 1 2 2 2 3 (108) 1 = 2 (108) 2 = 3www.youtube.com/vkedco www.vkedco.blogspot.com
    • Access Function for G-Numbers: Implementation // x is a natural number, compute (x)i long GAccess(long x, long i) { long p = computePrime(i); // compute i-th prime pi for t from 0 upto x { if ( pt does not divide x ) return t – 1; } }www.youtube.com/vkedco www.vkedco.blogspot.com
    • Access Function for G-Numbers: Implementation ● The previous slide assumes that we represent G- Numbers as integers ● This is a sensible choice, but only for fairly small numbers ● If we want to be generic, we can represent G-numbers as sequences of prime powers, e.g. arrays, lists, etc. ● In this case, we can represent much larger values without actually having to compute them ● Access function becomes much easier, because we do not have to compute primes or their powerswww.youtube.com/vkedco www.vkedco.blogspot.com
    • Lengths of Natural Numberswww.youtube.com/vkedco www.vkedco.blogspot.com
    • Length of a Natural Number ● Since Gödel numbering and access functions give us techniques to split any natural number into its constituents ● Next question: how many constituents does a given natural number have? How long is the number? ● Example: 18=[1, 2]. So the length of 18 is 2www.youtube.com/vkedco www.vkedco.blogspot.com
    • Length of a Natural Number: Definition Lt ( x ) = min ( ( x ) i ≠ 0 & ( ∀j ) ≤ x ( j ≤ i ∨ ( x ) j = 0 ) ). i≤ x In other words, i is the index of the last non - zero prime power in a G - number. By definition, Lt ( 0 ) = Lt (1) = 0.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Example 3 Lt ( 20 ) = ? . x = 20 = 2 ⋅ 3 ⋅ 5 = [ 2,0,1]. 2 0 1 ( x ) 3 = 1. ( x ) 4 = ( x ) 5 = ... = ( x ) 20 = 0. Lt ( 20 ) = 3.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Theorem 8.3 (Ch. 3) Let x > 1. Then a i if 1 ≤ i ≤ n 1. ( [ a1 ,..., a n ] ) i = 0 otherwise 2. [ ( x ) 1 ,..., ( x ) n ] = x if Lt ( x ) ≤ nwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Proof Part 1 follows from the definition of the G - number. For part 2, we observe that, if x > 1 and Lt ( x ) = n > 0, then p n|x, but no prime greater than p n divides x, because Lt ( [ a1 ,...,a n ] ) = n iff a n is the last non - zero prime power. Thus, if x > 1 and Lt ( x ) ≤ n, then n > 0 and [ ( x ) 1 ,..., ( x ) n ] = x.www.youtube.com/vkedco www.vkedco.blogspot.com
    • Formal Foundations of Program Compilation and Interpretation (Execution)www.youtube.com/vkedco www.vkedco.blogspot.com
    • The Big Picture Number GÖDEL Coder L Program Number Universal Program GÖDEL Decoder ??? GÖDEL Coder = Compiler GÖDEL Decoder = Reverse Compiler Universal Program = Operating System/VM/Interpreterwww.youtube.com/vkedco www.vkedco.blogspot.com
    • The Software/Hardware Duality Principle Co-Dependency Formalism Hardware Device There is no point in developing a formalism unless it can be executed on an existing hardware device There is no point in developing a hardware device unless there is (or there will be) a formalism for itwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Reading Suggestions ● Ch. 3, Computability, Complexity, and Languages, 2nd Edition, by Davis, Weyuker, Sigal ● http://en.wikipedia.org/wiki/Kurt_Gödelwww.youtube.com/vkedco www.vkedco.blogspot.com
    • Feedback Errors, comments to vladimir dot kulyukin at gmail dot comwww.youtube.com/vkedco www.vkedco.blogspot.com