Proving that your Dafny 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
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.
-
Write programs in Dafny with specifications; the verifier proves them through Boogie and Z3, then Dafny compiles the code to C#, Java, Go, JavaScript or Python.
Partial.No dedicated equivalence checker. Module refinement lets one module refine another, and you can prove two Dafny functions equal by hand. In the AWS authorization-engine rewrite, sameness with the old Java engine was checked by differential and shadow testing, not proved.
Source Partial — No dedicated equivalence checker. Module refinement lets one module refine another, and you can prove two Dafny functions equal by hand. In the AWS authorization-engine rewrite, sameness with the old Java engine was checked by differential and shadow testing, not proved.- Effort
- Auto-active
- Covers
- 6 of 10 Dafny features
- Relies on
- Boogie and the Z3 SMT solver decide; no proof certificates. Dafny's meaning is defined by its translation to Boogie; no published validation of it.
Stage 1 · Usable 1/5 strong - 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 4/5 strong - Gobra on compiled code: Go
Add specifications as comments to Go code; Gobra translates it to the Viper verifier, which proves memory safety, race freedom and your contracts.
Partial.No dedicated equivalence mode. The hyperproperty mode relates two runs of the same program, but comparing two different versions needs a hand-written specification. Partial — No dedicated equivalence mode. The hyperproperty mode relates two runs of the same program, but comparing two different versions needs a hand-written specification.
- Effort
- Auto-active
- Covers
- 6 of 10 common features
- Relies on
- Viper's symbolic execution engine and the Z3 SMT solver decide; no proof certificates. Go model built into Gobra; ignores integer overflow unless --overflow is set.
Stage 1 · Usable 0/5 strong - KeY on compiled code: Java
Write JML specifications for sequential Java code; KeY's prover, mostly automatic with interactive steps when needed, proves the code meets them.
Partial.No dedicated equivalence mode; you specify the relation between two versions by hand. Partial — No dedicated equivalence mode; you specify the relation between two versions by hand.
- Effort
- Interactive
- Covers
- 5 of 10 common features
- Relies on
- KeY's own rule-based prover decides; its large rule base is trusted, not a small kernel. Default integer rules ignore overflow, which KeY itself marks unsound; Java mode exists.
Stage 1 · Usable 0/5 strong - 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 2/5 strong
No option matches this effort level.
Verify Dafny, but not this property
- Islaris — The logic proves properties of one program; no support for relating two programs is described.
Ask something else about Dafny
- Everything
- No undefined behavior
- Functional correctness
- Information flow
- Concurrency
- Termination and liveness
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..