On this page
Diagnose proof results and choose a repair
A failed proof can mean a real defect, an interface/invariant too weak to establish a true property, an undecided solver query, or a tool failure. Read the result's evidence before editing the program. Changing the budget, adding a precondition and adding an invariant solve different problems.
Classify the result first
| Result | What it says | First action |
|---|---|---|
| Type/flow/ownership error | The program has not reached a valid proof input | Repair the reported language/state/lifetime issue |
| Statically discharged check | Compiler simplification established that generated obligation | Review the property/premises as part of the full proof result |
| Solver-proved check | Solver established validity under generated hypotheses | Retain provenance; inspect warnings and specification adequacy |
| Replay-confirmed counterexample | Reference execution reaches and fails the check | Understand and repair the actual boundary/algorithm/specification mismatch |
| Model replay runs through | Candidate state may be unreachable; information at a cut/call is too weak | Strengthen the justified invariant or callee contract |
| Unreplayed model | Candidate state lacks confirmation by available replay | Inspect model/domain/unsupported replay limits; do not call it a confirmed crash |
| Confirmed repeated loop state | Reference execution demonstrates the reported nontermination behavior | Repair progress/algorithm under the stated model |
| B5115 unknown | No proof or refutation within available effort | Check specification/hints first, then consider justified budget escalation |
| Solver/infrastructure failure | Required tool/process could not provide the attempted result | Repair environment/tool operation, preserving the original case |
An exit status of zero can still accompany assumption, vacuity or stale-certificate warnings. An early error can mean later stages never ran. Use the exact command and complete diagnostics, not only a green editor lens or a proof-count line.
Read a diagnostic as evidence
Start with the code, primary operation/check, secondary contract/invariant locations and the qualification of any counterexample. A “fails” title can reflect confirmed replay; “might fail” is deliberately weaker. Counterexample bindings can include entry arguments and abstract loop/call state, not just values a caller can pass directly.
failing inputs: exactly ... and for example ... have different force. Exact region/fix claims are reported only when the corresponding analysis establishes them for that query. A sample region is not a complete characterization of every failing program execution. prove --explain adds it fails for these inputs, and only these: ..., a complete condition over the inputs, and offers a precondition only when one is proved to make the check hold. In an editor, a failed check's counterexample is also shown as a code lens on the check. Do not strip qualification when quoting the diagnostic in a review or bug report.
The overflow example has a real admitted boundary failure: the largest Natural cannot be incremented within Integer. The loop repair has a safe actual algorithm but an insufficient invariant. Their similar B4101 codes do not make the remedy the same.
Repair an actual failing execution
Reproduce the boundary values in a disposable copy. Decide whether the implementation is wrong for an input the API should accept, or the interface intentionally needs a restriction. Then change the algorithm/representation or add the justified caller condition. Reprove all callers affected by the new interface.
Examples include widening before arithmetic, bounding lengths/products, checking an index before access, establishing a present dictionary key, or avoiding an invalid null dereference. Do not “repair” the result by assuming away the failure or deleting a required postcondition. A proof of a weaker requirement is not completion of the original requirement.
Repair a weak call boundary
If a caller needs a relation the callee does not promise, add an appropriate postcondition and prove the body establishes it. The contract family demonstrates a correct increment whose missing guarantee prevents client proof.
Keep frames as well as changed values. A client may need unchanged bounds, length, keys, other elements or ownership state. Adding an assertion in the caller cannot invent those facts; it must itself follow from the actual API. If the needed fact is private, expose a stable model or public predicate instead of leaking representation assumptions.
Repair a weak loop boundary
Identify what the solver knows at the invariant point and which modified values have become abstract. Derive the relationship with processed input/progress and frame regions. Establish it initially and preserve it through each update/case. Then show it implies the failed check or exit postcondition.
A suggested invariant can be useful, but review what it means and whether it proves the entire intended contract. A candidate proven sufficient for one check is not a guarantee that every remaining obligation or application requirement is satisfied. Generated help can also require syntax adaptation; use the accepted frontend forms and rerun the complete project.
Investigate unknown results
An unknown query can be true but difficult, false without a discovered model, unsupported by an alternate solver path, or limited by resources/watchdogs. Inspect the exact obligation and the diagnostic reason. Common improvements include a stronger inductive fact, a smaller operation boundary, explicit type/range conversion, a proved lemma, or separating a compound postcondition into meaningful relations.
An undecided answer is remembered in the proof cache, under the solvers' versions, the budget and the compiler's revision, so a later run reports it at once (the diagnostic says it was remembered) instead of spending the same search again. Changing the query, the budget or a solver asks again, and so does --no-cache.
Only after those questions are addressed should you try a larger budget on the affected operation. Record the effective override and optional engines; an unknown becoming proved is evidence for the same obligation under additional search, while a real counterexample cannot become valid merely by spending more time. Assume is an explicit trust addition, not a successful proof of the unknown fact.
Tool failures and stale artifacts
B7007 means Z3 could not be started; configuration, source loading, foreign compilation, linking and LLVM failures have their own diagnostics. Check that the intended compiler and solver executables are reachable and record their versions/paths. Do not weaken contracts to address a missing tool.
A rejected certificate, B8008, is a warning that the saved evidence did not match/recheck; the check is searched again. The warning does not by itself mean the program is invalid or that proof was accepted from the rejected file. A stale executable/cache directory left by an earlier run does not establish current success. Inspect the current exit status and log.
Use structured output and keep a reproducer
For automation, use diagnostic codes, severity, origin/labels and process status rather than English wording. --diagnostics json has documented streams and limitations; inspection flags can prepend human text. Capture the command's actual result and required source/project files.
Reduce a failing project while retaining the same obligation, mode and outcome category. Keep the original source revision, tool identities, configuration, optional engines and cache/certificate policy. If a reduction removes the invariant/callee that created the abstract state, a new failing example may no longer explain the original result.
Verify the repair
Rerun legality/flow, strict proof of the complete project and relevant caller/backend tests. Check that the diagnostic disappeared for the right reason: the required property still exists, intended inputs remain accepted, and trust did not silently increase. Add a focused regression that catches the meaningful defect or missing interface relationship. Preserve failed/unknown cases separately from examples whose expected outcome is success.
The diagnostic catalog explains each code.