what is an algorithm?

45
What is an Algorithm? Yuri Gurevich SOFSEM 2012 1

Upload: selene

Post on 24-Feb-2016

39 views

Category:

Documents


0 download

DESCRIPTION

What is an Algorithm?. Yuri Gurevich SOFSEM 2012. The Czech connection of “Gurevich”. z Hořovice  von Horowitz  Horowitz  Horowicz , Hurwicz  Гуреви ч  Gurevich. Agenda. Perspective Analysis of Turing’s analysis On related approaches Analysis of sequential algorithms - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: What is an Algorithm?

What is an Algorithm?

Yuri GurevichSOFSEM 2012

1

Page 2: What is an Algorithm?

The Czech connection of “Gurevich”

z Hořovice von Horowitz Horowitz Horowicz, Hurwicz Гуревич Gurevich

2

Page 3: What is an Algorithm?

Agenda

PerspectiveAnalysis of Turing’s analysisOn related approachesAnalysis of sequential algorithmsBeyond sequential algorithms

3

Page 4: What is an Algorithm?

Behavioral theory of algorithms

Syntactically an algorithm is a recipe or program butits meaning is a computation that may depend on the environment, e.g. on the initial state. Some logicians disagree.

We are interested in the meaning, and thus the analysis of algorithms is that of computation.

4

Page 5: What is an Algorithm?

Computation vs. computability

Algorithms perform tasks Computing functions is just one class of

tasks What function does an operating system

compute?“What’s computation”are more fundamental than “what’s computable”.

5

Page 6: What is an Algorithm?

“Give me a fulcrum, and I shall move the world.”

How to analyze computation in general? The task daunting, if not impossible.The notions is amorphous.You need a fulcrum – a viewpoint to make the problem more tractable. The quicksand analogy where

the desired fulcrum is a rescue board.

6

Page 7: What is an Algorithm?

Is it possible to define algorithms?

Not in full generality: the notion keeps expanding. The algorithms/numbers analogy

But some strata of algorithms have matured. The prime example is sequential (a.k.a. classical) algorithms, the only algorithm from antiquity to 1940s or even 1950s.

7

Page 8: What is an Algorithm?

Alan Turing1936/37

8

Page 9: What is an Algorithm?

Turing’s fulcrum

Only human computers in his timeForget what’s in the computer’s head; analyze implementation.

Besides, implicitly or explicitly, he constrained the notion of computation.

9

Page 10: What is an Algorithm?

Some constraintsSymbolicSequential time Bounded step complexity Bounded parallelismIsolated, or self-contained. No inter-step or intra-step interference No oracles The initial state determines

computation.10

Page 11: What is an Algorithm?

Non-symbolic algorithms(satisfying the other

constraints)

Euclid’sRuler-and-compassGauss eliminationBisection

11

Page 12: What is an Algorithm?

Final remarks on Turing’ analysis

It is hard to isolate first principles.How much does the analysis depend on the fact that computers were human?

13

Page 13: What is an Algorithm?

Functional approaches

14

Page 14: What is an Algorithm?

von Neumann architecture

15

Page 15: What is an Algorithm?

Robin Gandy1980

16

Page 16: What is an Algorithm?

Gandy’s goal“Turings analysis of computation by a human being does not apply directly to mechanical devices.” Hence the goal:

Thesis M. What can be calculated by a machine is computable.

17

Page 17: What is an Algorithm?

Explicit narrowingSequential timeThe initial state determines the computation.“in a loose sense, digital computers.”Mechanical but not physical (?)

18

Page 18: What is an Algorithm?

What’s Gandy’s fulcrum?To the best of my understanding, it is this: The states can be encoded by hereditary finite sets.

Principle 1. States are hereditarily finite sets plus …Principles 2 and 3 are technical restriction of the form of states and transitions.Principle 4 is about local causality, based on Components can be only so small, by

quantum mechanics. Signals move only so fast, by relativity.

19

Page 19: What is an Algorithm?

Thesis P. A discrete deterministic mechanical device satisfies principles I–IV below.Theorem. What can be calculated by a device satisfying principles I–IV is computable.

20

Page 20: What is an Algorithm?

Pros and cons+ Gandy pioneered axiomatic approach in the analysis of computation. What devices satisfy Principle 1?

There is just one example (cellular automata) and even it is unconvincing.

We have another (synchronous) parallel computation model which happens to be hard to work with.

21

Page 21: What is an Algorithm?

Andrey Kolmogorov1950s

22

Page 22: What is an Algorithm?

Facts“Algorithms compute in steps of bounded complexity”. Seq. time Bounded step complexity

Kolmogorov published no real analysis of computation. 1953 talk summary 1958 paper with Uspensky on Kolmogorov

machines.

23

Page 23: What is an Algorithm?

SpeculationApparently (according to Leonid Levin, a student of Kolmogorov):

Kolmogorov’s fulcrum was to view computation developing in time-space

24

Page 24: What is an Algorithm?

YET ANOTHER ANALYSIS

25

Page 25: What is an Algorithm?

Analysis of seq. algorithmsAgenda

Why?Constraints that seq. algorithms satisfyDefinition of seq. algorithms and Representation TheoremDerivation of Church’s thesis

26

Page 26: What is an Algorithm?

The specification problemBy the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational and algebraic – were declarative. Declaratve specs tend to be cleaner but they are static.Executable specs: run, test, debug.

27

Page 27: What is an Algorithm?

Related foundational problem

Maybe executable specs do not have to be low-level and unnecessarily detailed.

Is there an executable spec of any algorithm A on the level of abstraction of A itself?

Maybe some generalization of Turing machines.

28

Page 28: What is an Algorithm?

Proviso

By default algorithms are sequential.

30

Page 29: What is an Algorithm?

Informal definition

Kolmogorov 1953: “Algorithms compute in steps of bounded complexity.” An algorithm is a deterministic

transition system. There is a bound, independent from

the initial state, on the amount of work performed at each step.

31

Page 30: What is an Algorithm?

Fulcrum

States are first-order structures.

32

Page 31: What is an Algorithm?

CONSTRAINTS

33

Page 32: What is an Algorithm?

Sequential Time

An algorithm is a transition system determined by states, initial states and the transition function X X’.

34

Page 33: What is an Algorithm?

Interaction?

No to intra-state interaction.Yes to inter-state interaction.

35

Page 34: What is an Algorithm?

Behavioral equivalence

Two algorithms are behaviorally equivalent if they have same states and transitions.The equivalence survives inter-step meddling.

36

Page 35: What is an Algorithm?

37

Abstract State

The states can be faithfully represented by first-order structures of the same finite vocabulary in such a way that

state transition does not change the base set,collection of states and initial states are closed under isomorphisms, andany isomorphism from a state X to a state Y is also an isomorphism from X’ to Y’.

Page 36: What is an Algorithm?

38

Locations and update setsLocations and their contents = (f,(a1,..,aj))Content() = f(a1,..,aj)Updates (,v)The update set at state X is(X) = { (,v) : v = Content() in X′ Content() in X }

Page 37: What is an Algorithm?

Bonded work

“Algorithms compute in steps of bounded complexity.“ Same intuitive idea: there is a bound on the amount of work done during any one step. But how to measure either? Fortunately the abstract state constraint helps as we will see.

39

Page 38: What is an Algorithm?

Reduction to explorationWithout loss of generality, the executor does not remember any history (even its position in the current program.In order to change state X, the algorithm explores a portion of X and then performs the necessary changes of the values of the predicates and operations of X. If the exploration is bounded then so is the number of values changed and the change depends only on the explored part. 40

Page 39: What is an Algorithm?

41

Bounded Exploration

There is a finite set T of termssuch that for all states X,Y

if ValX(t) = ValY(t) for t ∈ Tthen (X) = (Y).

Page 40: What is an Algorithm?

42

Axiomatic definition of algorithms

View the constraints as postulates.Definition. A (sequential) algorithm

is any object satisfiyng the three postulates:sequential time,abstract state, bounded-exploration.

Page 41: What is an Algorithm?

43

D s

r

Given: A circle C with center p,and a point q outside C. The problem: Construct a tangent at C through qThe solution:

s‘

Classical non-Turing algorithmsExample 1: A ruler-and-compass algorithm

C

pql

Page 42: What is an Algorithm?

44

while |f(m:=(a+b)/2)| do if f(m) > 0 then b := m else a := moutput := m

Classical non-Turingbisection algorithmGiven a continuous function f with f(a) < 0 < f(b)and given > 0,find m with |f(m)| < .

Page 43: What is an Algorithm?

45

Representation Theorem

For every seq algorithm A,there exists a seq. ASM behaviorally equivalent to A.

Page 44: What is an Algorithm?

46

Seq ASM programs Syntax Semantics

f(t1,..,tj) := t0 = {(,a0)}where =(f,(a1,..,aj))

and each ai = Val(ti)

do in parallel (R1) … (Rk) R1 … Rk

if t then R1 else R2 if Val(t) = true then (R1)else (R2)

Page 45: What is an Algorithm?

THANKS

47