Created
October 16, 2017 18:47
-
-
Save jakewins/b431d83d8833953ea73a5d02d6724189 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 dbm ---- | |
EXTENDS TLC, Integers, Sequences | |
(* --algorithm dbm | |
variables | |
Ids = {1..100}, | |
requested = [i \in Ids |-> FALSE], | |
processed = [i \in Ids |-> FALSE]; | |
begin | |
A: | |
print "Hello, world"; | |
end algorithm; *) | |
\* BEGIN TRANSLATION | |
VARIABLES Ids, requested, processed, pc | |
vars == << Ids, requested, processed, pc >> | |
Init == (* Global variables *) | |
/\ Ids = {1..100} | |
/\ requested = [i \in Ids |-> FALSE] | |
/\ processed = [i \in Ids |-> FALSE] | |
/\ pc = "A" | |
A == /\ pc = "A" | |
/\ PrintT("Hello, world") | |
/\ pc' = "Done" | |
/\ UNCHANGED << Ids, requested, processed >> | |
Next == A | |
\/ (* Disjunct to prevent deadlock on termination *) | |
(pc = "Done" /\ UNCHANGED vars) | |
Spec == Init /\ [][Next]_vars | |
Termination == <>(pc = "Done") | |
\* END TRANSLATION | |
RequestsAreFulfilled == \A id \in Ids: requested[id] ~> processed[id] | |
==== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Couple of comments on the spec:
{1..100}
is the set containing the set1..100
, not the set1..100
. I think you wantIds = 1..100
instead.RequestsAreFulfilled
is breaking because TLC can check temporal properties of constant sets, butIds
is a variable. You want either makeIds
a constant (CONSTANT Ids
) or an operator (Ids == 1..100
).Word of warning: 100 ids will probably take a long time to validate any spec. Consider trying it with a smaller numbers first.