Silicon implementation of new backend-independent counterexample format - #940
Merged
Conversation
marcoeilers
marked this pull request as ready for review
July 15, 2026 22:32
marcoeilers
commented
Jul 21, 2026
AndreaKe
approved these changes
Jul 28, 2026
AndreaKe
left a comment
Collaborator
There was a problem hiding this comment.
Some nitpicky comments, otherwise LGTM
There was a problem hiding this comment.
Pull request overview
Implements Silicon support for the new backend-independent counterexample format by introducing “raw” and “resolved” counterexample generation from SMT models, extending term evaluation to cover more Silicon term constructs, and wiring the new counterexample modes into symbolic execution.
Changes:
- Add
SiliconResolvedCounterexample/SiliconRawCounterexampleto transform Z3 models into Viper counterexamples (including collections/heaps/domains/functions). - Extend
Converter.evaluateTermwith environment binding and support for additional boolean/int/perm/map operations used by counterexample resolution. - Update counterexample plumbing (model kinds, permission-term inlining) and adjust/replace counterexample test suites and Z3 configuration.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/scala/MappedCounterexampleTests.scala | Renames/retargets mapped counterexample test suite and annotation wrapper. |
| src/test/scala/GeneralCounterexampleTests.scala | Adds a general/resolved counterexample test suite and verifier config. |
| src/test/resources/counterexamples/simple-refs.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/simple-refs-rec.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/sequence.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/ref-sequence.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/predicate.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/permissions.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/negative.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/method-call.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/lseg.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/functions.vpr | Removes legacy counterexample test input. |
| src/test/resources/counterexamples/cyclic-ref.vpr | Removes legacy counterexample test input. |
| src/main/scala/rules/SymbolicExecutionRules.scala | Wires in Raw/Resolved counterexample modes. |
| src/main/scala/rules/QuantifiedChunkSupport.scala | Avoids macros for permission terms when counterexamples are requested. |
| src/main/scala/rules/MoreCompleteExhaleSupporter.scala | Inlines pTaken term when counterexamples are requested to keep permission arithmetic evaluable. |
| src/main/scala/reporting/SiliconResolvedCounterexample.scala | Introduces raw/resolved counterexample construction from SMT models (large new implementation). |
| src/main/scala/reporting/Converter.scala | Extends term evaluation (env binding + more operations) for counterexample resolution. |
| src/main/resources/z3config.smt2 | Enables partial models in Z3 configuration. |
Suppressed comments (1)
src/test/scala/MappedCounterexampleTests.scala:21
testDirectoriespoints tocounterexample_mapped, but this directory does not exist undersrc/test/resourcesin this branch, so this suite will either discover no tests or fail to load resources. Add the missing resource directory/files, or changetestDirectoriesto an existing resource path.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Silicon implementation of the new backend-independent counterexample format (see viperproject/silver#883), written by @rvandoren in his practical work project.
A lot of the code is used to evaluate arbitrary Silicon terms in a state described by a Z3 model, which is used for example to evaluate permission amounts that quantified chunks provide for specific heap locations.