Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Created July 8, 2026 02:51
Show Gist options
  • Select an option

  • Save jmcph4/035f33f35bf02f651425cb90dcf81d67 to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/035f33f35bf02f651425cb90dcf81d67 to your computer and use it in GitHub Desktop.
INIT Init
NEXT Next
INVARIANT TypeOK
--------------------------- MODULE TrafficLight -----------------------------
EXTENDS Naturals
VARIABLE light
TypeOK == light \in {"red", "green", "yellow"}
ToGreen == /\ light = "red"
/\ light' = "green"
ToYellow == /\ light = "green"
/\ light' = "yellow"
ToRed == /\ light = "yellow"
/\ light' = "red"
Init == light = "red"
Next == \/ ToGreen
\/ ToYellow
\/ ToRed
NeverSkipYellow == (light = "green") => (light' # "red")
=============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment