ABSTRACT
We present an efficient implementation of the full-reducing call-by-value strategy for the pure λ-calculus in the form of an abstract machine. The presented machine has been systematically derived using Danvy et al.’s functional correspondence that connects higher-order interpreters with abstract-machine models by a well-established transformation technique. It improves on a previously presented machine by Biernacka et al. in terms of efficiency: the new machine simulates β-reduction with the overhead polynomial in the number of β-steps and in the size of the initial term. Thus, the machine makes a “reasonable” (in the sense of Accattoli et al.) implementation of Strong CbV.
We prove correctness and reasonability of the machine. The latter property is shown using a form of amortized cost analysis à la Okasaki.
- Beniamino Accattoli. 2019. A Fresh Look at the lambda-Calculus (Invited Talk). In 4th International Conference on Formal Structures for Computation and Deduction, FSCD 2019, June 24-30, 2019, Dortmund, Germany(LIPIcs, Vol. 131), Herman Geuvers (Ed.). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 1:1–1:20. https://doi.org/10.4230/LIPIcs.FSCD.2019.1Google Scholar
- Beniamino Accattoli and Bruno Barras. 2017. Environments and the complexity of abstract machines. In Proceedings of the 19th International Symposium on Principles and Practice of Declarative Programming (PPDP’17), Namur, Belgium, October 09 - 11, 2017, Wim Vanhoof and Brigitte Pientka (Eds.). ACM, 4–16. https://doi.org/10.1145/3131851.3131855Google ScholarDigital Library
- Beniamino Accattoli and Claudio Sacerdoti Coen. 2015. On the Relative Usefulness of Fireballs. In 30th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Japan, July 6-10, 2015. IEEE Computer Society, 141–155. https://doi.org/10.1109/LICS.2015.23Google ScholarDigital Library
- Beniamino Accattoli, Andrea Condoluci, and Claudio Sacerdoti Coen. 2021. Strong Call-by-Value is Reasonable, Implosively. In 36th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2021, Rome, Italy, June 29 - July 2, 2021. IEEE, 1–14. https://doi.org/10.1109/LICS52264.2021.9470630Google ScholarDigital Library
- Beniamino Accattoli, Andrea Condoluci, Giulio Guerrieri, and Claudio Sacerdoti Coen. 2019. Crumbling Abstract Machines. In Proceedings of the 21st International Symposium on Principles and Practice of Programming Languages, PPDP 2019, Porto, Portugal, October 7-9, 2019, Ekaterina Komendantskaya (Ed.). ACM, 4:1–4:15. https://doi.org/10.1145/3354166.3354169Google ScholarDigital Library
- Beniamino Accattoli and Ugo Dal Lago. 2012. On the Invariance of the Unitary Cost Model for Head Reduction. In 23rd International Conference on Rewriting Techniques and Applications (RTA’12), RTA 2012, May 28 - June 2, 2012, Nagoya, Japan(LIPIcs, Vol. 15), Ashish Tiwari (Ed.). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 22–37. https://doi.org/10.4230/LIPIcs.RTA.2012.22Google Scholar
- Beniamino Accattoli and Ugo Dal Lago. 2016. (Leftmost-Outermost) Beta Reduction is Invariant, Indeed, In Logical Methods in Computer Science. Logical Methods in Computer Science 12. https://doi.org/10.2168/LMCS-12(1:4)2016Google Scholar
- Beniamino Accattoli and Giulio Guerrieri. 2016. Open Call-by-Value. In Programming Languages and Systems - 14th Asian Symposium, APLAS 2016, Hanoi, Vietnam, November 21-23, 2016, Proceedings(Lecture Notes in Computer Science, Vol. 10017), Atsushi Igarashi (Ed.). 206–226. https://doi.org/10.1007/978-3-319-47958-3_12Google Scholar
- Beniamino Accattoli and Giulio Guerrieri. 2019. Abstract machines for Open Call-by-Value. Sci. Comput. Program. 184 (2019). https://doi.org/10.1016/j.scico.2019.03.002Google ScholarDigital Library
- Klaus Aehlig and Felix Joachimski. 2004. Operational Aspects of Untyped Normalization by Evaluation. Mathematical Structures in Computer Science 14 (2004), 587–611.Google ScholarDigital Library
- Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. 2003. From Interpreter to Compiler and Virtual Machine: a Functional Derivation. Technical Report BRICS RS-03-14. DAIMI, Department of Computer Science, Aarhus University, Aarhus, Denmark.Google Scholar
- Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. 2003. A Functional Correspondence between Evaluators and Abstract Machines. In Proceedings of the Fifth ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP’03), Dale Miller (Ed.). ACM Press, Uppsala, Sweden, 8–19.Google ScholarDigital Library
- Thibaut Balabonski, Pablo Barenbaum, Eduardo Bonelli, and Delia Kesner. 2017. Foundations of strong call by need. PACMPL 1, ICFP (2017), 20:1–20:29. https://doi.org/10.1145/3110264Google ScholarDigital Library
- Malgorzata Biernacka, Dariusz Biernacki, Witold Charatonik, and Tomasz Drab. 2020. An Abstract Machine for Strong Call by Value. In Programming Languages and Systems - 18th Asian Symposium, APLAS 2020, Fukuoka, Japan, November 30 - December 2, 2020, Proceedings(Lecture Notes in Computer Science, Vol. 12470), Bruno C. d. S. Oliveira (Ed.). Springer, 147–166. https://doi.org/10.1007/978-3-030-64437-6_8Google ScholarDigital Library
- Malgorzata Biernacka and Witold Charatonik. 2019. Deriving an Abstract Machine for Strong Call by Need. In 4th International Conference on Formal Structures for Computation and Deduction, FSCD 2019, June 24-30, 2019, Dortmund, Germany(LIPIcs, Vol. 131), Herman Geuvers (Ed.). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 8:1–8:20. https://doi.org/10.4230/LIPIcs.FSCD.2019.8Google Scholar
- Malgorzata Biernacka, Witold Charatonik, and Klara Zielinska. 2017. Generalized Refocusing: From Hybrid Strategies to Abstract Machines. In 2nd International Conference on Formal Structures for Computation and Deduction, FSCD 2017, September 3-9, 2017, Oxford, UK(LIPIcs, Vol. 84), Dale Miller(Ed.). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 10:1–10:17. https://doi.org/10.4230/LIPIcs.FSCD.2017.10Google Scholar
- Andrea Condoluci, Beniamino Accattoli, and Claudio Sacerdoti Coen. 2019. Sharing Equality is Linear. In Proceedings of the 21st International Symposium on Principles and Practice of Programming Languages, PPDP 2019, Porto, Portugal, October 7-9, 2019. 9:1–9:14. https://doi.org/10.1145/3354166.3354174Google ScholarDigital Library
- Pierre Crégut. 2007. Strongly Reducing Variants of the Krivine Abstract Machine. Higher-Order and Symbolic Computation 20, 3 (2007), 209–230. A preliminary version was presented at the 1990 ACM Conference on Lisp and Functional Programming.Google ScholarDigital Library
- Ugo Dal Lago and Beniamino Accattoli. 2017. Encoding Turing Machines into the Deterministic Lambda-Calculus. CoRR abs/1711.10078(2017). arxiv:1711.10078http://arxiv.org/abs/1711.10078Google Scholar
- Andrzej Filinski and Henning Korsholm Rohde. 2005. Denotational Aspects of Untyped Normalization by Evaluation. Theoretical Informatics and Applications 39, 3 (2005), 423–453. A preliminary version was presented at FOSSACS 2004.Google ScholarCross Ref
- Yannick Forster, Fabian Kunze, and Marc Roth. 2020. The weak call-by-value λ-calculus is reasonable for both time and space. Proc. ACM Program. Lang. 4, POPL (2020), 27:1–27:23. https://doi.org/10.1145/3371095Google ScholarDigital Library
- A García-Pérez and Pablo Nogueira. 2014. On the syntactic and functional correspondence between hybrid (or layered) normalisers and abstract machines. Science of Computer Programming 95 (2014), 176–199.Google ScholarDigital Library
- Benjamin Grégoire and Xavier Leroy. 2002. A compiled implementation of strong reduction. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02), Pittsburgh, Pennsylvania, USA, October 4-6, 2002, Mitchell Wand and Simon L. Peyton Jones (Eds.). ACM, 235–246. https://doi.org/10.1145/581478.581501Google ScholarDigital Library
- J. D. Hunter. 2007. Matplotlib: A 2D graphics environment. Computing in Science & Engineering 9, 3 (2007), 90–95. https://doi.org/10.1109/MCSE.2007.55Google ScholarDigital Library
- Xavier Leroy, Damien Doligez, Alain Frisch, Jacques Garrigue, Didier Rémy, and Jérôme Vouillon. 2020. The OCaml system, release 4.10. INRIA, Rocquencourt, France. https://caml.inria.fr/pub/docs/manual-ocaml/Google Scholar
- Chris Okasaki. 1999. Purely functional data structures. Cambridge University Press.Google ScholarDigital Library
- Peter Sestoft. 2002. Demonstrating Lambda Calculus Reduction. In The Essence of Computation, Complexity, Analysis, Transformation. Essays Dedicated to Neil D. Jones [on occasion of his 60th birthday](Lecture Notes in Computer Science, 2566), Torben Æ. Mogensen, David A. Schmidt, and Ivan Hal Sudborough (Eds.). Springer, 420–435. https://doi.org/10.1007/3-540-36377-7_19Google Scholar
- Cees F. Slot and Peter van Emde Boas. 1984. On Tape Versus Core; An Application of Space Efficient Perfect Hash Functions to the Invariance of Space. In Proceedings of the 16th Annual ACM Symposium on Theory of Computing, April 30 - May 2, 1984, Washington, DC, USA, Richard A. DeMillo (Ed.). ACM, 391–400. https://doi.org/10.1145/800057.808705Google ScholarDigital Library
Index Terms
- A Derived Reasonable Abstract Machine for Strong Call by Value
Recommendations
A simple and efficient implementation of strong call by need by an abstract machine
We present an abstract machine for a strong call-by-need strategy in the lambda calculus. The machine has been derived automatically from a higher-order evaluator that uses the technique of memothunks to implement laziness. The derivation has ...
An Abstract Machine for Strong Call by Value
Programming Languages and SystemsAbstractWe present an abstract machine that implements a full-reducing (a.k.a. strong) call-by-value strategy for pure -calculus. It is derived using Danvy et al.’s functional correspondence from Crégut’s KN by: (1) deconstructing KN to a call-by-name ...
Call-by-push-value in Coq: operational, equational, and denotational theory
CPP 2019: Proceedings of the 8th ACM SIGPLAN International Conference on Certified Programs and ProofsCall-by-push-value (CBPV) is an idealised calculus for functional and imperative programming, introduced as a subsuming paradigm for both call-by-value (CBV) and call-by-name (CBN). We formalise weak and strong operational semantics for (effect-free) ...
Comments