A Verified Cost Analysis of Joinable Red-Black Trees (2309.11056v2)
Abstract: Ordered sequences of data, specified with a join operation to combine sequences, serve as a foundation for the implementation of parallel functional algorithms. This abstract data type can be elegantly and efficiently implemented using balanced binary trees, where a join operation is provided to combine two trees and rebalance as necessary. In this work, we present a verified implementation and cost analysis of joinable red-black trees in $\textbf{calf}$, a dependent type theory for cost analysis. We implement red-black trees and auxiliary intermediate data structures in such a way that all correctness invariants are intrinsically maintained. Then, we describe and verify precise cost bounds on the operations, making use of the red-black tree invariants. Finally, we implement standard algorithms on sequences using the simple join-based signature and bound their cost in the case that red-black trees are used as the underlying implementation. All proofs are formally mechanized using the embedding of $\textbf{calf}$ in the Agda theorem prover.
- Umut A. Acar and Guy E. Blelloch. 2019. Algorithms: Parallel and Sequential. http://www.algorithms-book.com.
- Andrew W. Appel. 2011. Efficient Verified Red-Black Trees. (2011).
- Andrew W. Appel. 2023. Verified Functional Algorithms. Software Foundations, Vol. 3. Electronic textbook. http://softwarefoundations.cis.upenn.edu Version 1.5.4.
- Guy Blelloch and John Greiner. 1995. Parallelism in Sequential Functional Languages. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture (FPCA ’95). Association for Computing Machinery, New York, NY, USA, 226–237. https://doi.org/10.1145/224164.224210
- Just Join for Parallel Ordered Sets. In Proceedings of the 28th ACM Symposium on Parallelism in Algorithms and Architectures (Pacific Grove, California, USA) (SPAA ’16). Association for Computing Machinery, New York, NY, USA, 253–264. https://doi.org/10.1145/2935764.2935768
- Joinable Parallel Balanced Binary Trees. ACM Trans. Parallel Comput. 9, 2, Article 7 (apr 2022), 41 pages. https://doi.org/10.1145/3512769
- Harrison Grodin and Robert Harper. 2023. Amortized Analysis via Coinduction. In 10th Conference on Algebra and Coalgebra in Computer Science (CALCO 2023) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 270), Paolo Baldan and Valeria de Paiva (Eds.). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 23:1–23:6. https://doi.org/10.4230/LIPIcs.CALCO.2023.23
- Leo J. Guibas and Robert Sedgewick. 1978. A Dichromatic Framework for Balanced Trees. In 19th Annual Symposium on Foundations of Computer Science (Sfcs 1978). 8–21. https://doi.org/10.1109/SFCS.1978.3
- Paul Blain Levy. 2003. Call-By-Push-Value: A Functional/Imperative Synthesis. Springer Netherlands, Dordrecht. https://doi.org/10.1007/978-94-007-0954-6
- Dan Licata. 2013. Programming and Proving in Agda, OPLSS 2013. http://www.cs.cmu.edu/~drl/teaching/oplss13/
- Tobias Nipkow (Ed.). 2023. Functional Data Structures and Algorithms: A Proof Assistant Approach (june 27, 2023 ed.). https://functional-algorithms-verified.org/
- A Cost-Aware Logical Framework. Proc. ACM Program. Lang. 6, POPL, Article 9 (jan 2022), 31 pages. https://doi.org/10.1145/3498670
- Ulf Norell. 2009. Dependently Typed Programming in Agda. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI ’09). Savannah, GA, USA, 1–2.
- Chris Okasaki. 1999. Red-Black Trees in a Functional Setting. Journal of Functional Programming 9, 4 (July 1999), 471–477. https://doi.org/10.1017/S0956796899003494
- Yihan Sun. 2019. Join-based Parallel Balanced Binary Trees. Ph.D. Dissertation. Carngie Mellon University.
- Robert Endre Tarjan. 1983. 4. Search Trees. In Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, 45–57. https://doi.org/10.1137/1.9781611970265.ch4
- TiML: A Functional Language for Practical Complexity Analysis with Invariants. Proceedings of the ACM on Programming Languages 1, OOPSLA (Oct. 2017), 79:1–79:26. https://doi.org/10.1145/3133903
- Stephanie Weirich. 2014. Depending on Types. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP ’14). Association for Computing Machinery, New York, NY, USA, 241. https://doi.org/10.1145/2628136.2631168