blob: eda8ef448413d9b49675827155a9708453800c02 (
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
28
29
30
31
32
33
34
35
36
37
38
39
40
|
var a:[int]int;
procedure Allocate() returns ({:linear "tid"} xls: int);
procedure {:entrypoint} {:yields} main()
{
var {:linear "tid"} i: int;
var {:linear "tid"} j: int;
call i := Allocate();
call j := Allocate();
call i := t(i) | j := Yield(j);
call i := u(i) | j := u(j);
}
procedure {:yields} {:stable} t({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
{
i := i';
a[i] := 42;
call i := Yield(i);
assert a[i] == 42;
}
procedure {:yields} {:stable} u({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
{
i := i';
a[i] := 42;
yield;
assert a[i] == 42;
}
procedure {:yields} {:stable} Yield({:linear "tid"} i': int) returns ({:linear "tid"} i: int)
ensures i == i';
ensures old(a)[i] == a[i];
{
i := i';
yield;
assert old(a)[i] == a[i];
}
|