your ancient heritage: abstract representation. great theoretical ideas in computer science steven...

99
Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven Rudich CS 15-251 Spring 2004 Lecture 2 Lecture 2 Jan 15, 2004 Jan 15, 2004 Carnegie Mellon University

Post on 15-Jan-2016

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Your Ancient Heritage:Abstract Representation.

Great Theoretical Ideas In Computer Science

Steven Rudich

CS 15-251 Spring 2004

Lecture 2Lecture 2 Jan 15, 2004Jan 15, 2004 Carnegie Mellon University

Page 2: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

How to play the 9 stone game?

9 stones, numbered 1-9 9 stones, numbered 1-9

Two players alternate moves. Two players alternate moves.

Each move a player gets to take a new Each move a player gets to take a new stonestone

Any subset ofAny subset of 3 stones adding to 153 stones adding to 15, wins., wins.

1 23

45

67 8

9

Page 3: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

For enlightenment, let’s look to ancient China in

the days of Emperor Yu.

A tortoise emerged from the river Lo…

Page 4: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Magic Square: Brought to humanity on the back of a tortoise from the river Lo in the days of Emperor Yu

49 2

35

7

8 16

Page 5: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Magic Square: Any 3 in a vertical, horizontal, or diagonal line add up to

15.

44 99 22

33 55 77

88 11 66

Page 6: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Conversely, any 3 that add to 15 must be on a

line.

44 99 22

33 55 77

88 11 66

Page 7: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

44 99 22

33 55 77

88 11 66

TIC-TAC-TOE on a Magic SquareRepresents The Nine Stone Game

Alternate taking squares 1-9. Get 3 in a row to win.

Page 8: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

BIG IDEA!

Don’t stick with the representation

in which you encounter problems!

Always seek the more useful one!

Page 9: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

This IDEA takes practice,

practice, practice

to understand and use.

Page 10: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Your Ancient Heritage

Let’s take a historical view on

abstract representations.

Page 11: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Mathematical Prehistory:30,000 BC

Paleolithic peoples in Europe record Paleolithic peoples in Europe record unaryunary numbers on bones. numbers on bones.

1 represented by 1 mark1 represented by 1 mark

2 represented by 2 marks2 represented by 2 marks

3 represented by 3 marks3 represented by 3 marks

4 represented by 4 marks4 represented by 4 marks

……

Page 12: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Hang on a minute!

Isn’t calling unary an abstract representation

pushing it a bit?

Page 13: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

No! In fact, it is important to respect

the status of each representation, no

matter how primitive. Unary is a perfect

object lesson.

Page 14: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Consider the problem of finding a formula for the sum of the first n

numbers.

First, we will give the standard high school

algebra proof….

Page 15: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

Page 16: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

Page 17: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

Page 18: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

2

1)(n n S

Page 19: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

Let’s restate this argument using a UNARY representation

Algebraic argument

Page 20: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 2 . . . . . . . . n

= number of white dots.1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

Page 21: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

1 2 . . . . . . . . n

= number of white dots

= number of yellow dots

n . . . . . . . 2 1

Page 22: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

n+1 n+1 n+1 n+1 n+1

= number of white dots

= number of yellow dots

n

n

n

n

n

n

There are n(n+1) dots in the grid

Page 23: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

1 + 2 + 3 + . . . + n-1 + n = S

n + n-1 + n-2 + . . . + 2 + 1 = S

(n+1) + (n+1) + (n+1) + . . . + (n+1) + (n+1) = 2S

n (n+1) = 2S

n+1 n+1 n+1 n+1 n+1

= number of white dots

= number of yellow dots

n

n

n

n

n

n

2

1)(n n S

Page 24: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Very convincing! The unary representation

brings out the geometry of the

problem and makes each step look very

natural.

By the way, my name is Bonzo. And you are?

Page 25: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Odette.

Yes, Bonzo. Let’s take it

even further…

Page 26: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

nth Triangular Number

nn = 1 + 2 + 3 + . . . + n-1 + n= 1 + 2 + 3 + . . . + n-1 + n

= n(n+1)/2= n(n+1)/2

Page 27: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

nth Square Number

nn = = nn + + n-1n-1

= n= n22

Page 28: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

Page 29: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

1

Page 30: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

1 + 3

Page 31: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

1 + 3 + 5

Page 32: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

1 + 3 + 5 + 7

Page 33: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Breaking a square up in a new way.

1 + 3 + 5 + 7 + 9

Page 34: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The sum of the first 5 odd numbers is 5 squared

1 + 3 + 5 + 7 + 9 = 52

Page 35: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The sum of the first n odd

numbers is n squared.

Pythagoras

Page 36: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Here is an alternative dot

proof of the same sum….

Page 37: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

nth Square Number

nn = = nn + + n-1n-1

= n= n22

Page 38: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

nth Square Number

nn = = nn + + n-1n-1

= n= n22

Page 39: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Look at the columns!

nn = = nn + + n-1n-1

= Sum of first n odd numbers.= Sum of first n odd numbers.

Page 40: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

High School Notation

nn + + n-1 = n-1 =

1 + 2 + 3 + 4 + 5 ...1 + 2 + 3 + 4 + 5 ...

+ + 1 + 2 + 3 + 4 ...1 + 2 + 3 + 4 ...

1 + 3 + 5 + 7 + 9 …1 + 3 + 5 + 7 + 9 …

Sum of odd numbersSum of odd numbers

Page 41: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Check the next one out…

Page 42: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

( n-1)2 = area of square

( n-1)2

n-1n-1

Page 43: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

( n)2 = area of square

( n-1)2

n-1n-1 nn

nnnnnn + + nnn-1n-1

= n (= n (n n + + n-1n-1))

= n = n nn

= = nn= area of pieces

Page 44: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

( n-1)2

n-1n-1 nn

nn

(( nn))2 =2 = (( n-1n-1))2 2

++nn

Page 45: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

(( nn))2 =2 = (( n-1n-1))2 2

++nn

(( nn))2 2 = + + . . . = + + . . . + +

nn

Page 46: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Can you find a formula for the sum

of the first n squares?

The Babylonians

needed this sum to compute the number

of blocks in their pyramids.

Page 47: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The ancients grappled with problems of

abstraction in representation and

reasoning.

Let’s look back to the dawn of symbols…

Page 48: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Sumerians [modern Iraq]

8000 BC Sumerian tokens use multiple8000 BC Sumerian tokens use multiplesymbols to represent numberssymbols to represent numbers

3100 BC Develop Cuneiform writing3100 BC Develop Cuneiform writing

2000 BC Sumerian tablet 2000 BC Sumerian tablet demonstrates:demonstrates:

base 10 notation (no zero)base 10 notation (no zero)solving linear equationssolving linear equationssimple quadratic equationssimple quadratic equations

Biblical timing: Abraham born in the Biblical timing: Abraham born in the Sumerian city of UrSumerian city of Ur

Page 49: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Babylonians absorb Sumerians

1900 BC Sumerian/Babylonian Tablet1900 BC Sumerian/Babylonian Tablet

Sum of first n numbersSum of first n numbers

Sum of first n squaresSum of first n squares

““Pythagorean Theorem”Pythagorean Theorem”

““Pythagorean Triplets”, e.g., 3-4-5Pythagorean Triplets”, e.g., 3-4-5

some bivariate equationssome bivariate equations

Page 50: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Babylonians

1600 BC Babylonian Tablet1600 BC Babylonian Tablet

Take square rootsTake square roots

Solve system of n linear equationsSolve system of n linear equations

Page 51: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

6000 BC Multiple symbols for numbers6000 BC Multiple symbols for numbers

3300 BC Developed Hieroglyphics3300 BC Developed Hieroglyphics

1850 BC Moscow Papyrus 1850 BC Moscow Papyrus Volume of truncated pyramidVolume of truncated pyramid

1650 BC Rhind Papyrus [Ahmose]1650 BC Rhind Papyrus [Ahmose]Binary Multiplication/Division Binary Multiplication/Division Sum of 1 to nSum of 1 to nSquare rootsSquare rootsLinear equationsLinear equations

Biblical timing: Joseph is Governor of Biblical timing: Joseph is Governor of Egypt.Egypt.

Egyptians

Page 52: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Rhind PapyrusScribe Ahmose was the Martin

Gardener of his day!

Page 53: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Rhind Papyrus87 Problems.

A man has seven houses,Each house contains seven cats,Each cat has killed seven mice,Each mouse had eaten seven ears of spelt,Each ear had seven grains on it.What is the total of all of these?

Sum of first five

powers of 7

Page 54: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Harrappans [Indus Valley Culture]Pakistan/India

3500 BC Perhaps the first writing system?!

2000 BC Had a uniform decimal system ofweights and measures

Page 55: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

China1500 BC Independent writing system

Surprisingly late.

1200 BC I Ching [Book of changes]Binary system developed to do

numerology.

Ancient interest in Magic Squares and whole numbers (Number Theory) is echoed by modern Chinese research emphasis and taste.

Page 56: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The ancient minds sought and found

patterns in numbers and

forms.

They gave useful calculation

methods for fundamental

problems (specified by examples).

Page 57: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

They understood how to

communicate patterns and calculation

methods, but they lacked the idea of

PROOF!

Page 58: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Enter the ancient Geeks!

Page 59: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

I meant ..

Enter the ancient Greeks!

Page 60: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

My greatest intellectual hero

of all time is

Page 61: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

My greatest methodological

hero of all time is

Page 62: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Thales Of Miletus (600 BC)

Thales traveled in Egypt and Thales traveled in Egypt and (probably) Babylon, where he (probably) Babylon, where he learned the Geometry and learned the Geometry and Astronomy of the time.Astronomy of the time.

Page 63: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Thales Of Miletus (600 BC)Insisted on Proofs!

““first mathematician”first mathematician”Most of the starting theorems of Most of the starting theorems of geometry. SSS, SAS, ASA, angle sum geometry. SSS, SAS, ASA, angle sum equals 180, . . .equals 180, . . .

Page 64: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Thales Of Miletus (600 BC)Use theory to do amazing things!

Measured height of the PyramidsMeasured height of the PyramidsMeasured distance to shipsMeasured distance to shipsPredicted Solar eclipse of 585 BCPredicted Solar eclipse of 585 BC

Articulated basic idea of

theory/experiment interaction for

science

Page 65: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Thales Of Miletus (600 BC)Absent minded professor

Fell down a well while Fell down a well while contemplating the contemplating the heavensheavens

Made up for this episode Made up for this episode by using the power of by using the power of theory to predict bumper theory to predict bumper olive crop, buying up all olive crop, buying up all the presses, and the presses, and cornering market on olive cornering market on olive oil.oil.

Page 66: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Thales Of Miletus (600 BC)“All is water”

Wondered if the world was made of one thing, or many, and whether it was discrete or continuous.

Page 67: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Pythagoras of Sarnas [Turkey, 570-500BC]

“All is number”

Greatly inspired by Thales.Greatly inspired by Thales.

Founded the Pythagorean School. Founded the Pythagorean School.

Mystical society of Mystical society of “mathematicians” meaning “the “mathematicians” meaning “the study of learned things”.study of learned things”.

““Mathematics” was later given Mathematics” was later given modern meaning by Aristotle .modern meaning by Aristotle .

Page 68: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Pythagoreans:Pythagoreans:

Gave the dot proof of the sum of first n numbers.Gave the dot proof of the sum of first n numbers.

Gives first proof of “Pythagorean” theorem.Gives first proof of “Pythagorean” theorem.

Showed sqrt(2) is irrational.Showed sqrt(2) is irrational.

Formula for perfect numbers.Formula for perfect numbers.

Constructed dodecahedronConstructed dodecahedron

Pythagoras of Sarnas [Turkey, 570-500BC]

“All is number”

Page 69: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Zeno of Elea [460 BC] The man of paradoxes

Constructed several famous Constructed several famous paradoxes of motion. paradoxes of motion.

Tortoise and Achilles Race Paradox:Tortoise and Achilles Race Paradox:

Tortoise gets head start. Tortoise gets head start. Achilles must catch up. Achilles must catch up. But Tortoise still has advantage.But Tortoise still has advantage.Achilles must catch up …Achilles must catch up …

Page 70: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

430 BC Hippocrates of Athens

Pioneered “Reductio Ad Absurdum”Pioneered “Reductio Ad Absurdum”

Proof by contradiction.Proof by contradiction.Assume Assume XX, derive an absurdity , derive an absurdity

(i.e., a (i.e., a contradiction)contradiction)..Conclude Conclude NOT XNOT X..

Explicitly writes mathematics by reducing Explicitly writes mathematics by reducing one theorem to another.one theorem to another.

Page 71: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

408-355 BC Eudoxus of Athens

Defined the Golden ratio.Defined the Golden ratio.

““Proved” area of circle is Proved” area of circle is proportional to the square of its proportional to the square of its diameter.diameter.

[Archimedes is credited with giving [Archimedes is credited with giving the first complete, modern proof of the first complete, modern proof of this formula.]this formula.]

Page 72: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

408-355 BC Eudoxus of Athens

Defined and proved that the product Defined and proved that the product of two of two realreal numbers is commutative numbers is commutative and associative!and associative!

Especially amazing Especially amazing given that real given that real

number were not number were not invented yet!invented yet!

Page 73: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Great Philosophers

427 – 347 BC 427 – 347 BC Plato of AthensPlato of AthensFounds Academy in 380Founds Academy in 380Believes that mathematical objects areBelieves that mathematical objects arereal, in fact, more real than the “real”real, in fact, more real than the “real”world. “Plato’s Heaven”world. “Plato’s Heaven”

384 – 322 BC 384 – 322 BC AristotleAristotleCompletely codifies rules of logicCompletely codifies rules of logicTakes a contrary view of Takes a contrary view of “Plato’s Heaven”“Plato’s Heaven”

Page 74: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The Great Debate!

Plato’s Heaven:Plato’s Heaven:

There is a place (or There is a place (or a sense) in which a sense) in which the infinity of the infinity of counting numbers counting numbers (0, 1, 2, … ) exists(0, 1, 2, … ) exists

Aristotle:Aristotle:

We have no direct We have no direct evidence of infinity. evidence of infinity. Infinity is an idea in Infinity is an idea in

our mind, not our mind, not something that something that

exists outside of our exists outside of our conception of it.conception of it.

Page 75: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Let me ask you:

do the infinity of counting numbers

exist in a sense that does not depend on the

existence of minds to conceive them?

Page 76: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

By the end of this course, you will

come to appreciate the

depth and relevance of the

issue.

Page 77: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

300 BC Euclid Of Athens

First chair of mathematics at the First chair of mathematics at the Museum (University) of AlexandriaMuseum (University) of Alexandria

Organized the project of writing the Organized the project of writing the “Elements”. A book that gave one “Elements”. A book that gave one consistent derivation of important consistent derivation of important Greek mathematics to date.Greek mathematics to date.

Page 78: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

287-212 BC Archimedes of Syracuse

rr22. 4/3 . 4/3 r r33..

Area of conics.Area of conics.

Volume by water Volume by water

immersion.immersion.

Percentage of silver/goldPercentage of silver/gold

Crane to drop ships and Crane to drop ships and

destroy themdestroy them

Lob huge stones at shipsLob huge stones at ships

Discovered IntegrationDiscovered Integration

Page 79: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The history of mathematics can be cast as the discovery and manipulation of

abstract representations.

Page 80: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Modern Times

Nothing has changed.

A good computer scientist will invent representations to make computation

easy.

Page 81: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

A case study.

Anagram Programming Task.

You are given a 70,000 word dictionary. Write an anagram utility that given a word as input returns all anagrams of that word appearing in the dictionary.

Page 82: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Examples

Input: CATInput: CAT

Output: ACT, CAT, TACOutput: ACT, CAT, TAC

Input: SUBESSENTIALInput: SUBESSENTIAL

Output: SUITABLENESSOutput: SUITABLENESS

Page 83: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Impatient Hacker (Novice Level Solution)

Loop through all possible ways of Loop through all possible ways of rearranging the input wordrearranging the input word

Use binary search to look up Use binary search to look up resulting word in dictionary.resulting word in dictionary.

If found, output itIf found, output it

Page 84: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Performance AnalysisCounting without executing

On the word “microphotographic”, we loop On the word “microphotographic”, we loop 17! 17! 3 * 10 3 * 10114 times.4 times.

Even at 1 microsecond per iteration, this will Even at 1 microsecond per iteration, this will take 3 *10take 3 *1088 seconds. seconds.

Almost a decade! Almost a decade!

(There are about (There are about seconds in a seconds in a nanocentury.)nanocentury.)

Page 85: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

“Expert” Hacker

Module ANAGRAM(X,Y) returns Module ANAGRAM(X,Y) returns TRUETRUE exactly when X and Y are anagrams. exactly when X and Y are anagrams.

(Works by sorting the letters in X and Y)(Works by sorting the letters in X and Y)

Input XInput X

Loop through all dictionary words YLoop through all dictionary words Y

If ANAGRAM(X,Y) output YIf ANAGRAM(X,Y) output Y

Page 86: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The hacker is satisfied and reflects no futher

Comparing an input word with each Comparing an input word with each of 70,000 dictionary entries takes of 70,000 dictionary entries takes

about 15 seconds. about 15 seconds.

Page 87: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

The master keeps trying to refine the solution.

The master’s program runs in less The master’s program runs in less than 1/1000 seconds.than 1/1000 seconds.

Page 88: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Master Solution

Don’t keep the dictionary in sorted order!

Rearranging the dictionary into anagram classes will make the

original problem simple.

Page 89: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Suppose the dictionary was the list below.

ASPASPDOGDOGLURELUREGODGODNICENICERULERULESPASPA

Page 90: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

After each word, write its “signature” (sort its letters)

ASPASP APSAPSDOGDOG DGODGOLURELURE ELRUELRUGODGOD DGODGONICENICE CEINCEINRULERULE ELRUELRUSPASPA APSAPS

Page 91: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Sort by the signatures

ASPASP APSAPSSPASPA APSAPSNICENICE CEINCEINDOGDOG DGODGOGODGOD DGODGOLURELURE ELRUELRURULERULE ELRUELRU

Page 92: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Master Program

Input word WInput word W

X := signature of WX := signature of W

Use binary search to find the Use binary search to find the anagram class of W and output it. anagram class of W and output it.

About microseconds

.0004 seconds

log ( , )2 70 000 25

Page 93: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Of course, it takes about 30 seconds to create the dictionary, but it is perfectly fair to think of this as programming time. The building of the dictionary is a one-time cost that is part of writing the program.

Page 94: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Neat! I wish I had thought of that.

Page 95: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Name Your Tools

Whenever you see something you wish you had thought of, try and formulate the minimal and most general lesson that will insure that you will not miss the same thing the next time. Name the lesson to make it easy to remember.

Page 96: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

NAME: Preprocessing

It is sometimes possible to pay a reasonable, one-time preprocessing cost to reorganize your data in such a way as to use it more efficiently later. The extra time required to preprocess can be thought of as additional programming effort.

Page 97: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Of course, preprocessing is

just a special case of seeking the appropriate representation.

Page 98: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

Don’t let the representation choose you,

CHOOSE THE REPRESENTATION!

Page 99: Your Ancient Heritage: Abstract Representation. Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2004 Lecture 2 Jan 15, 2004

References

The Heritage of ThalesThe Heritage of Thales, by W. S. Anglin , by W. S. Anglin and F. Lambekand F. Lambek

The Book Of NumbersThe Book Of Numbers, by J. Conway and , by J. Conway and R. GuyR. Guy

Programming PearlsProgramming Pearls, by J. Bentley, by J. Bentley

History of Mathematics, Histories of History of Mathematics, Histories of Problems,Problems, by The Inter-IREM Commission by The Inter-IREM Commission