Add VC Folding Simplification#250
Conversation
|
|
||
| // TODO: add more simplification steps here (e.g., folding) | ||
| return substituted; | ||
| return VCFolding.apply(implication); |
There was a problem hiding this comment.
It could be cool to have like implication.fold() and have that method call the VCFolding. In terms of API thats a bit more ergonomic since the user doenst need to know that there is another class resposible for the folding itself
There was a problem hiding this comment.
Maybe just implication.simplify() to call VCSimplification.simplifyToFixedPoint?
| return null; | ||
|
|
||
| Expression expression = implication.getRefinement().getExpression(); | ||
| Expression folded = fold(expression); |
There was a problem hiding this comment.
So with this architecture, each VCImplication only has one origin->simplification right?
Its not possible for one VCImplication to formulate 2 "independent" simplifications for different parts of the expression like you had planned before.
Like
VC: forall x: x == 3 -> forall y: y == 4 -> x < y
// there are 2 independent simplifcations possible
VC: forall y: y == 4 -> 3 < y e forall x: x == 3 -> x < 4
// but just one outcome for each of the next ones
3 < 4
true
If you want to keep this structure, I think this architecture does not work 😕
Nevertheless, this current option works for me if you want to leave that for a followup but it might require some more deep changes
There was a problem hiding this comment.
Yes, you are correct, but I think we should keep this approach because it stays consistent with the VCSubstitution, and even though it can be a bit more verbose than the previous one, each simplification step is atomic and easier to debug.
Description
This PR adds VC simplification for foldable expressions through
VCImplicationchains. When a refinement contains constant arithmetic, boolean expressions, conditionals, adjacent integer constants, or resolved enum literals, it folds the VC node while preserving its origin and the rest of the VC chain.It also adds focused unit tests for both the VC folding alone and the VC simplification with both the substitution and folding.
Example
Related Issue
None.
Type of change
Checklist
mvn testpasses locally