Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Inferring Lower Runtime Bounds for Integer Programs

Published: 15 October 2020 Publication History

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.
[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.
[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.
[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.
[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.
[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.
[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.
[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).
[9]
Amir M. Ben-Amram and Samir Genaim. 2014. Ranking functions for linear-constraint loops. J. ACM 61, 4 (2014), 26:1--26:55.
[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.
[11]
Marius Bozga, Codruta Gîrlea, and Radu Iosif. 2009. Iterating octagons. In TACAS’09 (LNCS 5505). 337--351.
[12]
Marius Bozga, Radu Iosif, and Filip Konecný. 2010. Fast acceleration of ultimately periodic relations. In CAV’10 (LNCS 6174). 227--242.
[13]
Aaron R. Bradley, Zohar Manna, and Henny B. Sipma. 2005. Linear ranking with reachability. In CAV’05 (LNCS 3576). 491--504.
[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.
[15]
Jacob Burnim, Sudeep Juvekar, and Koushik Sen. 2009. WISE: Automated test generation for worst-case complexity. In ICSE’09. 463--473.
[16]
Rod M. Burstall and John Darlington. 1977. A transformation system for developing recursive programs. J. ACM 24, 1 (1977), 44--67.
[17]
Pavel Cadek, Clemens Danninger, Moritz Sinn, and Florian Zuleger. 2018. Using loop bound analysis for invariant generation. In FMCAD’18. 1--9.
[18]
Peter Cameron. 2017. Polynomials Taking Integer Values. Retrieved from https://cameroncounts.wordpress.com/2017/01/31/polynomials-taking-integer-values/.
[19]
Quentin Carbonneaux, Jan Hoffmann, and Zhong Shao. 2015. Compositional certified resource bounds. In PLDI’15. 467--478.
[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.
[21]
Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An efficient SMT solver. In TACAS’08 (LNCS 4963). 337--340.
[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.
[23]
Complexity Analysis-Based Guaranteed Execution. 2015. Retrieved from https://www.draper.com/news-releases/drapers-cage-could-spot-code-vulnerable-denial-service-attacks.
[24]
Stephan Falke, Deepak Kapur, and Carsten Sinz. 2012. Termination analysis of imperative programs using bitvector arithmetic. In VSTTE’12 (LNCS 7152). 261--277.
[25]
Azadeh Farzan and Zachary Kincaid. 2015. Compositional recurrence analysis. In FMCAD’15. 57--64.
[26]
Antonio Flores-Montoya and Reiner Hähnle. 2014. Resource analysis of complex programs with cost equations. In APLAS’14 (LNCS 8858). 275--295.
[27]
Antonio Flores-Montoya. 2016. Upper and lower amortized cost bounds of programs expressed as cost relations. In FM’16 (LNCS 9995). 254--273.
[28]
Space/Time Analysis for Cybersecurity (STAC). 2015. Retrieved from http://www.darpa.mil/program/space-time-analysis-for-cybersecurity.
[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.
[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.
[31]
Florian Frohn and Jürgen Giesl. 2019. Termination of triangular integer loops is decidable. In CAV’19 (LNCS 11562). 426--444.
[32]
Florian Frohn and Jürgen Giesl. 2019. Proving non-termination via loop acceleration. In FMCAD’19. 221--230.
[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.
[34]
Hongfei Fu and Krishnendu Chatterjee. 2019. Termination of nondeterministic probabilistic programs. In VMCAI’19 (LNCS 11388). 468--490.
[35]
Pierre Ganty, Radu Iosif, and Filip Konecný. 2017. Underapproximation of procedure summaries for integer programs. STTT 19, 5 (2017), 565--584.
[36]
Jürgen Giesl, Peter Giesl, and Marcel Hark. 2019. Computing expected runtimes for constant probability programs. In CADE’19 (LNAI 11716). 269--286.
[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.
[38]
Laure Gonnord and Nicolas Halbwachs. 2006. Combining widening and acceleration in linear relation analysis. In SAS’06 (LNCS 4134). 144--160.
[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.
[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.
[41]
André Heck. 1996. Introduction to Maple (2nd ed.). Springer.
[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.
[43]
Nao Hirokawa and Georg Moser. 2008. Automated complexity analysis based on the dependency pair method. In IJCAR’08 (LNAI 5195). 364--379.
[44]
Dieter Hofbauer and Clemens Lautemann. 1989. Termination proofs and the length of derivations. In RTA’89 (LNCS 355). 167--177.
[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.
[46]
Jan Hoffmann and Zhong Shao. 2015. Type-based amortized resource analysis with integers and arrays. J. Funct. Prog. 25 (2015).
[47]
Jan Hoffmann, Ankush Das, and Shu-Chun Weng. 2017. Towards automatic resource bound analysis for OCaml. In POPL’17. 359--373.
[48]
Bertrand Jeannet, Peter Schrammel, and Sriram Sankaranarayanan. 2014. Abstract acceleration of general linear loops. In POPL’14. 529--540.
[49]
KoAT Benchmarks 2014. Retrieved from https://github.com/s-falke/kittel-koat/tree/master/koat-evaluation/examples.
[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.
[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.
[52]
LoAT. 2019. Retrieved from https://github.com/aprove-developers/LoAT.
[53]
Kumar Madhukar, Björn Wachter, Daniel Kroening, Matt Lewis, and Mandayam K. Srivas. 2015. Accelerating invariant generation. In FMCAD’15. 105--111.
[54]
Annabelle McIver and Carroll Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer.
[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.
[56]
Andreas Podelski and Andrey Rybalchenko. 2004. A complete method for the synthesis of linear ranking functions. In VMCAI’04 (LNCS 2937). 239--251.
[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.
[58]
Akhilesh Srikanth, Burak Sahin, and William R. Harris. 2017. Complexity verification using guided theorem enumeration. In POPL’17. 639--652.
[59]
Jan Strejcek and Marek Trtík. 2012. Abstracting path conditions. In ISSTA’12. 155--165.
[60]
Di Wang and Jan Hoffmann. 2019. Type-guided worst-case input generation. PACMPL 3, POPL (2019), 13:1--13:30.
[61]
Stephen Wolfram. 1992. Mathematica: A system for doing mathematics by computer. SIAM Rev. 34, 3 (1992), 519--522.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

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
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 October 2020
Accepted: 01 July 2020
Revised: 01 June 2020
Received: 01 September 2019
Published in TOPLAS Volume 42, Issue 3

Check for updates

Author Tags

  1. Integer programs
  2. automated complexity analysis
  3. lower bounds
  4. runtime complexity

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)131
  • Downloads (Last 6 weeks)26
Reflects downloads up to 12 Sep 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Estimating the Runtime and Global Network Traffic of SMPC ProtocolsProceedings of the Fourteenth ACM Conference on Data and Application Security and Privacy10.1145/3626232.3653258(7-18)Online publication date: 19-Jun-2024
  • (2024)Integrating Loop Acceleration Into Bounded Model CheckingFormal Methods10.1007/978-3-031-71162-6_4(73-91)Online publication date: 11-Sep-2024
  • (2024)Satisfiability Modulo Exponential Integer ArithmeticAutomated Reasoning10.1007/978-3-031-63498-7_21(344-365)Online publication date: 3-Jul-2024
  • (2023)Lower Bounds for Possibly Divergent Probabilistic ProgramsProceedings of the ACM on Programming Languages10.1145/35860517:OOPSLA1(696-726)Online publication date: 6-Apr-2023
  • (2022)Differential cost analysis with simultaneous potentials and anti-potentialsProceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3519939.3523435(442-457)Online publication date: 9-Jun-2022
  • (2022)A calculus for modular loop acceleration and non-termination proofsInternational Journal on Software Tools for Technology Transfer (STTT)10.1007/s10009-022-00670-224:5(691-715)Online publication date: 1-Oct-2022
  • (2022)Automatic Complexity Analysis of Integer Programs via Triangular Weakly Non-Linear LoopsAutomated Reasoning10.1007/978-3-031-10769-6_43(734-754)Online publication date: 8-Aug-2022
  • (2022)Proving Non-Termination and Lower Runtime Bounds with LoAT (System Description)Automated Reasoning10.1007/978-3-031-10769-6_41(712-722)Online publication date: 8-Aug-2022
  • (2022)Improving Automatic Complexity Analysis of Integer ProgramsThe Logic of Software. A Tasting Menu of Formal Methods10.1007/978-3-031-08166-8_10(193-228)Online publication date: 4-Jul-2022
  • (2021)Lower-Bound Synthesis Using Loop Specialization and Max-SMTComputer Aided Verification10.1007/978-3-030-81688-9_40(863-886)Online publication date: 20-Jul-2021

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media