Presentation is loading. Please wait.

Presentation is loading. Please wait.

Great Theoretical Ideas in Computer Science

Similar presentations


Presentation on theme: "Great Theoretical Ideas in Computer Science"— Presentation transcript:

1 Great Theoretical Ideas in Computer Science
15-251 Great Theoretical Ideas in Computer Science

2 Cantor’s Legacy: Infinity And Diagonalization
Lecture 24 (April 10, 2008)

3 The Theoretical Computer:
no bound on amount of memory no bound on amount of time Ideal Computer is defined as a computer with infinite RAM You can run a Java program and never have any overflow, or out of memory errors We will be talking about ideal computers. Ideal computers differ from real computers in that they have no bound on the amount of memory they can use. If the notion of a computer with an infinite amount of memory seems unsatisfactory, think of it this way: Your programs ask for as much memory as they wish. Whenever your computer runs out of memory, the computer automatically contacts the manufacturer, and a technician arrives with additional ram chips for your computer. Your computations continue where they left off, as if nothing had happened.

4 An Ideal Computer It can be programmed to print out:
2: … 1/3: … : … e: … : … What can these ideal computers do that real computers can’t? Well, real computers have a finite amount of memory. Add up all the memory they have – hard disk space, RAM, registers, etc. , and they still have only k bits of storage. This means, a real computer can be in only 2^k different states. Suppose you want to compute the ith digit of pi, for any I. On a real computer, as your computation, runs the computer changes from state to state. Eventually, it will run out of new states and must return to a state indistinguishable from a previous one. Thus, a deterministic program on a real computer can output only repeating decimals. So, real computers can output some digits of pi, but there will always be some ith digit which cannot be computed. Because ideal computers have an unlimited amount of memory, they can be in an unlimited number of different states. Thus, we can write a program on an ideal computer that can print the ith digit of pi, for any I. Any digit of pi which interests us will eventually appear in the output.

5 Printing Out An Infinite Sequence
A program P prints out the infinite sequence s0, s1, s2, …, sk, … if when P is executed on an ideal computer, it outputs a sequence of symbols such that: The kth symbol that it outputs is sk For every k, P eventually outputs the kth symbol. I.e., the delay between symbol k and symbol k+1 is not infinite

6 Computable Real Numbers
A real number r is computable if there is a (finite) program that prints out the decimal representation of r from left to right. Thus, each digit of r will eventually be output. Are all real numbers computable? Pi is “computable,” because we can program an ideal computer to output the ith digit for any I. In general, any real number r is computable, if we can program an ideal computer to print it digit by digit, such that any digit we are interested in will eventually be printed. For example, to find the 2^50th digit of r, we start the program and count the output digits. Eventually, we’ll the 2^50th digit will appear. The real numbers we’re familiar with -- pi, e, phi, and the square root of two– are all computable. But in general, are all real numbers computable?

7 List of questions Are all real numbers computable? ??

8 Are all real numbers describable?
Describable Numbers A real number r is describable if it can be denoted unambiguously by a finite piece of English text 2: “Two.” : “The area of a circle of radius one.” <think of good segue> When a finite piece of English text unambigously describes a real number r, we call that number describable. By unambigous, we mean that the text must describe one number and only one number. For example, we can describe pi as “The area of a circle of radius one.” This description applies to pi and only to pi – there is no other number that is the area of a circle of radius one. Our descriptions o f numbers, such as pi, do not necessarily tell us how to compute them. So, it Is not obvious that all describable numbers are computable. Are all real numbers describable?

9 List of questions Are all real numbers computable? ??
Are all real numbers describable?

10 Computable r: some program outputs r
Describable r: some sentence denotes r Is every computable real number, also a describable real number? And what about the other way? The moral here is that computer programs can be viewed as descriptions of their output. A program that computes pi, for example, can be taken as an unambiguous description of the number pi.

11 List of questions Are all real numbers computable? ??
Are all real numbers describable? Is every computable number describable? Is every describable number computable?

12 Computable  Describable
Theorem: Every computable real is also describable Proof: Let r be a computable real that is output by a program P. The following is an unambiguous description of r: However, it is true that every computable number is describable. Let r be a computable real number. Therefore, there is some program P which outputs r. Therefore, we can describe r by saying “The real number output by P.” That is, since the program outputs exactly r, it can be taken as an unambiguous description of r. “The real number output by the following program:” P

13 List of questions Are all real numbers computable? ??
Are all real numbers describable? Is every computable number describable? Yes Is every describable number computable?

14 Correspondence Principle
If two finite sets can be placed into bijection, then they have the same size Recall the correspondence principle. Two sets, A and B. Put them into one-to-one, onto correspondence: they have the exact same size.

15 Correspondence Definition
In fact, we can use the correspondence as the definition: Two finite sets are defined to have the same size if and only if they can be placed into bijection In fact, we will define two sets to have the same size if and only if they can be placed into one-to-one, onto correspondence. In the case of finite sets, this definition of size matches our intuitive understanding of size.

16 Georg Cantor ( ) Georg Cantor was one of the greatest 19th-century mathematical geniuses. While his work was in pure mathematics, the theorems Cantor proved and the techniques he developed have, as we’ll see today, profound implications for computer science. In addition to being a seminal character in mathematics, Cantor was also a very interesting person. Cantor suffered from bouts of severe depression which lasted for weeks. His work in mathematics was not well appreciated during his life, a fact which further fueled his depression. When Cantor was too depressed to pursue math, he pursued his interests in philosophy in literature. Cantor’s pet project in literature, unfortunately, was as controversial as his mathematics. He published several papers attempting to prove his pet theory that Shakespeare’s plays were written not by Shakespeare but by Francis Bacon.

17 Cantor’s Definition (1874)
Two sets are defined to have the same size if and only if they can be placed into bijection Two sets are defined to have the same cardinality if and only if they can be placed into bijection. One of Cantor’s most important contributions to mathematics was his generalization of the correspondence principle. Two sets, infinite or finite, have the same size if and only if they can be placed into one-to-one, onto correspondence. This notion gives us a well-defined understanding of “size” of infinite sets, which is compatible with our intuition for finite sets.

18 Do N and E have the same cardinality?
The even, natural numbers. Let’s take a look at two infinite sets, N, the natural numbers, and E the even naturals. Do N and E have the same size? Most students will say they clearly don’t have the same size.

19 The attempted correspondence f(x) = x does not take E onto N.
How can E and N have the same cardinality? E is a proper subset of N with plenty left over. The attempted correspondence f(x) = x does not take E onto N. Bonzo has a very natural view on the question. We can take the set of natural numbers, cross off all the naturals, and still be left with an infinite number of odd numbers. So, this means that there are many more natural numbers than even numbers. In other words, the correspondence which maps the even number x to the natural number x, is one-to-one: all the even naturals get mapped to distinct natural numbers. But the correspondence is not onto: all the odd naturals are left over.

20 f(x) = 2x is a bijection E and N do have the same cardinality!
Bonzo’s intuitive argument is very natural, but it’s not a proof. Odette has a better idea. In fact, the evens and the naturals DO have the same cardinality, and there is a one-to-one onto correspondence from the naturals to the even naturals which proves it. We map 0 to 0, 1 to 2, 2 to 4 and so forth, mapping the natural number x to the even natural 2*x. It’s easy to see that this correspondence is one-to-one – every natural gets mapped to a distinct even, and onto—every even is mapped from some natural.

21 Lesson: Cantor’s definition only requires that some injective correspondence between the two sets is a bijection, not that all injective correspondences are bijections! There’s an important lesson to learn here. In the case of finite sets, a one to one correspondence between two sets implies that all one-to-one correspondences are onto. That is, no matter how I try to match my fingers up, there are never any left over. But this is not the case for infinite sets. For two infinite sets A and B, there may many one-to-one correspondences, only some of which are onto. Fortunately, Cantor’s definition of cardinality requires only that there be some one-to-one correspondence which is onto. So, showing a one-to-one correspondence which isn’t onto proves nothing about the cardinality of two infinite sets. This distinction never arises when the sets are finite

22 Do N and Z have the same cardinality?
Let’s take a look at two more infinite sets: N, the natural numbers, and Z, the integers.

23 f(x) = x/2 if x is odd -x/2 if x is even
N and Z do have the same cardinality! N = 0, 1, 2, 3, 4, 5, 6 … Z = 0, 1, -1, 2, -2, 3, -3, …. f(x) = x/2 if x is odd x/2 if x is even

24 A Useful Transitivity Lemma
Lemma: If f: AB is a bijection, and g: BC is a bijection. Then h(x) = g(f(x)) defines a function h: AC that is a bijection Hence, N, E, and Z all have the same cardinality.

25 Onto the Rationals!

26 Do N and Q have the same cardinality?
Q = The Rational Numbers

27 How could it be???? The rationals are dense: between any two there is a third. You can’t list them one by one without leaving out an infinite number of them.

28 Theorem: N and N×N have the same cardinality
4 3 2 1 The point (x,y) represents the ordered pair (x,y) 1 2 3 4

29 The point at x,y represents x/y

30 The point at x,y represents x/y
3 1 2 The point at x,y represents x/y

31 Cantor’s 1877 letter to Dedekind: “I see it, but I don't believe it! ”
Georg Cantor was one of the greatest 19th-century mathematical geniuses. While his work was in pure mathematics, the theorems Cantor proved and the techniques he developed have, as we’ll see today, profound implications for computer science. In addition to being a seminal character in mathematics, Cantor was also a very interesting person. Cantor suffered from bouts of severe depression which lasted for weeks. His work in mathematics was not well appreciated during his life, a fact which further fueled his depression. When Cantor was too depressed to pursue math, he pursued his interests in philosophy in literature. Cantor’s pet project in literature, unfortunately, was as controversial as his mathematics. He published several papers attempting to prove his pet theory that Shakespeare’s plays were written not by Shakespeare but by Francis Bacon.

32 Countable Sets We call a set countable if it can be placed into a bijection with the natural numbers N Hence N, E, Z, Q are all countable

33 Do N and R have the same cardinality? I.e., is R countable?
R = The real numbers

34 Theorem: The set R[0,1] of reals between 0 and 1 is not countable
Proof: (by contradiction) Suppose R[0,1] is countable Let f be a bijection from N to R[0,1] Make a list L as follows: 0: decimal expansion of f(0) 1: decimal expansion of f(1) k: decimal expansion of f(k)

35 Position after decimal point
1 2 3 4 Index

36 Position after decimal point
1 2 3 4 5 9 8 6 Index

37 L 1 2 3 4 d0 d1 d2 d3 d4

38 Define the following real number ConfuseL = 0.C0C1C2C3C4C5 …
1 2 3 4 d0 d1 d2 d3 Define the following real number ConfuseL = 0.C0C1C2C3C4C5 … 5, if dk=6 6, otherwise Ck=

39 By design, ConfuseL can’t be on the list L!
Diagonalized! By design, ConfuseL can’t be on the list L! Indeed, note that ConfuseL differs from the kth element on the list L in the kth position. This contradicts the assumption that the list L is complete; i.e., that the map f: N to R[0,1] is onto.

40 The set of reals is uncountable! (Even the reals between 0 and 1)

41 Sanity Check Why can’t the same argument be used to show that the set of rationals Q is uncountable? Note that CONFUSEL is not necessarily rational. And so there is no contradiction from the fact that it is missing from the list L

42 Back to the questions we were asking earlier

43 List of questions Are all real numbers computable? ??
Are all real numbers describable? Is every computable number describable? Yes Is every describable number computable?

44 Standard Notation S = Any finite alphabet Example: {a,b,c,d,e,…,z}
S* = All finite strings of symbols from S including the empty string e

45 Theorem: Every infinite subset S of S* is countable
Proof: Sort S by first by length and then alphabetically Map the first word to 0, the second to 1, and so on…

46 Some infinite subsets of S*
S = The symbols on a standard keyboard For example: The set of all possible Java programs is a subset of S* The set of all possible finite pieces of English text is a subset of S*

47 Thus: The set of all possible Java programs is countable. The set of all possible finite length pieces of English text is countable.

48 But look: There are countably many Java programs and uncountably many reals. Hence, most reals are not computable!

49 There are countably many descriptions and uncountably many reals.
Hence: Most real numbers are not describable!

50 List of questions Next lecture… Are all real numbers computable? No
Are all real numbers describable? Is every computable number describable? Yes Is every describable number computable? ?? Next lecture…

51 To end, here’s an important digression about infinity…

52 We know there are at least 2 infinities
We know there are at least 2 infinities. (The number of naturals, the number of reals.) Are there more?

53 Definition: Power Set The power set of S is the set of all subsets of S. The power set is denoted as P(S) Proposition: If S is finite, the power set of S has cardinality 2|S| How do sizes of S and P(S) relate if S is infinite?

54 Theorem: S can’t be put into bijection with P(S)
{A} {B} B {C} {A,B} C {B,C} {A,C} {A,B,C} Suppose f:S → P(S) is a bijection. Let CONFUSEf = { x | x  S, x  f(x) } Since f is onto, exists y  S such that f(y) = CONFUSEf. Is y in CONFUSEf? YES: Definition of CONFUSEf implies no NO: Definition of CONFUSEf implies yes

55 For any set S (finite or infinite), the cardinality of P(S) is strictly greater than the cardinality of S.

56 This proves that there are at least a countable number of infinities.
Indeed, take any infinite set S. Then P(S) is also infinite, and its cardinality is a larger infinity than the cardinality of S.

57 This proves that there are at least a countable number of infinities.
The first infinity is the size of all the countable sets. It is called: 0

58 Cantor wanted to show that the number of reals was 1
0,1,2,… Cantor wanted to show that the number of reals was 1

59 However, he was unable to prove it. This helped fuel his depression.
Cantor called his conjecture that 1 was the number of reals the “Continuum Hypothesis.” However, he was unable to prove it. This helped fuel his depression. The problem of the continuum was the source of great vexation for Cantor. Once, he thought he had proved it false, only to uncover his error the following day. And later, Cantor believed he had proved the hypothesis true, but again he quickly discovered a bug in his proof.

60 The Continuum Hypothesis can’t be proved or disproved from the standard axioms of set theory!
This has been proved!

61 Here’s What You Need to Know…
Cantor’s Definition: Two sets have the same cardinality if there exists a bijection between them. E, N, Z and Q all have the same cardinality Proof that there is no bijection between N and R Definition of Countable versus Uncountable Here’s What You Need to Know…


Download ppt "Great Theoretical Ideas in Computer Science"

Similar presentations


Ads by Google