Carbon implementation of new backend-independent counterexample format#574
Open
marcoeilers wants to merge 11 commits into
Open
Carbon implementation of new backend-independent counterexample format#574marcoeilers wants to merge 11 commits into
marcoeilers wants to merge 11 commits into
Conversation
marcoeilers
marked this pull request as ready for review
July 15, 2026 22:32
marcoeilers
commented
Jul 21, 2026
| // The "weak" hash map is necessary to avoid leaking memory. | ||
| // See issue https://github.com/viperproject/carbon/issues/444 | ||
| val mapping = mutable.WeakHashMap[VerificationError, Member]() | ||
| val mapping = mutable.HashMap[String, Member]() |
Contributor
Author
There was a problem hiding this comment.
Adjust comment or revert change
| @@ -0,0 +1,1207 @@ | |||
| package viper.carbon.boogie | |||
|
|
||
| /** | ||
| * Transforms a counterexample returned by Boogie back to a Viper counterexample. The programmer can choose between an | ||
| * "intermediate" CE or an "extended" CE. |
Contributor
Author
There was a problem hiding this comment.
Adjust old names in comments throughout
| /** | ||
| * Chooses the latest instance of a variable in the counterexample model received from the SMT solver. | ||
| */ | ||
| def transformModelEntries(originalEntries: Map[String, ModelEntry], namesInMember: Map[String, String]): mutable.Map[String, ModelEntry] = { |
Contributor
Author
There was a problem hiding this comment.
This should no longer be needed
| newEntries | ||
| } | ||
|
|
||
| def isLaterVersion(firstName: String, originalName: String, secondName: String): Boolean = { |
Contributor
Author
There was a problem hiding this comment.
Should no longer be needed
| */ | ||
| def decodeBoxedValue(v: String, model: Model): String = { | ||
| if (!v.startsWith("T@U!")) return v | ||
| for (fn <- Seq("U_2_int", "U_2_bool")) { |
Contributor
Author
There was a problem hiding this comment.
Why is this specific to int and bool?
| * Match heap resources to their ast node and translate all identifiers (for fields and references) | ||
| */ | ||
| def detHeap(opMapping: Map[Seq[String], String], basicHeap: RawHeap, program: Program, collections: Seq[CECollection], translNames: Map[String, String], model: Model): HeapCounterexample = { | ||
| // choosing all the needed values from the Boogie Model |
Contributor
Author
There was a problem hiding this comment.
I don't understand this comment
| type WandShape = Func | ||
| //This needs to be resettable, which is why "lazy val" is not used. See also: wandToShapes method | ||
| private var lazyWandToShapes: Option[Map[MagicWandStructure.MagicWandStructure, WandShape]] = None | ||
| /* private */ var lazyWandToShapes: Option[Map[MagicWandStructure.MagicWandStructure, WandShape]] = None |
Contributor
Author
There was a problem hiding this comment.
Is this change necessary?
| capturedStates = collection.mutable.LinkedHashMap.empty | ||
| case "*** END_MODEL" if parsingModel.isDefined => | ||
| if (capturedStates != null && capturedStates.nonEmpty) { | ||
| // The captured states are sparse (each lists only the variables whose current |
Contributor
Author
There was a problem hiding this comment.
It's not clear to me that we want to do that, check.
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| // | ||
| // Copyright (c) 2011-2025 ETH Zurich. |
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.
Carbon implementation of the new backend-independent counterexample format (see viperproject/silver#883), written by @rvandoren in his practical work project.