Created
June 3, 2021 08:38
-
-
Save Vanlightly/0233cfa46c3a85bc60e94e2a1033f6ec to your computer and use it in GitHub Desktop.
Clock TLA+ specification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------- MODULE Clock ------------------------------- | |
EXTENDS Naturals | |
VARIABLES hour, minute, second | |
Init == | |
/\ hour = 0 | |
/\ minute = 0 | |
/\ second = 0 | |
Tick == | |
/\ hour' = IF second = 59 /\ minute = 59 | |
THEN IF hour = 23 | |
THEN 0 | |
ELSE hour + 1 | |
ELSE hour | |
/\ minute' = IF second = 59 | |
THEN IF minute = 59 | |
THEN 0 | |
ELSE minute + 1 | |
ELSE minute | |
/\ second' = IF second = 59 | |
THEN 0 | |
ELSE second + 1 | |
Next == | |
Tick | |
============================================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment