CakeML
A verified implementation of a Standard ML subset with a proven-correct, self-bootstrapping compiler, developed in the HOL4 theorem prover.
At a Glance
CakeML core compiler and ecosystem released under the OSI-approved BSD 3-Clause license.
Engagement
Available On
Listed Dec 2026
About CakeML
CakeML is a functional programming language and an ecosystem of proofs and tools built around it, developed by an academic open-source community and hosted on GitHub under a BSD 3-Clause license. It is based on a substantial subset of Standard ML, and its semantics are specified in higher-order logic within the HOL4 theorem prover. The project's website describes a compiler that can bootstrap itself and has been proved correct.
What It Is
CakeML is a formally verified programming language implementation. Its source and proofs are developed in HOL4. The language has a formal semantics (big-step, small-step, FFI semantics and a type system), and the verified compiler backend transforms an untyped AST to machine code for 6 target architectures. According to the project, the backend is proved to produce only machine code compatible with the behaviours of the source programs.
How the Toolchain Works
There are two compiler frontends. The first is a proof-producing translator that turns ML-like HOL functions into CakeML AST and proves that the generated code behaves like the HOL function. The second is a PEG parser followed by a type inferencer, both proved sound and complete with respect to declarative specifications. Combining frontend 2 with the backend yields a compiler that has been bootstrapped inside HOL, producing a verified binary of the compiler itself. Bootstrapped binaries are published as tar.gz files on the releases page.
Verification and Applications
Besides synthesis, CakeML adapts Charguéraud's CFML framework for Hoare-style reasoning in separation logic about references, arrays, exceptions and I/O. Verified applications built with it include grep, sort, cat, diff and patch style tools, an OpenTheory article checker, SAT proof checkers (DRAT/LPR), a floating-point error-bound certificate checker, and Candle, a verified HOL Light implementation. Other verified compilers built on it include Pancake (a systems-language compiler), PureCake (a lazy Haskell-style language) and Kalas (a choreographic language).
Setup Path
Building the full project, including the bootstrapped compiler and proofs, requires HOL4 (latest master) built on PolyML 5.7.1 and significant resources; build-instructions.sh and a how-to.md guide describe installation and usage. A tutorial covers writing verified programs with HOL and CakeML. The community is reachable via Zulip.
Collections
Popular collections
- Code Knowledge Graphs
Collection by @evtuff
- Obsidian Agentic & AI plugins
Collection by @samofcode
- Codebase Context Generators
Collection by @joemseifi
- Frameworks
Collection by @joemseifi
Add CakeML to one of your collections.
Community Discussions
Be the first to start a conversation about CakeML
Share your experience with CakeML, ask questions, or help others learn from your insights.
Pricing
Open Source
CakeML core compiler and ecosystem released under the OSI-approved BSD 3-Clause license.
- BSD 3-Clause License
- Verified compiler backend targeting 6 architectures
- Free software components
- Self-hosted; build from source or download binaries
Capabilities
Key Features
- Verified compiler backend targeting 6 architectures
- Bootstrapped compiler verified inside HOL
- Formal semantics in higher-order logic
- Proof-producing translator from HOL functions to CakeML
- Verified PEG parser and type inferencer
- CFML-based separation logic verification of CakeML programs
- Standard basis library
- Pancake and PureCake compilers built on the CakeML compiler
- Candle verified HOL Light prover
