Last active
January 23, 2022 19:56
-
-
Save aaronlelevier/75ec48f7de1878fb55d7604e3bcdacc3 to your computer and use it in GitHub Desktop.
My 2nd TLA+ Spec. RTOP stands for R-to-P and is a spec that shows a mapping of many-to-many P to R and the inverse
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 RTOP -------------------------------- | |
CONSTANT P, R | |
VARIABLE ptor, rtop | |
vars == <<ptor, rtop>> | |
TypeOK == /\ ptor \in [P -> SUBSET R] | |
/\ rtop \in [R -> SUBSET P] | |
Init == | |
/\ ptor = [p \in P |-> (CHOOSE r \in SUBSET R: TRUE)] | |
/\ rtop = [r \in R |-> {p \in P : r \in ptor[p]}] | |
PAddR(p, r) == | |
/\ ptor' = [ptor EXCEPT ![p] = @ \cup {r}] | |
/\ UNCHANGED <<rtop>> | |
Next == | |
\/ \E p \in P, r \in R: | |
\/ PAddR(p, r) | |
Spec == Init /\ [][Next]_<<vars>> | |
----------------------------------------------------------------------------- | |
THEOREM Spec => []TypeOK | |
============================================================================= | |
\* Modification History | |
\* Last modified Sun Jan 23 11:10:52 PST 2022 by aaron | |
\* Created Sat Jan 22 09:52:31 PST 2022 by aaron |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explanation of this gist can be found here under section "RTOP explained":
https://aaronlelevier.github.io/One-Month-of-TLAPlus-Learning-Adventure/