VARIABLE val
Calculate() ==
val' = val + 1
(*return [v: val] here*)
--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+u...@googlegroups.com.
To post to this group, send email to tla...@googlegroups.com.
Visit this group at https://groups.google.com/group/tlaplus.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/d6598cfb-609a-4f6c-98a6-b12d58e6c6b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
CONSTANTS Participants
VARIABLE counters
Init == counters = [i \in Participants |-> 0]
UpdateCounter(participant, newCounter) ==
IF /\ counters[participant] < newCounter THEN
/\ counters' = [counters EXCEPT ![participant] = newCounter]
/\ TRUE
ELSE
/\ FALSE
/\ UNCHANGED << counters >>
UpdateAndGet(participant, newCounter) ==
IF UpdateCounter(participant, newCounter) THEN
[p |-> participant, c |-> newCounter]
ELSE
[p |-> participant, c |-> counters[participant]]
Stephan
To unsubscribe from this group and stop receiving emails from it, send an email to tla...@googlegroups.com.