Open ehildenb opened 4 years ago
These conditions are not simplified:
{
true
#Equals
#lookup ( S , K ) ==Int V2
}
{
?V3 ==Int V2 +Int V1
#Equals
true
}
The first one may not be satisfied because the right-hand side of the equality is partial. I don't know why the second isn't simplified. Simplifying these conditions should give
{ V2 #Equals #lookup ( S , K ) } #And { ?V3 #Equals #lookup ( S , K ) +Int V1 }
and the solver should be happy after that.
The current version outputs a different remainder, but that remainder is also infeasible and should be discarded as such:
(After replacing rule
by claim
in the above spec module test-spec.k
) Running kprove test-spec.k
yields
#Not ( {
S [ K:Int <- #lookup ( S , K ) +Int V1 ]
#Equals
S [ K:Int <- V1 +Int #lookup ( S , K ) ]
} )
#And
<generatedTop>
<k>
_DotVar1
</k>
<mem>
S [ K:Int <- V1 +Int #lookup ( S , K ) ]
</mem>
</generatedTop>
#And
... Rest
where Rest
are constraints about the terms #lookup (S, K)
, V1
, and V1 +Int #lookup(S, K)
being within [0, 2^256)
.
The two maps S[ K -> #lookup(S,K) +Int V1]
and S[ K -> V1 +Int #lookup(S, K)]
should probably be recognised as equal.
I think that for some reason we can't unify #lookup ( S , K ) +Int V1
with V1 +Int #lookup ( S , K )
even though we should know that +Int
is commutative.
We should investigate how ^ is implemented.
I have a module where I want to assert things about a Map in the pre-condition, and use that knowledge to check a post condition. Attached is the generated bug report. This example comes from porting the benchmark proofs of KEVM over to the Haskell backend. Here is the K definition:
And the specification module:
In the output counterexample, I get this clause in the side-condition (i):
But we also have in the path condition (ii):
So it should be able to simplify (i) using (ii) to see that it's infeasible, and prune this branch, is my thinking.
Here is the generated bug report: test.tar.gz