Skip to content

Instantly share code, notes, and snippets.

@Vanlightly
Created June 3, 2021 08:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vanlightly/0233cfa46c3a85bc60e94e2a1033f6ec to your computer and use it in GitHub Desktop.
Save Vanlightly/0233cfa46c3a85bc60e94e2a1033f6ec to your computer and use it in GitHub Desktop.
Clock TLA+ specification
------------------------------- 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