Proving that your C++ code does what its spec says
The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”.
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.
-
Prove concurrent C++ code correct in the Rocq proof assistant, using a separation logic for C++ built on Iris.
Supported.Specifications are separation-logic pre- and postconditions; BlueRock's NOVA proofs go up to concurrent functional correctness.
Source Supported — Specifications are separation-logic pre- and postconditions; BlueRock's NOVA proofs go up to concurrent functional correctness.- Effort
- Interactive
- Covers
- 3 of 16 C++ features
- Relies on
- C++ is modeled by BRiCk's own axioms; no published validation against compilers. cpp2v prints Clang's syntax tree into Rocq; cpp2v itself is not verified.
Stage 0 · Research 1/5 strong -
Write a test-like harness for your C code; CBMC checks every execution up to a loop bound, giving a counterexample or a bounded proof.
Partial.You state properties as assertions in a harness or as function contracts. Checks hold for all inputs allowed by the harness, but only up to the loop bounds unless loop contracts are used.
Source Partial — You state properties as assertions in a harness or as function contracts. Checks hold for all inputs allowed by the harness, but only up to the loop bounds unless loop contracts are used.- Effort
- Push-button
- Covers
- 5 of 16 C++ features
- Relies on
- A SAT or SMT solver decides; its answer is trusted and no proof certificate is kept. C model built into CBMC; tested by its own regression suite.
Stage 1 · Usable 0/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.Each function has a HOL Light theorem that the code computes a mathematical specification for all inputs.
Source Supported — Each function has a HOL Light theorem that the code computes a mathematical specification for all inputs.- 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 - Islaris on compiled code: AArch64
Prove Arm or RISC-V machine code correct in Rocq, against the full official Sail ISA models, using Isla symbolic execution and an Iris separation logic.
Supported.Specifications are separation-logic pre- and postconditions over registers and memory.
Source Supported — Specifications are separation-logic pre- and postconditions over registers and memory.- Effort
- Interactive
- Covers
- 0 of 0 common features
- Relies on
- Isla and its SMT solver are trusted; Rocq checks the separation-logic proofs. Opcodes come from objdump output that the user trims and annotates by hand.
Stage 0 · Research 2/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.
Partial.Functional specifications can be stated and proved, but the main AWS-LC proofs are unfinished: SHA-512 and AES-GCM proofs contain sorry, and the GCM init proof covers one output register with the memory results commented out.
Source Partial — Functional specifications can be stated and proved, but the main AWS-LC proofs are unfinished: SHA-512 and AES-GCM proofs contain sorry, and the GCM init proof covers one output register with the memory results commented out.- 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 C++, but not this property
- Alive2 — No specification language. The closest substitute is writing a reference version in LLVM IR and checking equivalence against it.
Ask something else about C++
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..