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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
type X;
procedure A()
{
var {:linear "A"} a: X;
var {:linear "A"} b: int;
}
procedure B()
{
var {:linear "B"} a: X;
var {:linear "B"} b: [X]bool;
}
procedure C()
{
var {:linear "C"} a: X;
var {:linear "C"} c: [X]int;
}
function f(X): X;
procedure {:yields} D()
{
var {:linear "D"} a: X;
var {:linear "D"} x: X;
var {:linear "D"} b: [X]bool;
var c: X;
var {:linear "D2"} d: X;
b[a] := true;
a := f(a);
a := c;
c := a;
a := d;
a := a;
a, x := x, a;
a, x := x, x;
call a, x := E(a, x);
call a, x := E(a, a);
call a, x := E(a, f(a));
call a, x := E(a, d);
call d, x := E(a, x);
call a, x := E(c, x);
call c, x := E(a, x);
call a := F(a) | x := F(a);
}
procedure E({:linear "D"} a: X, {:linear "D"} b: X) returns ({:linear "D"} c: X, {:linear "D"} d: X)
{
c := a;
}
procedure {:yields} {:stable} F({:linear "D"} a: X) returns ({:linear "D"} c: X);
var{:linear "x"} g:int;
procedure G(i:int) returns({:linear "x"} r:int)
{
r := g;
}
procedure H(i:int) returns({:linear "x"} r:int)
modifies g;
{
g := r;
}
procedure {:yields} {:stable} I({:linear ""} x:int) returns({:linear ""} x':int)
{
x' := x;
}
procedure {:yields} {:stable} J()
{
}
procedure {:yields} P1({:linear ""} x:int) returns({:linear ""} x':int)
{
call x' := I(x) | J();
call x' := I(x');
}
procedure {:yields} P2({:linear ""} x:int) returns({:linear ""} x':int)
{
call x' := I(x);
call x' := I(x') | J();
}
|