blob: 73d111a6c0bb12b0217c226b58e3a0431781a7e5 (
plain) (
blame)
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
|
const bound: int = 7;
node updown() returns(probe x, probe y, probe z: int)
var last_x, last_y: int;
let
last_x = 0 -> pre x;
automaton
initial state UP
let x = last_x + 1; tel
until if x >= bound resume DOWN;
state DOWN
let x = last_x - 1; tel
until if x <= -bound resume UP;
returns x;
guarantee x_bounded: x >= -bound and x <= bound;
last_y = 0 -> pre y;
automaton
initial state DOWN
let y = last_y - 1; tel
until if y <= -bound resume UP;
state UP
let y = last_y + 1; tel
until if y >= bound resume DOWN;
returns y;
guarantee y_bounded: y >= -bound and y <= bound;
z = x + y;
guarantee x_y_opp: z = 0 and (true -> pre (z = 0));
tel
node test(i: int) returns(a, b, c: int; exit: bool)
let
exit = i >= 30;
a, b, c = updown2();
tel
|