Abstract
A thunk is a mutable data structure that offers a simple memoization service: it stores either a suspended computation or the result of this computation. Okasaki [1999] presents many data structures that exploit thunks to achieve good amortized time complexity. He analyzes their complexity by associating a debit with every thunk. A debit can be paid off in several increments; a thunk whose debit has been fully paid off can be forced. Quite strikingly, a debit is associated also with future thunks, which do not yet exist in memory. Some of the debit of a faraway future thunk can be transferred to a nearer future thunk. We present a complete machine-checked reconstruction of Okasaki's reasoning rules in Iris$, a rich separation logic with time credits. We demonstrate the applicability of the rules by verifying a few operations on streams as well as several of Okasaki's data structures, namely the physicist's queue, implicit queues, and the banker's queue.
- Robert Atkey. 2011. Amortised Resource Analysis with Separation Logic. Logical Methods in Computer Science, 7, 2:17 (2011), http://bentnib.org/amortised-sep-logic-journal.pdf Google Scholar
- Arthur Charguéraud and François Pottier. 2017. Verifying the Correctness and Amortized Complexity of a Union-Find Implementation in Separation Logic with Time Credits. Journal of Automated Reasoning, Sept., http://cambium.inria.fr/~fpottier/publis/chargueraud-pottier-uf-sltc.pdf Google Scholar
- Nils Anders Danielsson. 2008. Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures. In Principles of Programming Languages (POPL). http://www.cse.chalmers.se/~nad/publications/danielsson-popl2008.pdf Google Scholar
- James R. Driscoll, Neil Sarnak, Daniel Dominic Sleator, and Robert Endre Tarjan. 1989. Making Data Structures Persistent. J. Comput. System Sci., 38, 1 (1989), 86–124. https://doi.org/10.1016/0022-0000(89)90034-2 Google ScholarDigital Library
- Jennifer Hackett and Graham Hutton. 2019. Call-by-need is clairvoyant call-by-value. Proceedings of the ACM on Programming Languages, 3, ICFP (2019), 114:1–114:23. https://doi.org/10.1145/3341718 Google ScholarDigital Library
- Martin A. T. Handley, Niki Vazou, and Graham Hutton. 2020. Liquidate your assets: reasoning about resource usage in Liquid Haskell. Proceedings of the ACM on Programming Languages, 4, POPL (2020), 24:1–24:27. https://doi.org/10.1145/3371092 Google ScholarDigital Library
- Maximilian P. L. Haslbeck and Peter Lammich. 2021. For a Few Dollars More - Verified Fine-Grained Algorithm Analysis Down to LLVM. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 12648). Springer, 292–319. https://www21.in.tum.de/~haslbema/documents/Haslbeck_Lammich_LLVM_with_Time.pdf Google Scholar
- Maximilian P. L. Haslbeck and Tobias Nipkow. 2018. Hoare Logics for Time Bounds: A Study in Meta Theory. In Tools and Algorithms for Construction and Analysis of Systems (TACAS) (Lecture Notes in Computer Science, Vol. 10805). Springer, 155–171. https://www21.in.tum.de/~nipkow/pubs/tacas18.pdf Google Scholar
- Jan Hoffmann, Michael Marmar, and Zhong Shao. 2013. Quantitative Reasoning for Proving Lock-Freedom. In Logic in Computer Science (LICS). 124–133. http://www.cs.cmu.edu/~janh/papers/lockfree2013.pdf Google Scholar
- John Hughes. 1989. Why Functional Programming Matters. Computer Journal, 32, 2 (1989), 98–107. http://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf Google ScholarDigital Library
- Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming, 28 (2018), e20. https://people.mpi-sws.org/~dreyer/papers/iris-ground-up/paper.pdf Google ScholarCross Ref
- Yao Li, Li-yao Xia, and Stephanie Weirich. 2021. Reasoning about the garden of forking paths. Proceedings of the ACM on Programming Languages, 5, ICFP (2021), 1–28. https://doi.org/10.1145/3473585 Google ScholarDigital Library
- Ravichandhran Madhavan, Sumith Kulal, and Viktor Kuncak. 2017. Contract-based resource verification for higher-order functions with memoization. In Principles of Programming Languages (POPL). 330–343. https://doi.org/10.1145/3009837.3009874 Google ScholarDigital Library
- Simon Marlow, Simon L. Peyton Jones, and Satnam Singh. 2009. Runtime support for multicore Haskell. In International Conference on Functional Programming (ICFP). 65–78. https://www.microsoft.com/en-us/research/wp-content/uploads/2009/09/multicore-ghc.pdf Google ScholarDigital Library
- Jay A. McCarthy, Burke Fetscher, Max S. New, Daniel Feltey, and Robert Bruce Findler. 2016. A Coq Library for Internal Verification of Running-Times. In Functional and Logic Programming (Lecture Notes in Computer Science, Vol. 9613). Springer, 144–162. https://users.cs.northwestern.edu/~robby/publications/papers/flops2016-mfnff.pdf Google ScholarCross Ref
- Glen Mével, Jacques-Henri Jourdan, and François Pottier. 2019. Time credits and time receipts in Iris. In European Symposium on Programming (ESOP) (Lecture Notes in Computer Science, Vol. 11423). Springer, 1–27. http://cambium.inria.fr/~fpottier/publis/mevel-jourdan-pottier-time-in-iris-2019.pdf Google ScholarCross Ref
- Tobias Nipkow and Hauke Brinkop. 2019. Amortized Complexity Verified. Journal of Automated Reasoning, 62, 3 (2019), 367–391. https://www21.in.tum.de/~nipkow/pubs/jar18.pdf Google ScholarDigital Library
- Chris Okasaki. 1999. Purely Functional Data Structures. Cambridge University Press. https://doi.org/10.1017/CBO9780511530104 Google ScholarCross Ref
- Alexandre Pilkiewicz and François Pottier. 2011. The essence of monotonic state. In Types in Language Design and Implementation (TLDI). http://cambium.inria.fr/~fpottier/publis/pilkiewicz-pottier-monotonicity.pdf Google Scholar
- François Pottier, Armaël Guéneau, Jacques-Henri Jourdan, and Glen Mével. 2023. Thunks and Debits in Separation Logic with Time Credits: Coq Formalization. https://gitlab.inria.fr/cambium/iris-time-proofs Google Scholar
- Robert Endre Tarjan. 1985. Amortized Computational Complexity. SIAM J. Algebraic Discrete Methods, 6, 2 (1985), 306–318. http://dx.doi.org/10.1137/0606031 Google ScholarDigital Library
- Bohua Zhan and Maximilian P. L. Haslbeck. 2018. Verifying Asymptotic Time Complexity of Imperative Programs in Isabelle. In International Joint Conference on Automated Reasoning. arxiv:1802.01336 Google Scholar
Index Terms
- Thunks and Debits in Separation Logic with Time Credits
Recommendations
Cyclic proofs of program termination in separation logic
POPL '08We propose a novel approach to proving the termination of heap-manipulating programs, which combines separation logic with cyclic proof within a Hoare-style proof system.Judgements in this system express (guaranteed) termination of the program when ...
Cyclic proofs of program termination in separation logic
POPL '08: Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesWe propose a novel approach to proving the termination of heap-manipulating programs, which combines separation logic with cyclic proof within a Hoare-style proof system.Judgements in this system express (guaranteed) termination of the program when ...
Interactive proofs in higher-order concurrent separation logic
POPL '17When using a proof assistant to reason in an embedded logic -- like separation logic -- one cannot benefit from the proof contexts and basic tactics of the proof assistant. This results in proofs that are at a too low level of abstraction because they ...
Comments