-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtest-procedure-checker-3.ucl
61 lines (54 loc) · 1.17 KB
/
test-procedure-checker-3.ucl
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
module traffic_light
{
type light_t = enum { red, yellow, green };
var step : integer;
output light : light_t;
procedure next_light()
modifies light;
modifies step;
{
if (step == 0) {
case
(light == green) : {
light = yellow;
}
(light == yellow) : {
light = red;
step = 2;
}
(light == red) : {
light = green;
step = 1;
}
esac
} else {
step = step - 1;
}
}
next {
call next_light();
}
}
module main
{
type light_t = traffic_light.light_t;
instance light1 : traffic_light();
instance light2 : traffic_light();
init {
assume (light1.light == red && light1.step == 2);
assume (light2.light == green && light2.step == 1);
}
next {
next (light1);
next (light2);
}
invariant atleast_one_red : (light1.light == red) || (light2.light == red);
invariant steps_non_negative : (light1.step >= 0) && (light2.step >= 0);
invariant steps_upper_bound : (light1.step <= 2) && (light2.step <= 2);
control {
v = induction(1);
check;
print_results;
// v.print_cex(light1.light, light1.step, light2.light, light2.step);
}
}