Abstract
We develop a weakest-precondition-style calculus à la Dijkstra for reasoning about amortized expected runtimes of randomized algorithms with access to dynamic memory — the aert calculus. Our calculus is truly quantitative, i.e. instead of Boolean valued predicates, it manipulates real-valued functions. En route to the aert calculus, we study the ert calculus for reasoning about expected runtimes of Kaminski et al. [2018] extended by capabilities for handling dynamic memory, thus enabling compositional and local reasoning about randomized data structures. This extension employs runtime separation logic, which has been foreshadowed by Matheja [2020] and then implemented in Isabelle/HOL by Haslbeck [2021]. In addition to Haslbeck’s results, we further prove soundness of the so-extended ert calculus with respect to an operational Markov decision process model featuring countably-branching nondeterminism, provide extensive intuitive explanations, and provide proof rules enabling separation logic-style verification for upper bounds on expected runtimes. Finally, we build the so-called potential method for amortized analysis into the ert calculus, thus obtaining the aert calculus. Soundness of the aert calculus is obtained from the soundness of the ert calculus and some probabilistic form of telescoping. Since one needs to be able to handle changes in potential which can in principle be both positive or negative, the aert calculus needs to be — essentially — capable of handling certain signed random variables. A particularly pleasing feature of our solution is that, unlike e.g. Kozen [1985], we obtain a loop rule for our signed random variables, and furthermore, unlike e.g. Kaminski and Katoen [2017], the aert calculus makes do without the need for involved technical machinery keeping track of the integrability of the random variables.
Finally, we present case studies, including a formal analysis of a randomized delete-insert-find-any set data structure [Brodal et al. 1996], which yields a constant expected runtime per operation, whereas no deterministic algorithm can achieve this.
- Susanne Albers and Marek Karpinski. 2002. Randomized Splay Trees: Theoretical and Experimental Results. Inform. Process. Lett., 81, 4 (2002), 213–221.
Google Scholar
Digital Library
- Robert Atkey. 2011. Amortised Resource Analysis with Separation Logic. Log. Methods Comput. Sci., 7, 2 (2011).
Google Scholar
- Martin Avanzini, Ugo Dal Lago, and Alexis Ghyselen. 2019. Type-Based Complexity Analysis of Probabilistic Functional Programs. In LICS. IEEE, 1–13.
Google Scholar
- Christel Baier and Joost-Pieter Katoen. 2008. Principles of Model Checking. MIT Press.
Google Scholar
Digital Library
- Kevin Batz, Mingshuai Chen, Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Philipp Schröer. 2021. Latticed k-Induction with an Application to Probabilistic Programs. In CAV (2) (Lecture Notes in Computer Science, Vol. 12760). Springer, 524–549.
Google Scholar
- Kevin Batz, Ira Fesefeldt, Marvin Jansen, Joost-Pieter Katoen, Florian Keß ler, Christoph Matheja, and Thomas Noll. 2022. Foundations for Entailment Checking in Quantitative Separation Logic. In ESOP (Lecture Notes in Computer Science, Vol. 13240). Springer, 57–84.
Google Scholar
- Kevin Batz, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Christoph Matheja. 2021. Relatively complete verification of probabilistic programs: an expressive language for expectation-based reasoning. Proc. ACM Program. Lang., 5, POPL (2021), 1–30.
Google Scholar
Digital Library
- Kevin Batz, Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Thomas Noll. 2019. Quantitative Separation Logic — A Logic for Reasoning about Probabilistic Programs. Proc. ACM Program. Lang., 3, POPL (2019), 34:1–34:29.
Google Scholar
Digital Library
- Kevin Batz, Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Lena Verscht. 2022. A Calculus for Amortized Expected Runtimes - Extended Version. CoRR, to appear
Google Scholar
- David Blackwell. 1967. Positive dynamic programming. In Proceedings of the 5th Berkeley Symposium on Mathematical Statistics and Probability. 1, University of California Press, 415–418.
Google Scholar
- Tomás Brázdil, Stefan Kiefer, Antonín Kucera, and Ivana Hutarová Vareková. 2015. Runtime Analysis of Probabilistic Programs with Unbounded Recursion. J. Comput. System Sci., 81, 1 (2015), 288–310.
Google Scholar
Digital Library
- Gerth Stølting Brodal, Shiva Chaudhuri, and Jaikumar Radhakrishnan. 1996. The Randomized Complexity of Maintaining the Minimum. Nord. J. Comput., 3, 4 (1996), 337–351.
Google Scholar
Digital Library
- Quentin Carbonneaux, Jan Hoffmann, Tahina Ramananandro, and Zhong Shao. 2014. End-to-end verification of stack-space bounds for C programs. In PLDI. ACM, 270–281.
Google Scholar
- Orieta Celiku and Annabelle McIver. 2005. Compositional Specification and Analysis of Cost–Based Properties in Probabilistic Programs. In Proc. of the International Symposium on Formal Methods (FM) (Lecture Notes in Computer Science, Vol. 3582). Springer, 107–122.
Google Scholar
Digital Library
- Arthur Charguéraud and François Pottier. 2019. Verifying the Correctness and Amortized Complexity of a Union-Find Implementation in Separation Logic with Time Credits. J. Autom. Reason., 62, 3 (2019), 331–365.
Google Scholar
Digital Library
- Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. 2009. Introduction to Algorithms, 3rd Edition. MIT Press.
Google Scholar
Digital Library
- Martin Fürer. 1999. Randomized Splay Trees. In SODA. ACM/SIAM, 903–904.
Google Scholar
- Armaël Guéneau, Arthur Charguéraud, and François Pottier. 2018. A Fistful of Dollars: Formalizing Asymptotic Complexity Claims via Deductive Program Verification. In ESOP (Lecture Notes in Computer Science, Vol. 10801). Springer, 533–560.
Google Scholar
Cross Ref
- Maximilian Paul Louis Haslbeck. 2021. Verified Quantitative Analysis of Imperative Algorithms. Technische Universität München.
Google Scholar
- Maximilian Paul Louis Haslbeck and Tobias Nipkow. 2018. Hoare Logics for Time Bounds - A Study in Meta Theory. In TACAS (1) (Lecture Notes in Computer Science, Vol. 10805). Springer, 155–171.
Google Scholar
- Jan Hoffmann. 2011. Types with Potential: Polynomial Resource Bounds via Automatic Amortized Analysis. Ph. D. Dissertation. LMU Munich.
Google Scholar
- Jan Hoffmann and Steffen Jost. 2022. Two decades of automatic amortized resource analysis. Math. Struct. Comput. Sci..
Google Scholar
- Samin S. Ishtiaq and Peter William O’Hearn. 2001. BI as an Assertion Language for Mutable Data Structures. In Proc. of the Symposium on Principles of Programming Languages (POPL). ACM, 14–26.
Google Scholar
- David M. Kahn and Jan Hoffmann. 2020. Exponential Automatic Amortized Resource Analysis. In FoSSaCS (Lecture Notes in Computer Science, Vol. 12077). Springer, 359–380.
Google Scholar
- Benjamin Lucien Kaminski. 2019. Advanced Weakest Precondition Calculi for Probabilistic Programs. RWTH Aachen University. Aachen. https://doi.org/10.18154/RWTH-2019-01829
Google Scholar
Cross Ref
- Benjamin Lucien Kaminski and Joost-Pieter Katoen. 2017. A Weakest Pre–expectation Semantics for Mixed–sign Expectations. In Proc. of the Annual Symposium on Logic in Computer Science (LICS). IEEE Computer Society, 1–12.
Google Scholar
Cross Ref
- Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Federico Olmedo. 2018. Weakest Precondition Reasoning for Expected Runtimes of Randomized Algorithms. J. ACM, 30.
Google Scholar
- Dexter Kozen. 1985. A Probabilistic PDL. J. Comput. System Sci., 30, 2 (1985), 162–178.
Google Scholar
Cross Ref
- Lorenz Leutgeb, Georg Moser, and Florian Zuleger. 2022. Automated Expected Amortised Cost Analysis of Probabilistic Data Structures. In Proc. of the International Conference on Computer-Aided Verification (Lecture Notes inn Computer Science). (to appear)
Google Scholar
Digital Library
- Christoph Matheja. 2020. Automated Reasoning and Randomization in Separation Logic. RWTH Aachen University, Germany.
Google Scholar
- Annabelle McIver and Carroll Morgan. 2005. Abstraction, Refinement and Proof for Probabilistic Systems. Springer.
Google Scholar
- Glen Mével, Jacques-Henri Jourdan, and François Pottier. 2019. Time Credits and Time Receipts in Iris. In ESOP (Lecture Notes in Computer Science, Vol. 11423). Springer, 3–29.
Google Scholar
Cross Ref
- Fabian Meyer, Marcel Hark, and Jürgen Giesl. 2021. Inferring Expected Runtimes of Probabilistic Integer Programs Using Expected Sizes. In TACAS (1) (Lecture Notes in Computer Science, Vol. 12651). Springer, 250–269.
Google Scholar
- David Monniaux. 2001. An Abstract Analysis of the Probabilistic Termination of Programs. In Proc. of the Static Analysis Symposium (SAS) (Lecture Notes in Computer Science, Vol. 2126). Springer, 111–126.
Google Scholar
Cross Ref
- Marcel Moosbrugger, Ezio Bartocci, Joost-Pieter Katoen, and Laura Kovács. 2021. Automated Termination Analysis of Polynomial Probabilistic Programs. In ESOP (Lecture Notes in Computer Science, Vol. 12648). Springer, 491–518.
Google Scholar
Digital Library
- Van Chan Ngo, Quentin Carbonneaux, and Jan Hoffmann. 2018. Bounded Expectations: Resource Analysis for Probabilistic Programs. In Proc. of the Conference on Programming Language Design and Implementation (PLDI). ACM, 496–512.
Google Scholar
Digital Library
- Tobias Nipkow. 2015. Amortized Complexity Verified. In ITP (Lecture Notes in Computer Science, Vol. 9236). Springer, 310–324.
Google Scholar
Cross Ref
- Tobias Nipkow and Hauke Brinkop. 2019. Amortized Complexity Verified. J. Autom. Reason., 62, 3 (2019), 367–391.
Google Scholar
Digital Library
- William W. Pugh. 1989. Skip Lists: A Probabilistic Alternative to Balanced Trees. In WADS (Lecture Notes in Computer Science, Vol. 382). Springer, 437–449.
Google Scholar
Cross Ref
- Martin Lee Puterman. 2005. Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons.
Google Scholar
Digital Library
- Vineet Rajani, Marco Gaboardi, Deepak Garg, and Jan Hoffmann. 2021. A unifying type-theory for higher-order (amortized) cost analysis. Proc. ACM Program. Lang., 5, POPL (2021), 1–28.
Google Scholar
Digital Library
- John Charles Reynolds. 2002. Separation Logic: A Logic for Shared Mutable Data Structures. In Proc. of the Annual Symposium on Logic in Computer Science (LICS). IEEE Computer Society, 55–74.
Google Scholar
Cross Ref
- Daniel Dominic Sleator and Robert Endre Tarjan. 1985. Self-Adjusting Binary Search Trees. J. ACM, 652–686.
Google Scholar
- Robert Endre Tarjan. 1985. Amortized Computational Complexity. SIAM Journal on Algebraic Discrete Methods, 306–318.
Google Scholar
- Di Wang, David M. Kahn, and Jan Hoffmann. 2020. Raising expectations: automating expected cost analysis with types. Proc. ACM Program. Lang., 4, ICFP (2020), 110:1–110:31.
Google Scholar
Digital Library
Index Terms
A Calculus for Amortized Expected Runtimes
Recommendations
Weakest Precondition Reasoning for Expected Runtimes of Randomized Algorithms
This article presents a wp--style calculus for obtaining bounds on the expected runtime of randomized algorithms. Its application includes determining the (possibly infinite) expected termination time of a randomized algorithm and proving positive ...
Toward Optimal Self-Adjusting Heaps
We give a variant of the pairing heaps that achieves the following amortized costs: O(1) per find-min and insert, O(log log n) per decrease-key and meld, O(log n) per delete-min; where n is the number of elements in the resulting heap on which the ...
Fully dynamic connectivity in O(log n(log log n)2) amortized expected time
SODA '17: Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete AlgorithmsDynamic connectivity is one of the most fundamental problems in dynamic graph algorithms. We present a new randomized dynamic connectivity structure with O(log n(log log n)2) amortized expected update time and O(log n/log log log n) query time, which ...






Comments