hax
Hax translates Rust code into formal languages such as Lean, F*, and ProVerif, so you can prove that your code is panic-free, functionally correct, and meets its security goals.
How it works
-
Write Rust, state what it should do
Contracts are ordinary Rust attributes from
hax_lib.#[hax_lib::requires(x < 16)] #[hax_lib::ensures(|res| res >= x)] pub fn square(x: u8) -> u8 { x * x } -
Extract to a proof assistant
One command translates the crate into Lean, F*, or ProVerif.
cargo hax into lean -
Prove it
The contract becomes a theorem about the extracted code.
@[spec] theorem square.spec.proof (x : Std.U8) : square.spec x := by unfold square.spec square hax_mvcgen all_goals grind [Nat.le_mul_self]
More reading
- hax: Verifying Security-Critical Rust Software Using Multiple ProversKarthikeyan Bhargavan, Maxime Buyse, Lucas Franceschino, Lasse Letager Hansen, Franziskus Kiefer, Jonas Schneider-Bensch, Bas Spitters. VSTTE 2024.
- Formal Security and Functional Verification of Cryptographic Protocol Implementations in RustKarthikeyan Bhargavan, Lasse Letager Hansen, Franziskus Kiefer, Jonas Schneider-Bensch, Bas Spitters. ACM CCS 2025.
- The hax blogTechnical posts on hax and its applications.
Community and funding
Hax has been developed through research collaborations with Inria and Aarhus University, and our work is funded via the Cyberagentur through PROTECT (ÖvIT programme) and Campus Cyber through CIRCUS (PTCC).
We welcome questions and discussion on Zulip, and issues and contributions on GitHub.
News
-
Developer-driven Rust verification using hax, Lean, and AI
Showcasing hax 0.4 on IoT-friendly SHA-3
-
Hax 0.4!
Announcing hax 0.4, a pivotal release
-
Software Verification in Lean
We co-hosted a workshop on advancing software verification using the Lean proof assistant.
-
Formally Specifying and Testing the Rust Standard Library
We found and fixed bugs in the Rust SIMD libraries using formal specs
-
Helping Secure Signal's Post-Quantum Transition
We worked with Signal to formally analyze their new post-quantum ratchet
-
Announcing Campus Cyber Circus Project
We partner with Inria to build a new integrated development and verification environment
Rust logo by the Rust Foundation, CC BY 4.0.