Repository navigation
D6: cvc5 counterexamples in source terms, with their path - #107
Merged
Merged
Conversation
…peration after its own checks.
…in obligation modules.
…xpression begins.
… calls a removed function.
…nd reference flags, in results.
…S runner can meet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A failure cvc5 found showed the error and nothing else. The certifier checked cvc5's model against the true definitions, and then the verifier dropped it:
counterexample,model, ortrace, and SARIF had no code flow;--lean-fallback, a race that cvc5 won wrote no Lean refutation (the solver's model gives the goal's variables no values).The limitations page said so: cvc5's models "are not yet shown as source-level values". This is plan item D6, stacked on #105 (E6).
Before and after
clamp.cpp, the example this PR adds to chapter 17:cpp-verify --backend=cvc5 clamp.cppbefore:and now, as Z3 reports it:
The same values and steps are in the JSON record (
counterexample,model,trace), in SARIF (the message and the code flow), in the GitHub annotation, and in archive replay with--backend=cvc5.How
describeCounterexample(Backend/Certify.cpp) describes a certified model. cvc5's models are read by the adapter, not by a solver API, so the certifier does it, in the model it has just checked, with its own evaluation (evaluateTerm): a value shown is a value the check used, and nothing completes the model. It fills:Model: the source variables of the obligation's query (candidateValues), listed by internal name, the order of Z3's models, so a cvc5 record lists its variables as a Z3 record does;OnPath: each version's guard, so a version of a branch the path does not take is left out of the text, as for Z3;Trace: the obligation's events up to itsTraceEventCount; an event whose guard is false is dropped, and one the model does not decide is kept and marked undetermined. Each event's values are evaluated too;Assignment: the goal's variables, which a Lean refutation states.The cvc5 adapter calls it at both places where it reports a certified failure: a model after
sat, and a model cvc5 prints withunknown. cvc5 solves each obligation alone, so the query is always one obligation's.Replay printed the counterexample note without a location (
note: counterexample: ...) while every step had one. It is now at the failing check, as in a source run (Main.cpp).Checks
On
failure_notes.cppthere are 14 failures: branches, a call, stores,new/delete, local objects and references, loops, a long path, an undecided branch, a macro, and two overflows. cvc5's notes are Z3's line for line, except for values each solver picks itself (inheap,v = 0for cvc5 andv = -1for Z3). A script compared the 14 JSON records of the two solvers: each has the same obligation, the same model entries (names, versions,on_path), and the same trace events (kind, message,active, line). Before the order change, the only difference was the order of the model.The Lean refutation of a race that cvc5 won was checked in a build where the race prefers cvc5's answer (a local change, not committed). On
lean_refutation.cpp,--backend=race --lean-fallbackwrote refutations for the four failures cvc5 settled.--lean-certifythen reported each(confirmed in Lean). As with Z3,pick_oneis not confirmed:Lean cannot decide the goal at the counterexample.Tests
suite/failure_notes_cvc5.test(new, needs cvc5) runsfailure_notes.cppon cvc5 and checks:result, Z3's order), the version markedon_path: false, and a step's text;--backend=cvc5;Inputs/failure_notes_quantified.cpp, a failure cvc5 answersunknownfor, with a model that the certifier certifies.CertifyTest.CounterexamplesAreDescribedAlongTheFailingPath(unit) builds a module of two obligations and checks:on_pathmarks;It needs neither cvc5 nor a race.
failure_notes.cpp: the replayed counterexample note is at its check.solver_race.cpp: the failure has its counterexample whichever solver wins the race.On the base,
failure_notes_cvc5.testfails at its first counterexample note, and the unit test does not compile (describeCounterexampledoes not exist).Each mutant below, applied alone and rebuilt, is caught by
failure_notes_cvc5.test,failure_notes.cpp, or the unit test (11 of 11):satis not describedunknownis not describedOn a release build of this branch merged with main (#97 to #99, #104, and #105 merged forward, all pushed), the Verify suite ran 498 tests: 497 passed. The one failure was
obligation_size_limit.cpp, a test from #48 that expectedcppverify.diagnostic/1records; it is updated on #105 (74cac50) and passes. The 57 tests that use cvc5, a race, the portfolio, archive replay, or a Lean fallback pass on the branch itself, and so does the new unit test. The fullVerifyTestsrun was not finished here.Stacked on #105.