Algorithm
According to Dijkstra, “the algorithm is what remains when one abstracts from the specific values manipulared in time“, and “the concept of a variable represents an abstraction from its current value”.
Yes, an algorithm, which is a declarative sequence (implies a particular ordering) of instructions of what to be done by a computer (a person) is a generalization, usually derived from repeated observcations.
This, however, is not the best definiton. Just as in modern algebra symbols stand for all possible values of some Set, and a function definitoon uses “variables” as placeholders, algorithms are of the same kind of an abstraction.
Again, a function defined by an equation (on the Set of Real Numbers, lets say), corresponds to a definition of a simple algorithm (how to compute the function). In mathematics there is no fundamenral difference.
In programming a procedure (or a function) is an implementation of a simple algorithm, not a definition of the algorithm itself. However, the level of a generalized abstraction is the same.
Traditionally, in programming algorithms are stated in a declarative, abstract pseudo-code, which is usually derived from simple mathematical and logical expressions. This is because the “real” imperative languages are far away from math and too verbose.
Nothing, however, forbids one from defining algorithms right by an implmenetation in pure languages (Miranda, Haskell) which has the same properties as math or logic.
Of course, the same algorighm could have more than one implementation, but this is an orthogonal notion. What is important to uderstand is that an informal pseudo-code is not require if your language is decent.
This, by the way, is why languages like Haskell
, or SML
or Ocaml
or a pure subset of Scala3
or even Scheme
are such a pragmatic choices.
It is also important to realize that any algorithm can be re-stated in terms of something like TLA+
(which is a particular system of temporal logic) or just in some implemetation of the Lamda Calculus, which is timeless.