Quantcast
Channel: Dafny: An Automatic Program Verifier for Functional Correctness
Viewing all articles
Browse latest Browse all 1106

New Post: Array to Sequence to Multisets and comparison

$
0
0
Hello,

I made some changes in my program this morning, I had not realized that the state of the array needed to be asserted before trying to use it, this version is now accepted by the verifier:
class Test {
  method Main()
  {
    var arrInt := new int[5];
    arrInt[0] := 4;
    arrInt[1] := 3;
    arrInt[2] := 2;
    arrInt[3] := 1;
    arrInt[4] := 0;
    
    assert arrInt[..] == [4,3,2,1,0]; //Assertion of the array's sequence

    var m1 := multiset(arrInt[..]);
    var m2 := multiset([4,3,2,1,0]);
    assert m1 == m2; //The assertion is now valid
  }
}
Sorry for the disturbance,
Alexis Chevalier

Viewing all articles
Browse latest Browse all 1106

Trending Articles