what is an algorithm? · the specification problem by the 1980s, there were plenty of computers and...
TRANSCRIPT
![Page 1: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/1.jpg)
What is an Algorithm?
Yuri Gurevich
SOFSEM 2012
1
![Page 2: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/2.jpg)
The Czech connection of “Gurevich”
z Hořovice
von Horowitz Horowitz
Horowicz, Hurwicz
Гуревич
Gurevich
2
![Page 3: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/3.jpg)
Agenda
Perspective
Analysis of Turing’s analysis
On related approaches
Analysis of sequential algorithms
Beyond sequential algorithms
3
![Page 4: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/4.jpg)
Behavioral theory of algorithms
Syntactically an algorithm is a recipe or program but
its 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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/5.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/6.jpg)
“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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/7.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/8.jpg)
Alan Turing 1936/37
8
![Page 9: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/9.jpg)
Turing’s fulcrum
Only human computers in his time
Forget 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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/10.jpg)
Some constraints
Symbolic
Sequential time
Bounded step complexity
Bounded parallelism
Isolated, or self-contained.
No inter-step or intra-step interference
No oracles
The initial state determines computation.
10
![Page 11: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/11.jpg)
Non-symbolic algorithms (satisfying the other constraints)
Euclid’s
Ruler-and-compass
Gauss elimination
Bisection
11
![Page 12: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/12.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/13.jpg)
Functional approaches
14
![Page 14: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/14.jpg)
von Neumann architecture
15
![Page 15: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/15.jpg)
Robin Gandy 1980
16
![Page 16: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/16.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/17.jpg)
Explicit narrowing
Sequential time
The initial state determines the computation.
“in a loose sense, digital computers.”
Mechanical but not physical (?)
18
![Page 18: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/18.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/19.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/20.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/21.jpg)
Andrey Kolmogorov 1950s
22
![Page 22: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/22.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/23.jpg)
Speculation
Apparently (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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/24.jpg)
YET ANOTHER ANALYSIS
25
![Page 25: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/25.jpg)
Analysis of seq. algorithms Agenda
Why?
Constraints that seq. algorithms satisfy
Definition of seq. algorithms and Representation Theorem
Derivation of Church’s thesis
26
![Page 26: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/26.jpg)
The specification problem
By 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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/27.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/28.jpg)
Proviso
By default algorithms are sequential.
30
![Page 29: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/29.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/30.jpg)
Fulcrum
States are first-order structures.
32
![Page 31: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/31.jpg)
CONSTRAINTS
33
![Page 32: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/32.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/33.jpg)
Interaction?
No to intra-state interaction.
Yes to inter-state interaction.
35
![Page 34: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/34.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/35.jpg)
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, and
any isomorphism from a state X to a state Y is also an isomorphism from X’ to Y’.
![Page 36: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/36.jpg)
38
Locations and update sets
Locations 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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/37.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/38.jpg)
Reduction to exploration
Without 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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/39.jpg)
41
Bounded Exploration
There is a finite set T of terms such that for all states X,Y
if ValX(t) = ValY(t) for t ∈ T
then (X) = (Y).
![Page 40: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/40.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/41.jpg)
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 q
The solution:
s‘
Classical non-Turing algorithms Example 1: A ruler-and-compass algorithm
C
p q
l
![Page 42: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/42.jpg)
44
while |f(m:=(a+b)/2)| do
if f(m) > 0
then b := m
else a := m
output := m
Classical non-Turing bisection algorithm Given a continuous function f with f(a) < 0 < f(b) and given > 0, find m with |f(m)| < .
![Page 43: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/43.jpg)
45
Representation Theorem
For every seq algorithm A, there exists a seq. ASM behaviorally equivalent to A.
![Page 44: What is an Algorithm? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/44.jpg)
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? · The specification problem By the 1980s, there were plenty of computers and software, and a problem arose how to specify software. Popular approaches – denotational](https://reader034.vdocuments.net/reader034/viewer/2022042806/5f6ff8fc79609e243364b343/html5/thumbnails/45.jpg)
THANKS
47