├── .gitignore
├── AltBitProtocol
├── AltBitProtocol.cfg
├── AltBitProtocol.old
├── AltBitProtocol.tla
└── AltBitProtocol.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── AltBitProtocol.tla.pmap
│ └── AltBitProtocol___ABP_Model_1.launch
├── AsyncInterface
├── AsyncInterface.cfg
├── AsyncInterface.old
├── AsyncInterface.tla
└── AsyncInterface.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── AI_Model_1
│ ├── AsyncInterface.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── AI_Model_2
│ ├── AsyncInterface.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── AsyncInterface.tla.pmap
│ ├── AsyncInterface___AI_Model_1.launch
│ └── AsyncInterface___AI_Model_2.launch
├── AsyncInterfaceChan
├── AsyncInterfaceChan.cfg
├── AsyncInterfaceChan.old
├── AsyncInterfaceChan.tla
└── AsyncInterfaceChan.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── AIChan_Model_1
│ ├── AsyncInterfaceChan.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── AIChan_Model_2
│ ├── AsyncInterfaceChan.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── AsyncInterfaceChan.tla.pmap
│ ├── AsyncInterfaceChan___AIChan_Model_1.launch
│ └── AsyncInterfaceChan___AIChan_Model_2.launch
├── Euclid
├── Euclid.cfg
├── Euclid.old
├── Euclid.tla
└── Euclid.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── Euclid___Model_1.launch
│ └── Model_1
│ ├── Euclid.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
├── FIFO
├── FIFO.cfg
├── FIFO.old
├── FIFO.tla
└── FIFO.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── FIFO.tla.pmap
│ ├── FIFO_Model_4
│ ├── FIFO.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ └── FIFO___FIFO_Model_4.launch
├── FastMutex
├── FastMutex.cfg
├── FastMutex.old
├── FastMutex.tla
└── FastMutex.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── FM_Bad_Model_2
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FM_Model_1
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FM_Model_3
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FM_Model_4
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FM_Model_5
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FM_Model_6
│ ├── FastMutex.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── FastMutex.tla.pmap
│ ├── FastMutex___FM_Bad_Model_2.launch
│ ├── FastMutex___FM_Model_1.launch
│ ├── FastMutex___FM_Model_3.launch
│ ├── FastMutex___FM_Model_4.launch
│ ├── FastMutex___FM_Model_5.launch
│ └── FastMutex___FM_Model_6.launch
├── HourClock
├── HourClock.cfg
├── HourClock.old
├── HourClock.tla
└── HourClock.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── HR_Model_1
│ ├── HourClock.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── HR_Model_2
│ ├── HourClock.tla
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ └── MC_TE.out
│ ├── HourClock.tla.pmap
│ ├── HourClock___HR_Model_1.launch
│ └── HourClock___HR_Model_2.launch
├── HyperBook
├── DieHarder
│ ├── DieHarder.cfg
│ ├── DieHarder.old
│ └── DieHarder.tla
└── TickTock
│ ├── TickTock.cfg
│ ├── TickTock.old
│ └── TickTock.tla
├── HyperClock
├── HyperClock.cfg
├── HyperClock.old
└── HyperClock.tla
├── HyperDieHard
├── HyperDieHard.tla
├── PCalDieHard.cfg
├── PCalDieHard.old
└── PCalDieHard.tla
├── HyperEuclid
├── HyperEuclid.cfg
├── HyperEuclid.old
└── HyperEuclid.tla
├── README.md
├── TE4
├── TE4.cfg
├── TE4.old
├── TE4.play
└── TE4.tla
├── TE42
├── TE42.cfg
├── TE42.old
└── TE42.tla
├── TwoPhaseCommit
├── TwoPhaseCommit.cfg
├── TwoPhaseCommit.old
├── TwoPhaseCommit.tla
└── TwoPhaseCommit.toolbox
│ ├── .project
│ ├── .settings
│ └── org.lamport.tla.toolbox.prefs
│ ├── TPC_Model_2
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ ├── MC_TE.out
│ └── TwoPhaseCommit.tla
│ ├── TPC_Model_3
│ ├── MC.cfg
│ ├── MC.out
│ ├── MC.tla
│ ├── MC_TE.out
│ └── TwoPhaseCommit.tla
│ ├── TwoPhaseCommit.tla.pmap
│ ├── TwoPhaseCommit___TPC_Model_1.launch
│ ├── TwoPhaseCommit___TPC_Model_2.launch
│ └── TwoPhaseCommit___TPC_Model_3.launch
└── library
└── GCD
└── GCD.tla
/.gitignore:
--------------------------------------------------------------------------------
1 | workspace/
2 | TE4/TE4.toolbox
3 | TE4.pdf
4 | *toolbox/
5 |
--------------------------------------------------------------------------------
/AltBitProtocol/AltBitProtocol.cfg:
--------------------------------------------------------------------------------
1 | SPECIFICATION Spec
2 | CONSTANT defaultInitValue = defaultInitValue
3 | \* Add statements after this line.
4 |
--------------------------------------------------------------------------------
/AltBitProtocol/AltBitProtocol.old:
--------------------------------------------------------------------------------
1 | --------------------- MODULE AltBitProtocol ----------------------
2 | EXTENDS Naturals, Sequences, TLC
3 | CONSTANT Msg
4 |
5 | Remove(i, seq) == [j \in 1..(Len(seq)-1) |-> IF j < i THEN seq[j] ELSE seq[j+1]]
6 |
7 | (*
8 | --algorithm AltBitProtocol {
9 | variables
10 | input = <<>>, output = <<>>,
11 | msgChan = <<>>, ackChan = <<>>,
12 | newChan = <<>>;
13 |
14 | macro Send(m, chan) {
15 | chan := Append(chan, m);
16 | }
17 |
18 | macro Recv(v, chan) {
19 | await chan # <<>>; \* could also do Len(chan) > 0 ??
20 | v := Head(chan);
21 | chan := Tail(chan);
22 | }
23 |
24 | process (Sender = "S")
25 | variables next = 1, sbit = 0, ack;
26 | {
27 | s: while (TRUE) {
28 | either with (m \in Msg) {
29 | input := Append(input, m);
30 |
31 | } or {
32 | await next <= Len(input);
33 | Send(<>, msgChan);
34 |
35 | } or {
36 | Recv(ack, ackChan);
37 | if (ack = sbit) {
38 | next := next + 1;
39 | sbit := (sbit + 1) % 2;
40 | };
41 | };
42 | print <<"Sender", input>>;
43 | }
44 | }; \* end Sender process block
45 |
46 | process (Receiver = "R")
47 | variables rbit = 1, msg;
48 | {
49 | r: while (TRUE) {
50 | either {
51 | Send(rbit, ackChan);
52 | } or {
53 | Recv(msg, msgChan);
54 | if (msg[2] # rbit) {
55 | rbit := (rbit + 1) % 2;
56 | output := Append(output, msg[1]);
57 | };
58 | };
59 | }
60 | }; \* end Receiver process block
61 |
62 | process (LoseMsg = "L") {
63 | l: while (TRUE) {
64 | either with (i \in 1..Len(msgChan)) {
65 | msgChan := Remove(i, msgChan);
66 | } or with (i \in 1..Len(ackChan)) {
67 | ackChan := Remove(i, ackChan);
68 | };
69 | }
70 | }; \* end LoseMsg process block
71 |
72 | } \* end algorithm
73 | *)
74 | \* BEGIN TRANSLATION
75 | CONSTANT defaultInitValue
76 | VARIABLES input, output, msgChan, ackChan, newChan, next, sbit, ack, rbit,
77 | msg
78 |
79 | vars == << input, output, msgChan, ackChan, newChan, next, sbit, ack, rbit,
80 | msg >>
81 |
82 | ProcSet == {"S"} \cup {"R"} \cup {"L"}
83 |
84 | Init == (* Global variables *)
85 | /\ input = <<>>
86 | /\ output = <<>>
87 | /\ msgChan = <<>>
88 | /\ ackChan = <<>>
89 | /\ newChan = <<>>
90 | (* Process Sender *)
91 | /\ next = 1
92 | /\ sbit = 0
93 | /\ ack = defaultInitValue
94 | (* Process Receiver *)
95 | /\ rbit = 1
96 | /\ msg = defaultInitValue
97 |
98 | Sender == /\ \/ /\ \E m \in Msg:
99 | input' = Append(input, m)
100 | /\ UNCHANGED <>
101 | \/ /\ next <= Len(input)
102 | /\ msgChan' = Append(msgChan, (<>))
103 | /\ UNCHANGED <>
104 | \/ /\ ackChan # <<>>
105 | /\ ack' = Head(ackChan)
106 | /\ ackChan' = Tail(ackChan)
107 | /\ IF ack' = sbit
108 | THEN /\ next' = next + 1
109 | /\ sbit' = (sbit + 1) % 2
110 | ELSE /\ TRUE
111 | /\ UNCHANGED << next, sbit >>
112 | /\ UNCHANGED <>
113 | /\ PrintT(<<"Sender", input'>>)
114 | /\ UNCHANGED << output, newChan, rbit, msg >>
115 |
116 | Receiver == /\ \/ /\ ackChan' = Append(ackChan, rbit)
117 | /\ UNCHANGED <