skip to main content

A simple and efficient implementation of strong call by need by an abstract machine

Published:31 August 2022Publication History
Skip Abstract Section

Abstract

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 been done with the use of an off-the-shelf transformation tool implementing the "functional correspondence" between higher-order interpreters and abstract machines, and it yields a simple and concise description of the machine. We prove that the resulting machine conservatively extends the lazy version of Krivine machine for the weak call-by-need strategy, and that it simulates the normal-order strategy in bilinear number of steps.

References

  1. Beniamino Accattoli. 2016. The Useful MAM, a Reasonable Implementation of the Strong λ -Calculus. In Logic, Language, Information, and Computation - 23rd International Workshop, WoLLIC 2016, Puebla, Mexico, August 16-19th, 2016. Proceedings (Lecture Notes in Computer Science, Vol. 9803). Springer, 1–21. https://doi.org/10.1007/978-3-662-52921-8_1 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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. isbn:978-1-4503-5291-8 https://doi.org/10.1145/3131851.3131855 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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.23 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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.9470630 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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)2016 Google ScholarGoogle ScholarCross RefCross Ref
  6. 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.002 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Beniamino Accattoli and Maico Leberle. 2022. Useful Open Call-By-Need. In 30th EACSL Annual Conference on Computer Science Logic, CSL 2022, February 14-19, 2022, Göttingen, Germany (Virtual Conference), Florin Manea and Alex Simpson (Eds.) (LIPIcs, Vol. 216). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 4:1–4:21. https://doi.org/10.4230/LIPIcs.CSL.2022.4 Google ScholarGoogle ScholarCross RefCross Ref
  8. Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. 2003. A functional correspondence between evaluators and abstract machines. In Proceedings of the 5th International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, 27-29 August 2003, Uppsala, Sweden. ACM, 8–19. https://doi.org/10.1145/888251.888254 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Mads Sig Ager, Olivier Danvy, and Jan Midtgaard. 2004. A functional correspondence between call-by-need evaluators and lazy abstract machines. Inf. Process. Lett., 90, 5 (2004), 223–232. https://doi.org/10.1016/j.ipl.2004.02.012 Extended version available as the research report BRICS RS-04-3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Zena M. Ariola, Matthias Felleisen, John Maraist, Martin Odersky, and Philip Wadler. 1995. The Call-by-Need Lambda Calculus. In Conference Record of POPL’95: 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, San Francisco, California, USA, January 23-25, 1995, Ron K. Cytron and Peter Lee (Eds.). ACM Press, 233–246. https://doi.org/10.1145/199448.199507 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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/3110264 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Thibaut Balabonski, Antoine Lanco, and Guillaume Melquiond. 2021. A Strong Call-By-Need Calculus. In 6th International Conference on Formal Structures for Computation and Deduction, FSCD 2021, July 17-24, 2021, Buenos Aires, Argentina (Virtual Conference), Naoki Kobayashi (Ed.) (LIPIcs, Vol. 195). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 9:1–9:22. https://doi.org/10.4230/LIPIcs.FSCD.2021.9 Google ScholarGoogle ScholarCross RefCross Ref
  13. Pablo Barenbaum, Eduardo Bonelli, and Kareem Mohamed. 2018. Pattern Matching and Fixed Points: Resource Types and Strong Call-By-Need: Extended Abstract. In Proceedings of the 20th International Symposium on Principles and Practice of Declarative Programming, PPDP 2018, Frankfurt am Main, Germany, September 03-05, 2018, David Sabel and Peter Thiemann (Eds.). ACM, 6:1–6:12. https://doi.org/10.1145/3236950.3236972 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Mał gorzata 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, Bruno C. d. S. Oliveira (Ed.) (Lecture Notes in Computer Science, Vol. 12470). Springer, 147–166. https://doi.org/10.1007/978-3-030-64437-6_8 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Mał gorzata 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, Herman Geuvers (Ed.) (LIPIcs, Vol. 131). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 8:1–8:20. https://doi.org/10.4230/LIPIcs.FSCD.2019.8 Google ScholarGoogle ScholarCross RefCross Ref
  16. Mał gorzata Biernacka, Witold Charatonik, and Tomasz Drab. 2021. A Derived Reasonable Abstract Machine for Strong Call by Value. In 23rd International Symposium on Principles and Practice of Declarative Programming (PPDP 2021). Association for Computing Machinery, New York, NY, USA. Article 6, 14 pages. isbn:9781450386890 https://doi.org/10.1145/3479394.3479401 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Mał gorzata Biernacka, Witold Charatonik, and Tomasz Drab. 2022. Abstract Machines Workshop. https://doi.org/10.5281/zenodo.6786796 (software artifact) Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Mał gorzata Biernacka, Witold Charatonik, and Tomasz Drab. 2022. The Zoo of Lambda-Calculus Reduction Strategies, and Coq. In 13th International Conference on Interactive Theorem Proving, ITP 2022, July 7 to 10, 2022, Haifa, Israel, June Andronick and Leonardo de Moura (Eds.) (LIPIcs, Vol. 237). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 7:1–7:19. https://doi.org/10.4230/LIPIcs.ITP.2022.7 Google ScholarGoogle ScholarCross RefCross Ref
  19. Mał gorzata 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, Dale Miller (Ed.) (LIPIcs, Vol. 84). Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 10:1–10:17. isbn:978-3-95977-047-7 https://doi.org/10.4230/LIPIcs.FSCD.2017.10 Google ScholarGoogle ScholarCross RefCross Ref
  20. Mał gorzata Biernacka and Olivier Danvy. 2007. A Syntactic Correspondence between Context-Sensitive Calculi and Abstract Machines. Theor. Comput. Sci., 375, 1-3 (2007), 76–108. https://doi.org/10.1016/j.tcs.2006.12.028 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Maciej Buszka and Dariusz Biernacki. 2021. Automating the Functional Correspondence Between Higher-Order Evaluators and Abstract Machines. In Logic-Based Program Synthesis and Transformation - 31st International Symposium, LOPSTR 2021, Tallinn, Estonia, September 7-8, 2021, Proceedings, Emanuele De Angelis and Wim Vanhoof (Eds.) (Lecture Notes in Computer Science, Vol. 13290). Springer, 38–59. https://doi.org/10.1007/978-3-030-98869-2_3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Stephen Chang and Matthias Felleisen. 2012. The Call-by-Need Lambda Calculus, Revisited. In Programming Languages and Systems - 21st European Symposium on Programming, ESOP 2012, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, Tallinn, Estonia, March 24 - April 1, 2012. Proceedings, Helmut Seidl (Ed.) (Lecture Notes in Computer Science, Vol. 7211). Springer, 128–147. https://doi.org/10.1007/978-3-642-28869-2_7 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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, Ekaterina Komendantskaya (Ed.). ACM, 9:1–9:14. https://doi.org/10.1145/3354166.3354174 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Pierre Crégut. 2007. Strongly reducing variants of the Krivine abstract machine. High. Order Symb. Comput., 20, 3 (2007), 209–230. https://doi.org/10.1007/s10990-007-9015-z A preliminary version was presented at the 1990 ACM Conference on Lisp and Functional Programming Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Olivier Danvy and Ian Zerny. 2013. A Synthetic Operational Account of Call-by-need Evaluation. In Proceedings of the 15th Symposium on Principles and Practice of Declarative Programming (PPDP ’13). ACM, New York, NY, USA. 97–108. isbn:978-1-4503-2154-9 https://doi.org/10.1145/2505879.2505898 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Matthias Felleisen and Robert Hieb. 1992. The Revised Report on the Syntactic Theories of Sequential Control and State. Theor. Comput. Sci., 103, 2 (1992), 235–271. https://doi.org/10.1016/0304-3975(92)90014-7 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Andrzej Filinski and Henning Korsholm Rohde. 2005. Denotational aspects of untyped normalization by evaluation. RAIRO Theor. Informatics Appl., 39, 3 (2005), 423–453. https://doi.org/10.1051/ita:2005026 A preliminary version was presented at FOSSACS 2004 Google ScholarGoogle ScholarCross RefCross Ref
  28. Álvaro García-Pérez and Pablo Nogueira. 2014. On the syntactic and functional correspondence between hybrid (or layered) normalisers and abstract machines. Sci. Comput. Program., 95 (2014), 176–199. https://doi.org/10.1016/j.scico.2014.05.011 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Simon L. Peyton Jones. 1992. Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-Machine. J. Funct. Program., 2, 2 (1992), 127–202. https://doi.org/10.1017/S0956796800000319 Google ScholarGoogle ScholarCross RefCross Ref
  30. John Launchbury. 1993. A Natural Semantics for Lazy Evaluation. In Conference Record of the Twentieth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Charleston, South Carolina, USA, January 1993, Mary S. Van Deusen and Bernard Lang (Eds.). ACM Press, 144–154. https://doi.org/10.1145/158511.158618 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Johan Munk. 2007. A Study of Syntactic and Semantic Artifacts and its Application to Lambda Definability, Strong Normalization, and Weak Normalization in the Presence of State. Master’s thesis. DAIMI, Department of Computer Science, Aarhus University. Aarhus, Denmark. https://www.brics.dk/RS/08/3/BRICS-RS-08-3.pdf BRICS research report RS-08-3 Google ScholarGoogle Scholar
  32. Chris Okasaki. 1999. Purely functional data structures. Cambridge University Press. isbn:978-0-521-66350-2 https://doi.org/10.1017/CBO9780511530104 Google ScholarGoogle ScholarCross RefCross Ref
  33. Maciej Piróg and Dariusz Biernacki. 2010. A systematic derivation of the STG machine verified in Coq. In Proceedings of the 3rd ACM SIGPLAN Symposium on Haskell, Haskell 2010, Baltimore, MD, USA, 30 September 2010, Jeremy Gibbons (Ed.). ACM, 25–36. https://doi.org/10.1145/1863523.1863528 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Peter Sestoft. 1997. Deriving a Lazy Abstract Machine. J. Funct. Program., 7, 3 (1997), May, 231–264. https://doi.org/10.1017/s0956796897002712 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A simple and efficient implementation of strong call by need by an abstract machine

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Article Metrics

      • Downloads (Last 12 months)371
      • Downloads (Last 6 weeks)21

      Other Metrics

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!