Hostname: page-component-76fb5796d-25wd4 Total loading time: 0 Render date: 2024-04-26T04:30:56.165Z Has data issue: false hasContentIssue false

Type-based analysis of logarithmic amortised complexity

Published online by Cambridge University Press:  19 October 2021

Martin Hofmann
Affiliation:
Institut für Informatik, Ludwig-Maximilians-Universität München, Germany
Lorenz Leutgeb
Affiliation:
Institut für Logic and Computation 192/4, Technische Universität Wien, Austria
David Obwaller
Affiliation:
Institut für Informatik, Universität Innsbruck, Austria
Georg Moser
Affiliation:
Institut für Informatik, Universität Innsbruck, Austria
Florian Zuleger*
Affiliation:
Institut für Logic and Computation 192/4, Technische Universität Wien, Austria
*
*Corresponding author. Email: florian.zuleger@tuwien.ac.at
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We introduce a novel amortised resource analysis couched in a type-and-effect system. Our analysis is formulated in terms of the physicist’s method of amortised analysis and is potentialbased. The type system makes use of logarithmic potential functions and is the first such system to exhibit logarithmic amortised complexity. With our approach, we target the automated analysis of self-adjusting data structures, like splay trees, which so far have only manually been analysed in the literature. In particular, we have implemented a semi-automated prototype, which successfully analyses the zig-zig case of splaying, once the type annotations are fixed.

Type
Special Issue: In Homage to Martin Hofmann
Creative Commons
Creative Common License - CCCreative Common License - BYCreative Common License - NCCreative Common License - SA
This is an Open Access article, distributed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike licence (http://creativecommons.org/licenses/by-nc-sa/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2021. Published by Cambridge University Press

References

Albert, E., Arenas, P., Genaim, S. and Puebla, G. (2008). Automatic inference of upper bounds for recurrence relations in cost analysis. In: Proceedings of the 15th SAS, vol. 5079, 221–237.CrossRefGoogle Scholar
Albert, E., Arenas, P., Genaim, S. and Puebla, G. (2011). Closed-form upper bounds in static cost analysis. Journal of Automated Reasoning 46 (2).CrossRefGoogle Scholar
Alias, C., Darte, A., Feautrier, P. and Gonnord, L. (2010). Multi-dimensional rankings, program termination, and complexity bounds of flowchart programs. In: Proceedings of the 17th SAS, vol. 6337, LNCS, 117–133.CrossRefGoogle Scholar
Alonso-Blas, D. E. and Genaim, S. (2012). On the limits of the classical approach to cost analysis. In: Miné, A. and Schmidt, D. (eds.) Proceedings of the 19th SAS, vol. 7460, LNCS, Springer, 405–421.CrossRefGoogle Scholar
Avanzini, M., Eguchi, N. and Moser, G. (2011). A path order for rewrite systems that compute exponential time functions. In: Proceedings of the 22nd RTA, vol. 10. LIPIcs, 123–138.Google Scholar
Avanzini, M., Lago, U. D. and Moser, G. (2015). Analysing the complexity of functional programs: higher-order meets first-order. In: Proceedings of the 20th ICFP, ACM, 152164.CrossRefGoogle Scholar
Avanzini, M. and Moser, G. (2016). A combination framework for complexity. Information and Computation 248 2255.CrossRefGoogle Scholar
Avanzini, M., Moser, G. and Schaper, M. (2016). TcT: Tyrolean Complexity Tool. In: Proceedings of the 22nd TACAS, vol. 9636. LNCS, 407–423.CrossRefGoogle Scholar
Bauer, S., Jost, S. and Hofmann, M. (2018). Decidable inequalities over infinite trees. In: Barthe, G., Sutcliffe, G. and Veanes, M. (eds.), Proceedings of the 22nd LPAR, vol. 57. EPiC Series in Computing, EasyChair, 111–130.Google Scholar
Ben-Amram, A. M. and Hamilton, G. W. (2019). Tight worst-case bounds for polynomial loop programs. In: Bojanczyk, M. and Simpson, A. (eds.), Proceedings of the 22nd FOSSACS, vol. 11425. LNCS, Springer, 80–97.CrossRefGoogle Scholar
Blanc, R., Henzinger, T. A., Hottelier, T. and Kovács, L. (2010). ABC: Algebraic bound computation for loops. In: Proceedings of the 16th LPAR, vol. 6355. LNCS, 103–118.CrossRefGoogle Scholar
Brázdil, T., Chatterjee, K., Kucera, A., Novotný, P., Velan, D. and Zuleger, F. (2018). Efficient algorithms for asymptotic bounds on termination time in VASS. In: Dawar, A. and Grädel, E. (eds.) Proceedings of the 33rd LICS, ACM, 185–194.CrossRefGoogle Scholar
Chatterjee, K., Fu, H. and Goharshady, A. K. (2017). Non-polynomial worst-case analysis of recursive programs. In: Proceedings of the 29th CAV, vol. 10427, LNCS, 41–63.CrossRefGoogle Scholar
Colcombet, T., Daviaud, L. and Zuleger, F. (2014). Size-change abstraction and max-plus automata. In: Csuhaj-Varjú, E., Dietzfelbinger, M. and ésik, Z. (eds), Proceedings of 39th MFCS, vol. 8634, LNCS, Springer, 208–219.Google Scholar
Contejean, E., Marché, C., Tomás, A.-P. and Urbain, X. (2005). Mechanically proving termination using polynomial interpretations. Journal of Automated Reasoning 34 (4) 325363.CrossRefGoogle Scholar
Fiedor, T., Holk, L., Rogalewicz, A., Sinn, M., Vojnar, T. and Zuleger, F. (2018). From shapes to amortized complexity. In: Dillig, I. and Palsberg, J. (eds), Proceedings of the 19th VMCAI, vol. 10747, LNCS. Springer, 205–225.CrossRefGoogle Scholar
Flores-Montoya, A. (2017). Cost Analysis of Programs Based on the Refinement of Cost Relations. PhD thesis, Darmstadt University of Technology, Germany.Google Scholar
Fuhs, C., Kop, C. and Nishida, N. (2017). Verifying procedural programs via constrained rewriting induction. Transactions on Computational Logic 18 (2) 14:114:50.Google Scholar
Giesl, J., Aschermann, C., Brockschmidt, M., Emmes, F., Frohn, F., Fuhs, C., Hensel, J., Otto, C., Plücker, M., Schneider-Kamp, P., Ströder, T., Swiderski, S. and Thiemann, R. (2017). Analyzing program termination and complexity automatically with AProVE. Journal of Automated Reasoning 58 (1) 331.CrossRefGoogle Scholar
Gulwani, S. and Zuleger, F. (2010). The reachability-bound problem. In Zorn, B. G. and Aiken, A. (eds.) PLDI, ACM, 292–304.CrossRefGoogle Scholar
Hermenegildo, M., Bueno, F., Carro, M., López-Garca, P., Mera, E., Morales, J. and Puebla, G. (2012). An overview of ciao and its design philosophy. Theory and Practice of Logic Programming 12 (1-2) 219252.CrossRefGoogle Scholar
Hoffmann, J. (2011). Types with Potential: Polynomial Resource Bounds via Automatic Amortized Analysis. PhD thesis, Ludwig-Maximilians-Universiät München. Google Scholar
Hoffmann, J., Aehlig, K. and Hofmann, M. (2011). Multivariate amortized resource analysis. In: Proceedings of the 38th POPL. ACM, 357370.CrossRefGoogle Scholar
Hoffmann, J., Aehlig, K. and Hofmann, M. (2012a). Multivariate amortized resource analysis. Transactions on Programming Languages and Systems 34 (3) 14.CrossRefGoogle Scholar
Hoffmann, J., Aehlig, K. and Hofmann, M. (2012b). Resource aware ML. In Proceedings of the 24th CAV, vol. 7358, LNCS, 781–786.Google Scholar
Hoffmann, J., Das, A. and Weng, S.-C. (2017). Towards automatic resource bound analysis for OCaml. In Proceedings of the 44th POPL. ACM, 359373.CrossRefGoogle Scholar
Hoffmann, J. and Hofmann, M. (2010a). Amortized resource analysis with polymorphic recursion and partial big-step operational semantics. In: Proceedings of the 8th APLAS, vol. 6461. LNCS, 172–187.Google Scholar
Hoffmann, J. and Hofmann, M. (2010b). Amortized resource analysis with polynomial potential. In: Proceedings of the 19th ESOP, vol. 6012, LNCS, 287–306.Google Scholar
Hoffmann, J. and Shao, Z. (2015a). Automatic static cost analysis for parallel programs. In: Proceedings of the 24th ESOP, vol. 9032. LNCS, 132–157.Google Scholar
Hoffmann, J. and Shao, Z. (2015b). Type-based amortized resource analysis with integers and arrays. Journal of Functional Programming 25.CrossRefGoogle Scholar
Hoffmann, J. and Sho, Z. (2014). Type-based amortized resource analysis with integers and arrays. In: Proceedings of the 12th FLOPS, vol. 8475. LNCS, 152–168.CrossRefGoogle Scholar
Hofmann, M. and Jost, S. (2003). Static prediction of heap space usage for first-order functional programs. In: Proceedings of the 30th POPL, ACM, 185197.CrossRefGoogle Scholar
Hofmann, M. and Moser, G. (2014). Amortised resource analysis and typed polynomial interpretations. In: Proceedings of Joint 25th RTA and 12th TLCA, vol. 8560. LNCS, 272–286.CrossRefGoogle Scholar
Hofmann, M. and Moser, G. (2015). Multivariate amortised resource analysis for term rewrite systems. In: Proceedings of the 13th TLCA, vol. 38, LIPIcs, 241–256.Google Scholar
Hofmann, M. and Moser, G. (2018). Analysis of logarithmic amortised complexity.Google Scholar
Hofmann, M. and Rodriguez, D. (2013). Automatic type inference for amortised heap-space analysis. In Felleisen, M. and Gardner, P. (eds.) Proceedings of the 22nd ESOP, vol. 7792. LNCS, Springer, 593–613.CrossRefGoogle Scholar
Jost, S., Hammond, K., Loidl, H.-W. and Hofmann, M. (2010). Static determination of quantitative resource usage for higherorder programs. In: Proceedings of the 37th POPL, ACM, 223236.Google Scholar
Jost, S., Loidl, H.-W., Hammond, K., Scaife, N. and Hofmann, M. (2009). “Carbon Credits” for resource-bounded computations using amortised analysis. In: Proceedings of the 2nd FM, vol. 5850, LNCS, 354–369.CrossRefGoogle Scholar
Jost, S., Vasconcelos, P., Florido, M. and Hammond, K. (2017). Type-based cost analysis for lazy functional languages. Journal of Automated Reasoning 59 (1) 87–120.CrossRefGoogle Scholar
Kahn, D. M. and Hoffmann, J. (2020). Exponential automatic amortized resource analysis. In Goubault-Larrecq, J. and König, B. (eds.) Proceedings of the 23rd FOSSACS, vol. 12077. LNCS, Springer, 359–380.CrossRefGoogle Scholar
Moser, G. and Schneckenreither, M. (2018). Automated amortised resource analysis for term rewrite systems. In: Proceedings of the 14th FLOPS, vol. 10818, LNCS,214–229.CrossRefGoogle Scholar
Moser, G. and Schneckenreither, M. (2020). Automated amortised resource analysis for term rewrite systems. Science of Computer Programming 185.Google Scholar
Nipkow, T. (2015). Amortized complexity verified. In: Proceedings of the 6th ITP, vol. 9236. LNCS, 310–324.CrossRefGoogle Scholar
Okasaki, C. (1999). Purely Functional Data Structures, Cambridge University Press.Google Scholar
Pierce, B. (2002). Types and Programming Languages, MIT Press. Google Scholar
Podelski, A. and Rybalchenko, A. (2004). A complete method for the synthesis of linear ranking functions. In: Proceedings of the 5th VMCAI, vol. 2937, LNCS, 239–251.CrossRefGoogle Scholar
Schoenmakers, B. (1993). A systematic analysis of splaying. Information Processing Letters 45 (1) 4150.CrossRefGoogle Scholar
Schrijver, A. (1999). Theory of Linear and Integer Programming, Wiley. Google Scholar
Sinn, M., Zuleger, F. and Veith, H. (2014). A simple and scalable static analysis for bound analysis and amortized complexity analysis. In: Proceedings of the 26th CAV, vol. 8559. LNCS, 745–761.CrossRefGoogle Scholar
Sinn, M., Zuleger, F. and Veith, H. (2015). Difference constraints: An adequate abstraction for complexity analysis of imperative programs. In: Kaivola, R. and Wahl, T. (eds.) FMCAD, IEEE, 144–151.CrossRefGoogle Scholar
Sinn, M., Zuleger, F. and Veith, H. (2017). Complexity and resource bound analysis of imperative programs using difference constraints. Journal of Automated Reasoning 59 (1) 345.CrossRefGoogle ScholarPubMed
Sleator, D. and Tarjan, R. (1985). Self-adjusting binary search trees. Journal of Alternative and Complementary Medicine 32 (3) 652686.Google Scholar
Tarjan, R. (1985). Amortized computational complexity. SIAM Journal on Algebraic Discrete Methods 6 (2) 306318.CrossRefGoogle Scholar
Wang, P., Wang, D. and Chlipala, A. (2017). TiML: A functional language for practical complexity analysis with invariants. Proceedings of the ACM on Programming Languages 1 (OOPSLA).CrossRefGoogle Scholar
Winkler, S. and Moser, G. (2020). Runtime complexity analysis of logically constrained rewriting. In: Proceedings of the LOPSTR 2020. Google Scholar
Zuleger, F. (2015). Asymptotically precise ranking functions for deterministic size-change systems. In: Beklemishev, L. D. and Musatov, D. V. (eds.) Proceedings of 10th CSR, vol. 9139. LNCS. Springer, 426–442.CrossRefGoogle Scholar
Zuleger, F. (2020). The polynomial complexity of vector addition systems with states. In: Goubault-Larrecq, J. and König, B. (eds.) Proceedings of the 23rd FOSSACS, vol. 12077. LNCS, Springer, 622–641.CrossRefGoogle Scholar
Zuleger, F., Gulwani, S., Sinn, M. and Veith, H. (2011). Bound analysis of imperative programs with the size-change abstraction. In: Yahav, E. (ed.) Proceedings of the 18th SAS, vol. 6887. LNCS. Springer, 280–297.CrossRefGoogle Scholar