Automatic Inference of Upper Bounds for Recurrence Relations in Cost Analysis

  • Elvira Albert
  • Puri Arenas
  • Samir Genaim
  • Germán Puebla
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5079)


The classical approach to automatic cost analysis consists of two phases. Given a program and some measure of cost, we first produce recurrence relations (RRs) which capture the cost of our program in terms of the size of its input data. Second, we convert such RRs into closed form (i.e., without recurrences). Whereas the first phase has received considerable attention, with a number of cost analyses available for a variety of programming languages, the second phase has received comparatively little attention. In this paper we first study the features of RRs generated by automatic cost analysis and discuss why existing computer algebra systems are not appropriate for automatically obtaining closed form solutions nor upper bounds of them. Then we present, to our knowledge, the first practical framework for the fully automatic generation of reasonably accurate upper bounds of RRs originating from cost analysis of a wide range of programs. It is based on the inference of ranking functions and loop invariants and on partial evaluation.


Evaluation Tree Cost Analysis Recurrence Relation Cost Relation Internal Node 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Adachi, A., Kasai, T., Moriya, E.: A theoretical study of the time analysis of programs. In: Becvar, J. (ed.) MFCS 1979. LNCS, vol. 74, pp. 201–207. Springer, Heidelberg (1979)Google Scholar
  2. 2.
    Albert, E., Arenas, P., Codish, M., Genaim, S., Puebla, G., Zanardini, D.: Termination Analysis of Java Bytecode. In: Proc. of FMOODS. LNCS, Springer, Heidelberg (to appear, 2008)Google Scholar
  3. 3.
    Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: Cost analysis of java bytecode. In: De Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, Springer, Heidelberg (2007)CrossRefGoogle Scholar
  4. 4.
    Aspinall, D., Gilmore, S., Hofmann, M., Sannella, D., Stark, I.: Mobile Resource Guarantees for Smart Devices. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, Springer, Heidelberg (2005)Google Scholar
  5. 5.
    Bagnara, R., Pescetti, A., Zaccagnini, A., Zaffanella, E.: PURRS: Towards computer algebra support for fully automatic worst-case complexity analysis. Technical report, arXiv:cs/0512056 (2005),
  6. 6.
    Bagnara, R., Ricci, E., Zaffanella, E., Hill, P.M.: Possibly not closed convex polyhedra and the Parma Polyhedra Library. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, Springer, Heidelberg (2002)CrossRefGoogle Scholar
  7. 7.
    Benzinger, R.: Automated higher-order complexity analysis. In: TCS, vol. 318(1-2) (2004)Google Scholar
  8. 8.
    Bonfante, G., Marion, J.-Y., Moyen, J.-Y.: Quasi-interpretations and small space bounds. In: Giesl, J. (ed.) RTA 2005. LNCS, vol. 3467, Springer, Heidelberg (2005)Google Scholar
  9. 9.
    Chander, A., Espinosa, D., Islam, N., Lee, P., Necula, G.: Enforcing resource bounds via static verification of dynamic checks. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, Springer, Heidelberg (2005)Google Scholar
  10. 10.
    Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: POPL (1978)Google Scholar
  11. 11.
    Crary, K., Weirich, S.: Resource bound certification. In: POPL (2000)Google Scholar
  12. 12.
    Debray, S.K., Lin, N.W.: Cost analysis of logic programs. TOPLAS 15(5) (1993)Google Scholar
  13. 13.
    Gómez, G., Liu, Y.A.: Automatic time-bound analysis for a higher-order language. In: PEPM, ACM Press, New York (2002)Google Scholar
  14. 14.
    Hickey, T., Cohen, J.: Automating program analysis. J. ACM 35(1) (1988)Google Scholar
  15. 15.
    Hill, P.M., Payet, E., Spoto, F.: Path-length analysis of object-oriented programs. In: Proc. EAAI, Elsevier, Amsterdam (2006)Google Scholar
  16. 16.
    Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functional programs. In: POPL (2003)Google Scholar
  17. 17.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, New York (1993)zbMATHGoogle Scholar
  18. 18.
    Le Metayer, D.: ACE: An Automatic Complexity Evaluator. TOPLAS 10(2) (1988)Google Scholar
  19. 19.
    Marion, J.-Y., Péchoux, R.: Resource analysis by sup-interpretation. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, Springer, Heidelberg (2006)CrossRefGoogle Scholar
  20. 20.
    Navas, J., Mera, E., López-García, P., Hermenegildo, M.: User-definable resource bounds analysis for logic programs. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, Springer, Heidelberg (2007)CrossRefGoogle Scholar
  21. 21.
    Podelski, A., Rybalchenko, A.: A complete method for the synthesis of linear ranking functions. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, Springer, Heidelberg (2004)Google Scholar
  22. 22.
    Rosendahl, M.: Automatic Complexity Analysis. In: FPCA, ACM Press, New York (1989)Google Scholar
  23. 23.
    Sands, D.: A naïve time analysis and its theory of cost equivalence. Journal of Logic and Computation 5(4) (1995)Google Scholar
  24. 24.
    Wadler, P.: Strictness analysis aids time analysis. In: POPL (1988)Google Scholar
  25. 25.
    Wegbreit, B.: Mechanical Program Analysis. Comm. of the ACM 18(9) (1975)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Elvira Albert
    • 1
  • Puri Arenas
    • 1
  • Samir Genaim
    • 2
  • Germán Puebla
    • 2
  1. 1.DSICComplutense University of MadridMadridSpain
  2. 2.CLIPTechnical University of MadridMadridSpain

Personalised recommendations