Conjuring Fusion Laws via Relational Calculus
Open Access
- 1 January 2023
- journal article
- research article
- Published by Information Processing Society of Japan in Journal of Information Processing
- Vol. 31, 21-32
Abstract
Wadler demonstrated that several laws, called “free theorems”, about polymorphic functions can be derived from their types alone. Free theorems form the foundations of many program transformations, including function fusions particularly. Walder's approach requires systematic but cumbersome reasoning, which makes it difficult for non-experts to apply. To alleviate this problem, Voigtländer proposed a conjuring lemma. This lemma derives free theorems from an expression containing polymorphic functions but whose type does not contain polymorphic type variables. Unfortunately, it cannot derive function fusion laws. In this work, we generalize the conjuring lemma on the basis of Bird and de Moor's relational calculus. This calculus uses non-deterministic computations for uniformly describing and thereby relating specifications and implementations. To make the generalized conjuring lemma easier to use, we develop simpler corollaries by borrowing intuitions from the worker/wrapper transformations. The effectiveness of our approach is demonstrated through experiments with the derivation of three well-known fusion laws. While the original conjuring lemma cannot derive any of them, the generalization can systematically derive all.Keywords
This publication has 36 references indexed in Scilit:
- A short cut to parallelization theoremsACM SIGPLAN Notices, 2013
- Relating computational effects by ⊤⊤-liftingInformation and Computation, 2013
- Proceedings Ninth Workshop on Quantitative Aspects of Programming LanguagesElectronic Proceedings in Theoretical Computer Science, 2011
- Factorising folds for faster functionsJournal of Functional Programming, 2010
- Relational Parametricity for Computational EffectsLogical Methods in Computer Science, 2009
- The worker/wrapper transformationJournal of Functional Programming, 2009
- When is a function a fold or an unfold?Electronic Notes in Theoretical Computer Science, 2001
- Parametric polymorphism and operational equivalenceMathematical Structures in Computer Science, 2000
- Functional PearlsJournal of Functional Programming, 1996
- Functional programming with bananas, lenses, envelopes and barbed wire1991