Automated Amortised Resource Analysis for Term Rewrite Systems

  • Georg MoserEmail author
  • Manuel SchneckenreitherEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10818)


Based on earlier work on amortised resource analysis, we establish a novel automated amortised resource analysis for term rewrite systems. The method is presented in an inference system akin to a type system and gives rise to polynomial bounds on the innermost runtime complexity of the analysed term rewrite system. Our analysis does not restrict the input rewrite system in any way. This facilitates integration in a general framework for resource analysis of programs. In particular, we have implemented the method and integrated it into our tool Open image in new window .


Analysis of algorithms Amortised complexity Term rewriting Types Automation 


  1. 1.
    Sleator, D., Tarjan, R.: Self-adjusting binary trees. In: Proceedings of the 15th STOC, pp. 235–245. ACM (1983)Google Scholar
  2. 2.
    Tarjan, R.: Amortized computational complexity. SIAM J. Alg. Disc. Methods 6(2), 306–318 (1985)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Hoffmann, J., Das, A., Weng, S.: Towards automatic resource bound analysis for OCaml. In: Proceedings of the 44th POPL, pp. 359–373. ACM (2017)CrossRefGoogle Scholar
  4. 4.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-form upper bounds in static cost analysis. JAR 46(2), 161–203 (2011)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Flores-Montoya, A.: Upper and lower amortized cost bounds of programs expressed as cost relations. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 254–273. Springer, Cham (2016). Scholar
  6. 6.
    Sinn, M., Zuleger, F., Veith, H.: A simple and scalable static analysis for bound analysis and amortized complexity analysis. In: Proceedings of the Software Engineering. LNI, vol. 252, pp. 101–102 (2016)Google Scholar
  7. 7.
    Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1999)zbMATHGoogle Scholar
  8. 8.
    Hofmann, M., Moser, G.: Amortised resource analysis and typed polynomial interpretations. In: Dowek, G. (ed.) RTA 2014. LNCS, vol. 8560, pp. 272–286. Springer, Cham (2014). Scholar
  9. 9.
    Hofmann, M., Moser, G.: Multivariate amortised resource analysis for term rewrite systems. In: Proceedings of the 13th TLCA. LIPIcs, vol. 38, pp. 241–256 (2015)Google Scholar
  10. 10.
    Avanzini, M., Lago, U.D.: Automating sized-type inference for complexity analysis. In: PACMPL, vol. 1, pp. 43:1–43:29 (2017)CrossRefGoogle Scholar
  11. 11.
    Avanzini, M., Moser, G., Schaper, M.: TcT: tyrolean complexity tool. In: Chechik, M., Raskin, J.-F. (eds.) TACAS 2016. LNCS, vol. 9636, pp. 407–423. Springer, Heidelberg (2016). Scholar
  12. 12.
    Moser, G., Schneckenreither, M.: Amortised analysis for bestcase lowerbounds (2018, submitted)Google Scholar
  13. 13.
    Schneckenreither, M.: Amortized resource analysis for term rewrite systems. Master’s thesis, University of Innsbruck (2018).
  14. 14.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press, Cambridge (1998)CrossRefGoogle Scholar
  15. 15.
    TeReSe: Term Rewriting Systems. Cambridge Tracks in Theoretical Computer Science, vol. 55. Cambridge University Press (2003)Google Scholar
  16. 16.
    Thiemann, R.: The DP framework for proving termination of term rewriting. Ph.D. thesis, University of Aachen, Department of Computer Science (2007)Google Scholar
  17. 17.
    Barrett, C., Fontaine, P., Tinelli, C.: The SMT-LIB Standard: Version 2.6. Technical report, Department of Computer Science, The University of Iowa (2017).
  18. 18.
    Farkas, J.: Theorie der einfachen ungleichungen. Journal für die reine und angewandte Mathematik 124, 1–27 (1902)MathSciNetzbMATHGoogle Scholar
  19. 19.
    Hoffmann, J.: Types with potential: polynomial resource bounds via automatic amortized analysis. Ph.D. thesis, Ludwig-Maximilians-Universiät München (2011)Google Scholar
  20. 20.
    Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. TOPLAS 34(3), 14 (2012)CrossRefGoogle Scholar
  21. 21.
    Glenstrup, A.: Terminator II: stopping partial evaluation of fully recursive programs. Master’s thesis, Technical report DIKU-TR-99/8, DIKU (1999)Google Scholar
  22. 22.
    Frederiksen, C.: Automatic runtime analysis for first order functional programs. Master’s thesis, DIKU TOPPS D-470, DIKU (2002)Google Scholar
  23. 23.
    Avanzini, M., Lago, U.D., Moser, G.: Analysing the complexity of functional programs: higher-order meets first-order. In: Proceedings of the 20th ICFP, pp. 152–164. ACM (2015)Google Scholar
  24. 24.
    Naaf, M., Frohn, F., Brockschmidt, M., Fuhs, C., Giesl, J.: Complexity analysis for term rewriting by integer transition systems. In: Dixon, C., Finger, M. (eds.) FroCoS 2017. LNCS (LNAI), vol. 10483, pp. 132–150. Springer, Cham (2017). Scholar
  25. 25.
    Giesl, J., Aschermann, C., Brockschmidt, M., Emmes, F., Frohn, F., Fuhs, C., Hensel, J., Otto, C., Plücker, M., Schneider-Kamp, P., Ströder, T., Swiderski, S., Thiemann, R.: Analyzing program termination and complexity automatically with aprove. JAR 58(1), 3–31 (2017)MathSciNetCrossRefGoogle Scholar
  26. 26.
    Flores-Montoya, A.: CoFloCo: system description. In: 15th International Workshop on Termination, vol. 20 (2016)Google Scholar
  27. 27.
    Nipkow, T.: Amortized complexity verified. In: Urban, C., Zhang, X. (eds.) ITP 2015. LNCS, vol. 9236, pp. 310–324. Springer, Cham (2015). Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of InnsbruckInnsbruckAustria
  2. 2.Department of Information Systems, Production and Logistics ManagementUniversity of InnsbruckInnsbruckAustria

Personalised recommendations