The FLINT Project








Type-Based Amortized Resource Analysis with Integers and Arrays

Last modified: Wed Jun 18 13:56:48 2014 GMT.


Jan Hoffmann
Zhong Shao


Proving bounds on the resource consumption of a program by statically analyzing its source code is an important and well-studied problem. Automatic approaches for numeric programs with side-effects usually apply abstract-interpretation–based invariant generation to derive bounds on loops and recursion depths of function calls.

This paper presents an alternative approach to resource-bound analysis for numeric, heap-manipulating programs that uses type-based amortized resource analysis. As a first step towards the analysis of imperative code, we develop the technique for a first-order ML-like language with unsigned integers and arrays. The analysis automatically derives bounds that are multivariate polynomials in the numbers and the lengths of the arrays in the input. Experiments with example programs demonstrate two main advantages of amortized analysis over current abstract-interpretation–based techniques. For one thing, amortized analysis can handle programs with non-linear intermediate values like f((n+m)2). For another thing, amortized analysis is compositional and works naturally for compound programs like f(g(x)).


  • In Proc. 12th International Symosium on Functional and Logic Programming (FLOPS'14), Kanazawa, Japan, June 2014. Lecture Notes in Computer Science, Vol. 8475, pages 152-168. [pdf]

Copyright © 1996-2023 The FLINT Group <flint at cs dot yale dot edu>
Yale University Department of Computer Science
Validate this page