rocq-of-rust
Formal verification tool that translates Rust code into Rocq so developers can prove programs meet their specifications.
At a Glance
About rocq-of-rust
rocq-of-rust is a formal verification tool from Formal Land that translates Rust programs into the Rocq proof system. Users write specifications for the functions they want to check and prove that the translated code satisfies them, with proofs covering every input allowed by the stated hypotheses. The project's development was funded by the Ethereum Foundation and the Aleph Zero Foundation, according to the documentation.
What It Is
rocq-of-rust is a translator and proof framework for Rust. It takes Rust code at the compiler's THIR level and represents the syntax explicitly in Rocq, including low-level details such as effect sequencing and implicit borrowing and dereferencing. The generated Rocq code is therefore more verbose than the original Rust. According to the documentation, a large subset of Rust can be translated, including most of alloc and core. The docs note that applying a proof to the Rust program also relies on the translator, the Rust semantics in Rocq, and assumptions about dependencies.
Verification Workflow
The typical workflow starts with translating the Rust code with cargo rocq-of-rust. The translated code then goes through two semi-automated refinement steps: linking, which handles type-checking and trait inference with native Rocq types and typeclasses, and simulation, which represents control flow and memory manipulation in a purely functional style. Users then write specifications and prove them against the simulations. The README lists example properties such as code that cannot panic, preserved data invariants, backward compatibility between releases, and serialization/deserialization functions being inverses.
Setup Path
Installation requires a working Rust installation and Rocq. Users clone the repository, run cargo install --path lib/ to add the cargo rocq-of-rust command, copy the repository's rust-toolchain file into the target project, and run the command. This produces one .v Rocq file per Rust file, which are not dependent on each other for compilation so that one translation failure does not block the rest. The files are compiled within the RocqOfRust/ folder using opam and make.
Application to Revm
Formal Land uses the tool to verify Revm, a Rust implementation of the Ethereum Virtual Machine, by showing it equivalent to a specification written in a purely functional style. Formal Land's homepage states that a private, more scalable version is available on request, and the README notes that the tool is a work in progress in many parts.
Collections
Popular collections
- Black Friday 2026: AI APIs and Creative Tools
Collection by @priyashah
- Harness Setup
Collection by @joemseifi
- Code Knowledge Graphs
Collection by @evtuff
- Obsidian Agentic & AI plugins
Collection by @samofcode
Add rocq-of-rust to one of your collections.
Community Discussions
Be the first to start a conversation about rocq-of-rust
Share your experience with rocq-of-rust, ask questions, or help others learn from your insights.
Pricing
Open Source
Self-hosted rocq-of-rust core: Rust transpiler under AGPL-3.0 and Rocq proofs/libraries under MIT license.
- Rust transpiler (cli/, lib/) licensed under AGPL-3.0
- Rocq proofs and libraries (RocqOfRust/) licensed under MIT
- Install via cargo install and compile with Rocq
- Formal verification services are sold separately and not priced publicly
Capabilities
Key Features
- Translates Rust code to Rocq from the THIR level
- Cargo subcommand `cargo rocq-of-rust`
- Linking step for type-checking and trait inference with Rocq types and typeclasses
- Simulation step representing control flow and memory in a functional style
- Translation of a large subset of Rust including most of alloc and core
- One generated Rocq file per Rust file, independent for compilation
- Used to build a formal specification of Revm
