@@ -20,30 +20,23 @@ VARIABLES x, \* Abstract/very high-level representation of the overall computati
20
20
\* Think of it as some computation going on. At a certain state
21
21
\* of the computation, the composed system transitions into the
22
22
\* next phase.
23
- y , \* Represents the phase that the composed system is in.
24
- \* This toy example has three phases: <<"A", "B", "C">>.
25
23
z \* z is the variable that is only going to be present in spec A.
26
- varsA == << x , y , z >>
24
+ varsA == << x , z >>
27
25
28
26
InitA ==
29
27
/\ x = 0
30
- /\ y = "A"
31
28
/\ z = TRUE
32
29
33
30
NextA ==
34
- /\ y = "A"
31
+ /\ x < 6
35
32
/\ x ' = x + 1
36
- /\ IF x ' = 5
37
- THEN y ' = "B"
38
- ELSE UNCHANGED y
39
33
/\ z ' = ~ z
40
34
41
35
==================================
42
36
43
37
(* COMPONENT Spec B *)
44
- VARIABLES x ,
45
- y
46
- varsB == << x , y >>
38
+ VARIABLES x
39
+ varsB == << x >>
47
40
48
41
\* ++Observation: This is most likely not the original Init predicate of a
49
42
\* standalone B component, unless perhaps we consider spec A
@@ -54,15 +47,10 @@ varsB == <<x, y>>
54
47
InitB ==
55
48
/\ x \in Nat \* Spec B may starts with x being any natural number,
56
49
\* which is where A left off.
57
- /\ y \in { "A" , "B" } \* Phase A or B, otherwise InitA /\ InitB in Spec
58
- \* below will equal FALSE.
59
50
60
51
NextB ==
61
- /\ y = "B"
52
+ /\ x < 10
62
53
/\ x ' = x + 1
63
- /\ IF x ' = 10 \* (Make sure values is greater than in spec A)
64
- THEN y ' = "C" \* Phase C of the composed system (or ultimate termination).
65
- ELSE UNCHANGED y
66
54
67
55
-----------------------------------------------------------------------------
68
56
@@ -77,23 +65,26 @@ OpenNextB ==
77
65
/\ UNCHANGED << restOfTheUniverse >>
78
66
79
67
vars ==
80
- << x , y , restOfTheUniverse >>
68
+ << x , restOfTheUniverse >>
81
69
82
70
(* Composition of A and B (A /\ B) *)
83
71
(* Down here we know about the internals *)
84
72
(* of spec A and B (whitebox component). *)
85
73
86
74
INSTANCE A WITH z <- restOfTheUniverse
87
75
88
- Spec == InitA /\ InitB /\ [] [ \/ [ NextA ]_ vars
89
- \/ [ OpenNextB ]_ vars
76
+ Spec == InitA /\ InitB /\ [] [ IF ENABLED NextA THEN [ NextA ]_ vars
77
+ ELSE [ OpenNextB ]_ vars
90
78
]_ vars
91
79
92
- Inv == y \in { "A" , "B" , "C" }
80
+ Inv == x \in 0 .. 10
93
81
THEOREM Spec => Inv
94
82
83
+ \* Not a theorem due to no fairness constraint.
84
+ Live ==
85
+ <> [] ( x = 10 )
95
86
=============================================================================
96
87
\* Modification History
97
- \* Last modified Fri Jun 12 17:30:28 PDT 2020 by markus
88
+ \* Last modified Fri Jun 12 17:34:09 PDT 2020 by markus
98
89
\* Last modified Fri Jun 12 16:30:19 PDT 2020 by Markus Kuppe
99
90
\* Created Fri Jun 12 10:30:09 PDT 2020 by Leslie Lamport
0 commit comments