Reasoning about the garden of forking paths
Open Access
- 19 August 2021
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 5 (ICFP) , 1-28
Abstract
Lazy evaluation is a powerful tool for functional programmers. It enables the concise expression of on-demand computation and a form of compositionality not available under other evaluation strategies. However, the stateful nature of lazy evaluation makes it hard to analyze a program's computational cost, either informally or formally. In this work, we present a novel and simple framework for formally reasoning about lazy computation costs based on a recent model of lazy evaluation: clairvoyant call-by-value. The key feature of our framework is its simplicity, as expressed by our definition of the clairvoyance monad. This monad is both simple to define (around 20 lines of Coq) and simple to reason about. We show that this monad can be effectively used to mechanically reason about the computational cost of lazy functional programs written in Coq.Keywords
All Related Versions
Funding Information
- NSF (1521539,2006535)
This publication has 42 references indexed in Scilit:
- Evaluation strategies for monadic computationsElectronic Proceedings in Theoretical Computer Science, 2012
- Hoare type theory, polymorphism and separationJournal of Functional Programming, 2008
- Call-by-name, Call-by-value, Call-by-need, and the Linear Lambda CalculusElectronic Notes in Theoretical Computer Science, 1995
- Comprehending monadsMathematical Structures in Computer Science, 1992
- Notions of computation and monadsInformation and Computation, 1991
- The semantics of lazy functional languagesTheoretical Computer Science, 1989
- Why Functional Programming MattersThe Computer Journal, 1989
- A novel representation of lists and its application to the function “reverse”Information Processing Letters, 1986
- Guarded commands, nondeterminacy and formal derivation of programsCommunications of the ACM, 1975
- An axiomatic basis for computer programmingCommunications of the ACM, 1969