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.
Similar content being viewed by others
Explore related subjects
Discover the latest articles and news from researchers in related subjects, suggested using machine learning.References
Atkey, R.: Amortised resource analysis with separation logic. Log. Methods Comput. Sci. 7, 2 (2011)
Benzinger, R.: Automated higher-order complexity analysis. Theor. Comput. Sci. 318(1–2), 79–103 (2004)
Brinkop, H., Nipkow, T.: Pairing heap. Archive of Formal Proofs (2016). Formal proof development. http://isa-afp.org/entries/Pairing_Heap.html
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)
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
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)
Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. MIT Press, Cambridge (1990)
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)
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)
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)
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)
Flajolet, P., Salvy, B., Zimmermann, P.: Automatic average-case analysis of algorithms. Theor. Comput. Sci. 79(1), 37–109 (1991)
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)
Haeupler, B., Sen, S., Tarjan, R.E.: Rank-pairing heaps. SIAM J. Comput. 40(6), 1463–1485 (2011)
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)
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)
Hickey, T., Cohen, J.: Automating program analysis. J. ACM 35(1), 185–220 (1988)
Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate amortized resource analysis. ACM Trans. Program. Lang. Syst. 34(3), 14 (2012)
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)
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)
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)
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)
Kaldewaij, A., Schoenmakers, B.: The derivation of a tighter bound for top-down skew heaps. Inf. Process. Lett. 37, 265–271 (1991)
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)
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)
Le Métayer, D.: ACE: an automatic complexity evaluator. ACM Trans. Program. Lang. Syst. 10(2), 248–266 (1988)
Madhavan, R., Kulal, S., Kuncak, V.: Contract-based resource verification for higher-order functions with memoization. In: Principles of Programming Languages (POPL) (2017)
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)
Nipkow, T.: Amortized complexity verified. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Amortized_Complexity.shtml
Nipkow, T.: Skew heap. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Skew_Heap.shtml
Nipkow, T.: Splay tree. Archive of Formal Proofs, 2014. Formal proof development. http://isa-afp.org/entries/Splay_Tree.shtml
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)
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)
Nipkow, T.: Pairing heap. Archive of Formal Proofs (2016). Formal proof development. http://isa-afp.org/entries/Pairing_Heap.shtml
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)
Nipkow, T., Klein, G.: Concrete Semantics with Isabelle/HOL. Springer (2014). http://concrete-semantics.org
Nipkow, T., Paulson, L., Wenzel, M.: Isabelle/HOL—A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, Berlin (2002)
Okasaki, C.: Purely Functional Data Structures. Cambridge University Press, Cambridge (1998)
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)
Schoenmakers, B.: A systematic analysis of splaying. Inf. Process. Lett. 45, 41–50 (1993)
Sleator, D.D., Tarjan, R.E.: Self-adjusting binary search trees. J. ACM 32(3), 652–686 (1985)
Sleator, D.D., Tarjan, R.E.: Self-adjusting heaps. SIAM J. Comput. 15(1), 52–69 (1986)
Tarjan, R.E.: Amortized complexity. SIAM J. Algebraic. Disc. Meth. 6(2), 306–318 (1985)
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)
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)
Wegbreit, B.: Mechanical program analysis. Commun. ACM 18(9), 528–539 (1975)
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)
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
Additional information
Supported by DFG Koselleck grant NI 491/16-1.
Rights and permissions
About this article
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
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10817-018-9459-3