Amortized Resource Analysis with Polynomial Potential

A Static Inference of Polynomial Bounds for Functional Programs
  • Jan Hoffmann
  • Martin Hofmann
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6012)


In 2003, Hofmann and Jost introduced a type system that uses a potential-based amortized analysis to infer bounds on the resource consumption of (first-order) functional programs. This analysis has been successfully applied to many standard algorithms but is limited to bounds that are linear in the size of the input.

Here we extend this system to polynomial resource bounds. An automatic amortized analysis is used to infer these bounds for functional programs without further annotations if a maximal degree for the bounding polynomials is given. The analysis is generic in the resource and can obtain good bounds on heap-space, stack-space and time usage.


Functional Programming Static Analysis Resource Consumption Amortized Analysis 


  1. 1.
    Hofmann, M., Jost, S.: Static Prediction of Heap Space Usage for First-Order Functional Programs. In: 30th ACM Symp. on Principles of Prog. Langs. (POPL 2003), pp. 185–197 (2003)Google Scholar
  2. 2.
    Jost, S., Loidl, H.W., Hammond, K., Scaife, N., Hofmann, M.: Carbon Credits for Resource-Bounded Computations using Amortised Analysis. In: Cavalcanti, A., Dams, D.R. (eds.) FM 2009. LNCS, vol. 5850, pp. 354–369. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  3. 3.
    Hammond, K., Dyckhoff, R., Ferdinand, C., Heckmann, R., Hofmann, M., Loidl, H.W., Michaelson, G., Sérot, J., Wallace, A.: The EmBounded Project: Automatic Prediction of Resource Bounds for Embedded Systems. Trends in Fun. Prog. 6 (2006)Google Scholar
  4. 4.
    Tarjan, R.E.: Amortized Computational Complexity. SIAM J. Algebraic Discrete Methods 6(2), 306–318 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Campbell, B.: Amortised Memory Analysis using the Depth of Data Structures. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 190–204. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  6. 6.
    Jost, S., Hammond, K., Loidl, H.W., Hofmann, M.: Static Determination of Quantitative Resource Usage for Higher-Order Programs. In: 37th ACM Symp. On Principles of Prog. Langs., POPL 2010 (to appear, 2010)Google Scholar
  7. 7.
    Hammond, K., Michaelson, G.: Hume: a Domain-Speci_c Language for Real-Time Embedded Systems. In: Pfenning, F., Smaragdakis, Y. (eds.) GPCE 2003. LNCS, vol. 2830, pp. 37–56. Springer, Heidelberg (2003)Google Scholar
  8. 8.
    Girard, J.Y., Scedrov, A., Scott, P.: Bounded Linear Logic. Theoret. Comput. Sci. 97(1), 1–66 (1992)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Grobauer, B.: Cost Recurrences for DML Programs. In: 6th Intl. Conf. on Funct. Prog. (ICFP 2001), pp. 253–264 (2001)Google Scholar
  10. 10.
    Flajolet, P., Salvy, B., Zimmermann, P.: Automatic Average-case Analysis of Algorithms. Theoret. Comput. Sci. 79(1), 37–109 (1991)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Crary, K., Weirich, S.: Resource Bound Certification. In: 27th ACM Symp. On Principles of Prog. Langs. (POPL 2000), pp. 184–198 (2000)Google Scholar
  12. 12.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis. In: Alpuente, M., Vidal, G. (eds.) SAS 2008. LNCS, vol. 5079, pp. 221–237. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Gulwani, S., Mehra, K.K., Chilimbi, T.M.: SPEED: Precise and E_cient Static Estimation of Program Computational Complexity. In: 36th ACM Symp. on Principles of Prog. Langs. (POPL 2009), pp. 127–139 (2009)Google Scholar
  14. 14.
    Gulavani, B.S., Gulwani, S.: A Numerical Abstract Domain Based on Expression Abstraction and Max Operator with Application in Timing Analysis. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123, pp. 370–384. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  15. 15.
    Beringer, L., Hofmann, M., Momigliano, A., Shkaravska, O.: Automatic Certification of Heap Consumption. In: Baader, F., Voronkov, A. (eds.) LPAR 2004. LNCS (LNAI), vol. 3452, pp. 347–362. Springer, Heidelberg (2005)Google Scholar
  16. 16.
    Hughes, J., Pareto, L., Sabry, A.: Proving the Correctness of Reactive Systems Using Sized Types. In: Symp. Princ. of Prog. Langs. (POPL 1996), pp. 410–423 (1996)Google Scholar
  17. 17.
    Hughes, J., Pareto, L.: Recursion and Dynamic Data-structures in Bounded Space: Towards Embedded ML Programming. In: 4th Intl. Conf. on Funct. Prog. (ICFP 1999), pp. 70–81 (1999)Google Scholar
  18. 18.
    Chin, W.N., Khoo, S.C.: Calculating Sized Types. High.-Ord. and Symb. Comp. 14(2-3), 261–300 (2001)zbMATHCrossRefGoogle Scholar
  19. 19.
    Chin, W.N., Khoo, S.C., Qin, S., Popeea, C., Nguyen, H.H.: Verifying Safety Policies with Size Properties and Alias Controls. In: Intl. Conf. on Software Eng. (ICSE 2005), pp. 186–195 (2005)Google Scholar
  20. 20.
    Shkaravska, O., van Kesteren, R., van Eekelen, M.C.: Polynomial Size Analysis of First-Order Functions. In: Della Rocca, S.R. (ed.) TLCA 2007. LNCS, vol. 4583, pp. 351–365. Springer, Heidelberg (2007)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Jan Hoffmann
    • 1
  • Martin Hofmann
    • 1
  1. 1.Ludwig-Maximilians-Universität München 

Personalised recommendations