Germany2024: Difference between revisions
| Line 236: | Line 236: | ||
Parsers and printers are both essential for language implementation. As they are tightly related, much research has been devoted to showing that both can be derived from a single definition. It, however, turns out to be challenging to extend this work with exact-printing, which recovers the original source text for a parsed syntax tree. In this paper, we propose a new approach to tackling the challenge that considers a parser-printer pair as a mechanism to synchronise the input text string with its AST, and formalises them as a bidirectional program (lens). We propose the first bi-parser framework to support exact-printing with abstract syntax trees, provide a library of combinators for common patterns, and demonstrate its usefulness with a bi-parser for a non-trivial expression language. | Parsers and printers are both essential for language implementation. As they are tightly related, much research has been devoted to showing that both can be derived from a single definition. It, however, turns out to be challenging to extend this work with exact-printing, which recovers the original source text for a parsed syntax tree. In this paper, we propose a new approach to tackling the challenge that considers a parser-printer pair as a mechanism to synchronise the input text string with its AST, and formalises them as a bidirectional program (lens). We propose the first bi-parser framework to support exact-printing with abstract syntax trees, provide a library of combinators for common patterns, and demonstrate its usefulness with a bi-parser for a non-trivial expression language. | ||
[[ | [[Media:81_slides_tom.pdf|slides]] | ||
</blockquote> | </blockquote> | ||
| Line 244: | Line 244: | ||
In this talk we focus on how we leverage functional programming to orchestrate type-driven large-scale pricing workflows. The same API can be used to price one trade locally, or millions of trades across thousands of cloud nodes. Different parts of the computation can be run and inspected individually, and recomputing one part triggers recalculation of the dependent parts only. We build upon decades of research and experience in the functional programming community, relying on concepts such as monads, lenses, datatype generics, and closure serialisation. We conclude that the use of functional programming is one of the main drivers of the success of our project, and we see no significant downsides from it. | In this talk we focus on how we leverage functional programming to orchestrate type-driven large-scale pricing workflows. The same API can be used to price one trade locally, or millions of trades across thousands of cloud nodes. Different parts of the computation can be run and inspected individually, and recomputing one part triggers recalculation of the dependent parts only. We build upon decades of research and experience in the functional programming community, relying on concepts such as monads, lenses, datatype generics, and closure serialisation. We conclude that the use of functional programming is one of the main drivers of the success of our project, and we see no significant downsides from it. | ||
Slides not available, but they are an extended subset of [[http://dreixel.net/research/pdf/fpfm_pres_ifl23.pdf | Slides not available, but they are an extended subset of [[http://dreixel.net/research/pdf/fpfm_pres_ifl23.pdf|this IFL'23 talk]]. | ||
</blockquote> | </blockquote> | ||
| Line 251: | Line 251: | ||
Experience in teaching functional programming on a relational basis has led me to focus on a graphical style of expression and reasoning in which a geometric construct shines: the (semi) commutative square. | Experience in teaching functional programming on a relational basis has led me to focus on a graphical style of expression and reasoning in which a geometric construct shines: the (semi) commutative square. | ||
Such squares compose and have a number of useful properties. Among several examples ranging over different application domains, 'free-theorem squares' are shown to be particularly elegant and productive. Helped by a little bit of Galois connections, a generic, induction-free theory for foldr and foldl is given, showing in particular that 'foldl f = foldr(flip f)' holds under conditions milder than usually advocated. ( [[https://josenunooliveira.github.io/jno/publications/wg21-81-sl.pdf | Such squares compose and have a number of useful properties. Among several examples ranging over different application domains, 'free-theorem squares' are shown to be particularly elegant and productive. Helped by a little bit of Galois connections, a generic, induction-free theory for foldr and foldl is given, showing in particular that 'foldl f = foldr(flip f)' holds under conditions milder than usually advocated. ( [[https://josenunooliveira.github.io/jno/publications/wg21-81-sl.pdf|slides]]) | ||
</blockquote> | </blockquote> | ||
Revision as of 17:22, 13 August 2024
Meeting Information
The 81st meeting will be organised by Ralf Hinze.
Location: Kloster Neustadt, Germany (https://kloster-neustadt.de/).
For practical information, go to Germany (practical).
Dates
Monday 1 April (Easter Monday) to Friday 5 April 2024 (Meeting starts on Monday morning.)
Participants
| Name | Function |
|---|---|
| Ralf Hinze | Organizer |
| Peter Hoefner | (online only) |
| Tom Schrijvers | Secretary |
| Lambert Meertens | |
| José Pedro Magalhães | |
| José N. Oliveira | |
| [[Main/PatrikJansson][Patrik Jansson]] | Acting Chair |
| Alexander Dinges | Local observer |
| Andres Löh | |
| Carroll Morgan | |
| Fritz Henglein | |
| James !McKinna | |
| Janis Voigtländer | |
| Josh Ko | |
| Liam O'Connor | |
| Matija Pretnar | |
| Meng Wang | |
| Niki Vazou | |
| Oleg Kiselyov | |
| Pierre-Evariste Dagand | |
| Sam Lindley | |
| Tarmo Uustalu | |
| Wouter Swierstra | |
| Zhenjiang Hu | |
| Jeremy Gibbons | (online only) |
See also the table of participants on the “practical” page for detailed practical information
Organizational and administrative matters
Friday morning, April 5, 2025.
Membership
These private matters are not recorded in the public version of the minutes.
Formal resolution
We've learnt what's in a Bag (kein Schnick-Schnack) and how to ornament numbers in French style.
We've seen derivatives pop up in everything from Financial Markets, via Einstein's curved space-time, to Temporal logic.
How can we best describe the actions of the 2.1 group on (monadic?) Monastery Neustadt?
Were they essentially functional, or perhaps informally formal?
Were they secured by dynamic (even Liquid?) policies, or discovered by (magic?) square diagrams?
Not even the acting chair knows the true group actions, but the members and observers of IFIP WG2.1 present at Meeting #81 in Germany would in any case definitely like to thank Ralf Hinze, Alexander Dinges, Thomas Schneider and Judith Stengel for organising a wonderful meeting in Kloster Neustadt.
Next meetings:
[[Canberra2024][M82 (Nov 2024) Australia]].
M83 (Sep 2025) Portugal (provisional).
M84 (May 2026) Netherlands (provisional).
Technical presentations in scheduled order
Wouter Swierstra, The functional essence of imperative binary search trees' (Monday, April 1 2024, 11:08 -- 12:10)
Algorithms on restructuring binary search trees are typically presented in imperative pseudocode. Understandably so, as their performance relies on in-place execution, rather than the repeated allocation of fresh nodes in memory. Unfortunately, these imperative algorithms are notoriously difficult to verify as their loop invariants must relate the unfinished tree fragments being rebalanced. This talk presents several novel functional algorithms for accessing and inserting elements in a restructuring binary search tree that are as fast as their imperative counterparts; yet the correctness of these functional algorithms is established using a simple inductive argument.
[[%ATTACHURL%/slides_wouter.pdf][slides]]
Josh Ko, Bottom-up construction of sublist trees using dependent types (Monday, April 1 2024, 13:32 -- 14:28)
At the last meeting in Oxford, Shin talked about deriving an ‘upgrade’ function used in a bottom-up algorithm for solving problems specified recursively over immediate sublists, for which there is also a natural but inefficient top-down algorithm. In this talk, we give precise types to the upgrade function and the two algorithms in Agda. The key component is an inductive family of trees that allows us to quantify over sublists of a particular length. The correctness of upgrade is verified by transcribing the Haskell program into Agda, and the two algorithms are equal simply because their type can be proved to be uniquely inhabited by parametricity.
[[%ATTACHURL%/slides_josh][slides]]
Pierre-Evariste Dagand, Rough Pearl: Manufacturing Cons-Cells: A dependently-typed riff on Okasaki's Chapter 9 (Monday, April 1 2024, 14:30 -- 15:56)
Ornaments were invented by !McBride as a systematic method to manufacture datatypes through data decoration and logical refinement while preserving the recursive structure of some underlying datatype. That story is often told by showing how lists (and, in turn, vectors) emerge from Peano numbers.
In his Chapter 9, Okasaki also tells a story relating Peano numbers (unary numbers) and lists. But then, he goes on to build datastructures from other numerical systems, which inspired Hinze in Haskell (with nested types) and Ko & Gibbons as well as Swierstra in Agda.
This talk proposes a tour of the design space of various numerical representations from the literature, in both French-style theorem proving and Scottish-style indexed programming.
[[%ATTACHURL%/slides_pierre][slides]]
Oleg Kiselyov, Lambek Grammars (Monday, April 1 2024, 15:56 -- 17:14)
Lambek Calculus and Grammars are rarely taught in CS courses, despite their strong logical foundations and despite being the first resource-sensitive calculus, proposed 30 years prior linear logic. Lambek Grammars are also `better' (lexicalized) as grammars, compared to the well-known Context-Free Grammars (CFG). Incidentally, AB grammars (a particular case of Lambek Grammars) were introduced before CFG.
This talk is a half-tutorial on AB and Lambek Grammars, citing sources and developing intuition: using arithmetic to describe syntax. We relate AB and Lambek Grammars to CFG, inviting to look at grammars from a rarely taken (in CS) point of view.
The second part of the talk is about Chomsky's conjecture that Lambek and Context-Free Grammars are equivalent. We give the intuition for why it took 30 years to settle, and what proved to be the key. The settlement, the famous Pentus result, proved the weak equivalence. We then demonstrate, from a very different standpoint, that under a reasonable restriction (which seems to hold for natural languages at least) Lambek Grammars are strongly equivalent to CFG.
Alexander Dinges, What's in a Bag (Tuesday, April 2 2024, 9:14 -- 9:51)
Bags are ubiquitous in program verification. They are the means of choice when we want to express that a collection of elements is a rearrangement of another collection. In this talk I present some approaches to define bags in Agda and argue that the best approach is to define bags as join lists together with an equivalence relation based on the commutative monoid laws.
[[%ATTACHURL%/slides_alexander.pdf][slides]]
Carroll Morgan, "Formal Methods, Informally" --- an overview of the text book (Tuesday, April 2 2024, 9:53 -- 10:34)
This book, on its way to publication, was written to accompany the "(In-)Formal Methods" course that has been given ~10 times at UNSW.
Its presentation of its material is somewhat atypical for Formal-Methods text, aiming not to instill complete rigour in program construction but rather to attract the attention of the "middle third" of Computer-Science students who would benefit from understanding the basic principles of assertions, invariants and static reasoning generally -without- needing to take a "prerequisite" course in logic etc beforehand, or even afterwards.
[[%ATTACHURL%/slides_carroll.pdf][slides]]
Ralf Hinze, Discovering concepts in category theory, (Tuesday, April 2 2024, 11:01 -- 12:22)
TBD
Niki Vazou, Design, implementation and mechanisation of dynamic policies, (Tuesday, April 2 2024, 13:31 -- 14:27)
In this talk, I present various interpretations of the security condition of dynamic policies, concretely, time transitive and no time transitive. I present dynLIO, en enforcement mechanism that extends LIO to ensure safety of IFC policies and discuss the development of the meta theory in Liquid Haskell.
[[%ATTACHURL%/slides_niki][slides]]
James !McKinna, Monoids, Actions & Wreath Products_ (Tuesday, April 2 2024, 14:31 -- 15:04)
We sometimes forget the importance in (functional) programming of not only isolating algebras of interest, but also the data on which they act.
This talk considers the so-called Wreath product construction, here of a monoid with a monoid action, by way of identifying the fundamental abstraction underlying Bernhard Möller's talk at #80, and also recent work-in-progress in reformulating a construction of Simon Gay (U Glasgow)
Tarmo Uustalu, A concurrent monad for shared state, (Tuesday, April 2 2024, 15:31 -- 16:25)
I insist that parallel composition is a control operator rather than an effect and promote Rivas and Jaskelioff's concurrent monads as a categorical structure axiomatizing not only sequential but also parallel composition of effectful compositions.
I exemplify this concept on the example of a concurrent monad for resumptions for shared state.
Zhenjiang Hu, Superfusion: Optmizing Functional Programs by Inductively Reframing Intermediate Data Structures, (Tuesday, April 2 2024, 16:27 -- 17:23)
Intermediate data structures are a common cause of inefficiency in functional programming. Fusion attempts to eliminate intermediate data structures, but existing fusion techniques are based on predefined rewrite rules and hence are limited in expressiveness.
In this talk, we report a different approach, called superfusion, to eliminating intermediate data structures, based on inductive program synthesis. Starting from a reference program annotated with data structures to be eliminated, superfusion first generates a sketch where program fragments operating on those data structures are replaced with holes; it then fills the holes with constant-time expressions such that the resulting program is equivalent to the reference. The main technical challenge is that all holes in the sketch have to be solved jointly, making the search space intractably large for naive enumeration.We address this challenge by first synthesizing a ghost function that describes the relationship between the original intermediate data structure and its compressed version; this function, although not used in the final program, serves to decompose the joint sketch filling problem into independent synthesis problems for each hole.
We have implemented superfusion in a tool called !SuFu (available at http://8.140.207.65/demo) and evaluate it on a dataset of 290 tasks collected from prior work on deductive fusion and program restructuring. The results show that !SuFu solves 264 out of 290 tasks, outperforming rewriting-based fusion systems and achieving comparable performance with specialized approaches to program restructuring on their respective domains.
[[%ATTACHURL%/slides_zhenjiang][slides]]
Liam O'Connor, Putting the Past Behind Us (but not forgetting it), (Wednesday, April 3 2024, 9:08 -- 10:02)
On both sides of the linear/branching time spectrum (LTL and CTL), I have observed a tendency towards future-oriented temporal logics. Perhaps this is because adding past operators does not change the expressivity of LTL, but even with a linear view on time, past operators can be exponentially more compact and provide a neat characterisation of safety properties. In the branching time case, past operators do add expressivity, but they also dramatically widen the design space: Should the past be considered branching, like the future? Or, should the past be considered linear, as the past is known but the future is not? In this talk, I show (with some handwaving) that linear past operators can be added to future-oriented logics by the mechanical process of taking the derivative of the (co)datatype used for models, giving models that include a (linear) “history” of one-hole-contexts (i.e. zippers).
[[%ATTACHURL%/slides_liam][slides]]
Tom Schrijvers, Bi-Parsers: Exact Printing with ASTs (Wednesday, April 3 2024, 10:04 -- 11:36)
Parsers and printers are both essential for language implementation. As they are tightly related, much research has been devoted to showing that both can be derived from a single definition. It, however, turns out to be challenging to extend this work with exact-printing, which recovers the original source text for a parsed syntax tree. In this paper, we propose a new approach to tackling the challenge that considers a parser-printer pair as a mechanism to synchronise the input text string with its AST, and formalises them as a bidirectional program (lens). We propose the first bi-parser framework to support exact-printing with abstract syntax trees, provide a library of combinators for common patterns, and demonstrate its usefulness with a bi-parser for a non-trivial expression language.
Jose Pedro Magalhaes, Functional Programming in Financial Markets (Wednesday, April 3 2024, 11:38 -- Thursday, April 4 2024, 9:44)
We present a case-study of using functional programming in the real world at a very large scale. At a large global financial institution, Haskell is used in a core software library supporting a business line with 5 billion USD operating income in 2023. Typed functional programming is used across the entire tech stack, including foundational APIs and CLIs for deal valuation and risk analysis, server-side components for long-running batches or sub-second RESTful services, and end-user GUIs. Thousands of users interact with software built using functional programming, and over one hundred write functional code.
In this talk we focus on how we leverage functional programming to orchestrate type-driven large-scale pricing workflows. The same API can be used to price one trade locally, or millions of trades across thousands of cloud nodes. Different parts of the computation can be run and inspected individually, and recomputing one part triggers recalculation of the dependent parts only. We build upon decades of research and experience in the functional programming community, relying on concepts such as monads, lenses, datatype generics, and closure serialisation. We conclude that the use of functional programming is one of the main drivers of the success of our project, and we see no significant downsides from it.
Slides not available, but they are an extended subset of [IFL'23 talk].
Jose Oliveira, 'How much is in a square?' An appraisal of relational thinking (Thursday, April 4 2024, 9:54 -- 11:31)
Experience in teaching functional programming on a relational basis has led me to focus on a graphical style of expression and reasoning in which a geometric construct shines: the (semi) commutative square.
Such squares compose and have a number of useful properties. Among several examples ranging over different application domains, 'free-theorem squares' are shown to be particularly elegant and productive. Helped by a little bit of Galois connections, a generic, induction-free theory for foldr and foldl is given, showing in particular that 'foldl f = foldr(flip f)' holds under conditions milder than usually advocated. ( [[3]])
Patrik Jansson, Tensors DSLs and Curved Space-Time (Thursday, April 4 2024, 11:33 -- 12:15; 13:30 -- 14:08)
[Joint work with Jean-Philippe Bernardy.] Tensor calculus uses a terse but effective language for expressing physical laws. It was instrumental already a century ago in the formulation of Einstein's general relativity. We have implemented two tensor DSLs embedded in Haskell, the conversions between them, and helper functions to view the tensors in Einstein index notation and as diagrams. As an example we express Einstein's General Relativity equation for the curvature of space-time and verify that the Schwarzschild metric tensor is a solution. [Based on a paper in submission: [[4][arXiv.org/abs/2312.02664/]], with some [[5][source code available]].]
[[%ATTACHURL%/Jansson_2024-04_Tensors.pdf][Jansson_2024-04_Tensors.pdf]]: talk slides
Matija Pretnar, ... (Thursday, April 4 2024, 14:13 -- 14:57)
Even though the mathematical core of algebraic effect handlers has remained unchanged, they have evolved into a more useful programming construct since their introduction. In the talk, I will talk about steps (and one missed opportunity!) on the way to their discovery, initial considerations behind their design, and lessons learnt along the way.
[[%ATTACHURL%/slides_matija.pdf][slides]]
Problem Solving Sessions
Thursday 15:30-17:30
* Practical equality in Agda (Ralf Hinze) * Binary numbers (Pierre-Evariste Dagand) * Sharing in Haskell (Andre Loeh) * Coin tossing (Sam Lindley)
Schedule
Sessions will start at 9:00 on Monday and finish at noon on Friday.
Monday, Tuesday, and Thursday, the schedule is as follows:
* session – 9:00 to 10:30
* coffee break – 10:30 to 11:00
* session – 11:00 to 12:15
* lunch – 12:15 to 13:30
* session – 13:30 to 15:00
* coffee break – 15:00 to 15:30
* session – 15:30 to 17:30
* dinner – starts at 18:00
Wednesday and Friday we will have sessions only in the morning:
* session – 9:00 to 10:30
* coffee break – 10:30 to 11:00
* session – 11:00 to 12:15
* lunch – 12:15 to 13:30
The Friday-morning session before the 10:30 coffee break is attended by members only.
-- Main.TomSchrijvers - 23 Sep 2023