A synthetic operational account of call-by-need evaluation

Research output: Contribution to book/anthology/report/proceedingArticle in proceedingsResearchpeer-review

We present the first operational account of call by need that connects syntactic theory and implementation practice. Syntactic theory: the storeless operational semantics using syntax rewriting to account for demand-driven computation and for caching intermediate results. Implementational practice: the store-based operational technique using memo-thunks to implement demand-driven computation and to cache intermediate results for subsequent sharing. The implementational practice was initiated by Landin and Wadsworth and is prevalent today to implement lazy programming languages such as Haskell. The syntactic theory was initiated by Ariola, Felleisen, Maraist, Odersky and Wadler and is prevalent today to reason equationally about lazy programs, on par with Barendregt et al.'s term graphs. Nobody knows, however, how the theory of call by need compares to the practice of call by need: all that is known is that the theory of call by need agrees with the theory of call by name, and that the practice of call by need optimizes the practice of call by name.

Our operational account takes the form of three new calculi for lazy evaluation of lambda-terms and our synthesis takes the form of three lock-step equivalences. The first calculus is a hereditarily compressed variant of Ariola et al.'s call-by-need lambda-calculus and makes "neededness" syntactically explicit. The second calculus distinguishes between strict bindings (which are induced by demand-driven computation) and non-strict bindings (which are used for caching intermediate results). The third calculus uses memo-thunks and an algebraic store. The first calculus syntactically corresponds to a storeless abstract machine, the second to an abstract machine with local stores, and the third to a lazy Krivine machine, i.e., a traditional store-based abstract machine implementing lazy evaluation. The machines are intensionally compatible with extensional reasoning about lazy programs and they are lock-step equivalent. Each machine functionally corresponds to a natural semantics for call by need in the style of Launchbury, though for non-preprocessed λ-terms.

Our results reveal a genuine and principled unity of computational theory and computational practice, one that readily applies to variations on the general theme of call by need.
Original languageEnglish
Title of host publicationProceedings of the 15th Symposium on Principles and Practice of Declarative Programming, PPDP '13
EditorsRicardo Peña , Tom Schrijvers
Number of pages12
PublisherAssociation for Computing Machinery
Publication year2013
Pages97-108
ISBN (print) 978-1-4503-2154-9
DOIs
Publication statusPublished - 2013
EventSymposium on Principles and Practice of Declarative Programming - Madrid, Spain
Duration: 16 Sep 201318 Sep 2013
Conference number: 15

Conference

ConferenceSymposium on Principles and Practice of Declarative Programming
Nummer15
LandSpain
ByMadrid
Periode16/09/201318/09/2013

See relations at Aarhus University Citationformats

ID: 56478798