{"slug": "bird-meertens-formalism", "title": "Bird–Meertens Formalism", "summary": "Richard Bird and Lambert Meertens developed the Bird–Meertens formalism (BMF), a calculus for deriving programs from specifications through equational reasoning in functional programming. The formalism, sometimes called \"Squiggol,\" enables algebraic manipulation of expressions to transform inefficient specifications into efficient programs, as demonstrated by Bird's derivation of Kadane's algorithm for the maximum segment sum problem.", "body_md": "# Bird–Meertens formalism\n\nThe **Bird–Meertens formalism** (**BMF**) is a [calculus](/wiki/Proof_calculus) for [deriving programs](/wiki/Program_derivation) from [program specifications](/wiki/Program_specification) (in a [functional programming](/wiki/Functional_programming) setting) by a process of equational reasoning. It was devised by [Richard Bird](/wiki/Richard_Bird_(computer_scientist)) and [Lambert Meertens](/wiki/Lambert_Meertens) as part of their work within [IFIP Working Group 2.1](/wiki/IFIP_Working_Group_2.1).\n\nIt is sometimes referred to in publications as BMF, as a nod to [Backus–Naur form](/wiki/Backus%E2%80%93Naur_form). Facetiously, it is also referred to as *Squiggol*, as a nod to [ALGOL](/wiki/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*.\nMartin and Nipkow provided automated support for Squiggol development proofs, using the [Larch Prover](/wiki/Larch_Prover).[[1]](#cite_note-1)\n\n## Basic examples and notations\n\n[[edit](/w/index.php?title=Bird%E2%80%93Meertens_formalism&action=edit§ion=1)]\n\n[Map](/wiki/Map_(higher-order_function)) is a well-known second-order function that applies a given function to every element of a list; in BMF, it is written :\n\nLikewise, [reduce](/wiki/Fold_(higher-order_function)) is a function that collapses a list into a single value by [repeated application of a binary operator](/wiki/Iterated_binary_operation). It is written as in BMF.\nTaking as a suitable binary operator with neutral element *e*, we have\n\nUsing those two operators and the primitives (as the usual addition), and (for list concatenation), we can easily express the sum of all elements of a list, and the [flatten](/wiki/Flatten_(higher-order_function)) function, as and , in\n[point-free style](/wiki/Tacit_programming). We have:\n\n[Kadane's algorithm](/wiki/Kadane%27s_algorithm)\n\n[[2]](#cite_note-FOOTNOTEBird1989Sect.8,_p.126r-2)| Example instances of used laws |\n|---|\n\nSimilarly, writing for [functional composition](/wiki/Functional_composition) and for [conjunction](/wiki/Logical_conjunction), it is easy to write a function testing that all elements of a list satisfy a predicate *p*, simply as :\n\nBird (1989) transforms inefficient easy-to-understand expressions (\"specifications\") into efficient involved expressions (\"programs\") by algebraic manipulation. For example, the specification \"\" is an almost literal translation of the [maximum segment sum problem](/wiki/Maximum_segment_sum_problem), [6] but running that functional program on a list of size will take time in general. From this, Bird computes an equivalent functional program that runs in time , and is in fact a functional version of\n\n[Kadane's algorithm](/wiki/Kadane%27s_algorithm).\n\nThe derivation is shown in the picture, with computational complexities [7] given in blue, and law applications indicated in red.\nExample instances of the laws can be opened by clicking on\n\n*[show]*; they use lists of integer numbers, addition, minus, and multiplication. The notation in Bird's paper differs from that used above: , , and correspond to , , and a generalized version of above, respectively, while and compute a list of all\n\n[prefixes](/wiki/Prefix_(computer_science))and\n\n[suffixes](/wiki/Suffix_(computer_science))of its arguments, respectively. As above, function composition is denoted by \"\", which has the lowest\n\n[binding precedence](/wiki/Binding_precedence). In the example instances, lists are colored by nesting depth; in some cases, new operations are defined ad hoc (grey boxes).\n\n## The homomorphism lemma and its applications to parallel implementations\n\n[[edit](/w/index.php?title=Bird%E2%80%93Meertens_formalism&action=edit§ion=2)]\n\nA function *h* on lists is called a list [homomorphism](/wiki/Homomorphism) if there exists an associative binary operator and neutral element such that the following holds:\n\nThe *homomorphism lemma* states that *h* is a homomorphism if and only if there exists an operator and a function *f* such that .\n\nA point of great interest for this lemma is its application to the derivation of highly [parallel](/wiki/Parallel_computing) implementations of computations. Indeed, it is trivial to see that has a highly parallel implementation, and so does — most obviously as a binary tree. Thus, for any list homomorphism *h*, there exists a parallel implementation. That implementation cuts the list into chunks, which are assigned to different computers; each computes the result on its own chunk. It is those results that transit on the network and are finally combined into one. In any application where the list is enormous and the result is a very simple type – say an integer – the benefits of parallelisation are considerable. This is the basis of the [map-reduce](/wiki/Map-reduce) approach.\n\n## See also\n\n[[edit](/w/index.php?title=Bird%E2%80%93Meertens_formalism&action=edit§ion=3)]\n\n## References\n\n[[edit](/w/index.php?title=Bird%E2%80%93Meertens_formalism&action=edit§ion=4)]\n\n[^](#cite_ref-1)[Ursula Martin](/wiki/Ursula_Martin);[Tobias Nipkow](/wiki/Tobias_Nipkow)(Apr 1990).[\"Automating Squiggol\"](https://www21.in.tum.de/~nipkow/pubs/squiggol.html). In[Manfred Broy](/wiki/Manfred_Broy);[Cliff B. Jones](/wiki/Cliff_Jones_(computer_scientist))(eds.).*Proc.*. North-Holland. pp. 233–247.[IFIP WG 2.2/2.3](/wiki/IFIP_Working_Group_2.3)Working Conference on Programming Concepts and Methods[^](#cite_ref-FOOTNOTEBird1989Sect.8,_p.126r_2-0)[Bird 1989](#CITEREFBird1989), Sect.8, p.126r.- ^\n**a****b**[Bird 1989](#CITEREFBird1989), Sect.2, p.123l. [^](#cite_ref-FOOTNOTEBird1989Sect.7,_Lem.1,_p.125l_4-0)[Bird 1989](#CITEREFBird1989), Sect.7, Lem.1, p.125l.- ^\n**a****b**[Bird 1989](#CITEREFBird1989), 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.[^](#cite_ref-6)Each expression in a line denotes an executable functional program to compute the maximum segment sum.[^](#cite_ref-7)\n\n## Bibliography\n\n[[edit](/w/index.php?title=Bird%E2%80%93Meertens_formalism&action=edit§ion=5)]\n\n[Meertens, Lambert](/wiki/Lambert_Meertens)(1986).[\"Algorithmics: Towards programming as a mathematical activity\"](https://ir.cwi.nl/pub/2686). In de Bakker, J.W.;[Hazewinkel, M.](/wiki/Michiel_Hazewinkel); Lenstra, J.K. (eds.).*Mathematics and Computer Science*. CWI Monographs. Vol. 1. North-Holland. pp. 289–334.[Meertens, Lambert](/wiki/Lambert_Meertens);[Bird, Richard](/wiki/Richard_Bird_(computer_scientist))(1987).[\"Two Exercises Found in a Book on Algorithmics\"](https://www.kestrel.edu/people/meertens/publications/papers/Two_exercises_found_in_a_book_on_Algorithmics.pdf)(PDF). North-Holland.[Backhouse, Roland](/wiki/Roland_Carl_Backhouse)(1988).(PDF) (Technical report).*An Exploration of the Bird-Meertens Formalism*[Bird, Richard S.](/wiki/Richard_Bird_(computer_scientist))(1989).[\"Algebraic Identities for Program Calculation\"](https://academic.oup.com/comjnl/article-pdf/32/2/122/1445670/320122.pdf)(PDF).*The Computer Journal*.**32**(2): 122–126.[doi](/wiki/Doi_(identifier)):[10.1093/comjnl/32.2.122](https://doi.org/10.1093%2Fcomjnl%2F32.2.122).- Cole, Murray (1993).\n[\"Parallel Programming, List Homomorphisms and the Maximum Segment Sum Problem\"](http://homepages.inf.ed.ac.uk/mic/Pubs/segmentsum.ps.gz).*Parallel Computing: Trends and Applications, PARCO 1993, Grenoble, France*. pp. 489–492. [Backhouse, Roland](/wiki/Roland_Carl_Backhouse); Hoogendijk, Paul (1993).(PDF). pp. 7–42.*Elements of a Relational Theory of Datatypes*[doi](/wiki/Doi_(identifier)):[10.1007/3-540-57499-9_15](https://doi.org/10.1007%2F3-540-57499-9_15).[ISBN](/wiki/ISBN_(identifier))[978-3-540-57499-6](/wiki/Special:BookSources/978-3-540-57499-6).- Bunkenburg, Alexander (1994). O'Donnell, John T.; Hammond, Kevin (eds.).\n(PDF).*The Boom Hierarchy**Functional Programming, Glasgow 1993: Proceedings of the 1993 Glasgow Workshop on Functional Programming, Ayr, Scotland, 5–7 July 1993*. London: Springer. pp. 1–8.[doi](/wiki/Doi_(identifier)):[10.1007/978-1-4471-3236-3_1](https://doi.org/10.1007%2F978-1-4471-3236-3_1).[ISBN](/wiki/ISBN_(identifier))[978-1-4471-3236-3](/wiki/Special:BookSources/978-1-4471-3236-3). [Bird, Richard](/wiki/Richard_Bird_(computer_scientist)); de Moor, Oege (1997).*Algebra of Programming*. International Series in Computing Science. Vol. 100. Prentice Hall.[ISBN](/wiki/ISBN_(identifier))[0-13-507245-X](/wiki/Special:BookSources/0-13-507245-X).[Gibbons, Jeremy](/wiki/Jeremy_Gibbons)(2020). Troy Astarte (ed.).(PDF).*The School of Squiggol: A History of the Bird-Meertens Formalism**Formal Methods (Workshop on History of Formal Methods)*. LNCS. Vol. 12233. Springer.[doi](/wiki/Doi_(identifier)):[10.1007/978-3-030-54997-8_2](https://doi.org/10.1007%2F978-3-030-54997-8_2).", "url": "https://wpnews.pro/news/bird-meertens-formalism", "canonical_source": "https://en.wikipedia.org/wiki/Bird%E2%80%93Meertens_formalism", "published_at": "2026-05-26 06:59:58+00:00", "updated_at": "2026-05-26 07:08:53.775433+00:00", "lang": "en", "topics": ["ai-research"], "entities": ["Richard Bird", "Lambert Meertens", "IFIP Working Group 2.1", "Larch Prover"], "alternates": {"html": "https://wpnews.pro/news/bird-meertens-formalism", "markdown": "https://wpnews.pro/news/bird-meertens-formalism.md", "text": "https://wpnews.pro/news/bird-meertens-formalism.txt", "jsonld": "https://wpnews.pro/news/bird-meertens-formalism.jsonld"}}