The prover
Proof that works for you,
not after you.
Verada's prover is part of the compiler. On a normal build it proves first, answers every failure with the input that causes it and a fix it has already proved, reaches pointer structures and floating point that other verifiers leave to trust, and tells the compiler which checks it no longer needs.
Default build
proves every check and every contract
Zero cost
for a proved check: it leaves the binary
Replayed
counterexamples: real bugs, not guesses
Re-checkable
proofs, by an independent checker
Side by side
Verada and SPARK.
SPARK, with its prover GNATprove, is the established way to prove Ada programs, and Verada keeps Ada's contracts. Where they differ is in what the prover does for you.
And everything you'd expect from Ada's verifier.
- ✓Flow analysis: initialisation, Global and Depends, state abstraction
- ✓Absence of run-time errors: overflow, range, index, division, null, tags
- ✓Contracts: Pre and Post, Contract_Cases, invariants, variants, predicates
- ✓Exceptional_Cases, termination and subprogram variants
- ✓Ghost code, functional models, lemmas and big numbers
- ✓Ownership of pointers, borrowing and observing
- ✓Tasks and protected objects: no data races, ceilings, no blocking
- ✓Volatile objects and device registers
Failures you can act on
A real bug, or a weak invariant?
A counting loop with no loop invariant. The prover cannot see that
Count stays small, so the overflow check fails. Verada runs
the values the solver found on the program, finds that no real run
reaches them, and says so: the code is fine, the invariant is
missing. Then it writes the invariant, and proves it before offering it.
package Tally {
// two points for every step
pub fn Double_Count(N: Natural) -> Natural
requires N <= 1000
{
var Count: Natural = 0;
for I in 1..=N {
Count += 2;
}
return Count;
}
} $ veradic prove
error[B4101]: overflow check might fail
--> src/tally.va:8:19
|
8 | Count += 2;
| ^^^^ might overflow `Integer` (-9223372036854775808 .. 9223372036854775807)
|
= note: running from these inputs does not fail: the values the prover found are a state no run reaches here, so a loop invariant or a callee's contract is too weak to show that the check holds
= counterexample: might fail when N = 2, Count (in the loop) = 9223372036854775804, I (in the loop) = 1
= help: this loop invariant is proved, and with it this check: `invariant Count <= 3 * (I - 1);`
1 error emitted
proved 4 of 5 checks in 1 subprogram (2 statically, 2 by the solver)
For a check that really fails, Verada says fails, not
might fail, and gives the exact range of failing inputs
with the precondition that excludes them: see it on the
home page.
The same reports appear in your editor, in Ada, Varc or Vibe syntax,
with the fix one click away.
Proof that pays its way
Proved code is faster code.
Because one representation is both proved and compiled, the prover's results go straight to the code generator. A proved check produces no code. Proved arithmetic is marked as unable to overflow, so LLVM optimises it freely. And proved array loops vectorise: an element-wise add or a dot product compiles to SIMD vector loops, which the same loops with their checks kept do not.
In a project, veradic run reuses cached proofs and
keeps the other checks at run time, so you can try an edit without
waiting for the solver. Use veradic run --proof full
to prove first, as a normal veradic build does.
The run guide
explains these modes.
Pointers without fear
Shared structures, proved whole.
Ownership keeps ordinary pointer code simple. For the structures it cannot express, a doubly linked list, a graph, a hash map, Verada has proof enclaves: the structure's body and its clients are proved together, with every cell's footprint tracked. Generic enclaves are proved once for any element type. Objects that own memory free it automatically, and the freeing is proved.
Floating point, taken seriously
Three ways to add,
all proved.
Adding floats left to right loses small values next to a large one.
Verada offers Ada's plain sum, Neumaier's compensated sum (what
Python's sum() does) and a lane sum that vectorises and
rounds the same way on every machine. A sound model of rounding lets
the prover bound each of them, so none can overflow, and nothing is
assumed. In Vibe, Python's own sum() is the compensated
sum, and CPython prints exactly what the native build prints.
// Three ways to add up floats, each proved: no overflow, whatever the inputs.
package Sums {
pub subtype Reading = Long_Float range -1.0E6..=1.0E6;
pub type Readings = [Positive..]Reading;
// left to right, rounding at every step: Ada's meaning
pub fn Plain(V: Readings) -> Long_Float
requires V::Length <= 1000
= V::Reduce("+", 0.0);
// Neumaier's compensated sum, as Python's sum() is
pub fn Careful(V: Readings) -> Long_Float
requires V::Length <= 1000
= V::Compensated_Sum;
// eight lanes combined in a fixed tree: vector code, the same answer on every machine
pub fn Laned(V: Readings) -> Long_Float
requires V::Length <= 1000
= V::Lane_Sum;
} import Ada.Text_IO; use Ada.Text_IO;
import Sums; use Sums;
fn Main() {
let V: Readings = (1.0E6, 3.0E-11, 3.0E-11, 3.0E-11, -1.0E6);
Put_Line("plain: " ++ Long_Float::Image(Plain(V)));
Put_Line("careful:" ++ Long_Float::Image(Careful(V)));
Put_Line("laned: " ++ Long_Float::Image(Laned(V)));
} """Three ways to add up floats, each proved: no overflow, whatever the inputs."""
from verada import *
type Reading = Annotated[float, Interval(ge=-1.0e6, le=1.0e6)]
class Readings(Array[Reading], rank=1):
pass
# left to right, rounding at every step: Ada's meaning
def plain(v: Readings) -> float:
requires(len(v) <= 1000)
return plain_sum(v)
# Python's own sum(): Neumaier's compensated sum
def careful(v: Readings) -> float:
requires(len(v) <= 1000)
return sum(v)
# eight lanes combined in a fixed tree: vector code, the same answer on every machine
def laned(v: Readings) -> float:
requires(len(v) <= 1000)
return lane_sum(v) $ veradic prove
proved 47 of 47 checks in 4 subprograms (3 statically, 44 by the solver)
$ veradic run
plain: 0.00000000000000E+00
careful: 9.00000000000000E-11
laned: 1.16415321826935E-10 Evidence
Proof you can show a reviewer.
Proofs anyone can re-check
Certificates keep the facts behind each proof in sorted text files you commit. Another machine re-checks them without searching again, and cvc5's proofs are verified by an independent checker, so trust does not rest on one solver.
A trust report
One command lists everything a build relies on without proof: assumptions, C imports and their contracts, reviewed justifications, budget overrides. --no-assume turns each into an error.
Reviewed justifications
A check you have reviewed but cannot prove is recorded with its reason. It stays unproved, adds nothing to what later proofs may use, and appears in the trust report.
Same answer everywhere
Solver effort is counted in resource units, never seconds, and solvers are tried in a fixed order. A proof that passes on your laptop passes in CI, with any amount of parallelism.
Fast to re-prove
The cache is keyed by each verification condition, so an edit re-proves only what it changed. --only proves the one subprogram you are working on.
Fits your pipeline
Diagnostics as JSON with a schema, SARIF for code scanning, numbered codes with full explanations, and veradic --version naming every solver it used.
In your editor
Proof as you type.
Extensions for VS Code and Zed run Verada's language server: checks as you type, background proof after a clean edit, counterexamples beside the line that fails, hovers with types and contracts, and quick fixes that apply the proved precondition or invariant. Inside APL text, a backtick and a key complete to a glyph.
A fair note
SPARK and GNATprove have two decades of industrial use behind them. Verada is new, and earns trust from how it is built: one representation that is both proved and compiled, GNAT and GNATprove as test oracles on every Ada test corpus, CPython on every Python one, and proofs anyone can re-check.