A cost-aware logical framework
Yue Niu, Jonathan Sterling, Harrison Grodin, Robert Harper
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.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 2b6a9389-48c8-44e5-b77c-de503524845dCited by top-tier papers10
- Robust Resource Bounds with Static Analysis and Bayesian InferenceLong Pham, Feras A. Saad, Jan HoffmannPLDI 2024 · 6 citations
- Automatic Amortized Resource Analysis with Regular Recursive TypesJessie Grosen, David M. Kahn, Jan HoffmannLICS 2023 · 5 citations
- A Metalanguage for Cost-Aware Denotational SemanticsYue Niu, Robert HarperLICS 2023 · 5 citations
- Polynomial Time and Dependent TypesRobert AtkeyPOPL 2024 · 5 citations
- Denotational Foundations for Expected Cost AnalysisPedro H. Azevedo de AmorimOOPSLA 2025 · 4 citations
Builds on6
- The fire triangle: how to mix substitution, dependent elimination, and effectsPierre-Marie Pédrot, Nicolas TabareauPOPL 2020 · 42 citations
- Liquidate your assets: reasoning about resource usage in liquid HaskellMartin A. T. Handley, Niki Vazou, Graham HuttonPOPL 2020 · 38 citations
- Normalization for Cubical Type TheoryJonathan Sterling, Carlo AngiuliLICS 2021 · 28 citations
- A unifying type-theory for higher-order (amortized) cost analysisVineet Rajani, Marco Gaboardi, Deepak Garg, Jan HoffmannPOPL 2021 · 26 citations
- The taming of the rew: a type theory with computational assumptionsJesper Cockx, Nicolas Tabareau, Théo WinterhalterPOPL 2021 · 24 citations
Related papers
- Decalf: A Directed, Effectful Cost-Aware Logical FrameworkHarrison Grodin, Yue Niu, Jonathan Sterling, Robert HarperPOPL 2024 · 11 citations
- Static prediction of parallel computation graphsStefan K. MullerPOPL 2022 · 4 citations
- Abstraction Functions as Types: Modular Verification of Cost and Behavior in Dependent Type TheoryHarrison Grodin, Runming Li, Robert HarperPOPL 2026 · 2 citations
- Proof Repair across Quotient Type EquivalencesCosmo Viola, Max Fan, Talia RingerOOPSLA 2025 · 1 citation
- Internal and Observational Parametricity for Cubical AgdaAntoine Van Muylder, Andreas Nuyts, Dominique DevriesePOPL 2024 · 2 citations
