Reasoning about the Garden of Forking Paths

被引:4
|
作者
Li, Yao [1 ]
Xia, Li-yao [1 ]
Weirich, Stephanie [1 ]
机构
[1] Univ Penn, 3330 Walnut St, Philadelphia, PA 19104 USA
基金
美国国家科学基金会;
关键词
formal verification; computation cost; lazy evaluation; monad;
D O I
10.1145/3473585
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页数:28
相关论文
共 50 条