blob: 01ee67074d433a4bd1951f264c479b3d1735d878 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
function {:existential true} Assert() : bool;
function {:existential true} b1():bool;
function {:existential true} b2(x:bool):bool;
function {:existential true} b3(x:bool):bool;
function {:existential true} b4(x:bool):bool;
var array:[int]int;
procedure foo (i:int)
requires b2(i > 0);
ensures b3(array[i] > 0);
modifies array;
ensures Assert() || (forall x:int :: {array[x]} x == i || array[x] == old(array)[x]);
{
array[i] := 2 * i;
}
procedure bar (j:int) returns (result:int)
requires b4(j > 0);
modifies array;
ensures Assert() || (forall x:int :: {array[x]} (!b1() && x == j) || array[x] == old(array)[x]);
{
call foo(j);
result := array[j];
}
// expected assignment: Assert = false, b1(x) = false, b2(x) = false, b3(x) = false, b4(x) = false
|