vary prove does not run your function on real numbers. It treats the parameters (x, lo and hi in the clamp example) as unknown placeholders and follows each path through the code, recording what must be true on that path: the in conditions, the if conditions taken, and the assignments made. This technique is called symbolic execution.
At each place where something could go wrong it creates a proof obligation, which just means "a thing the prover has to show is true". For clamp in the overview, each of the three return paths yields a statement like "if lo <= hi and x < lo, then lo >= lo and lo <= hi". Each obligation is sent to an SMT solver as the question "can this be false?". No is a proof. Yes is a counterexample.
Calls are checked against the callee's contract, never its body. This is called modular verification. Changing a function body re-proves only that function and anything that relied on its contract, which keeps proofs scalable and cacheable.
| Obligation | When |
|---|---|
Postconditions (out, post) | Every function that declares them |
Loop invariants and decreases | Every loop and recursive call that declares them |
| Runtime failures such as division by zero | Always, in every function. This includes a missing dict key, !! on None, an index out of range, assert, and unwrap on a possible Err |
| Arithmetic overflow | In functions that declare a contract. Wrapping is valid Vary behaviour, so a function with no contract is not flagged |
| Callee preconditions | At every call site |
| Class invariants | At construction and at the end of every method. They are assumed at method entry |
modifies frames | Every write to a field |
| Status | Meaning |
|---|---|
| proven | Holds for all inputs that satisfy the preconditions |
| refuted | The solver found inputs that break it, and Vary confirmed them by running the function |
| unknown | The solver could not decide, or a loop invariant was too weak |
| timeout | The solver ran out of time |
| unsupported | The function uses a construct the prover does not model, and the report names it |
| bound-reached | Bounded mode stopped unrolling a loop |
| proven-external | A Lean proof you supplied was checked |
If the prover itself fails on a function, that function is reported unsupported with an internal: note that carries the error. The other functions in the file are still checked.
When a result is unknown and the solver offered inputs, the report may say unconfirmed candidate. The inputs did not fail when Vary ran the function, so they are not a bug. They are a hint about which fact is missing, usually a loop invariant or a callee contract that is too weak.
| Mode | Command | What it does |
|---|---|---|
| Bounded checking | vary prove --bounded | Unrolls loops and recursion a fixed number of times (8 by default) and looks for a counterexample. It needs no annotations and proves nothing, so it is a bug finder, like a very thorough test generator. Start here |
| Deductive proof | vary prove | Reasons about all iterations using loop invariants and decreases. This is the mode that can say proven |
Bounded mode is what found the overflow in the first worked example. Deductive mode is what turns a clean bounded run into a real proof.
A refuted obligation prints concrete inputs as Vary literals and, where possible, a generated test block that reproduces the failure. Before the prover reports refuted, it replays the counterexample on the real semantics of the program. If the solver was wrong, or the model was too loose, the status becomes unknown with an unconfirmed candidate note instead of a false alarm.
Vary Int is a 64-bit wrapping long. The prover models it as an unbounded mathematical integer and adds an overflow obligation at every operation that could wrap. If every overflow obligation is proven, the simple model is exact. Division with // truncates toward zero and % takes the sign of the dividend, unlike the division in the solver's own language, so the encoder never uses the solver's operators directly.
| Rule | What it means for you |
|---|---|
| One specification language | The contract you test at run time is the contract you prove. There is no second language to learn |
| Modular | A call is checked against the callee's contract. Edits re-prove only what they affect |
| Sound for the supported part, explicit about the rest | A construct the prover cannot model is reported unsupported by name. It is never reported proven |
| Trusted boundaries are named | Builtins, runtime functions, JVM interop, spawn and AI library calls are opaque, and the axioms a proof used are listed in the report |
| Nothing to install | The default solver is pure Java and ships with Vary. Z3 and cvc5 are optional |
| Counterexamples are replayed | Refuted means a real failure, not a solver artifact |
Real code calls the standard library, parses strings, and talks to services. vary prove treats any value or call it has no model for as opaque. A call with no body and no contract returns a fresh value of its declared type, and unless the callee is pure it is assumed to change anything it was passed. The report lists it as opaque:NAME, so you can see exactly what a proof took on trust. For a few built-ins the standard library states what the runtime guarantees (ord returns a value from 0 to 65535); those are written as extern def contracts in the standard library, the prover uses them like a function contract, and a test runs every one against the runtime. The proof of the rest of the function still goes through.
This is why vary prove is useful on existing code with no changes. A function that mixes an HTTP call with arithmetic still gets its arithmetic checked.