DEVELOPMENT EDITION · 769442725406
Verification Manual
On this page

Operating proof and retaining evidence

Use proof operations to answer a precise question: which obligations were attempted, under which search policy and trusted model, with which reused evidence? A warm run from the proof cache, a fresh search and certificate replay can all succeed, but they are different records. Exact switches and output streams are in the Toolchain proof reference.

A normal investigation

veradic check --project verada.toml
veradic prove --project verada.toml
veradic prove --no-cache --stats --project verada.toml

The first separates legality and flow problems from solver work. The second proves the project, reusing what the proof cache knows. The third asks every solver question again and prints statistics; enabled certificates are still replayed. Use prove to read results: run in a project uses only the proof cache and prints no proof summary.

Human proof summaries go to stdout. With --diagnostics json the diagnostic array is on stdout and the summary and statistics on stderr. Inspection flags such as --show-flow and --dump-bir also write to stdout, so do not combine them with a consumer expecting one JSON document. An early error can prevent a proof summary entirely.

How a proof run proceeds

Verada generates the verification conditions (VCs) of each subprogram, then shares them out over the workers one at a time, so a slow query holds up only its own worker. Identical queries are solved once.

Each query is canonical: its symbols are named within it, its facts are in a fixed order, and Verada chooses the triggers of its quantifiers, so a declaration the check does not use cannot change the query a solver sees, nor its answer. Each query is asked of a reset solver, so what was asked before it cannot change its answer either.

Budget policy

Budget Search Purpose
quick A first pass with Z3 under a twentieth of the resource limit, then one pass with Z3 (and Yices for linear queries) The default: a check either proves on its first try or is reported at once
standard Seed retries, then Z3 and cvc5 at ten times the resource limit A check known to need more, named by an override
thorough Further Z3 seeds and configurations, and cvc5 with enumerative instantiation Localized harder obligations
heavy The thorough attempts at a hundred times the resource limit Deliberate expensive search after reviewing the model

The budget is solver effort, not an assurance grade. A heavy proof establishes the same proposition; a quick counterexample is not less real. Only undecided queries climb the ladder, and a definite answer stops the search.

The default is quick, so a check that will not prove costs one pass, not minutes of retries, and --stats reports the solver time the unproved checks took. Under every budget, each check is first asked of Z3 alone under a twentieth of the resource limit, where almost every proof is found; only what that does not prove goes on to the full pass. Z3 under a resource limit is deterministic, so this first pass changes no outcome, only the time spent on checks that will not prove. Whether a precondition can hold (B8003) and whether code is reached (B8010) are asked in that first pass only, under every budget. A proof that only a retry with another seed finds is one the next edit can break, so the larger budgets are for checks known to need them, named by an override.

The effective budget is a matching subprogram override, otherwise --proof-budget, otherwise the project's proof.budget, otherwise quick. Overrides name a qualified subprogram and are matched case-insensitively:

[proof]
budget = "quick"

[proof.budget-overrides]
"Counting.Count_To" = "thorough"

This is a configuration fragment, not advice that the counting example needs more effort. A source pragma does not change the budget. Fix the invariant, contract, type domain or lemma before raising a budget, and give each override a reason: veradic trust lists them.

Engines, workers, and operational limits

The default pipe interface uses Z3, with yices-smt2 for the linear queries it takes; cvc5 and seeded retries belong to the larger budgets. The alternate What4 interface (--solver-interface what4) supports different forms and has no retry ladder. It is not an independent checker of results obtained through the pipe interface.

-j N (or --jobs N) sets the number of solver sessions; the default is half the machine's processor cores, and the VERADA_JOBS environment variable sets it for a machine. The worker count changes how long a proof takes, never its result: record it for timing comparisons, not as part of a proof's strength.

Effort is counted in solver resource units, not time, so an outcome depends on the query, the budget and the solver versions, not on the machine's speed. A watchdog of 60 seconds per solver call guards against a solver that never returns; VERADA_SOLVER_TIMEOUT (milliseconds) replaces it on a loaded machine. A watchdog or process failure is not evidence that the program is wrong. See outcomes.

--stats adds timing, cache and interface figures, among them the solver time the checks that did not prove took. --stability N asks each proved check again with N mutations of its query (another seed, renamed symbols, its facts in another order) and lists the checks whose answers differ. It measures how repeatable a proof's search is; it is not a new proof.

Persistent proof cache

A project keeps its proof cache in .verada/proof-cache. It holds, keyed by the SHA-256 of each query's text with the solver interface and resource limit:

Beside it, .verada/fact-proofs keeps each proof with the facts it was proved from, as hashes of the lines of the query that proved it: a check whose query is not in the cache, but whose goal was proved before from facts that are all still among its own, is proved without a solver, so adding a hint assertion does not send every check after it back to the solver. Only proofs are kept so, never a counterexample or an undecided answer. And .verada/digests keeps the last run's subprogram digests, reused while no source file, option or compiler changes.

A proof that took the solver more than a tenth of a second also has its query queued in .verada/harvest. veradic harvest, which the editor starts after a proof, takes the queue costliest first, at the lowest scheduling priority, and asks the solver which of each query's facts the proof used (an unsat core). It checks that those facts alone prove the goal, and keeps them as a proof beside the others in .verada/fact-proofs. After an edit to something such a proof never used, a contract its subprogram calls say, the check is proved without the solver, though its query changed.

The cache keeps its own size. Each entry records the last run that wrote or used it; a run adds what it learned to the end of the files and does not rewrite them. Every sixteenth run, and any run that finds a file over 256 MiB, the files are compacted: each entry's latest form is kept and, of those, the most recently used, up to four times what the last 64 runs used (at least 8 MiB, at most 256 MiB). So a project used little loses nothing, an undo or a branch switched back to finds its proofs, and what the current program needs goes last. An entry dropped only means a question asked again. The ledger (below) is cut to its newer half when it passes 32 MiB.

A remembered undecided answer says so in its diagnostic. --no-cache ignores the cache and writes nothing to it: every question is asked again. It does not delete the cache, turn off certificates, or clear the object and library caches.

The same cache serves veradic prove, veradic run in a project (--proof cached) and the editor's background prover, so a proof made by any of them speeds up the others.

Summaries are kept under a digest of the prover's own sources, so a new veradic that changes only what the prover cannot reach (code generation, the IDE, the language server) keeps them; any other new build generates the VCs again once.

After changing the compiler or a solver, the cache's proved answers remain valid for the same queries, but they do not show that the new solver would find the proofs. For a release comparison after changing tools, prove with --no-cache and record the tools' versions.

Proving in the editor

veradic lsp proves an open document in the background a second after a change that checks cleanly, and on save; setting proof.trigger to save makes it prove on save only. A proof stopped by a new edit keeps what it had proved. Each subprogram shows its proof state as a code lens, a failed check's counterexample appears as a lens on the check, and a message gives the verdict when the number of unproved checks changes (proof.notify). See the background prover for the settings in each editor. The editor's results come from the same prover and cache as veradic prove; run the command for a complete project result to record.

Proof ledger

Every attempt at a check is recorded in the project's .verada/proof-ledger.jsonl, one line of JSON each: the digest of its verification condition (the key under which the proof cache keeps it), the check (subprogram, diagnostic code, place), the attempt, its outcome, its cost in the solver's resource units and in seconds, and how many assertions the attempt's query had. It is a history for measuring proof cost, kept to its last 32 MiB or so; no outcome depends on it. --dump-vcs writes the queries themselves.

What a proof sees of other packages

A function written as an expression in a package's specification, in its visible or private part, is published: every client's proof sees what it computes. A function whose body is in the package body is the package's own: clients' proofs see its contract (its result's range and its postcondition), and its own package, nested units and child units see its body. Changing such a body therefore cannot change a client's proof. To publish one, annotate it:

function Total (S : Seqs.Sequence) return Integer
  with Annotate => (Verada, Inline_For_Proof);

The opposite, for a published expression function whose definition only clutters the proofs that call it: Hide_Info hides its body from every proof, its own package's too, so that callers see its contract alone; Unhide_Info in a subprogram's declarations shows it to that subprogram's proof again:

function Area (W, H : Natural) return Natural is (W * H)
  with Annotate => (Verada, Hide_Info, "Expression_Function_Body");

procedure Report is
   pragma Annotate (Verada, Unhide_Info, "Expression_Function_Body", Area);
   ...

pragma Annotate (Verada, Hide_Info, "Expression_Function_Body", Area) after the declaration hides it as the aspect does, and inside a subprogram hides a body from that subprogram's proof alone. Each of these annotations also accepts GNATprove in place of Verada, so that code written for GNATprove keeps its meaning.

Logical_Equal on a function of two parameters that returns Boolean makes the prover take it as its own equality of the two values: whatever is computed from one is then known of the other. It is assumed, not proved, so a proof run warns of it (B8002), --no-assume makes it an error and veradic trust lists it:

function Same (L, R : Pair) return Boolean
  with Annotate => (Verada, Logical_Equal);

Certificate evidence

With --certificates or [proof] certificates = true, Verada keeps a deterministic text core in .verada/certs for each solver-proved obligation. A core records hashes of the hypotheses that make the negated goal unsatisfiable, keyed by the regenerated SMT-LIB query.

On replay, the compiler regenerates the query, finds the named hypotheses, and asks Z3 to check that this subset with the negated goal is unsatisfiable. A missing, stale or edited core proves nothing: B8008 warns that it was rejected and the check is searched again. A replayed proof is a solver re-check of an unsat core, not an independently checked formal proof object. Checks proved statically by the compiler need no certificate.

veradic prove --certificates --project verada.toml
veradic prove --no-cache --certificates --project verada.toml

The second command ignores the proof cache but still replays cores; its summary says how many checks were replayed from certificates. Keep the compiler and solver versions with the certificates: the files do not record them.

For release evidence that does not rest on the solvers, veradic prove --check-proofs has cvc5 write a full proof of each proved check and Carcara check it; the summary and veradic trust say how many were checked independently, and why the others were not (see proofs checked independently).

Inspection artifacts

--dump-vcs DIR writes each query as an SMT-LIB file, named by subprogram and diagnostic code. --dump-bir displays the shared intermediate representation; --show-flow displays inferred effects and dependencies. These can reveal an unexpected subtype, a lost frame or a wrong module before you add hints. A hand-edited query is not evidence for the source until the corresponding source change is regenerated and proved.

When you suspect a compiler or model bug, keep a small project and the unmodified original. Record whether the problem survives --no-cache, other budgets and the other solver interface.

A release evidence bundle

Keep the source, configuration and dependency revisions; veradic --version (which names the compiler revision and each solver's version and path); the effective budgets and overrides; the cache and certificate policy; the diagnostics and exit status of a prove --no-assume run; the veradic trust report with its review; and the backend and oracle tests you ran. Reviewed certificates can be committed; derived caches and objects are not a substitute for that record. The artifact reference gives locations, and adoption explains review gates.