一句话:提出 calf 成本感知逻辑框架,以依赖类型论统一程序行为与成本推理,并在 Agda 中机器化验证算法复杂度。
论文研究如何在一个统一的逻辑框架中推理函数式程序的定量成本。作者受模态相区分工作启发,提出 calf——一个成本感知逻辑框架,将程序成本结构刻画为计算效应,并在内涵与外延之间引入相区分,使成本感知程序满足输入/输出行为不依赖成本的非干涉性质。calf 是全程依赖类型论,可用同一语言编程并规约成本与行为,并能与类型论证明助手中的现有数学库集成。为评估框架,作者实现了递推关系法与物理家摊还分析法,并在 Agda 中完全机器化验证:Euclid 算法的紧致闭界、批量队列的摊还复杂度,以及归并排序串行与并行复杂度的紧致闭界。最后,作者通过模型构造论证 calf 中定量推理的可靠性。
We present calf , a c ost- a ware l ogical f ramework for studying quantitative aspects of functional programs. Taking inspiration from recent work that reconstructs traditional aspects of programming languages in terms of a modal account of phase distinctions , we argue that the cost structure of programs motivates a phase distinction between intension and extension . Armed with this technology, we contribute a synthetic account of cost structure as a computational effect in which cost-aware programs enjoy an internal noninterference property: input/output behavior cannot depend on cost. As a full-spectrum dependent type theory, calf presents a unified language for programming and specification of both cost and behavior that can be integrated smoothly with existing mathematical libraries available in type theoretic proof assistants. We evaluate calf as a general framework for cost analysis by implementing two fundamental techniques for algorithm analysis: the method of recurrence relations and physicist’s method for amortized analysis . We deploy these techniques on a variety of case studies: we prove a tight, closed bound for Euclid’s algorithm, verify the amortized complexity of batched queues, and derive tight, closed bounds for the sequential and parallel complexity of merge sort, all fully mechanized in the Agda proof assistant. Lastly we substantiate the soundness of quantitative reasoning in calf by means of a model construction.
@article{paperbot1596,
title = {A cost-aware logical framework},
author = {Yue Niu and Jonathan Sterling and Harrison Grodin and Robert Harper},
journal = {Proceedings of the ACM on Programming Languages},
volume = {6},
number = {POPL},
year = {2022},
doi = {10.1145/3498670}
}