WhileyCompiler icon indicating copy to clipboard operation
WhileyCompiler copied to clipboard

Overlapping Lvals

Open DavePearce opened this issue 4 years ago • 2 comments

Does this make sense:

method main(int[] xs, int i, int j):
    xs[i],xs[j]= 0,1

What is the semantics of this? Dafny disallows this.

DavePearce avatar Mar 25 '21 06:03 DavePearce

If you want to allow overlapping lvals, I think it should generate a proof obligation:

assert i != j;

or perhaps more generally:

assert i == j ==> rhs1 == rhs2 (0 == 1) in this case.

utting avatar Mar 26 '21 07:03 utting

Hey,

Yeah, so that second obligation is interesting. I'll have to have a think, but yeah definitely one of these two makes sense.

DavePearce avatar Mar 28 '21 22:03 DavePearce