Open michael-schwarz opened 2 years ago
There is some overlap of this suggestion with #59 which proposes adding such a location_invariant
on top of the current loop_invariant
entry.
There's another problem regarding loop_invariant
and its positioning in the code that got discussed during some SV-COMP community meeting a while ago AFAIK, but I don't recall any solution.
Namely, a loop invariant isn't an invariant that can be inserted into the specified code location as an assertion at a single point (which is how I remember its semantics being defined somewhere, if I'm not mistaken). Rather, that invariant expression should actually hold at four different code locations:
So a loop invariant is stronger than an assertion inserted into any single of the four possible locations.
There is some overlap of this suggestion with #59 which proposes adding such a location_invariant on top of the current loop_invariant entry.
Indeed, I forgot that I already tasked Sven with this before hand!
So a loop invariant is stronger than an assertion inserted into any single of the four possible locations.
Indeed, this is the usual semantics.There are also some pecularities regarding special cases when variables go out of scope after the loop (i.e., the C expression is not valid "after" the loop). This is not a problem for the witness automata from the graphml-based format, but when one tries to translate these into concrete locations then there might be no specific location to put 4. to. As such an loop_invariant
cannot simple be replaced by 4 location_invariant
s.
In a discussion between some Munich Goblint folks and @MartinSpiessl and others from the CPAChecker team on Friday we were wondering whether
loop_invariant
is actually the right name for the entry as it is currently specified:loop_invariant
entry - one could just as well provide invariants for locations / program points that are not in loopsCalling this assertion the loop invariant is a bit strange as it does not hold inside the loop, but only after the loop.
Maybe just
invariant
orlocation_invariant
is a better name?