-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce result class #26
base: master
Are you sure you want to change the base?
Conversation
mkString(PrepareACSLPrinting(i))))) | ||
} | ||
|
||
// SSSOWO TODO: This doesn't seem to be used anywhere. Remove? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zafer-esen Please advice on this.
(result: Either[Option[HornPreprocessor.Solution], hornconcurrency.VerificationLoop.Counterexample]) | ||
: Result = { | ||
import scala.collection.mutable.HashSet | ||
// SSSOWO TODO: These constants should be defined in a single place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zafer-esen Please advice on how to go forward here.
subres: Seq[IExpression] | ||
): IExpression = { | ||
t update subres match { | ||
// SSSOWO TODO: Why does this need special handling? "emptyHeap" is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zafer-esen Do you have any comment on this?
@@ -225,6 +226,9 @@ object ValSetReader { | |||
extends CollectingVisitor[Unit, ValSet] | |||
with ExpressionUtils { | |||
|
|||
// SSSOWO: The de Bruijn version disregards disjunctions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zafer-esen To mee this looks really weird. The deBruijn version and the "invariant" version treat disjunctions differently. I actually think the deBruijn version is correct and that this implementation may cause some to the problems discussed in issue #15. But I think we need to have a closer look on what to do with disjunctions.
Summary
This PR introduces a
Result
trait and related classes in order to introduce more structure into the post processing of the result from the horn solver. Therefore this PR makes substantial changes to these parts of the code, especially the post-processors related to translation of explicit heap into implicit form more suitable for ACSL contract generation.An ambition has been to introduce an interface between the translator (
CCReader
) the solver and the result. A major change is a move away from the existingFunctionContext
andACSLTranslator.FunctionContext
. These classes kept too much information in a form tightly bound to the problem description for them to be practical to use.the
ResultConverter.hornSolverSolutionToResult()
converts the solution from the horn solver and data fromCCReader
into aSolution
result (see below). As part of this conversion, the predicate variables representing program variables of some kind (globals, parameters, or locals in the case of loop invariants) are replaced with symbolic constants. However, in order to keep necessary meta data about them theIConstant
is instantiated with a special type of constant,ProgVarProxy
, derived fromConstantTerm
. That way they can be separated from any other constant in the expressions.ProgVarProxy
does not rely on prefix or suffix information in the name in order to keep track of various attributes. Instead such informtion is kept in separate variables.Introduced concepts
Result
trait. A container for a the result. There are case classes forEmpty
,CounterExample
andSolution
.Solution
is a set ofFunctionInvariants
, one for each function we are inferring contracts for.FunctionInvariant
is aPreCondition
,PostCondition
, andLoopInvariants
and some meta-data.PreCondition
,PostCondition
, andLoopInvariants
are cases extending theInvariantContext
trait.PreCondition
andPostCondition
each contains anInvariant
.Invariant
is a container for anIFormula
and some meta-data for heap operations.HeapInfo
is a class that contains information regarding the heap and objects and functions related to that.ProgVarProxy
is derived fromConstantTerm
and is used as a proxy for program variables inIFormula
andIExpressions
.ProgVarProxy
carries meta data about scope (global, parameter etc.) and context (pre-execution, post-execution). This is utilized in ACSL contract generation.Comments
ValSetReader
EqualitySwapper
and friends. I can't see this being necessary anymore, since all free variables are replaced by symbolic constants before any processing is started. However, I noticed some differences in their implementation and have therefore kept both. This needs further consideration