Journal of Automated Reasoning

, Volume 59, Issue 1, pp 121–163 | Cite as

Lower Bounds for Runtime Complexity of Term Rewriting

  • Florian Frohn
  • Jürgen GieslEmail author
  • Jera Hensel
  • Cornelius Aschermann
  • Thomas Ströder


We present the first approach to deduce lower bounds for (worst-case) runtime complexity of term rewrite systems (TRSs) automatically. Inferring lower runtime bounds is useful to detect bugs and to complement existing methods that compute upper complexity bounds. Our approach is based on two techniques: the induction technique generates suitable families of rewrite sequences and uses induction proofs to find a relation between the length of a rewrite sequence and the size of the first term in the sequence. The loop detection technique searches for “decreasing loops”. Decreasing loops generalize the notion of loops for TRSs, and allow us to detect families of rewrite sequences with linear, exponential, or infinite length. We implemented our approach in the tool AProVE and evaluated it by extensive experiments.


Complexity analysis Term rewriting Induction Lower bounds 



We thank Fabian Emmes for important initial ideas for the induction technique and Chris Lynch, René Thiemann, and Carsten Fuhs for helpful suggestions.


  1. 1.
    Albert, E., Genaim, S., Masud, A.N.: On the inference of resource usage upper and lower bounds. ACM Trans. Comput. Log. 14(3), 22 (2013)Google Scholar
  2. 2.
  3. 3.
    Avanzini, M., Moser, G.: A combination framework for complexity. In: Proceedings of RTA ’13. LIPIcs 21, pp. 55–70 (2013)Google Scholar
  4. 4.
    Avanzini, M., Moser, G., Schaper, M.: \({\sf TcT}\): Tyrolean complexity tool. In: Proceedings of TACAS ’16. LNCS 9636, pp. 407–423 (2016)Google Scholar
  5. 5.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press, Cambridge (1998)CrossRefzbMATHGoogle Scholar
  6. 6.
    Boyer, Robert S., Moore, J.S.: A Computational Logic. Academic Press, Cambridge (1979)zbMATHGoogle Scholar
  7. 7.
    de Moura, L., Bjørner, N.: Z3: An efficient SMT solver. In: Proceedings of TACAS ’08. LNCS 4963, pp. 337–340 (2008)Google Scholar
  8. 8.
    Emmes, F., Enger, T., Giesl, J.: Proving non-looping non-termination automatically. In: Proceedings of IJCAR ’12. LNAI 7364, pp. 225–240 (2012)Google Scholar
  9. 9.
    Frohn, F., Giesl, J., Hensel, J., Aschermann, C., Ströder, T.: Inferring lower bounds for runtime complexity. In: Proceedings of RTA ’15. LIPIcs 36, pp. 334–349 (2015)Google Scholar
  10. 10.
    Frohn, F., Naaf, M., Hensel, J., Brockschmidt, M., Giesl, J.: Lower runtime bounds for integer programs. In: Proceedings of IJCAR ’16. LNAI 9706, pp. 550–567 (2016)Google Scholar
  11. 11.
    Fuhs, C., Giesl, J., Parting, M., Schneider-Kamp, P., Swiderski, S.: Proving termination by dependency pairs and inductive theorem proving. J. Autom. Reason. 47(2), 133–160 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Geser, A., Hofbauer, D., Waldmann, J.: Termination proofs for string rewriting systems via inverse match-bounds. J. Autom. Reason. 34(4), 365–385 (2005)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Giesl, J., Thiemann, R., Schneider-Kamp, P.: Proving and disproving termination of higher-order functions. In: Proceedings of FroCoS ’05. LNAI 3717, pp. 216–231 (2005)Google Scholar
  14. 14.
    Giesl, J., Raffelsieper, M., Schneider-Kamp, P., Swiderski, S., Thiemann, R.: Automated termination proofs for Haskell by term rewriting. ACM Trans. Program. Lang. Syst. 33(2), 7 (2011)Google Scholar
  15. 15.
    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 \({{\sf AProVE}}\). J. Autom. Reason (to appear). Preliminary version appeared in Proceedings of IJCAR ’14. LNAI 8562, pp. 184–191 (2014)Google Scholar
  16. 16.
    Hirokawa, N., Moser, G.: Automated complexity analysis based on the dependency pair method. In: Proceedings of IJCAR ’08. LNAI 5195, pp. 364–379 (2008)Google Scholar
  17. 17.
    Hofbauer, D., Lautemann, C.: Termination proofs and the length of derivations. In: Proceedings of RTA ’89. LNCS 355, pp. 167–177 (1989)Google Scholar
  18. 18.
    Hofbauer, D., Waldmann, J.: Constructing lower bounds on the derivational complexity of rewrite systems. Slides of a Talk at the 2nd Workshop on Proof Theory and Rewriting. (2010)
  19. 19.
    Hofmann, M., Moser, G.: Amortised resource analysis and typed polynomial interpretations. In: Proceedings of RTA-TLCA ’14. LNCS 8560, pp. 272–286 (2014)Google Scholar
  20. 20.
    Hooper, P.K.: The undecidability of the Turing machine immortality problem. J. Symb. Log. 31(2), 219–234 (1966)MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Knuth, D.: Johann Faulhaber and sums of powers. Math. Comput. 61(203), 277–294 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  22. 22.
    Lynch, C., Morawska, B.: Basic syntactic mutation. In: Proceedings of CADE ’18. LNAI 2392, pp. 471–485 (2002)Google Scholar
  23. 23.
    Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17(3), 348–375 (1978)MathSciNetCrossRefzbMATHGoogle Scholar
  24. 24.
    Moser, G., Schnabl, A.: The derivational complexity induced by the dependency pair method. Log. Methods Comput. Sci. 7(3:01), 1–38 (2011)Google Scholar
  25. 25.
    Noschinski, L., Emmes, F., Giesl, J.: Analyzing innermost runtime complexity of term rewriting by dependency pairs. J. Autom. Reason. 51(1), 27–56 (2013)MathSciNetCrossRefzbMATHGoogle Scholar
  26. 26.
    Otto, C., Brockschmidt, M., von Essen, C., Giesl, J.: Automated termination analysis of Java Bytecode by term rewriting. In: Proceedings of RTA ’10. LIPIcs 6, pp. 259–276 (2010)Google Scholar
  27. 27.
    Payet, É.: Loop detection in term rewriting using the eliminating unfoldings. Theor. Comput. Sci. 403(2–3), 307–327 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  28. 28.
  29. 29.
    Waldmann, J.: Matchbox: A tool for match-bounded string rewriting. In: Proceedings of RTA ’04. LNCS 3091, pp. 85–94 (2004)Google Scholar
  30. 30.
    Waldmann, J.: Automatic termination. In: Proceedings of RTA ’09. LNCS 5595, pp. 1–16 (2009)Google Scholar
  31. 31.
    Zankl, H., Sternagel, C., Hofbauer, D., Middeldorp, A.: Finding and certifying loops. In: Proceedings of SOFSEM ’10. LNCS 5901, pp. 755–766 (2010)Google Scholar
  32. 32.
    Zankl, H., Korp, M.: Modular complexity analysis for term rewriting. Log. Methods Comput. Sci. 10(1:19), 1–33 (2014)Google Scholar
  33. 33.
    Zantema, H.: Termination of term rewriting: interpretation and type elimination. J. Symbol. Comput. 17(1), 23–50 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  34. 34.
    Zantema, H.: Termination of string rewriting proved automatically. J. Autom. Reason. 34(2), 105–139 (2005)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer Science+Business Media Dordrecht 2016

Authors and Affiliations

  1. 1.LuFG Informatik 2RWTH Aachen UniversityAachenGermany

Personalised recommendations