Do you have space for dessert? a verified space cost semantics for CakeML programs
Alejandro Gómez-Londoño, Johannes Åman Pohjola, Hira Taqdees Syeda, Magnus O. Myreen, Yong Kiam Tan
Abstract
Garbage collectors relieve the programmer from manual memory management, but lead to compiler-generated machine code that can behave differently (e.g. out-of-memory errors) from the source code. To ensure that the generated code behaves exactly like the source code, programmers need a way to answer questions of the form: what is a sufficient amount of memory for my program to never reach an out-of-memory error? This paper develops a cost semantics that can answer such questions for CakeML programs. The work described in this paper is the first to be able to answer such questions with proofs in the context of a language that depends on garbage collection. We demonstrate that positive answers can be used to transfer liveness results proved for the source code to liveness guarantees about the generated machine code. Without guarantees about space usage, only safety results can be transferred from source to machine code. Our cost semantics is phrased in terms of an abstract intermediate language of the CakeML compiler, but results proved at that level map directly to the space cost of the compiler-generated machine code. All of the work described in this paper has been developed in the HOL4 theorem prover.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext aac6d2c4-6ab3-4de7-9ce0-91a3e808c7edCited by top-tier papers4
- A separation logic for heap space under garbage collectionJean-Marie Madiot, François PottierPOPL 2022 · 10 citations
- Preservation of Speculative Constant-Time by CompilationSantiago Arranz-Olmos, Gilles Barthe, Lionel Blatter, Benjamin Grégoire et al.POPL 2025 · 8 citations
- Structured Leakage and Applications to Cryptographic Constant-Time and CostGilles Barthe, Benjamin Grégoire, Vincent Laporte, Swarn PriyaCCS 2021 · 2 citations
- A High-Level Separation Logic for Heap Space under Garbage CollectionAlexandre Moine, Arthur Charguéraud, François PottierPOPL 2023
Builds on1
Related papers
- Cakes That Bake Cakes: Dynamic Computation in CakeMLThomas Sewell, Magnus O. Myreen, Yong Kiam Tan, Ramana Kumar et al.PLDI 2023 · 16 citations
- PureCake: A Verified Compiler for a Lazy Functional LanguageHrutvik Kanabar, Samuel Vivien, Oskar Abrahamsson, Magnus O. Myreen et al.PLDI 2023 · 7 citations
- A Metalanguage for Cost-Aware Denotational SemanticsYue Niu, Robert HarperLICS 2023 · 5 citations
- An SMT Encoding of LLVM's Memory Model for Bounded Translation ValidationJuneyoung Lee, Dongjoo Kim, Chung-Kil Hur, Nuno P. LopesCAV 2021 · 10 citations
- Translating C To Rust: Lessons from a User StudyRuishi Li, Bo Wang, Tianyu Li, Prateek Saxena et al.NDSS 2025
