Abstract
Call-by-need evaluation, also known as lazy evaluation, provides two key benefits: compositional programming and infinite data. The standard semantics for laziness is Launchbury’s natural semantics DBLP:conf/popl/Launchbury93, which uses a heap to memoise the results of delayed evaluations. However, the stateful nature of this heap greatly complicates reasoning about the operational behaviour of lazy programs. In this article, we propose an alternative semantics for laziness, clairvoyant evaluation, that replaces the state effect with nondeterminism, and prove this semantics equivalent in a strong sense to the standard semantics. We show how this new semantics greatly simplifies operational reasoning, admitting much simpler proofs of a number of results from the literature, and how it leads to the first denotational cost semantics for lazy evaluation.
Supplemental Material
- Zena M Ariola and Matthias Felleisen. 1997. The Call-By-Need Lambda Calculus. Journal of Functional Programming 7, 3 (1997). Google Scholar
Digital Library
- Zena M. Ariola, Matthias Felleisen, John Maraist, Martin Odersky, and Philip Wadler. 1995. A Call-by-Need Lambda Calculus. In Principles of Programming Languages. Google Scholar
Digital Library
- Richard S. Bird. 1984. Using Circular Programs to Eliminate Multiple Traversals of Data. Acta Informatica 21, 3 (1984). Google Scholar
Digital Library
- Bror Bjerner and Sören Holmström. 1989. A Composition Approach to Time Analysis of First Order Lazy Functional Programs. In International Conference on Functional Programming Languages and Computer Architecture. Google Scholar
Digital Library
- Bernd Braßel, Michael Hanus, Sebastian Fischer, Frank Huch, and Germán Vidal. 2007. Lazy Call-By-Value Evaluation. In ACM SIGPLAN Notices, Vol. 42. ACM, 265–276. Google Scholar
Digital Library
- Norman Danner, Daniel R. Licata, and Ramyaa Ramyaa. 2015. Denotational Cost Semantics for Functional Languages with Inductive Types. In International Conference on Functional Programming. Google Scholar
Digital Library
- Dan R. Ghica. 2005. Slot Games: A Quantitative Model of Computation. In Principles of Programming Languages. Google Scholar
Digital Library
- Jörgen Gustavsson and David Sands. 1999. A Foundation for Space-Safe Transformations of Call-by-Need Programs. Electronic Notes on Theoretical Computer Science 26 (1999).Google Scholar
- Jörgen Gustavsson and David Sands. 2001. Possibilities and Limitations of Call-by-Need Space Improvement. In International Conference on Functional Programming. Google Scholar
Digital Library
- Jennifer Hackett and Graham Hutton. 2014. Worker/Wrapper/Makes It/Faster. In International Conference on Functional Programming. Google Scholar
Digital Library
- Jennifer Hackett and Graham Hutton. 2018. Parametric Polymorphism and Operational Improvement. Proceedings of the ACM on Programming Languages 2, ICFP, Article 68 (2018). Google Scholar
Digital Library
- Peter Henderson and James H Morris. 1976. A Lazy Evaluator. In Principles on Programming Languages. Google Scholar
Digital Library
- Catherine Hope. 2008. A Functional Semantics for Space and Time. Ph.D. Dissertation. University of Nottingham.Google Scholar
- John Hughes. 1989. Why Functional Programming Matters. Comput. J. 32, 2 (1989). Google Scholar
Digital Library
- J. M. E. Hyland and C.-H.L. Ong. 2000. On Full Abstraction for PCF: I, II, and III. Information and Computation 163, 2 (2000). Google Scholar
Digital Library
- Mark B. Josephs. 1989. The Semantics of Lazy Functional Languages. Theoretical Computer Science 68, 1 (1989). Google Scholar
Digital Library
- Steffen Jost, Kevin Hammond, Hans-Wolfgang Loidl, and Martin Hofmann. 2010. Static Determination of Quantitative Resource Usage for Higher-Order Programs. In ACM SIGPLAN Notices, Vol. 45. Google Scholar
Digital Library
- John Launchbury. 1993. A Natural Semantics for Lazy Evaluation. In Principles of Programming Languages. Google Scholar
Digital Library
- John Maraist, Martin Odersky, David N. Turner, and Philip Wadler. 1999. Call-By-Name, Call-By-Value, Call-By-Need and the Linear Lambda Calculus. Theoretical Computer Science 228, 1-2 (1999). Google Scholar
Digital Library
- John Maraist, Martin Odersky, and Philip Wadler. 1998. The Call-by-Need Lambda Calculus. Journal of Functional Programming 8, 3 (1998). Google Scholar
Digital Library
- Andrew Moran and David Sands. 1999a. Improvement in a Lazy Context: An Operational Theory for Call-by-Need. (1999). Extended version of { Moran and Sands 1999b }, available at http://tinyurl.com/ohuv8ox .Google Scholar
- Andrew Moran and David Sands. 1999b. Improvement in a Lazy Context: An Operational Theory for Call-by-Need. In Principles of Programming Languages. Google Scholar
Digital Library
- James Hiram Morris. 1969. Lambda-Calculus Models of Programming Languages. Ph.D. Dissertation. MIT.Google Scholar
- Keiko Nakata. 2010. Denotational Semantics for Lazy Initialization of letrec. In Fixed Points in Computer Science.Google Scholar
- Chris Okasaki. 1999. Purely Functional Data Structures. Cambridge University Press. Google Scholar
Digital Library
- Andrew M Pitts. 2000. Operational Semantics and Program Equivalence. In International Summer School on Applied Semantics. Springer, 378–412. Google Scholar
Digital Library
- Mads Rosendahl. 1989. Automatic Complexity Analysis. In Functional Programming Languages and Computer Architecture. Google Scholar
Digital Library
- David Sands. 1991. Operational Theories of Improvement in Functional Languages. In Glasgow Workshop on Functional Programming. Google Scholar
Digital Library
- David Sands. 1997. Improvement Theory and its Applications. In Higher Order Operational Techniques in Semantics, Publications of the Newton Institute. Cambridge University Press. Google Scholar
Digital Library
- Patrick M. Sansom and Simon L. Peyton Jones. 1997. Formally Based Profiling for Higher-Order Functional Languages. ACM Transactions on Programming Languages and Systems 19, 2 (1997). Google Scholar
Digital Library
- Manfred Schmidt-Schauß and Nils Dallmeyer. 2018. Space Improvements and Equivalences in a Functional Core Language. arXiv preprint arXiv:1802.06498 (2018).Google Scholar
- Manfred Schmidt-Schauß and David Sabel. 2015a. Improvements in a Functional Core Language with Call-By-Need Operational Semantics. In Principles and Practice of Declarative Programming. Google Scholar
Digital Library
- Manfred Schmidt-Schauß and David Sabel. 2015b. Sharing-Aware Improvements in a Call-by-Need Functional Core Language. In Implementation and Application of Functional Programming Languages. Google Scholar
Digital Library
- Daniel Seidel and Janis Voigtländer. 2011. Improvements for Free. In Quantitative Aspects of Programming Languages.Google Scholar
- Hugo Simões, Pedro Vasconcelos, Mário Florido, Steffen Jost, and Kevin Hammond. 2012. Automatic Amortised Analysis of Dynamic Memory Allocation for Lazy Functional Programs. In International Conference on Functional Programming. Google Scholar
Digital Library
- David A Turner. 1982. Recursion Equations as a Programming Language. In Functional Programming and its Applications: An Advanced Course. Cambridge University Press.Google Scholar
- Philip Wadler and John Hughes. 1987. Projections for Strictness Analysis. In Functional Programming Languages and Computer Architecture. Google Scholar
Digital Library
Index Terms
Call-by-need is clairvoyant call-by-value
Recommendations
Classical call-by-need and duality
TLCA'11: Proceedings of the 10th international conference on Typed lambda calculi and applicationsWe study call-by-need from the point of view of the duality between call-by-name and call-by-value. We develop sequent-calculus style versions of call-by-need both in the minimal and classical case. As a result, we obtain a natural extension of call-by-...
Classical By-Need
Proceedings of the 25th European Symposium on Programming Languages and Systems - Volume 9632Call-by-need calculi are complex to design and reason with. When adding control effects, the very notion of canonicity is irremediably lost, the resulting calculi being necessarily ad hoc. This calls for a design of call-by-need guided by logical rather ...
Classical call-by-need sequent calculi: the unity of semantic artifacts
FLOPS'12: Proceedings of the 11th international conference on Functional and Logic ProgrammingWe systematically derive a classical call-by-need sequent calculus, which does not require an unbounded search for the standard redex, by using the unity of semantic artifacts proposed by Danvy <em>et al.</em> The calculus serves as an intermediate step ...






Comments