Formal verification

Vary can prove its contracts for every input, not just the ones a test tries. These pages cover the ideas, how vary prove works, and the reference.

Alpha. Vary is under active development and not ready for production use. Syntax, APIs, performance, and behaviour may change between releases.

Formal verification means proving that a function does what it promises for every input it accepts, without running it on each one. A test checks the inputs you thought of. A proof covers all of them.

In Vary, vary prove ships with the compiler and checks the same in, out and invariant blocks that already run as checks at run time. There is no second specification language, and the default solver is bundled, so there is nothing to install. Start with the overview, then try vary prove --bounded on a function that has a contract.

Documentation

What formal verification is A plain-language introduction: what a proof is, how it differs from a test, and what vary prove gives you
How vary prove works Symbolic execution, proof obligations, the result statuses, the two modes, and the design rules
Writing your first proofs A step-by-step tutorial: find bugs, prove a loop, a recursive function, a list property, and a class
Worked examples Three real kinds of bug that vary prove finds, and how each one is fixed
Advanced proof techniques What to do when a proof is stuck: lemmas, ghost variables, changing lists in place, and loops with huge counts
Supported language features A reference table of what vary prove understands, by type and construct, and what it reports as unsupported
Solvers The bundled solver, Z3 and cvc5, and when to switch
Toolchain integration Editor feedback, caching, CI baselines, contracts that cannot hide, replay against the compiled code, removing proven checks, mutation testing, and Lean export
Other verification tools How vary prove relates to Dafny, SPARK, Why3, Frama-C, Eiffel, Lean, Rust verifiers and others, and where it is weaker