Your SlideShare is downloading. ×
Theory of Computation (Fall 2013): More Number Theory Factoids, Pairing Functions, Godel Numbers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Theory of Computation (Fall 2013): More Number Theory Factoids, Pairing Functions, Godel Numbers

338
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
338
On Slideshare
0
From Embeds
0
Number of Embeds
44
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Theory of Computation More Number Theory Factoids, Pairing Functions, Gödel Numbers Vladimir Kulyukin www.vkedco.blogspot.com
  • 2. Outline ● ● Review More Number Theory   ● Euclid's 1st Theorem  ● Bezout's Identity Fundamental Theorem of Arithmetic (Unique Factorization Theorem) Pairing Functions Gödel Numbers
  • 3. Review
  • 4. Review: Well-Ordering Principle ● ● ● The well-ordering principle states that every nonempty set of natural numbers has a smallest element In axiomatic set theory, the set of natural numbers is defined as the set that contains 0 and is closed under the successor operation The set of natural numbers {n | {0, …, n}} is well-ordered contains all natural numbers
  • 5. Review: Euclid’s 2nd Theorem There are infinitely many primes
  • 6. Review: Euclid’s 2nd Theorem (Formulation 1) Given a finite sequence of primes 2,3,5,..., pi , Ei  2  3  5  ...  pi  1 is either a new prime or has a prime divisor greater than pi .
  • 7. Review: Euclid’s 2nd Theorem (Formulation 2) We set p0  0 for the base case. Then we define pi to be the i prime. Thus, p1  2, p2  3, p3  5, p4  7,... th Consider En  pn !1. Then En is either a prime or is divisible by a prime greater than pn .
  • 8. Review: Lower and Upper Bounds for Next Prime pi 1   pi  1, pi !1. 1) pi  1 is the lower bound, because, naturally, the next prime, pi 1 , can be right after pi , (e.g., 2, 3). 2) The upper bound is pi !1, because pi 1 | pi !1, by nd Euclid' s 2 theorem.
  • 9. Review: Computing N-th Prime is P.R. 1. p 0  0 2. p n 1  min Primet  & t  p n  t  pn !1
  • 10. More Number Theory Factoids
  • 11. Bezout’s Identity If a and b are integers whose greatest common divisor is d , i.e., gcda,b   d , then there are integers x and y such that ax  by  d .
  • 12. Bezout’s Identity: Example gcd(12,42)  6 12 x  42 y  6 x  4, y  1 12  4  42  (1)  6 x  3, y  1 (3) 12  1  42  6
  • 13. Euclid’s 1st Theorem (Book VII of Euclid’s Elements) If a prime divides the product of two integers, then the prime divides at least one of the two integers. Formally, if p|ab, then p|a or p|b, where p is a prime and a and b are integers.
  • 14. Proof Technique Note 1 ● ● ● ● Suppose we want to prove a statement: if A then B or C We assume A and not B and prove C In other words, if A and not B are true, then C must be true, because otherwise, B or C cannot be true We can also assume A and not C and prove B
  • 15. Euclid’s 1st Theorem: Proof Assume that p | ab, p is prime, ( p | a ). Since p | ab, rp  ab, for some number r. Then gcd (p,a)  1. By Bezout' s Identity, there are integers x and y such that px  ay  1. Now, b  b( px  ay )  bpx  bay  bpx  rpy  p (bx  ry ). So p is a factor of b. We could have also assumed that ( p | b) and shown that p is a factor of a.
  • 16. Fundamental Theorem of Arithmetic Every positive integer greater than 1 is either a prime or can be written as a product of primes. The factorization is unique except for the order of factor primes. This theorem is also known as Unique Factorization Theorem
  • 17. FTA: Examples 6  23 8  222  2 3 10  2  5  5  2 1 1 1 1 12  2  3 2 1200  2  3  5 4 2
  • 18. FTA: Key Insight 1200  2  3  5 Any divisor of 1200 is of the form 4 2 2  3  5 , where x  [0,4], y  [0,1], z  [0,2] x y z
  • 19. FTA: Proof 1. We need to prove 2 statements: 1. Every natural number greater than 1 has a prime factorization, i.e., can be written as a product of primes 2. The prime factorization is unique
  • 20. FTA: Proof (Part 1) 1. Suppose not every natural number greater than 1 has a prime factorization. 2. By the well - ordering principle, there must be the smallest such number. Call this number n. 3. n is not a prime, because, if it were, it would have itself as its factorization. 4. So n is a composite. 5. Since n is a composite, n  ab, where 1  a  n and 1  b  n. 6. Since a and b are positive numbers less than n and n is the smallest number that does not have a prime factorization, a and b both have prime factorizations. 7. But then n has a prime factorization that consists ofthe prime factorizations of a and b.
  • 21. Proof Technique Note 2 ● ● ● Suppose that we want to prove that some mathematical object A is unique A common way of doing this is to postulate the existence of another mathematical object B with A’s properties and then show that A and B are the same In other words, A is unique, because any other object that has the same properties is A itself
  • 22. FTA: Proof (Part 2) 1. Recall Euclid' s 1st Theorem : if p is a prime and p|ab, then p|a or p|b. 2. Let n be a natural number greater than 1 that has two prime factorizations F1 and F2 . 3. n  F1  p1...pn  F2  q1...qm  n. 4. Take p1. We know that p1|n. Thus, p1|q1...qm . 5. By Euclid' s 1st Theorem, p1|q1 or p1|q2 ...qm . Since p1 is a prime, it must be the case that p1  q1 or p1  qi , 2  i  m. Thus, p1 can be taken out of F1 and F2 by dividing them both by p1. 6. The same trick can be repeated for p2 , p3 , ..., pn . 7. But, since F1  F2 , it must be the case that n  m and for 1  i, j  n, pi  q j .
  • 23. Pairing Functions
  • 24. Pairing Functions ● ● ● Pairing functions are coding devices for mapping pairs of natural numbers into single natural numbers and vice versa Once we have pairing functions we will be able to map lists of numbers into single numbers and vice versa Remember that our end objective is to compile L programs into natural numbers
  • 25. Pairing Functions  x, y  2 2 y  1  1 x  2 2 y  1 1  0 x x, y  1  2 2 y  1 x
  • 26. Equation 8.1 (Ch. 3) If z is a a natural number, there is a unique solution for x, y to x, y  z.
  • 27. Equation 8.1 (Ch. 3) 1. x, y  z 2. x, y  1  2 (2 y  1). x 3. z  1  2 x (2 y  1).   4. x  max 2 | z  1 . d d In other words, x is the largest number such that 2 x |  z  1. z 1 1 x z 1 5. 2 y  1  x  y  2 2 2
  • 28. Equation 8.1 (Ch. 3): Upper Bounds on x & y  Since x, y  z  2 2 y  1 1, x x, y  1  z  1  2 2 y  1. x Therefore, x  z  1, y  z  1. Hence, x  z , y  z.
  • 29. Example 1 Solve x, y  10.  x, y  10  2 2 y  1 1  10  x 2 2 y  1  11  x   x  max 2 | 11  x  0  d d 2 y  1  11  y  5. Check : 0,5  2 2  5  1  1  11  1  10.   0
  • 30. Example 2 Solve x, y  19. x, y  2 2 y  1  1  19   x 2 2 y  1  20  x   x  max 2 | 20  2  d d 2 2 y  1  20  2 y  1  5  y  2. 2 Check : 2,2  2 2  2  1  1  20  1  19.   2
  • 31. Splitting Natural Numbers
  • 32. Equation 8.1 (Ch. 03) 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   l  2,2   2; r 19   r  2,2   2.
  • 33. Lemma l z  and r z  are primitive recursive.
  • 34. Proof If z  N , then z  x, y , x  z , y  z. Thus, l ( z )  miny  z z  x, y  r ( z )  minx  z z  x, y  x z y z
  • 35. Theorem 8.1 (Ch. 03) The functions x,y , l  z , 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   z , r  z   z
  • 36. Proof 8.1 (Ch. 03) This theorem summarizes the properties of the pairing function and the splitting functions l(z) and r(z). Properties 2, 3, 4 follow from Equation 8.1. Property 1 follows from Equation 8.1 and the definitions for l(z) and r(z).
  • 37. Gödel Numbers
  • 38. Kurt Gödel 1906 - 1978
  • 39. Background ● ● ● Gödel investigated the use of logic and set theory to understand the foundations of mathematics Gödel developed a technique to convert formal symbolic statements into natural numbers The technique was later called Gödel numbering
  • 40. Coding Programs by Numbers Programming languages are symbolic formalisms ● If we can convert statements of symbolic formalisms into numbers [in other words, any program P is associated with a unique number #(P)], we have the foundations of a mathematical theory of program compilation and program execution (interpretation) ● The gist of the theory is three-fold: ● Given a program P, there is a computable function C (Compiler) such that C(P) = #(P); this is the compiler ● Given #(P), there is a computable function RC (Reverse Compiler) such that RC(#(P))= P; this function is the reverse compiler ● Given a program P, there is a partially computable function VM that can execute C(P); this is the operating system or the virtual machine ●
  • 41. Gödel Numbers Let a1 ,..., an  be a sequence of numbers. We define n a1 ,..., an    p ai i th , where pi is the i prime. i 1 a1 ,..., an  is the Gödel number (G-number) of this sequence.
  • 42. 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 2
  • 43. Reading Suggestions ● ● Ch. 03, Computability, Complexity, and Languages, 2nd Edition, by Davis, Sigal, Weyuker, Academic Press http://en.wikipedia.org/wiki/Kurt_Gödel