1
|
types
|
2
|
MyInt = int [0..42];
|
3
|
SmallInt = int [0..3];
|
4
|
MyTuple = (MyInt, SmallInt);
|
5
|
Sum = autocons system
|
6
|
|[
|
7
|
var
|
8
|
my_list : list [4] of SmallInt = [5,5,5,5]
|
9
|
methods
|
10
|
add(a: MyInt, b: SmallInt) : MyInt =
|
11
|
requires true :
|
12
|
result := a + b
|
13
|
end
|
14
|
end ;
|
15
|
sum(Xs : list [4] of SmallInt) : MyInt =
|
16
|
requires true :
|
17
|
result := add :: (0) :>: (Xs)
|
18
|
end
|
19
|
end
|
20
|
actions
|
21
|
obs Sum(a: MyInt) =
|
22
|
requires a = sum(my_list) :
|
23
|
skip
|
24
|
end
|
25
|
do
|
26
|
var A : MyInt : Sum(A)
|
27
|
od
|
28
|
]|
|
29
|
system
|
30
|
Sum
|
31
|
|