Skip to content

Instantly share code, notes, and snippets.

@Vanlightly
Created June 3, 2021 08:23
Show Gist options
  • Save Vanlightly/06415729c113301ceb435d7918c667a8 to your computer and use it in GitHub Desktop.
Save Vanlightly/06415729c113301ceb435d7918c667a8 to your computer and use it in GitHub Desktop.
Example TLA+ specification
---------------------------- MODULE TwoCounters ----------------------------
EXTENDS Integers
CONSTANT C, Limit
VARIABLES counter
Init ==
counter = [c \in C |-> 0]
Next ==
\E c \in C :
/\ counter[c] < Limit
/\ counter' = [counter EXCEPT ![c] = counter[c] + 1]
AlwaysNonNegative ==
\A c \in C : counter[c] > -1
AllAtLimit ==
\A c \in C : counter[c] = Limit
EventuallyAllAtLimit ==
<>[]AllAtLimit
=============================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment