Skip to main content
Log in

Amortized Complexity Verified

  • Published:
Journal of Automated Reasoning Aims and scope Submit manuscript

Abstract

A framework for the analysis of the amortized complexity of functional data structures is formalized in the proof assistant Isabelle/HOL and applied to a number of standard examples and to the following non-trivial ones: skew heaps, splay trees, splay heaps and pairing heaps. The proofs are completely algebraic and are presented in some detail.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Atkey, R.: Amortised resource analysis with separation logic. Log. Methods Comput. Sci. 7, 2 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  2. Benzinger, R.: Automated higher-order complexity analysis. Theor. Comput. Sci. 318(1–2), 79–103 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  3. Brinkop, H., Nipkow, T.: Pairing heap. Archive of Formal Proofs (2016). Formal proof development. http://isa-afp.org/entries/Pairing_Heap.html

  4. Carbonneaux, Q., Hoffmann, J., Reps, T.W., Shao, Z.: Automated resource analysis with Coq proof objects. In: Majumdar, R., Kuncak, V. (eds.) Computer Aided Verification, CAV 2017, Part II. Lecture Notes in Computer Science, vol. 10427, pp. 64–85. Springer, Berlin (2017)

    Google Scholar 

  5. Charguéraud, A., Pottier, F.: Verifying the correctness and amortized complexity of a union-find implementation in separation logic with time credits. J. Autom. Reason. To appear

  6. Charguéraud, A., Pottier, F.: Machine-checked verification of the correctness and amortized complexity of an efficient union-find implementation. In: Urban, C., Zhang, X. (eds.) ITP 2015, volume 9236 of LNCS, pp. 137–153. Springer, Berlin (2015)

  7. Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. MIT Press, Cambridge (1990)

    MATH  Google Scholar 

  8. Crary, K., Weirich, S.: Resource bound certification. In: Proceeding of the 27th Symposium on Principles of Programming Languages, POPL ’00, pp. 184–198. ACM (2000)

  9. Danielsson, N. A.: Lightweight semiformal time complexity analysis for purely functional data structures. In: Proceeding of the 35th Symposium on Principles of Programming Languages, POPL ’08, pp. 133–144. ACM (2008)

  10. Danner, N., Licata, D. R., Ramyaa, R.: Denotational cost semantics for functional languages with inductive types. In: Proceedings of the International Conference on Functional Programming, ICFP 2015, pp. 140–151. ACM (2015)

  11. Danner, N., Paykin, J., Royer, J.: A static cost analysis for a higher-order language. In: Proceeding of the Workshop Programming Languages Meets Program Verification, PLPV ’13, pp. 25–34. ACM (2013)

  12. Flajolet, P., Salvy, B., Zimmermann, P.: Automatic average-case analysis of algorithms. Theor. Comput. Sci. 79(1), 37–109 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  13. Fredman, M.L., Sedgewick, R., Sleator, D., Tarjan, R.: The pairing heap: a new form of self-adjusting heap. Algorithmica 1(1), 111–129 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  14. Haeupler, B., Sen, S., Tarjan, R.E.: Rank-pairing heaps. SIAM J. Comput. 40(6), 1463–1485 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  15. Haftmann, F., Nipkow, T.: Code generation via higher-order rewrite systems. In: Blume, M., Kobayashi, N., Vidal, G. (eds.) Functional and Logic Programming (FLOPS 2010). Springer, Berlin (2010)

  16. Harrison, J.: Verifying nonlinear real formulas via sums of squares. In: Schneider, K., Brandt, J. (eds.) TPHOLs 2007, volume 4732 of LNCS, pp. 102–118. Springer, Berlin (2007)

  17. Hickey, T., Cohen, J.: Automating program analysis. J. ACM 35(1), 185–220 (1988)

    Article  MathSciNet  MATH  Google Scholar 

  18. Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst. 34(3), 14 (2012)

    Article  MATH  Google Scholar 

  19. Hoffmann, J., Das, A., Weng, S.-C.: Towards automatic resource bound analysis for OCaml. In: Proceeding of the 44th Symposium on Principles of Programming Languages, POPL ’17, pp. 359–373. ACM (2017)

  20. Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functional programs. In: Proceeding of the 30th ACM Symposium Principles of Programming Languages, pp. 185–197 (2003)

  21. Hupel, L., Nipkow, T.: A verified compiler from Isabelle/HOL to CakeML. In: Ahmed, A. (eds.) European Symposium on Programming (ESOP 2018), volume of LNCS, Springer, Berlin (2018)

  22. Iacono, J.: Improved upper bounds for pairing heaps. In: M. M. Halldórsson (ed.) Algorithm Theory - SWAT 2000, volume 1851 of LNCS, pp. 32–45. Springer (2000)

  23. Kaldewaij, A., Schoenmakers, B.: The derivation of a tighter bound for top-down skew heaps. Inf. Process. Lett. 37, 265–271 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  24. Krauss, A.: Partial recursive functions in higher-order logic. In: Furbach, U., Shankar, N. (eds.) Automated Reasoning (IJCAR 2006), volume 4130 of LNCS, pp. 589–603. Springer, Berlin (2006)

    Google Scholar 

  25. Kumar, R., Myreen, M. O., Norrish, M., Owens, S.: CakeML: A verified implementation of ML. In: Symposium Principles of Programming Languages, POPL ’14, pp. 179–191. ACM (2014)

  26. Le Métayer, D.: ACE: an automatic complexity evaluator. ACM Trans. Program. Lang. Syst. 10(2), 248–266 (1988)

    Article  Google Scholar 

  27. Madhavan, R., Kulal, S., Kuncak, V.: Contract-based resource verification for higher-order functions with memoization. In: Principles of Programming Languages (POPL) (2017)

  28. McCarthy, J. A., Fetscher, B., New, M. S., Feltey, D., Findler, R. B.: A Coq library for internal verification of running-times. In: Kiselyov, O., King, A. (eds.) Functional and Logic Programming (FLOPS 2016), volume 9613 of LNCS, pp. 144–162. Springer, Berlin (2016)

  29. Nipkow, T.: Amortized complexity verified. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Amortized_Complexity.shtml

  30. Nipkow, T.: Skew heap. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Skew_Heap.shtml

  31. Nipkow, T.: Splay tree. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Splay_Tree.shtml

  32. Nipkow, T.: Amortized complexity verified. In: Urban, C., Zhang, X. (eds.) Interactive Theorem Proving (ITP 2015), volume 9236 of LNCS, pp. 310–324. Springer, Berlin (2015)

  33. Nipkow, T.: Automatic functional correctness proofs for functional search trees. In: Blanchette, J., Merz, S. (eds.) Interactive Theorem Proving (ITP 2016), LNCS. Springer, Berlin (2016)

  34. Nipkow, T.: Pairing heap. Archive of Formal Proofs (2016). Formal proof development. http://isa-afp.org/entries/Pairing_Heap.shtml

  35. Nipkow, T.: Verified root-balanced trees. In: Chang, B.-Y. E. (ed.) Asian Symposium on Programming Languages and Systems, APLAS 2017, volume 10695 of LNCS, pp. 255–272. Springer, Berlin (2017)

  36. Nipkow, T., Klein, G.: Concrete Semantics with Isabelle/HOL. Springer (2014). http://concrete-semantics.org

  37. Nipkow, T., Paulson, L., Wenzel, M.: Isabelle/HOL—A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, Berlin (2002)

  38. Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)

    Book  MATH  Google Scholar 

  39. Sands, D.: Complexity analysis for a lazy higher-order language. In: Jones, N. (eds.) European Symposium on Programming (ESOP), volume 432 of LNCS, pp. 361–376. Springer, Berlin (1990)

  40. Schoenmakers, B.: A systematic analysis of splaying. Inf. Process. Lett. 45, 41–50 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  41. Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. J. ACM 32(3), 652–686 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  42. Sleator, D.D., Tarjan, R.E.: Self-adjusting heaps. SIAM J. Comput. 15(1), 52–69 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  43. Tarjan, R.E.: Amortized complexity. SIAM J. Algebraic. Disc. Meth. 6(2), 306–318 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  44. Traytel, D., Berghofer, S., Nipkow, T.: Extending Hindley–Milner type inference with coercive structural subtyping. In: Yang, H. (eds.) APLAS 2011, volume 7078 of LNCS, pp. 89–104. Springer, Berlin (2011)

  45. Vasconcelos, P. B., Hammond, K.: Inferring cost equations for recursive, polymorphic and higher-order functional programs. In: Trinder, P., Michaelson, G., Pena, R. (eds.) Implementation of Functional Languages, IFL 2003, volume 3145 of LNCS, pp. 86–101. Springer, Berlin (2004)

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

    Article  MathSciNet  MATH  Google Scholar 

  47. Wenzel, M.: Isabelle/Isar—A Versatile Environment for Human-Readable Formal Proof Documents. PhD thesis, Institut für Informatik, Technische Universität München (2002)

Download references

Acknowledgements

Berry Schoenmakers patiently answered many questions about his work. We thank the referees for their careful reading and helpful suggestions.

Author information

Authors and Affiliations

Authors

Additional information

Supported by DFG Koselleck grant NI 491/16-1.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Nipkow, T., Brinkop, H. Amortized Complexity Verified. J Autom Reasoning 62, 367–391 (2019). https://doi.org/10.1007/s10817-018-9459-3

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10817-018-9459-3

Keywords

Navigation