Introduction to Computer Scienceiml1/intcs.pdf · Introduction to Computer Science Ian Leslie with...

Post on 14-Oct-2020

0 views 0 download

Transcript of Introduction to Computer Scienceiml1/intcs.pdf · Introduction to Computer Science Ian Leslie with...

Introduction toComputer Science

Ian Leslie

with thanks to Robin Milner, Andrew Pitts and

others...

Computer LaboratoryIntroduction to CS, 2003 – p.1

In the beginning. . .

Introduction to CS, 2003 – p.2

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Mathematics and Logic: solution of Hilbert’s

Entscheidungsproblem and Church-Turing notion

of (un)computability.

lambda calculus Turing machines

Introduction to CS, 2003 – p.3

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Mathematics and Logic: solution of Hilbert’s

Entscheidungsproblem and Church-Turing notion

of (un)computability.

lambda calculus Turing machines

Introduction to CS, 2003 – p.3

Hilbert’s EntscheidungsproblemIs there an algorithm which, when fed any

statement in formal language of arithmetic,

determines in a finite number of steps whether or

not the statment can be proved from Peano’s

axioms for natural numbers?

Posed by Hilbert at 1928 International Congress of

Mathematicians; he thought the answer would be “yes”!

Church and Turing proved him wrong (1935-7).

Introduction to CS, 2003 – p.4

Hilbert’s EntscheidungsproblemIs there an algorithm which, when fed any

statement in formal language of arithmetic,

determines in a finite number of steps whether or

not the statment can be proved from Peano’s

axioms for natural numbers?

Posed by Hilbert at 1928 International Congress of

Mathematicians; he thought the answer would be “yes”!

Church and Turing proved him wrong (1935-7).

Introduction to CS, 2003 – p.4

Hilbert’s EntscheidungsproblemIs there an algorithm which, when fed any

statement in formal language of arithmetic,

determines in a finite number of steps whether or

not the statment can be proved from Peano’s

axioms for natural numbers?

Posed by Hilbert at 1928 International Congress of

Mathematicians; he thought the answer would be “yes”!

Church and Turing proved him wrong (1935-7).

Introduction to CS, 2003 – p.4

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Engineering: from Turing Machine to

von Neumann architecture to real machines,

driven by the numerical & data-processing needs

of the scientific, military and industrial

communities.

FORTRAN COBOL

and of course COMPUTERS, eg EDSAC (Wilkes)

Introduction to CS, 2003 – p.5

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Engineering: from Turing Machine to

von Neumann architecture to real machines,

driven by the numerical & data-processing needs

of the scientific, military and industrial

communities.

FORTRAN COBOL

and of course COMPUTERS, eg EDSAC (Wilkes)

Introduction to CS, 2003 – p.5

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Engineering: from Turing Machine to

von Neumann architecture to real machines,

driven by the numerical & data-processing needs

of the scientific, military and industrial

communities.

FORTRAN COBOL

and of course COMPUTERS, eg EDSAC (Wilkes)

Introduction to CS, 2003 – p.5

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Cognitive sciences: input from physiology,

psychology, linguistics.

Can machines exhibit human-like intelligence?

Relationship between thinking and computation?

Symbolic (non-numerical) computation.

LISP

Introduction to CS, 2003 – p.6

Origins (30s, 40s, 50s)What gave rise to Computer Science as a

distinctive intellectual discipline?

Cognitive sciences: input from physiology,

psychology, linguistics.

Can machines exhibit human-like intelligence?

Relationship between thinking and computation?

Symbolic (non-numerical) computation.

LISP

Introduction to CS, 2003 – p.6

The classical age. . .

Introduction to CS, 2003 – p.7

Classical era (60s, 70s)A single computer

“mainframes”, time-sharing

Architecture of computers

processor and memory technologies

Architecture of computingstructures for data & languages for algorithms

analysis of correctness and efficiency

Artificial intelligence

suffered from lack of computing power

Introduction to CS, 2003 – p.8

Classical era (60s, 70s)A single computer

“mainframes”, time-sharing

Architecture of computers

processor and memory technologies

Architecture of computingstructures for data & languages for algorithms

analysis of correctness and efficiency

Artificial intelligence

suffered from lack of computing power

Introduction to CS, 2003 – p.9

A classic example(Thanks to Steven Rudich, CMU and Jon Bentley’s

“Programming Pearls”)

We have a 70,000 word dictionary.

Task: write a program that

inputs a word

outputs all anagrams of that word occurring in the

dictionary.

E.g

slope→ lopes, poles, slope

sorted→ doters, sorted, stored, strode

Introduction to CS, 2003 – p.10

A classic example(Thanks to Steven Rudich, CMU and Jon Bentley’s

“Programming Pearls”)

We have a 70,000 word dictionary.

Task: write a program that

inputs a word

outputs all anagrams of that word occurring in the

dictionary.

E.g

slope→ lopes, poles, slope

sorted→ doters, sorted, stored, strodeIntroduction to CS, 2003 – p.10

Novice hacker solutionLoop through all possible ways of rearranging the

input word

use binary search to look up each

rearrangement in dictionary

if found, output it.

This isvery slow on long

inputs—e.g. at a microsecond/iteration, 17-letter

word takes about a decade to process!

Introduction to CS, 2003 – p.11

Novice hacker solutionLoop through all possible ways of rearranging the

input word

use binary search to look up each

rearrangement in dictionary

if found, output it.

This isvery slow on long

inputs—e.g. at a microsecond/iteration, 17-letter

word takes about a decade to process!

Introduction to CS, 2003 – p.11

Intermediate hacker solutionSubroutine ANAGRAM(X,Y): sort the letters in X and

Y and test the resulting words for equality.

Main routine: input word X; run through the

dictionary words Y in order, outputting Y if

ANAGRAM(X,Y)=TRUE.

Much faster—comparing X with each of 70,000 Y

takes about 15 seconds.

Introduction to CS, 2003 – p.12

Intermediate hacker solutionSubroutine ANAGRAM(X,Y): sort the letters in X and

Y and test the resulting words for equality.

Main routine: input word X; run through the

dictionary words Y in order, outputting Y if

ANAGRAM(X,Y)=TRUE.

Much faster—comparing X with each of 70,000 Y

takes about 15 seconds.

Introduction to CS, 2003 – p.12

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

Introduction to CS, 2003 – p.13

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

doters

lear

lopes

real

slope

stored

→sort letters

deorst

aelr

elops

aelr

elops

deorst

Introduction to CS, 2003 – p.14

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

doters

lear

lopes

real

slope

stored

→sort letters

deorst

aelr

elops

aelr

elops

deorst

Introduction to CS, 2003 – p.14

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

doters

lear

lopes

real

slope

stored

→sort letters

deorst

aelr

elops

aelr

elops

deorst

Introduction to CS, 2003 – p.14

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

lear

real

doters

stored

lopes

slope

↓sort list

deorst

aelr

elops

aelr

elops

deorst

aelr

aelr

deorst

deorst

elops

elops

Introduction to CS, 2003 – p.15

Überhacker solutionIDEA: don’t keep the dictionary in dictionary

order!—rearrange it into anagram classes.

lear

real

doters

stored

lopes

slope

↓sort list

aelr

aelr

deorst

deorst

elops

elops

Introduction to CS, 2003 – p.15

Überhacker solutionPre-processing the dictionay into anagram classes

is a one-time cost.

Now the program is:

Input X; X’ := sorted version of X;

use binary search to find the anagram class of X’

in the pre-processed dictionary

Very fast—what previously took a decade now

runs in less than 1/1000 seconds.

Introduction to CS, 2003 – p.16

Überhacker solutionPre-processing the dictionay into anagram classes

is a one-time cost.

Now the program is:

Input X; X’ := sorted version of X;

use binary search to find the anagram class of X’

in the pre-processed dictionary

Very fast—what previously took a decade now

runs in less than 1/1000 seconds.

Introduction to CS, 2003 – p.16

Überhacker solutionPre-processing the dictionay into anagram classes

is a one-time cost.

Now the program is:

Input X; X’ := sorted version of X;

use binary search to find the anagram class of X’

in the pre-processed dictionary

Very fast—what previously took a decade now

runs in less than 1/1000 seconds.

Introduction to CS, 2003 – p.16

Classical era (60s, 70s)A single computer

“mainframes”, time-sharing

Architecture of computers

processor and memory technologies

Architecture of computingstructures for data & languages for algorithms

analysis of correctness and efficiency

Artificial intelligence

suffered from lack of computing power

Introduction to CS, 2003 – p.17

Classical era (60s, 70s)A single computer

Architecture of computers

Architecture of computing

Artificial intelligence

A DISTINCTIVE INTELLECTUAL DISCIPLINE.

VERY COMFORTABLE.

BUT THEN. . .

Introduction to CS, 2003 – p.18

Classical era (60s, 70s)A single computer

Architecture of computers

Architecture of computing

Artificial intelligence

A DISTINCTIVE INTELLECTUAL DISCIPLINE.

VERY COMFORTABLE.

BUT THEN. . .

Introduction to CS, 2003 – p.18

O Brave New World. . .

Introduction to CS, 2003 – p.19

Modern era (80s on)Many computers

microprocessors, parallelism, networking

Interactioncomputer-computer

human-computer

The communications revolution

computing and communications converge

AND WE ALL RELY ON IT MUCH MORE!

Introduction to CS, 2003 – p.20

Modern era (80s on)Many computers

microprocessors, parallelism, networking

Interactioncomputer-computer

human-computer

The communications revolution

computing and communications converge

Previous methods often become inappropriate (e.g. may

not be able to preprocess a distributed dictionary)

AND WE ALL RELY ON IT MUCH MORE!

Introduction to CS, 2003 – p.20

Modern era (80s on)Many computers

microprocessors, parallelism, networking

Interactioncomputer-computer

human-computer

The communications revolution

computing and communications converge

AND WE ALL RELY ON IT MUCH MORE!

Introduction to CS, 2003 – p.20

Computer Laboratory researchSystems Research

Security

Automated Reasoning

Theory and Semantics

Programming Research

Rainbow Group (graphics, HCI, . . . )

Intelligent Systems

Natural Language & Inf. Processing

BREADTH AND QUALITY!

Introduction to CS, 2003 – p.21

Computer Laboratory researchSystems Research

Security

Automated Reasoning

Theory and Semantics

Programming Research

Rainbow Group (graphics, HCI, . . . )

Intelligent Systems

Natural Language & Inf. Processing

BREADTH AND QUALITY!

Introduction to CS, 2003 – p.21

Computer Science and theComputer Industry

Introduction to CS, 2003 – p.22

Edsger W Dijkstra, 1930–2002

“About 10 years ago I tried to make up my mind

on the question of whether Computing Science

could save the computer industry, and my

conclusion was negative; since then I felt it my

duty to try to prevent the computer industry from

killing Computing Science, but I doubt that I have

been successful . . . ”

(“Under the spell of Leibniz’s dream”, EWD1298,

2000)

Introduction to CS, 2003 – p.23

Edsger W Dijkstra, 1930–2002

“About 10 years ago I tried to make up my mind

on the question of whether Computing Science

could save the computer industry, and my

conclusion was negative; since then I felt it my

duty to try to prevent the computer industry from

killing Computing Science, but I doubt that I have

been successful . . . ”

(“Under the spell of Leibniz’s dream”, EWD1298,

2000)

Introduction to CS, 2003 – p.23

The future. . .

Introduction to CS, 2003 – p.24

The next era

???ubiquitous computing

quantum computation

conscious computers

solve the software crisis!

Introduction to CS, 2003 – p.25

The next eraWhatever the future, facets of Computer Science

important today are likely to remain so:

Theory

Abstraction

Design

Social & professional context

Introduction to CS, 2003 – p.25

The next eraThe future of Computer Science belongs to those

who have

Content: an up-to-date grasp of fundamental

problems and solutions

Method: principles and techniques to solve the

vast array of unfamiliar problems arising in a

rapidly changing field

Introduction to CS, 2003 – p.25

Your future . . .

Introduction to CS, 2003 – p.26

For the moment, academic but . . .No harm to pay some attention to the long term:

Computer Lab has about 3500 former students

(undergraduate, postgraduate).

They have had very diverse careers, but for

example, they have founded over 80 companies

(that we know about).

Introduction to CS, 2003 – p.27

For the moment, academic but . . .No harm to pay some attention to the long term:

Computer Lab has about 3500 former students

(undergraduate, postgraduate).

They have had very diverse careers, but for

example, they have founded over 80 companies

(that we know about).

Introduction to CS, 2003 – p.27

Learn from former graduates . . .

You can gain insight into their careers. They come

back to tell you about their experiences, and will

give career advice.

Through the graduate association (“The

Cambridge Computer Lab Ring”) website you

can find them, find job opportunities, get a list of

Ring events (typically one a month).

We hope that you too one day will come back...

Introduction to CS, 2003 – p.28

Learn from former graduates . . .

You can gain insight into their careers. They come

back to tell you about their experiences, and will

give career advice.

Through the graduate association (“The

Cambridge Computer Lab Ring”) website you

can find them, find job opportunities, get a list of

Ring events (typically one a month).

We hope that you too one day will come back...

Introduction to CS, 2003 – p.28

Learn from former graduates . . .

You can gain insight into their careers. They come

back to tell you about their experiences, and will

give career advice.

Through the graduate association (“The

Cambridge Computer Lab Ring”) website you

can find them, find job opportunities, get a list of

Ring events (typically one a month).

We hope that you too one day will come back...

Introduction to CS, 2003 – p.28

The future belongs to you:

we aren’t here to teach you

how to cope with it

we’re here to help you

learn how to shape it

Introduction to CS, 2003 – p.29

The future belongs to you:

we aren’t here to teach you

how to cope with it

we’re here to help you

learn how to shape it

Introduction to CS, 2003 – p.29

HAVE FUN!

29-1