Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

28
Theory of Computation Euclid's Gift to Computer Science Vladimir Kulyukin www.vkedco.blogspot.com www.vkedco.blogspot.com

Transcript of Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Page 1: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Theory of Computation

Euclid's Gift to Computer Science

Vladimir Kulyukin

www.vkedco.blogspot.comwww.vkedco.blogspot.com

Page 2: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Outline● Interesting Facts from History of Numbers● Several Concepts & Theorems of Number Theory

Well-Ordering Principle

Prime Divisibility

Euclid Numbers

Euclid's 2nd Theorem

Euclid's Gift to Computer Science

● Computing Primes is Primitive Recursive

Page 3: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

History of Numbers

Are Arabic Numbers Really Arabic?

Page 4: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Origin of Decimal Numbers

“The world owes the decimal notation to the Hindus, and arithmetic as a practical science would have been impossible without the decimal notation. The Arabs first learned that notation from the Hindus and introduced it into Europe.”

Romesh Chunder Dutt. “A History of Civilization in Ancient India Based on Sanskrit Literature – Rationalistic Age” (1,000 BC – 242 BC)”

Page 5: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Nagari Script Numerals and Their Modern Decimal Equivalents

1 2 3 4 5 6 7 8 9 0

Page 6: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Sulva Sutra (8-th Century B.C.)● Sulva Sutra is a Sanskrit document that dates back to the 8th century B.C.● The document handles the question of how to find the value of a diagonal in relation to the side of the square?● Quote: “Increase the measure by its third part, and this third by its own forth, less the thirty-fourth part of that fourth.”● In other words, the square root of 2 can be computed as:

4142156.13443

1

43

1

3

11

Page 7: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Sulva Sutra (8-th Century B.C.)

B.C.century th -8 in theritten document w

a from comesion approximat second that themindin Keep

4142156.13443

1

43

1

3

11:ionapproximat Sutra Sulva

4142135.12 :ionapproximatModern

Page 8: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Several Concepts & Theorems of Number Theory

Page 9: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Two Number Theory Concepts

● We will need the following two concepts from number theory to prove that computing prime numbers is primitive recursive:

Well-Ordering PrinciplePrime Divisibility: Every number has a prime divisor

Page 10: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Well-Ordering Principle

● The well-ordering principle states that every non-empty 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

Page 11: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Prime Divisibility

p|Ap

A

such that number prime a exists

there,1number naturalany For

Page 12: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Proof

1. Assume that the statement is not true2. Then there exists a non-empty set K of natural numbers, each of which is

greater than 1 and has no prime divisors3. By the Well-Ordering Principle, K has a smallest element s4. s cannot be a prime, because it would have itself as a prime divisor5. Thus, s is a composite number such that s = ab, where 1 < a < s and 1 < b < s6. But, then a and b must have prime divisors 7. Thus, s has the same prime divisors as a and b8. But this contradicts 2 and hence 1

Page 13: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

A Number Theory Factoid

.|then ,|,1,1 ifThen

numbers. natural be ,,Let

nbabbna

bna

Page 14: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Euclid Numbers: Definition

number. Euclidth -i theis

.1...532

prime.th -i thebe Let

,...17,13,11,7,5,3,2

i

ii

i

E

pE

p

Page 15: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Euclid’s 2nd Theorem (Proposition IX.20 in Euclid’s Elements)

There are infinitely many primes.

Page 16: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Euclid’s 2nd Theorem Reformulated

.an greater thdivisor prime a has

or prime new aeither is 1...532

,,...,5,3,2 primes of sequence finite aGiven

i

ii

i

p

pE

p

Page 17: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Proof

primes. previous theof

each an greater th isich divisor wh prime a hasit or primes

previous theallan greater th prime a is either Thus, .9

.an greater th bemust

divisor prime that thefollowsit 4, fromBut 8.

divisor. prime a havemust composite, a is If 7.

prime. new a found webecause done, are weprime, a is If 6.

number. composite aor prime aeither is 5.

.532 primesany by divisiblenot is .4

.1532 number heConsider t 3.

.,,5,3,2 be primes Let these 2.

primes. ofnumber finite a be Let there 1.

i

i

ii

i

i

ii

i

i

E

p

EE

E

E

,...,p,,E

p...E

p...

Page 18: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Euclid’s 2nd Theorem: Another Formulation

.an greater th prime aby divisible isor

prime aeither is Then .1!Consider

,...7,5,3,2 s,other wordIn

prime.th -i thebe to define Then we

case. base for the 0set We

4321

0

n

nnn

i

p

EpE

pppp

p

p

Page 19: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Proof

.an greater th

divisor prime a havemust it But then composite. is Then

prime. anot is that Assume done. are weprime, a is If

n

n

nn

p

E

EE

Page 20: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Looking for the Next Prime: Lower & Upper Bounds

bound.upper for the 1! Hence,

.1! dividemust it But bound.lower

for the 1 Hence, .an greater th is after

primenext thebecause ,1!,11

i

i

iii

iii

p

p

ppp

ppp

Page 21: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Examples

121,61!,17

7,41!,15

3,31!,13

2,11!,12

0

334

223

112

001

0

ppp

ppp

ppp

ppp

p

Page 22: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Euclid's Gift to Computer Science● What does Euclid's Theorem give to computer scientists?● It gives us the strict lower and upper bounds where we are

guaranteed to find the next prime● The existence of the strict upper bound implies the applicability of

bound minimalization● The applicability of bounded minimalization implies the primitive

recursiveness of computing primes● Why? Because we have shown that checking the primality of a

number is primitive recursive

Page 23: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Computing Prime Numbers

Page 24: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Computing N-th Prime is Primitive Recursive

recursive primitive is that Show np

Page 25: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Recurrences

npt

n pttp

p

n

&Primemin 2.

0 1.

1!1

0

Page 26: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Formalizing Recurrences

)1!,(

&Primemin),(

xxhxk

lowerttupperlowerhuppert

Page 27: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

Formalizing Recurrences

nn pkp

p

.2

0 1.

1

0

Page 28: Theory of Computation (Fall 2014): Euclid's Gift to Computer Science

References & Reading Suggestions

● Ch. 3, Computability, Complexity, and Languages, 2nd Edition, by Davis, Weyuker, Sigal

● Romesh Chunder Dutt. A History of Civilization in Ancient India Based on Sanskrit Literature – Rationalistic Age (1,000 BC – 242 BC)