Lune

LICS2023Top-tier venue

Automatic Amortized Resource Analysis with Regular Recursive Types

Jessie Grosen, David M. Kahn, Jan Hoffmann

Abstract

The goal of automatic resource bound analysis is to statically infer symbolic bounds on the resource consumption of the evaluation of a program. A longstanding challenge for automatic resource analysis is the inference of bounds that are functions of complex custom data structures. This article builds on type-based automatic amortized resource analysis (AARA) to address this challenge. AARA is based on the potential method of amortized analysis and reduces bound inference to standard type inference with additional linear constraint solving, even when deriving non-linear bounds. A key component of AARA are resource functions that generate the space of possible bounds for values of a given type while enjoying necessary closure properties.

Existing work on AARA defined such functions for many data structures such as lists of lists but the question of whether such functions exist for arbitrary data structures remained open. This work answers this questions positively by uniformly constructing resource polynomials for algebraic data structures defined by regular recursive types. These functions are a generalization of all previously proposed polynomial resource functions and can be seen as a general notion of polynomials for values of a given recursive type. A resource type system for FPC, a core language with recursive types, demonstrates how resource polynomials can be integrated with AARA while preserving all benefits of past techniques. The article also proposes the use of new techniques useful for stating the rules of this type system succinctly and proving it sound against a small-step cost semantics. First, multivariate potential annotations are stated in terms of free semimodules, substantially abstracting details of the presentation of annotations and the proofs of their properties. Second, a logical relation giving semantic meaning to resource types enables a proof of soundness by a single induction on typing derivations.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

4 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • A cost-aware logical framework cites A unifying type-theory for higher-order (amortized) cost analysis
  • A cost-aware logical framework cites Recurrence extraction for functional programs through call-by-push-value
  • Integrating Resource Analyses via Resource Decomposition cites A cost-aware logical framework
  • Integrating Resource Analyses via Resource Decomposition cites Verifying and Synthesizing Constant-Resource Implementations with Types
  • Integrating Resource Analyses via Resource Decomposition cites Robust Resource Bounds with Static Analysis and Bayesian Inference
  • Integrating Resource Analyses via Resource Decomposition cites Recurrence extraction for functional programs through call-by-push-value
  • A unifying type-theory for higher-order (amortized) cost analysis cites Recurrence extraction for functional programs through call-by-push-value
  • Robust Resource Bounds with Static Analysis and Bayesian Inference cites A cost-aware logical framework
  • Robust Resource Bounds with Static Analysis and Bayesian Inference cites Recurrence extraction for functional programs through call-by-push-value
  • Denotational Foundations for Expected Cost Analysis cites A cost-aware logical framework
  • Denotational Foundations for Expected Cost Analysis cites A unifying type-theory for higher-order (amortized) cost analysis
  • Denotational Foundations for Expected Cost Analysis cites Recurrence extraction for functional programs through call-by-push-value
  • Handling Exceptions and Effects with Automatic Resource Analysis cites A cost-aware logical framework
  • Handling Exceptions and Effects with Automatic Resource Analysis cites A unifying type-theory for higher-order (amortized) cost analysis
  • Handling Exceptions and Effects with Automatic Resource Analysis cites Verifying and Synthesizing Constant-Resource Implementations with Types
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers4

  1. Robust Resource Bounds with Static Analysis and Bayesian InferenceLong Pham, Feras A. Saad, Jan HoffmannPLDI 2024 · 6 citations
  2. Denotational Foundations for Expected Cost AnalysisPedro H. Azevedo de AmorimOOPSLA 2025 · 4 citations
  3. Integrating Resource Analyses via Resource DecompositionLong Pham, Yue Niu, Nathaniel Glover, Feras Saad et al.OOPSLA 2025
  4. Handling Exceptions and Effects with Automatic Resource AnalysisEthan Chu, Yiyang Guo, Jan HoffmannOOPSLA 2026

Builds on4

  1. Verifying and Synthesizing Constant-Resource Implementations with TypesVan Chan Ngo, Mario Dehesa-Azuara, Matthew Fredrikson, Jan HoffmannS&P 2017 · 51 citations
  2. A unifying type-theory for higher-order (amortized) cost analysisVineet Rajani, Marco Gaboardi, Deepak Garg, Jan HoffmannPOPL 2021 · 26 citations
  3. A cost-aware logical frameworkYue Niu, Jonathan Sterling, Harrison Grodin, Robert HarperPOPL 2022 · 23 citations
  4. Recurrence extraction for functional programs through call-by-push-valueG. A. Kavvos, Edward Morehouse, Daniel R. Licata, Norman DannerPOPL 2020 · 20 citations

Related papers

  1. Automatic Linear Resource Bound Analysis for Rust via Prophecy PotentialsQihao Lian, Di WangOOPSLA 2025 · 1 citation
  2. Automated Amortised Analysis of Skew Heaps and Leftist HeapsArmin Walch, Georg Moser, Berry Schoenmakers, Florian ZulegerCAV 2026
  3. Synthesis with Asymptotic Resource BoundsQinheping Hu, John Cyphert, Loris D'Antoni, Thomas W. RepsCAV 2021 · 5 citations
  4. Resource-Aware Soundness for Big-Step SemanticsRiccardo Bianchini, Francesco Dagnino, Paola Giannini, Elena ZuccaOOPSLA 2023 · 6 citations
  5. ATLAS: Automated Amortised Complexity Analysis of Self-adjusting Data StructuresLorenz Leutgeb, Georg Moser, Florian ZulegerCAV 2021 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines