Affiliation:
1. Carnegie Mellon University, USA
2. Aarhus University, Denmark
Abstract
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.
Funder
NSF
Air Force Office of Scientific Research
Air Force Research Laboratory
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference74 articles.
1. Umut A. Acar and Guy E . Blelloch . 2019 . Algorithms : Parallel and Sequential . http:www.algorithms-book.com Umut A. Acar and Guy E. Blelloch. 2019. Algorithms: Parallel and Sequential. http:www.algorithms-book.com
2. Type theory in type theory using quotient inductive types
3. Topo-logie
4. Robert Atkey . 2010. Amortised Resource Analysis with Separation Logic . In Programming Languages and Systems, Andrew D. Gordon (Ed.). Springer Berlin Heidelberg , Berlin, Heidelberg . 85–103. isbn:978-3-642-1 1957 -6 Robert Atkey. 2010. Amortised Resource Analysis with Separation Logic. In Programming Languages and Systems, Andrew D. Gordon (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 85–103. isbn:978-3-642-11957-6
Cited by
6 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Story of Your Lazy Function’s Life: A Bidirectional Demand Semantics for Mechanized Cost Analysis of Lazy Programs;Proceedings of the ACM on Programming Languages;2024-08-15
2. Robust Resource Bounds with Static Analysis and Bayesian Inference;Proceedings of the ACM on Programming Languages;2024-06-20
3. Polynomial Time and Dependent Types;Proceedings of the ACM on Programming Languages;2024-01-05
4. Decalf: A Directed, Effectful Cost-Aware Logical Framework;Proceedings of the ACM on Programming Languages;2024-01-05
5. A Metalanguage for Cost-Aware Denotational Semantics;2023 38th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS);2023-06-26