Created
April 30, 2024 10:45
-
-
Save davebryson/367013ce035a2780beacdb61df48cec5 to your computer and use it in GitHub Desktop.
Counter.tla
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 counter ---- | |
EXTENDS Naturals | |
CONSTANT Limit | |
VARIABLE counter | |
Init == counter = 1 | |
Terminates == counter = Limit | |
Next == | |
/\ counter < Limit | |
/\ counter' = counter + 1 | |
Spec == | |
/\ Init | |
/\ [][Next]_counter | |
(* Invariants *) | |
TypeOk == | |
/\ Limit \in Nat | |
/\ Limit > 0 | |
WithinLimit == counter <= Limit | |
(* Propeties *) | |
\* Safety | |
AlwaysIncreases == [][counter' > counter]_counter | |
\* Liveliness | |
\* Eventually it hits the limit and stays there | |
ReachLimit == <>[]Terminates | |
==== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment