Find a tool · Rust

Proving that your Rust code behaves like another version

Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other.

Change the question

I have code and want to prove

Effort
My code uses

Ranked by: support for this property, stage, coverage of the features you pick, and trust. Tools that work on compiled code rank lower. Ranking as JSON.

  1. Annotate Rust functions with contracts; Creusot translates the code to Why3, whose SMT solvers prove absence of panics and that the contracts hold.

    Partial.No dedicated equivalence mode; you write both versions and a contract relating them by hand. Partial — No dedicated equivalence mode; you write both versions and a contract relating them by hand.

    Effort
    Auto-active
    Covers
    11 of 19 Rust features
    Relies on
    SMT solvers (Alt-Ergo, Z3, cvc5) run through Why3 decide; no proof certificates. Rust model built into Creusot's translation; no published validation against rustc.
    Stage 1 · Usable Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial 0/5 strong
  2. Alive2 on compiled code: LLVM IR

    Automatically checks that an optimized LLVM IR function still behaves like the original, or shows a counterexample. Loops are checked only up to a set bound.

    Supported.This is Alive2's main job: it checks that the target refines the source (it may be more defined, never less). Within the loop bound and without timeouts, a pass is a proof for that one pair of functions.
    Source
    Supported — This is Alive2's main job: it checks that the target refines the source (it may be more defined, never less). Within the loop bound and without timeouts, a pass is a proof for that one pair of functions.

    Effort
    Push-button
    Covers
    2 of 10 common features
    Relies on
    Z3 decides refinement; no proof certificates. Results hold only up to the loop bound. Alive2's own SMT model of LLVM IR; run on LLVM's tests, but no published validation.
    Stage 1 · Usable Trust: Checker partial, Semantics partial, Frontend strong, Binary gap weak, Escape hatches partial 1/5 strong
  3. Write test-like proof harnesses for Rust code; Kani checks every input the harness allows, up to loop bounds, and gives a counterexample when a check fails.

    Partial.No dedicated mode; you write a harness that runs two implementations on the same symbolic inputs and asserts equal results, within the loop bounds.
    Source
    Partial — No dedicated mode; you write a harness that runs two implementations on the same symbolic inputs and asserts equal results, within the loop bounds.

    Effort
    Push-button
    Covers
    9 of 19 Rust features
    Relies on
    CBMC and a SAT solver decide; no proof certificate. A proof only if unwinding checks pass. Rust model built into Kani's code generator; tested by its own regression suite.
    Stage 1 · Usable Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial 0/5 strong
  4. Write specifications and proofs next to your Rust code; Verus turns them into questions for the Z3 solver and checks them for every possible run.

    Partial.No dedicated equivalence mode; you write both versions and a specification relating them by hand. Partial — No dedicated equivalence mode; you write both versions and a specification relating them by hand.

    Effort
    Auto-active
    Covers
    8 of 19 Rust features
    Relies on
    The Z3 SMT solver decides each proof obligation; no proof certificate is kept. Rust's meaning is built into Verus's encoding; no published validation against rustc.
    Stage 1 · Usable Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial 0/5 strong
  5. Translate safe Rust into pure functions in Lean 4 (or F*, Rocq, HOL4) and prove properties there; the Lean kernel checks every proof.

    Partial.No dedicated equivalence mode. Because each Rust function becomes a pure function, you can prove it equal to a reference or specification function by hand. Partial — No dedicated equivalence mode. Because each Rust function becomes a pure function, you can prove it equal to a reference or specification function by hand.

    Effort
    Interactive
    Covers
    5 of 19 Rust features
    Relies on
    Aeneas's own model of Rust (LLBC); proved sound on paper, no published validation. Charon, a separate unverified translator from rustc's MIR to LLBC.
    Stage 1 · Usable Trust: Checker strong, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial 1/5 strong
  6. s2n-bignum on compiled code: x86-64

    Prove hand-written x86-64 or Arm64 assembly correct in HOL Light, on the exact bytes of the built object file; used for AWS's cryptography code.

    Supported.A relational Hoare logic (CAV 2025) is used to prove optimized code (NEON vectorization, SLOTHY reordering) equivalent to a reference version.
    Source
    Supported — A relational Hoare logic (CAV 2025) is used to prove optimized code (NEON vectorization, SLOTHY reordering) equivalent to a reference version.

    Effort
    Interactive
    Covers
    0 of 0 common features
    Relies on
    Hand-written instruction models; random co-simulation against real CPUs in CI.
    Stage 1 · Usable Trust: Checker strong, Semantics partial, Frontend strong, Binary gap strong, Escape hatches strong 4/5 strong
  7. LNSym on compiled code: AArch64

    Prove Armv8 (AArch64) machine code correct in Lean 4 by symbolic simulation over a hand-written model; aimed at AWS-LC cryptographic routines.

    Unknown

    Effort
    Interactive
    Covers
    0 of 0 common features
    Relies on
    Hand-written AArch64 subset; random co-simulation against real Arm CPUs in CI. Opcodes are pasted from objdump into Lean; not linked to the binary by a proof.
    Stage 0 · Research Trust: Checker strong, Semantics partial, Frontend partial, Binary gap strong, Escape hatches partial 2/5 strong

Verify Rust, but not this property

  • Islaris — The logic proves properties of one program; no support for relating two programs is described.

Ask something else about Rust

New to this? Start with the glossary: auto-activeAuto-active verification. You write specifications and hints in the code; an automatic solver does the proving., interactiveInteractive theorem prover. A proof assistant where you write proofs step by step and the system checks each step., trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says..

esc