-
Notifications
You must be signed in to change notification settings - Fork 2
/
2pc.tla
50 lines (33 loc) · 1.18 KB
/
2pc.tla
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-------------------------------- MODULE 2pc --------------------------------
EXTENDS Naturals, Integers, FiniteSets, Bags, Sequences, TLC
(* PlusCal options (-termination) *)
(*
--algorithm 2pc {
variables participants={"A", "B", "C"},
states=[i\in participants |-> "start"]; \* states can be "start", "prepared" / "failed", "committed" / "aborted"
process(name="P") {
p0: print "hello";
}
}
*)
\* BEGIN TRANSLATION
VARIABLES participants, states, pc
vars == << participants, states, pc >>
Init == (* Global variables *)
/\ participants = {"a", "b", "c"}
/\ states = [i\in participants |-> "start"]
/\ pc = "Lbl_1"
Lbl_1 == /\ pc = "Lbl_1"
/\ PrintT("start")
/\ pc' = "Done"
/\ UNCHANGED << participants, states >>
Next == Lbl_1
\/ (* Disjunct to prevent deadlock on termination *)
(pc = "Done" /\ UNCHANGED vars)
Spec == Init /\ [][Next]_vars
Termination == <>(pc = "Done")
\* END TRANSLATION
=============================================================================
\* Modification History
\* Last modified Wed Mar 25 08:41:58 CET 2015 by bela
\* Created Wed Mar 25 08:25:16 CET 2015 by bela