Skip to main content

Certified Abstract Cost Analysis

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 12649)

Abstract

A program containing placeholders for unspecified statements or expressions is called an abstract (or schematic) program. Placeholder symbols occur naturally in program transformation rules, as used in refactoring, compilation, optimization, or parallelization. We present a generalization of automated cost analysis that can handle abstract programs and, hence, can analyze the impact on the cost of program transformations. This kind of relational property requires provably precise cost bounds which are not always produced by cost analysis. Therefore, we certify by deductive verification that the inferred abstract cost bounds are correct and sufficiently precise. It is the first approach solving this problem. Both, abstract cost analysis and certification, are based on quantitative abstract execution (QAE) which in turn is a variation of abstract execution, a recently developed symbolic execution technique for abstract programs. To realize QAE the new concept of a cost invariant is introduced. QAE is implemented and runs fully automatically on a benchmark set consisting of representative optimization rules.

References

  1. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, 1986.

    Google Scholar 

  2. Wolfgang Ahrendt, Bernhard Beckert, Richard Bubel, Reiner Hähnle, Peter H. Schmitt, and Mattias Ulbrich, editors. Deductive Software Verification - The KeY Book - From Theory to Practice, volume 10001 of LNCS. Springer, 2016.

    Google Scholar 

  3. Elvira Albert, Puri Arenas, Samir Genaim, German Puebla, and Damiano Zanardini. Cost analysis of object-oriented bytecode programs. Theor. Comput. Sci., 413(1):142–159, 2012.

    Google Scholar 

  4. Elvira Albert, Richard Bubel, Samir Genaim, Reiner Hähnle, Germán Puebla, and Guillermo Román-Díez. A formal verification framework for static analysis - as well as its instantiation to the resource analyzer COSTA and formal verification tool KeY. Software and Systems Modeling, 15(4):987–1012, 2016.

    Google Scholar 

  5. Roberto Bagnara, Patricia M. Hill, and Enea Zaffanella. The Parma polyhedra library: Toward a complete set of numerical abstractions for the analysis and verification of hardware and software systems. Sci. Comput. Program., 72(1-2):3–21, 2008.

    Google Scholar 

  6. Roberto Bagnara, Fred Mesnard, Andrea Pescetti, and Enea Zaffanella. A new look at the automatic synthesis of linear ranking functions. Inf. Comput., 215:47–67, 2012.

    Google Scholar 

  7. Yves Bertot and Pierre Castéran. Interactive Theorem Proving and Program Development - Coq’Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. An EATCS Series. Springer, 2004.

    Google Scholar 

  8. Régis Blanc, Thomas A. Henzinger, Thibaud Hottelier, and Laura Kovács. ABC: algebraic bound computation for loops. In Edmund M. Clarke and Andrei Voronkov, editors, Logic for Programming, Artificial Intelligence, and Reasoning - 16th International Conference, LPAR-16, Dakar, Senegal, April 25-May 1, 2010, Revised Selected Papers, volume 6355 of LNCS, pages 103–118. Springer, 2010.

    Google Scholar 

  9. Robert S. Boyer, Bernard Elspas, and Karl N. Levitt. SELECT—A formal system for testing and debugging programs bysymbolic execution. ACM SIGPLAN Notices, 10(6):234–245, June 1975.

    Google Scholar 

  10. Marc Brockschmidt, Fabian Emmes, Stephan Falke, Carsten Fuhs, and JürgenGiesl. Alternating runtime and size complexity analysis of integer programs. In Erika Ábrahám and Klaus Havelund, editors, Tools and Algorithms for the Construction and Analysis of Systems - 20th Intl. Conf., TACAS, Grenoble, France, volume 8413 of LNCS, pages 140–155. Springer, 2014.

    Google Scholar 

  11. Marc Brockschmidt, Richard Musiol, Carsten Otto, and Jürgen Giesl. Automated termination proofs for Java programs with cyclic data. In P. Madhusudan and Sanjit A. Seshia, editors, Computer Aided Verification - 24th International Conference, CAV 2012, Berkeley, CA, USA, July 7-13, 2012 Proceedings, volume 7358 of LNCS, pages 105–122. Springer, 2012.

    Google Scholar 

  12. Richard Bubel, Andreas Roth, and Philipp Rümmer. Ensuring the Correctness of Lightweight Tactics for JavaCard Dynamic Logic. Electr. Notes Theor. Comput. Sci., 199:107–128, 2008.

    Google Scholar 

  13. Patrick Cousot and Nicolas Halbwachs. Automatic discovery of linear restraints among variables of a program. In Alfred V. Aho, Stephen N. Zilles, and Thomas G. Szymanski, editors, Conference Record of the Fifth Annual ACM Symposium on Principles of Programming Languages, Tucson, Arizona, USA, January 1978, pages 84–96. ACM Press, 1978.

    Google Scholar 

  14. Karl Crary and Stephanie Weirich. Resource bound certification. In Mark N. Wegman and Thomas W. Reps, editors, POPL 2000, Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Boston, Massachusetts, USA, January 19-21, 2000, pages 184–198. ACM, 2000.

    Google Scholar 

  15. Jean-Christophe Filliâtre and Claude Marché. The Why/Krakatoa/Caduceus platform for deductive program verification. In Werner Damm and Holger Hermanns, editors, Computer Aided Verification, 19th Intl. Conf., CAV, Berlin, Germany, volume 4590 of LNCS, pages 173–177. Springer, 2007.

    Google Scholar 

  16. Antonio Flores-Montoya and Reiner Hähnle. Resource analysis of complex programs with cost equations. In Jacques Garrigue, editor, Programming Languages and Systems -12th Asian Symposium, APLAS 2014, Singapore, November 17-19, 2014, Proceedings, volume 8858 of LNCS, pages 275–295. Springer, 2014.

    Google Scholar 

  17. Jürgen Giesl, Marc Brockschmidt, Fabian Emmes, Florian Frohn, Carsten Fuhs, Carsten Otto, Martin Plücker, Peter Schneider-Kamp, Thomas Ströder, Stephanie Swiderski, and René Thiemann. Proving termination of programs automatically with AProVE. In Stéphane Demri, Deepak Kapur, and Christoph Weidenbach, editors, Automated Reasoning - 7th Intl. Joint Conf., IJCAR, Vienna, Austria, volume 8562 of LNCS, pages 184–191. Springer, 2014.

    Google Scholar 

  18. Benny Godlin and Ofer Strichman. Regression Verification: Proving the Equivalence of Similar Programs. Softw. Test., Verif. Reliab., 23(3):241–258, 2013

    Google Scholar 

  19. Neville Grech, Kyriakos Georgiou, James Pallister, Steve Kerrison, and Kerstin Eder. Static energy consumption analysis of LLVM IR programs. CoRR, abs/1405.4565, 2014.

    Google Scholar 

  20. Sumit Gulwani, Krishna K. Mehra, and Trishul M. Chilimbi. SPEED: precise and efficient static estimation of program computational complexity. In Zhong Shao and Benjamin C. Pierce, editors, Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, Savannah, GA, USA, January 21-23, 2009, pages 127–139. ACM, 2009.

    Google Scholar 

  21. Reiner Hähnle and Marieke Huisman. Deductive verification: from pen-and-paper proofs to industrial tools. In Bernhard Steffen and Gerhard Woeginger, editors, Computing and Software Science: State of the Art and Perspectives, volume 10000 of LNCS, pages 345–373. Springer, 2019.

    Google Scholar 

  22. Reiner Hähnle and Dominic Steinhöfel. Modular, correct compilation with automatic soundness proofs. In Tiziana Margaria and Bernhard Steffen, editors, Leveraging Applications of Formal Methods, Verification and Validation: Foundational Techniques, 8th Intl. Symp., Proc. Part I, ISoLA, Cyprus, volume 11244 of LNCS, pages 424–447. Springer, 2018.

    Google Scholar 

  23. Jan Hoffmann and Martin Hofmann. Amortized resource analysis with polynomial potential. In Andrew D. Gordon, editor, Programming Languages and Systems, 19th European Symposium on Programming, ESOP, Paphos, Cyprus, volume 6012 of LNCS, pages 287–306. Springer, 2010.

    Google Scholar 

  24. John Hughes, Lars Pareto, and Amr Sabry. Proving the correctness of reactive systems using sized types. In Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’96, page 410–423, New York, NY, USA, 1996. Association for Computing Machinery.

    Google Scholar 

  25. James C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385–394, July 1976.

    Google Scholar 

  26. Sudipta Kundu, Zachary Tatlock, and Sorin Lerner. Proving Optimizations Correct Using Parameterized Program Equivalence. In Proc. PLDI 2009, pages 327–337, 2009.

    Google Scholar 

  27. Gary T. Leavens, Erik Poll, Curtis Clifton, Yoonsik Cheon, Clyde Ruby, David Cok, Peter Müller, Joseph Kiniry, Patrice Chalin, Daniel M. Zimmerman, and Werner Dietl. JML Reference Manual, May 2013. Draft revision 2344.

    Google Scholar 

  28. Rustan Leino. Dafny: An automatic program verifier for functional correctness. In 16th International Conference, LPAR-16, Dakar, Senegal, pages 348–370. Springer Berlin Heidelberg, April 2010.

    Google Scholar 

  29. Umer Liqat, Kyriakos Georgiou, Steve Kerrison, Pedro López-García, John P. Gallagher, Manuel V. Hermenegildo, and Kerstin Eder. Inferring parametric energy consumption functions at different software levels: ISA vs. LLVM IR. In Marko C. J. D. van Eekelen and Ugo Dal Lago, editors, Foundational and Practical Aspects of Resource Analysis - 4th Intl. Workshop, FOPARA, London, UK, Revised Selected Papers, volume 9964 of LNCS, pages 81–100, 2015.

    Google Scholar 

  30. Nuno P. Lopes, David Menendez, Santosh Nagarakatte, and John Regehr. Practical Verification of Peephole Optimizations with Alive. Commun. ACM, 61(2):84–91, 2018.

    Google Scholar 

  31. Tobias Nipkow, Lawrence C. Paulson, and Markus Wenzel. Isabelle/HOL - A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002.

    Google Scholar 

  32. Ivan Radiček, Gilles Barthe, Marco Gaboardi, Deepak Garg, and Florian Zuleger. Monadic refinements for relational cost analysis. Proc. ACM Program. Lang., 2(POPL), December 2017.

    Google Scholar 

  33. Wolfgang Reif. The KIV-approach to software verification. In KORSO - Methods, Languages, and Tools for the Construction of Correct Software, volume 1009 of LNCS, pages 339–370. Springer, 1995.

    Google Scholar 

  34. Jan Smans, Bart Jacobs, Frank Piessens, and Wolfram Schulte. An automatic verifier for Java-like programs based on dynamic frames. In José Luiz Fiadeiro and Paola Inverardi, editors, Fundamental Approaches to Software Engineering, 11th Intl. Conf., FASE, Budapest, Hungary, volume 4961 of LNCS, pages 261–275. Springer, 2008.

    Google Scholar 

  35. Fausto Spoto, Fred Mesnard, and Étienne Payet. A termination analyzer for Java bytecode based on path-length. ACM Trans. Program. Lang. Syst., 32(3):8:1–8:70, 2010.

    Google Scholar 

  36. Dominic Steinhöfel. REFINITY to Model and Prove Program Transformation Rules. In Bruno C. d. S. Oliveira, editor, Proc. 18th Asian Symposium on Programming Languages and Systems (APLAS), LNCS. Springer, 2020.

    Google Scholar 

  37. Dominic Steinhöfel and Reiner Hähnle. Abstract execution. In Maurice H. ter Beek, Annabelle McIver, and José N. Oliveira, editors, Formal Methods - The Next 30 Years - Third World Congress, FM 2019, Porto, Portugal, October 7-11, 2019, Proceedings, volume 11800 of LNCS, pages 319–336. Springer, 2019.

    Google Scholar 

  38. Dominic Steinhöfel. Abstract Execution: Automatically Proving Infinitely Many Programs. PhD thesis, Technical University of Darmstadt, Department of Computer Science, Darmstadt, Germany, 2020.

    Google Scholar 

  39. Ben Wegbreit. Mechanical program analysis. Commun. ACM, 18(9):528–539, 1975.

    Google Scholar 

  40. Florian Zuleger, Sumit Gulwani, Moritz Sinn, and Helmut Veith. Bound analysis of imperative programs with the size-change abstraction (extended version). CoRR, abs/1203.5303, 2012.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Alicia Merayo .

Editor information

Editors and Affiliations

Rights and permissions

Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.

The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

Reprints and Permissions

Copyright information

© 2021 The Author(s)

About this paper

Verify currency and authenticity via CrossMark

Cite this paper

Albert, E., Hähnle, R., Merayo, A., Steinhöfel, D. (2021). Certified Abstract Cost Analysis. In: Guerra, E., Stoelinga, M. (eds) Fundamental Approaches to Software Engineering. FASE 2021. Lecture Notes in Computer Science(), vol 12649. Springer, Cham. https://doi.org/10.1007/978-3-030-71500-7_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-71500-7_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-71499-4

  • Online ISBN: 978-3-030-71500-7

  • eBook Packages: Computer ScienceComputer Science (R0)