-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLamp.tla
42 lines (35 loc) · 1.3 KB
/
Lamp.tla
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
-------------------------------- MODULE Lamp --------------------------------
VARIABLES
on, \* Represents whether the lamp is on (TRUE) or off (FALSE)
onPending, \* Represents whether the lamp is waiting to be turned on
offPending \* Represents whether the lamp is waiting to be turned off
vars == << on, onPending, offPending >>
TypeInvariant == on \in BOOLEAN /\ (~onPending \/ ~offPending)
----
Init == /\ on \in BOOLEAN
/\ onPending = FALSE
/\ offPending = FALSE
PressButton == \/ /\ ~on
/\ onPending' = TRUE
/\ UNCHANGED << on, offPending >>
\/ /\ on
/\ offPending' = TRUE
/\ UNCHANGED << on, onPending >>
TurnOn == /\ onPending
/\ on' = TRUE
/\ onPending' = FALSE
/\ UNCHANGED offPending
TurnOff == /\ offPending
/\ on' = FALSE
/\ offPending' = FALSE
/\ UNCHANGED onPending
Next == \/ PressButton
\/ TurnOn
\/ TurnOff
Spec == Init /\ [][Next]_vars /\ WF_vars(TurnOn) /\ WF_vars(TurnOff)
----
THEOREM Spec => []TypeInvariant
=============================================================================
\* Modification History
\* Last modified Sat Aug 20 20:11:01 ART 2016 by juampi
\* Created Thu Jul 14 20:48:46 ART 2016 by juampi