Bird–Meertens formalism
The Bird–Meertens formalism (BMF) is a calculus for deriving programs from program specifications (in a functional programming setting) by a process of equational reasoning. It was devised by Richard Bird and Lambert Meertens as part of their work within IFIP Working Group 2.1.
It is sometimes referred to in publications as BMF, as a nod to Backus–Naur form. Facetiously it is also referred to as Squiggol, as a nod to ALGOL, which was also in the remit of WG 2.1, and because of the "squiggly" symbols it uses. A less-used variant name, but actually the first one suggested, is SQUIGOL. Martin and Nipkow provided automated support for Squiggol development proofs, using the Larch Prover.[1]
Basic examples and notations
Map is a well-known second-order function that applies a given function to every element of a list; in BMF, it is written
Likewise, reduce is a function that collapses a list into a single value by repeated application of a binary operator. It is written / in BMF.
Taking
Using those two operators and the primitives
Similarly, writing
Bird (1989) transforms inefficient easy-to-understand expressions ("specifications") into efficient involved expressions ("programs") by algebraic manipulation. For example, the specification "
The derivation is shown in the picture, with computational complexities[7] given in blue, and law applications indicated in red.
Example instances of the laws can be opened by clicking on [show]; they use lists of integer numbers, addition, minus, and multiplication. The notation in Bird's paper differs from that used above:
The homomorphism lemma and its applications to parallel implementations
A function h on lists is called a list homomorphism if there exists an associative binary operator
The homomorphism lemma states that h is a homomorphism if and only if there exists an operator
A point of great interest for this lemma is its application to the derivation of highly parallel implementations of computations. Indeed, it is trivial to see that
See also
- Catamorphism
- Anamorphism
- Paramorphism
- Hylomorphism
References
- ↑ Ursula Martin; Tobias Nipkow (Apr 1990). "Proc. IFIP WG 2.2/2.3 Working Conference on Programming Concepts and Methods". North-Holland. pp. 233–247.
- ↑ Bird 1989, Sect.8, p.126r.
- ↑ Jump up to: 3.0 3.1 Bird 1989, Sect.2, p.123l.
- ↑ Bird 1989, Sect.7, Lem.1, p.125l.
- ↑ Jump up to: 5.0 5.1 Bird 1989, Sect.5, p.124r.
- ↑ Where
, , and returns the largest value, the sum, and the list of all segments (i.e. sublists) of a given list, respectively. - ↑ Each expression in a line denotes an executable functional program to compute the maximum segment sum.
- de Bakker, J.W.; Hazewinkel, M.; Lenstra, J.K., eds (1986). "Algorithmics: Towards programming as a mathematical activity". Mathematics and Computer Science. CWI Monographs. 1. North-Holland. pp. 289–334. https://ir.cwi.nl/pub/2686.
- "Two Exercises Found in a Book on Algorithmics". North-Holland. 1987. https://www.kestrel.edu/people/meertens/publications/papers/Two_exercises_found_in_a_book_on_Algorithmics.pdf.
- Template:Cite tech report
- "Algebraic Identities for Program Calculation". The Computer Journal 32 (2): 122–126. 1989. doi:10.1093/comjnl/32.2.122. https://academic.oup.com/comjnl/article-pdf/32/2/122/1445670/320122.pdf.
- Cole, Murray (1993). "Parallel Programming, List Homomorphisms and the Maximum Segment Sum Problem". pp. 489–492. http://homepages.inf.ed.ac.uk/mic/Pubs/segmentsum.ps.gz.
- "Elements of a Relational Theory of Datatypes". 1993. pp. 7-42. doi:10.1007/3-540-57499-9_15. ISBN 978-3-540-57499-6. https://www.researchgate.net/profile/Roland-Backhouse/publication/221509704_Elements_of_a_Relational_Theory_of_Datatypes/links/00b7d52caa66af36d1000000/Elements-of-a-Relational-Theory-of-Datatypes.pdf.
- Bunkenburg, Alexander (1994). "The Boom Hierarchy". in O'Donnell, John T.; Hammond, Kevin (PDF). London: Springer. 1–8. doi:10.1007/978-1-4471-3236-3_1. ISBN 978-1-4471-3236-3. https://citeseerx.ist.psu.edu/pdf/dd3ed1c7d523781513f01d25e1be472de4279d72.
- Algebra of Programming. International Series in Computing Science. 100. Prentice Hall. 1997. ISBN 0-13-507245-X.
- Troy Astarte, ed (2020). "The School of Squiggol: A History of the Bird-Meertens Formalism". 12233. Springer. doi:10.1007/978-3-030-54997-8_2. http://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/squiggol-history.pdf.
![]() | Original source: https://en.wikipedia.org/wiki/Bird–Meertens formalism.
Read more |