skip to main content
research-article
Open Access

Inferring Lower Runtime Bounds for Integer Programs

Published:15 October 2020Publication History
Skip Abstract Section

Abstract

We present a technique to infer lower bounds on the worst-case runtime complexity of integer programs, where in contrast to earlier work, our approach is not restricted to tail-recursion. Our technique constructs symbolic representations of program executions using a framework for iterative, under-approximating program simplification. The core of this simplification is a method for (under-approximating) program acceleration based on recurrence solving and a variation of ranking functions. Afterwards, we deduce asymptotic lower bounds from the resulting simplified programs using a special-purpose calculus and an SMT encoding. We implemented our technique in our tool LoAT and show that it infers non-trivial lower bounds for a large class of examples.

References

  1. Elvira Albert, Diego E. Alonso-Blas, Puri Arenas, Samir Genaim, and Germán Puebla. 2009. Asymptotic resource usage bounds. In APLAS’09 (LNCS 5904). 294--310.Google ScholarGoogle Scholar
  2. Elvira Albert, Puri Arenas, Samir Genaim, and Germán Puebla. 2011. Closed-form upper bounds in static cost analysis. J. Autom. Reas. 46, 2 (2011), 161--203.Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Elvira Albert, Puri Arenas, Samir Genaim, Germán Puebla, and Damiano Zanardini. 2012. Cost analysis of object-oriented bytecode programs. Theor. Comput. Sci. 413, 1 (2012), 142--159.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Elvira Albert, Samir Genaim, and Abu N. Masud. 2013. On the inference of resource usage upper and lower bounds. ACM Trans. Comput. Log. 14, 3 (2013), 22:1--22:35.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Elvira Albert, Miquel Bofill, Cristina Borralleras, Enrique Martin-Martin, and Albert Rubio. 2019. Resource analysis driven by (conditional) termination proofs. Theor. Pract. Log. Prog. 19, 5–6 (2019), 722--739.Google ScholarGoogle Scholar
  6. Christophe Alias, Alain Darte, Paul Feautrier, and Laure Gonnord. 2010. Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In SAS’10 (LNCS 6337). 117--133.Google ScholarGoogle Scholar
  7. Diego E. Alonso-Blas and Samir Genaim. 2012. On the limits of the classical approach to cost analysis. In SAS’12 (LNCS 7460). 405--421.Google ScholarGoogle Scholar
  8. Roberto Bagnara, Andrea Pescetti, Alessandro Zaccagnini, and Enea Zaffanella. 2005. PURRS: Towards computer algebra support for fully automatic worst-case complexity analysis. CoRR abs/cs/0512056 (2005).Google ScholarGoogle Scholar
  9. Amir M. Ben-Amram and Samir Genaim. 2014. Ranking functions for linear-constraint loops. J. ACM 61, 4 (2014), 26:1--26:55.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Régis Blanc, Thomas A. Henzinger, Thibaud Hottelier, and Laura Kovács. 2010. ABC: Algebraic bound computation for loops. In LPAR’10 (LNCS 6355). 103--118.Google ScholarGoogle Scholar
  11. Marius Bozga, Codruta Gîrlea, and Radu Iosif. 2009. Iterating octagons. In TACAS’09 (LNCS 5505). 337--351.Google ScholarGoogle Scholar
  12. Marius Bozga, Radu Iosif, and Filip Konecný. 2010. Fast acceleration of ultimately periodic relations. In CAV’10 (LNCS 6174). 227--242.Google ScholarGoogle Scholar
  13. Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2005. Linear ranking with reachability. In CAV’05 (LNCS 3576). 491--504.Google ScholarGoogle Scholar
  14. Marc Brockschmidt, Fabian Emmes, Stephan Falke, Carsten Fuhs, and Jürgen Giesl. 2016. Analyzing runtime and size complexity of integer programs. ACM Trans. Prog. Lang. Syst. 38, 4 (2016), 13:1--13:50.Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Jacob Burnim, Sudeep Juvekar, and Koushik Sen. 2009. WISE: Automated test generation for worst-case complexity. In ICSE’09. 463--473.Google ScholarGoogle Scholar
  16. Rod M. Burstall and John Darlington. 1977. A transformation system for developing recursive programs. J. ACM 24, 1 (1977), 44--67.Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Pavel Cadek, Clemens Danninger, Moritz Sinn, and Florian Zuleger. 2018. Using loop bound analysis for invariant generation. In FMCAD’18. 1--9.Google ScholarGoogle Scholar
  18. Peter Cameron. 2017. Polynomials Taking Integer Values. Retrieved from https://cameroncounts.wordpress.com/2017/01/31/polynomials-taking-integer-values/.Google ScholarGoogle Scholar
  19. Quentin Carbonneaux, Jan Hoffmann, and Zhong Shao. 2015. Compositional certified resource bounds. In PLDI’15. 467--478.Google ScholarGoogle Scholar
  20. Quentin Carbonneaux, Jan Hoffmann, Thomas W. Reps, and Zhong Shao. 2017. Automated resource analysis with Coq proof objects. In CAV’17 (LNCS 10427). 64--85.Google ScholarGoogle Scholar
  21. Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An efficient SMT solver. In TACAS’08 (LNCS 4963). 337--340.Google ScholarGoogle Scholar
  22. Saumya Debray, Pedro López-García, Manuel V. Hermenegildo, and Nai-Wei Lin. 1997. Lower bound cost estimation for logic programs. In ILPS’97. 291--305.Google ScholarGoogle Scholar
  23. Complexity Analysis-Based Guaranteed Execution. 2015. Retrieved from https://www.draper.com/news-releases/drapers-cage-could-spot-code-vulnerable-denial-service-attacks.Google ScholarGoogle Scholar
  24. Stephan Falke, Deepak Kapur, and Carsten Sinz. 2012. Termination analysis of imperative programs using bitvector arithmetic. In VSTTE’12 (LNCS 7152). 261--277.Google ScholarGoogle Scholar
  25. Azadeh Farzan and Zachary Kincaid. 2015. Compositional recurrence analysis. In FMCAD’15. 57--64.Google ScholarGoogle Scholar
  26. Antonio Flores-Montoya and Reiner Hähnle. 2014. Resource analysis of complex programs with cost equations. In APLAS’14 (LNCS 8858). 275--295.Google ScholarGoogle Scholar
  27. Antonio Flores-Montoya. 2016. Upper and lower amortized cost bounds of programs expressed as cost relations. In FM’16 (LNCS 9995). 254--273.Google ScholarGoogle Scholar
  28. Space/Time Analysis for Cybersecurity (STAC). 2015. Retrieved from http://www.darpa.mil/program/space-time-analysis-for-cybersecurity.Google ScholarGoogle Scholar
  29. Florian Frohn, Matthias Naaf, Jera Hensel, Marc Brockschmidt, and Jürgen Giesl. 2016. Lower runtime bounds for integer programs. In IJCAR’16 (LNAI 9706). 550--567.Google ScholarGoogle Scholar
  30. Florian Frohn, Jürgen Giesl, Jera Hensel, Cornelius Aschermann, and Thomas Ströder. 2017. Lower bounds for runtime complexity of term rewriting. J. Autom. Reas. 59, 1 (2017), 121--163.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Florian Frohn and Jürgen Giesl. 2019. Termination of triangular integer loops is decidable. In CAV’19 (LNCS 11562). 426--444.Google ScholarGoogle Scholar
  32. Florian Frohn and Jürgen Giesl. 2019. Proving non-termination via loop acceleration. In FMCAD’19. 221--230.Google ScholarGoogle Scholar
  33. Florian Frohn, Matthias Naaf, Marc Brockschmidt, and Jürgen Giesl. 2020. Empirical Evaluation of “Inferring Lower Runtime Bounds for Integer Programs.” Retrieved from https://aprove-developers.github.io/its-lowerbounds-journal.Google ScholarGoogle Scholar
  34. Hongfei Fu and Krishnendu Chatterjee. 2019. Termination of nondeterministic probabilistic programs. In VMCAI’19 (LNCS 11388). 468--490.Google ScholarGoogle Scholar
  35. Pierre Ganty, Radu Iosif, and Filip Konecný. 2017. Underapproximation of procedure summaries for integer programs. STTT 19, 5 (2017), 565--584.Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Jürgen Giesl, Peter Giesl, and Marcel Hark. 2019. Computing expected runtimes for constant probability programs. In CADE’19 (LNAI 11716). 269--286.Google ScholarGoogle Scholar
  37. Jürgen Giesl, Albert Rubio, Christian Sternagel, Johannes Waldmann, and Akihisa Yamada. 2019. The termination and complexity competition. In TACAS’19 (LNCS 11429). 156--166.Google ScholarGoogle Scholar
  38. Laure Gonnord and Nicolas Halbwachs. 2006. Combining widening and acceleration in linear relation analysis. In SAS’06 (LNCS 4134). 144--160.Google ScholarGoogle Scholar
  39. Sumit Gulwani, Krishna K. Mehra, and Trishul M. Chilimbi. 2009. SPEED: Precise and efficient static estimation of program computational complexity. In POPL’09. 127--139.Google ScholarGoogle Scholar
  40. Marcel Hark, Benjamin Lucien Kaminski, Jürgen Giesl, and Joost-Pieter Katoen. 2020. Aiming low is harder—Inductive proof rules for lower bounds on weakest preexpectations in probabilistic program verification. PACMPL 4, POPL (2020), 37:1--37:28.Google ScholarGoogle Scholar
  41. André Heck. 1996. Introduction to Maple (2nd ed.). Springer.Google ScholarGoogle Scholar
  42. Jera Hensel, Jürgen Giesl, Florian Frohn, and Thomas Ströder. 2018. Termination and complexity analysis for programs with bitvector arithmetic by symbolic execution. J. Log. Algor. Meth. Prog. 97 (2018), 105--130.Google ScholarGoogle ScholarCross RefCross Ref
  43. Nao Hirokawa and Georg Moser. 2008. Automated complexity analysis based on the dependency pair method. In IJCAR’08 (LNAI 5195). 364--379.Google ScholarGoogle Scholar
  44. Dieter Hofbauer and Clemens Lautemann. 1989. Termination proofs and the length of derivations. In RTA’89 (LNCS 355). 167--177.Google ScholarGoogle Scholar
  45. Jan Hoffmann, Klaus Aehlig, and Martin Hofmann. 2012. Multivariate amortized resource analysis. ACM Trans. Prog. Lang. Syst. 34, 3 (2012), 14:1--14:62.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Jan Hoffmann and Zhong Shao. 2015. Type-based amortized resource analysis with integers and arrays. J. Funct. Prog. 25 (2015).Google ScholarGoogle Scholar
  47. Jan Hoffmann, Ankush Das, and Shu-Chun Weng. 2017. Towards automatic resource bound analysis for OCaml. In POPL’17. 359--373.Google ScholarGoogle Scholar
  48. Bertrand Jeannet, Peter Schrammel, and Sriram Sankaranarayanan. 2014. Abstract acceleration of general linear loops. In POPL’14. 529--540.Google ScholarGoogle Scholar
  49. KoAT Benchmarks 2014. Retrieved from https://github.com/s-falke/kittel-koat/tree/master/koat-evaluation/examples.Google ScholarGoogle Scholar
  50. Daniel Kroening, Matt Lewis, and Georg Weissenbacher. 2015. Under-approximating loops in C programs for fast counterexample detection. Form. Meth. Syst. Des. 47, 1 (2015), 75--92.Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Daniel Larraz, Albert Oliveras, Enric Rodríguez-Carbonell, and Albert Rubio. 2013. Proving termination of imperative programs using Max-SMT. In FMCAD’13. 218--225.Google ScholarGoogle Scholar
  52. LoAT. 2019. Retrieved from https://github.com/aprove-developers/LoAT.Google ScholarGoogle Scholar
  53. Kumar Madhukar, Björn Wachter, Daniel Kroening, Matt Lewis, and Mandayam K. Srivas. 2015. Accelerating invariant generation. In FMCAD’15. 105--111.Google ScholarGoogle Scholar
  54. Annabelle McIver and Carroll Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer.Google ScholarGoogle Scholar
  55. Matthias Naaf, Florian Frohn, Marc Brockschmidt, Carsten Fuhs, and Jürgen Giesl. 2017. Complexity analysis for term rewriting by integer transition systems. In FroCoS’17 (LNAI 10483). 132--150.Google ScholarGoogle Scholar
  56. Andreas Podelski and Andrey Rybalchenko. 2004. A complete method for the synthesis of linear ranking functions. In VMCAI’04 (LNCS 2937). 239--251.Google ScholarGoogle Scholar
  57. Moritz Sinn, Florian Zuleger, and Helmuth Veith. 2017. Complexity and resource bound analysis of imperative programs using difference constraints. J. Autom. Reas. 59, 1 (2017), 3--45.Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Akhilesh Srikanth, Burak Sahin, and William R. Harris. 2017. Complexity verification using guided theorem enumeration. In POPL’17. 639--652.Google ScholarGoogle Scholar
  59. Jan Strejcek and Marek Trtík. 2012. Abstracting path conditions. In ISSTA’12. 155--165.Google ScholarGoogle Scholar
  60. Di Wang and Jan Hoffmann. 2019. Type-guided worst-case input generation. PACMPL 3, POPL (2019), 13:1--13:30.Google ScholarGoogle Scholar
  61. Stephen Wolfram. 1992. Mathematica: A system for doing mathematics by computer. SIAM Rev. 34, 3 (1992), 519--522.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Inferring Lower Runtime Bounds for Integer Programs

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Transactions on Programming Languages and Systems
            ACM Transactions on Programming Languages and Systems  Volume 42, Issue 3
            September 2020
            230 pages
            ISSN:0164-0925
            EISSN:1558-4593
            DOI:10.1145/3430314
            Issue’s Table of Contents

            Copyright © 2020 Owner/Author

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 15 October 2020
            • Accepted: 1 July 2020
            • Revised: 1 June 2020
            • Received: 1 September 2019
            Published in toplas Volume 42, Issue 3

            Check for updates

            Qualifiers

            • research-article
            • Research
            • Refereed

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader

          HTML Format

          View this article in HTML Format .

          View HTML Format
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!