fact
stringlengths 6
24.9k
| type
stringclasses 4
values | library
stringclasses 77
values | imports
listlengths 0
8
| filename
stringclasses 299
values | symbolic_name
stringlengths 1
46
| docstring
stringclasses 186
values |
|---|---|---|---|---|---|---|
Proc == 1 .. N
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Proc
| null |
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Location
| null |
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
vars
| null |
guardE == (N + T + 2) \div 2
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
guardE
| null |
guardR1 == T + 1
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
guardR1
| null |
guardR2 == 2 * T + 1
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
guardR2
| null |
Init ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ Proc -> { "V0", "V1" } ]
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Init
| null |
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Init0
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0.
|
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Init1
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1.
|
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
BecomeByzantine
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction.
|
Receive(i, includeByz) ==
\/ /\ nRcvdE[i] < nSntE + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdE' = [ nRcvdE EXCEPT ![i] = nRcvdE[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdR, nByz, pc >>
\/ /\ nRcvdR[i] < nSntR + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdR' = [ nRcvdR EXCEPT ![i] = nRcvdR[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nByz, pc >>
\/ /\ UNCHANGED vars
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Receive
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction. *)
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
(* Process i receives a new message. If includeByz is TRUE, then messages from both *)
(* correct and Byzantine processes are considered. Otherwise, only messages from *)
(* correct processes are considered.
|
SendEcho(i) ==
/\ \/ pc[i] = "V1"
\/ /\ pc[i] = "V0"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "EC" ]
/\ nSntE' = nSntE + 1
/\ UNCHANGED << nSntR, nRcvdE, nRcvdR, nByz >>
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
SendEcho
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction. *)
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
(* Process i receives a new message. If includeByz is TRUE, then messages from both *)
(* correct and Byzantine processes are considered. Otherwise, only messages from *)
(* correct processes are considered. *)
Receive(i, includeByz) ==
\/ /\ nRcvdE[i] < nSntE + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdE' = [ nRcvdE EXCEPT ![i] = nRcvdE[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdR, nByz, pc >>
\/ /\ nRcvdR[i] < nSntR + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdR' = [ nRcvdR EXCEPT ![i] = nRcvdR[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nByz, pc >>
\/ /\ UNCHANGED vars
(* Process i will send an ECHO message if it proposed 1 and did not send an ECHO message.
If process i proposed 0, did not send an ECHO message but has received greater than
(N + F) / 2 ECHO messages or (F + 1) READY messages, it will also send an ECHO messages.
|
SendReady(i) ==
/\ pc[i] = "EC"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "RD" ]
/\ nSntR' = nSntR + 1
/\ UNCHANGED << nSntE, nRcvdE, nRcvdR, nByz >>
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
SendReady
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction. *)
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
(* Process i receives a new message. If includeByz is TRUE, then messages from both *)
(* correct and Byzantine processes are considered. Otherwise, only messages from *)
(* correct processes are considered. *)
Receive(i, includeByz) ==
\/ /\ nRcvdE[i] < nSntE + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdE' = [ nRcvdE EXCEPT ![i] = nRcvdE[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdR, nByz, pc >>
\/ /\ nRcvdR[i] < nSntR + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdR' = [ nRcvdR EXCEPT ![i] = nRcvdR[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nByz, pc >>
\/ /\ UNCHANGED vars
(* Process i will send an ECHO message if it proposed 1 and did not send an ECHO message.
If process i proposed 0, did not send an ECHO message but has received greater than
(N + F) / 2 ECHO messages or (F + 1) READY messages, it will also send an ECHO messages.
)
SendEcho(i) ==
/\ \/ pc[i] = "V1"
\/ /\ pc[i] = "V0"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "EC" ]
/\ nSntE' = nSntE + 1
/\ UNCHANGED << nSntR, nRcvdE, nRcvdR, nByz >>
(* If process i sent an ECHO message and has received enough ECHO or READY messages,
it will send a READY messages.
|
Decide(i) ==
/\ pc[i] = "RD"
/\ nRcvdR[i] >= guardR2
/\ pc' = [ pc EXCEPT ![i] = "AC" ]
/\ UNCHANGED << nSntE, nSntE, nSntR, nRcvdE, nRcvdR, nByz >>
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Decide
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction. *)
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
(* Process i receives a new message. If includeByz is TRUE, then messages from both *)
(* correct and Byzantine processes are considered. Otherwise, only messages from *)
(* correct processes are considered. *)
Receive(i, includeByz) ==
\/ /\ nRcvdE[i] < nSntE + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdE' = [ nRcvdE EXCEPT ![i] = nRcvdE[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdR, nByz, pc >>
\/ /\ nRcvdR[i] < nSntR + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdR' = [ nRcvdR EXCEPT ![i] = nRcvdR[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nByz, pc >>
\/ /\ UNCHANGED vars
(* Process i will send an ECHO message if it proposed 1 and did not send an ECHO message.
If process i proposed 0, did not send an ECHO message but has received greater than
(N + F) / 2 ECHO messages or (F + 1) READY messages, it will also send an ECHO messages.
)
SendEcho(i) ==
/\ \/ pc[i] = "V1"
\/ /\ pc[i] = "V0"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "EC" ]
/\ nSntE' = nSntE + 1
/\ UNCHANGED << nSntR, nRcvdE, nRcvdR, nByz >>
(* If process i sent an ECHO message and has received enough ECHO or READY messages,
it will send a READY messages.
)
SendReady(i) ==
/\ pc[i] = "EC"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "RD" ]
/\ nSntR' = nSntR + 1
/\ UNCHANGED << nSntE, nRcvdE, nRcvdR, nByz >>
(* If process has received READY messages from a majority of processes, it will accept.
|
Next ==
/\ \E self \in Proc :
\/ BecomeByzantine(self)
\/ Receive(self, TRUE)
\/ SendEcho(self)
\/ SendReady(self)
\/ Decide(self)
\/ UNCHANGED vars
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Next
| null |
Spec == Init /\ [][Next]_vars
/\ WF_vars(\E self \in Proc : \/ Receive(self, FALSE)
\/ SendEcho(self)
\/ SendReady(self)
\/ Decide(self))
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Spec
|
An encoding of the asynchronous Byzantine consensus protocol in Fig.3 [1]:
[1] Bracha, Gabriel, and Sam Toueg. "Asynchronous consensus and broadcast protocols."
Journal of the ACM (JACM) 32.4 (1985): 824-840.
Thanh Hai Tran, Igor Konnov, Josef Widder, 2016
This file is a subject to the license that is bundled together with this package and can
be found in the file LICENSE.
)
EXTENDS Naturals (*, FiniteSets *)
CONSTANTS N, T, F
VARIABLES nSntE, (* the number of ECHO, READY messages which are sent *)
nSntR,
nRcvdE, (* the number of ECHO, READY messages which are received *)
nRcvdR,
nByz, (* the number of Byzantine processes *)
pc (* program counters *)
ASSUME NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
Proc == 1 .. N
Location == { "V0", "V1", "EC", "RD", "AC", "BYZ" }
vars == << nSntE, nSntR, nRcvdE, nRcvdR, nByz, pc >>
guardE == (N + T + 2) \div 2
guardR1 == T + 1
guardR2 == 2 * T + 1
(* Some processes propose 0 and others propose 1.*)
Init ==
/\ nSntE = 0 (* Neither ECHO nor READY messages are sent. *)
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ] (* Neither ECHO nor READY messages are received. *)
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0 (* No processes are faulty. *)
/\ pc \in [ Proc -> { "V0", "V1" } ]
(* All processes propose 0. *)
Init0 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V0" ]
(* All processes propose 1. *)
Init1 ==
/\ nSntE = 0
/\ nSntR = 0
/\ nRcvdE = [ i \in Proc |-> 0 ]
/\ nRcvdR = [ i \in Proc |-> 0 ]
/\ nByz = 0
/\ pc \in [ i \in Proc |-> "V1" ]
(* If there are less than F Byzantine processes, process i becomes faulty. *)
(* We requite i to be in an initial state (V0 or V1) to not break the *)
(* message counting abstraction. *)
BecomeByzantine(i) ==
/\ nByz < F
/\ \/ pc[i] = "V1"
\/ pc[i] = "V0"
/\ nByz' = nByz + 1
/\ pc' = [ pc EXCEPT ![i] = "BYZ" ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nRcvdR >>
(* Process i receives a new message. If includeByz is TRUE, then messages from both *)
(* correct and Byzantine processes are considered. Otherwise, only messages from *)
(* correct processes are considered. *)
Receive(i, includeByz) ==
\/ /\ nRcvdE[i] < nSntE + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdE' = [ nRcvdE EXCEPT ![i] = nRcvdE[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdR, nByz, pc >>
\/ /\ nRcvdR[i] < nSntR + (IF includeByz THEN nByz ELSE 0)
/\ nRcvdR' = [ nRcvdR EXCEPT ![i] = nRcvdR[i] + 1 ]
/\ UNCHANGED << nSntE, nSntR, nRcvdE, nByz, pc >>
\/ /\ UNCHANGED vars
(* Process i will send an ECHO message if it proposed 1 and did not send an ECHO message.
If process i proposed 0, did not send an ECHO message but has received greater than
(N + F) / 2 ECHO messages or (F + 1) READY messages, it will also send an ECHO messages.
)
SendEcho(i) ==
/\ \/ pc[i] = "V1"
\/ /\ pc[i] = "V0"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "EC" ]
/\ nSntE' = nSntE + 1
/\ UNCHANGED << nSntR, nRcvdE, nRcvdR, nByz >>
(* If process i sent an ECHO message and has received enough ECHO or READY messages,
it will send a READY messages.
)
SendReady(i) ==
/\ pc[i] = "EC"
/\ \/ nRcvdE[i] >= guardE
\/ nRcvdR[i] >= guardR1
/\ pc' = [ pc EXCEPT ![i] = "RD" ]
/\ nSntR' = nSntR + 1
/\ UNCHANGED << nSntE, nRcvdE, nRcvdR, nByz >>
(* If process has received READY messages from a majority of processes, it will accept. *)
Decide(i) ==
/\ pc[i] = "RD"
/\ nRcvdR[i] >= guardR2
/\ pc' = [ pc EXCEPT ![i] = "AC" ]
/\ UNCHANGED << nSntE, nSntE, nSntR, nRcvdE, nRcvdR, nByz >>
Next ==
/\ \E self \in Proc :
\/ BecomeByzantine(self)
\/ Receive(self, TRUE)
\/ SendEcho(self)
\/ SendReady(self)
\/ Decide(self)
\/ UNCHANGED vars
(* Add weak fairness condition since we want to check liveness properties.
|
Spec0 == Init0 /\ [][Next]_vars
/\ WF_vars(\E self \in Proc : \/ Receive(self, FALSE)
\/ SendEcho(self)
\/ SendReady(self)
\/ Decide(self))
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Spec0
| null |
TypeOK ==
/\ pc \in [ Proc -> Location ]
/\ nSntE \in 0..N
/\ nSntR \in 0..N
/\ nByz \in 0..F
/\ nRcvdE \in [ Proc -> 0..(nSntE + nByz) ]
/\ nRcvdR \in [ Proc -> 0..(nSntR + nByz) ]
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
TypeOK
| null |
Unforg_Ltl ==
(\A i \in Proc : pc[i] = "V0") => []( \A i \in Proc : pc[i] # "AC" )
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Unforg_Ltl
| null |
Corr_Ltl ==
(\A i \in Proc : pc[i] = "V1") => <>( \E i \in Proc : pc[i] = "AC" )
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Corr_Ltl
| null |
Agreement_Ltl ==
[]((\E i \in Proc : pc[i] = "AC") => <>(\A i \in Proc : pc[i] = "AC" \/ pc[i] = "BYZ" ))
|
definition
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
Agreement_Ltl
| null |
NTF == N \in Nat /\ T \in Nat /\ F \in Nat /\ (N > 3 * T) /\ (T >= F) /\ (F >= 0)
|
assume
|
aba-asyn-byz
|
[
"Naturals"
] |
aba-asyn-byz/aba_asyn_byz.tla
|
NTF
| null |
TypeInvParticipantNB == participant \in [
participants -> [
vote : {yes, no},
alive : BOOLEAN,
decision : {undecided, commit, abort},
faulty : BOOLEAN,
voteSent : BOOLEAN,
forward : [ participants -> {notsent, commit, abort} ]
]
]
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
TypeInvParticipantNB
| null |
TypeInvNB == TypeInvParticipantNB /\ TypeInvCoordinator
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
TypeInvNB
| null |
InitParticipantNB == participant \in [
participants -> [
vote : {yes, no},
alive : {TRUE},
decision : {undecided},
faulty : {FALSE},
voteSent : {FALSE},
forward : [ participants -> {notsent} ]
]
]
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
InitParticipantNB
| null |
InitNB == InitParticipantNB /\ InitCoordinator
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
InitNB
| null |
forward(i,j) == /\ i # j
/\ participant[i].alive
/\ participant[i].forward[i] # notsent
/\ participant[i].forward[j] = notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.forward =
[@ EXCEPT ![j] = participant[i].forward[i]]
]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
forward
| null |
preDecideOnForward(i,j) == /\ i # j
/\ participant[i].alive
/\ participant[i].forward[i] = notsent
/\ participant[j].forward[i] # notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.forward =
[@ EXCEPT ![i] = participant[j].forward[i]]
]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
preDecideOnForward
| null |
preDecide(i) == /\ participant[i].alive
/\ participant[i].forward[i] = notsent
/\ coordinator.broadcast[i] # notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.forward =
[@ EXCEPT ![i] = coordinator.broadcast[i]]
]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
preDecide
| null |
decideNB(i) == /\ participant[i].alive
/\ \A j \in participants : participant[i].forward[j] # notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.decision = participant[i].forward[i]]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
decideNB
| null |
abortOnTimeout(i) == /\ participant[i].alive
/\ participant[i].decision = undecided
/\ ~coordinator.alive
/\ \A j \in participants : participant[j].alive => coordinator.broadcast[j] = notsent
/\ \A j,k \in participants : ~participant[j].alive /\ participant[k].alive => participant[j].forward[k] = notsent
/\ participant' = [participant EXCEPT ![i] = [@ EXCEPT !.decision = abort]]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
abortOnTimeout
| null |
parProgNB(i,j) == \/ sendVote(i)
\/ abortOnVote(i)
\/ abortOnTimeoutRequest(i)
\/ forward(i,j)
\/ preDecideOnForward(i,j)
\/ abortOnTimeout(i)
\/ preDecide(i)
\/ decideNB(i)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
parProgNB
| null |
parProgNNB == \E i,j \in participants : parDie(i) \/ parProgNB(i,j)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
parProgNNB
| null |
progNNB == parProgNNB \/ coordProgN
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
progNNB
| null |
fairnessNB == /\ \A i \in participants : WF_<<coordinator, participant>>(\E j \in participants : parProgNB(i,j))
/\ WF_<<coordinator, participant>>(coordProgB)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
fairnessNB
| null |
SpecNB == InitNB /\ [][progNNB]_<<coordinator, participant>> /\ fairnessNB
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
SpecNB
| null |
AllCommit == \A i \in participants : <>(participant[i].decision = commit \/ participant[i].faulty)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
AllCommit
| null |
AllAbort == \A i \in participants : <>(participant[i].decision = abort \/ participant[i].faulty)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
AllAbort
| null |
AllCommitYesVotes == \A i \in participants :
\A j \in participants : participant[j].vote = yes
~> participant[i].decision = commit \/ participant[i].faulty \/ coordinator.faulty
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB.tla
|
AllCommitYesVotes
| null |
Perms == Permutations(participants)
|
definition
|
acp
|
[
"TLC",
"ACP_NB"
] |
acp/ACP_NB_TLC.tla
|
Perms
| null |
AC4_alt == [][ /\ (\A i \in participants : participant[i].decision = commit
=> (participant'[i].decision = commit))
/\ (\A j \in participants : participant[j].decision = abort
=> (participant'[j].decision = abort))]_<<participant>>
|
definition
|
acp
|
[
"TLC",
"ACP_NB"
] |
acp/ACP_NB_TLC.tla
|
AC4_alt
| null |
TypeInvParticipantNB == participant \in [
participants -> [
vote : {yes, no},
alive : BOOLEAN,
decision : {undecided, commit, abort},
faulty : BOOLEAN,
voteSent : BOOLEAN,
forward : [ participants -> {notsent, commit, abort} ]
]
]
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
TypeInvParticipantNB
| null |
TypeInvNB == TypeInvParticipantNB /\ TypeInvCoordinator
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
TypeInvNB
| null |
InitParticipantNB == participant \in [
participants -> [
vote : {yes, no},
alive : {TRUE},
decision : {undecided},
faulty : {FALSE},
voteSent : {FALSE},
forward : [ participants -> {notsent} ]
]
]
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
InitParticipantNB
| null |
InitNB == InitParticipantNB /\ InitCoordinator
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
InitNB
| null |
forward(i,j) == /\ i # j
/\ participant[i].alive
/\ participant[i].decision # notsent
/\ participant[i].forward[j] = notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.forward =
[@ EXCEPT ![j] = participant[i].decision]
]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
forward
| null |
decideOnForward(i,j) == /\ i # j
/\ participant[i].alive
/\ participant[i].decision = undecided
/\ participant[j].forward[i] # notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.decision = participant[j].forward[i]]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
decideOnForward
| null |
abortOnTimeout(i) == /\ participant[i].alive
/\ participant[i].decision = undecided
/\ ~coordinator.alive
/\ \A j \in participants : participant[j].alive => coordinator.broadcast[j] = notsent
/\ \A j,k \in participants : ~participant[j].alive /\ participant[k].alive => participant[j].forward[k] = notsent
/\ participant' = [participant EXCEPT ![i] = [@ EXCEPT !.decision = abort]]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
abortOnTimeout
| null |
parProgNB(i,j) == \/ parProg(i)
\/ forward(i,j)
\/ decideOnForward(i,j)
\/ abortOnTimeout(i)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
parProgNB
| null |
parProgNNB == \E i,j \in participants : parDie(i) \/ parProgNB(i,j)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
parProgNNB
| null |
progNNB == parProgNNB \/ coordProgN
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
progNNB
| null |
fairnessNB == /\ \A i \in participants : WF_<<coordinator, participant>>(\E j \in participants : parProgNB(i,j))
/\ WF_<<coordinator, participant>>(coordProgB)
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
fairnessNB
| null |
SpecNB == InitNB /\ [][progNNB]_<<coordinator, participant>> /\ fairnessNB
|
definition
|
acp
|
[
"ACP_SB"
] |
acp/ACP_NB_WRONG_TLC.tla
|
SpecNB
| null |
TypeInvParticipant == participant \in [
participants -> [
vote : {yes, no},
alive : BOOLEAN,
decision : {undecided, commit, abort},
faulty : BOOLEAN,
voteSent : BOOLEAN
]
]
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
TypeInvParticipant
| null |
TypeInvCoordinator == coordinator \in [
request : [participants -> BOOLEAN],
vote : [participants -> {waiting, yes, no}],
broadcast : [participants -> {commit, abort, notsent}],
decision : {commit, abort, undecided},
alive : BOOLEAN,
faulty : BOOLEAN
]
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
TypeInvCoordinator
| null |
TypeInv == TypeInvParticipant /\ TypeInvCoordinator
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
TypeInv
| null |
InitParticipant == participant \in [
participants -> [
vote : {yes, no},
alive : {TRUE},
decision : {undecided},
faulty : {FALSE},
voteSent : {FALSE}
]
]
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
InitParticipant
| null |
InitCoordinator == coordinator \in [
request : [participants -> {FALSE}],
vote : [participants -> {waiting}],
alive : {TRUE},
broadcast : [participants -> {notsent}],
decision : {undecided},
faulty : {FALSE}
]
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
InitCoordinator
| null |
Init == InitParticipant /\ InitCoordinator
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
Init
| null |
request(i) == /\ coordinator.alive
/\ ~coordinator.request[i]
/\ coordinator' = [coordinator EXCEPT !.request =
[@ EXCEPT ![i] = TRUE]
]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
request
| null |
getVote(i) == /\ coordinator.alive
/\ coordinator.decision = undecided
/\ \A j \in participants : coordinator.request[j]
/\ coordinator.vote[i] = waiting
/\ participant[i].voteSent
/\ coordinator' = [coordinator EXCEPT !.vote =
[@ EXCEPT ![i] = participant[i].vote]
]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
getVote
| null |
detectFault(i) == /\ coordinator.alive
/\ coordinator.decision = undecided
/\ \A j \in participants : coordinator.request[j]
/\ coordinator.vote[i] = waiting
/\ ~participant[i].alive
/\ ~participant[i].voteSent
/\ coordinator' = [coordinator EXCEPT !.decision = abort]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
detectFault
| null |
makeDecision == /\ coordinator.alive
/\ coordinator.decision = undecided
/\ \A j \in participants : coordinator.vote[j] \in {yes, no}
/\ \/ /\ \A j \in participants : coordinator.vote[j] = yes
/\ coordinator' = [coordinator EXCEPT !.decision = commit]
\/ /\ \E j \in participants : coordinator.vote[j] = no
/\ coordinator' = [coordinator EXCEPT !.decision = abort]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
makeDecision
| null |
coordBroadcast(i) == /\ coordinator.alive
/\ coordinator.decision # undecided
/\ coordinator.broadcast[i] = notsent
/\ coordinator' = [coordinator EXCEPT !.broadcast =
[@ EXCEPT ![i] = coordinator.decision]
]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
coordBroadcast
| null |
coordDie == /\ coordinator.alive
/\ coordinator' = [coordinator EXCEPT !.alive = FALSE, !.faulty = TRUE]
/\ UNCHANGED<<participant>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
coordDie
| null |
sendVote(i) == /\ participant[i].alive
/\ coordinator.request[i]
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.voteSent = TRUE]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
sendVote
| null |
abortOnVote(i) == /\ participant[i].alive
/\ participant[i].decision = undecided
/\ participant[i].voteSent
/\ participant[i].vote = no
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.decision = abort]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
abortOnVote
| null |
abortOnTimeoutRequest(i) == /\ participant[i].alive
/\ participant[i].decision = undecided
/\ ~coordinator.alive
/\ ~coordinator.request[i]
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.decision = abort]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
abortOnTimeoutRequest
| null |
decide(i) == /\ participant[i].alive
/\ participant[i].decision = undecided
/\ coordinator.broadcast[i] # notsent
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.decision = coordinator.broadcast[i]]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
decide
| null |
parDie(i) == /\ participant[i].alive
/\ participant' = [participant EXCEPT ![i] =
[@ EXCEPT !.alive = FALSE, !.faulty = TRUE]
]
/\ UNCHANGED<<coordinator>>
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
parDie
| null |
parProg(i) == sendVote(i) \/ abortOnVote(i) \/ abortOnTimeoutRequest(i) \/ decide(i)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
parProg
| null |
parProgN == \E i \in participants : parDie(i) \/ parProg(i)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
parProgN
| null |
coordProgA(i) == request(i) \/ getVote(i) \/ detectFault(i) \/ coordBroadcast(i)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
coordProgA
| null |
coordProgB == makeDecision \/ \E i \in participants : coordProgA(i)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
coordProgB
| null |
coordProgN == coordDie \/ coordProgB
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
coordProgN
| null |
progN == parProgN \/ coordProgN
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
progN
| null |
fairness == /\ \A i \in participants : WF_<<coordinator, participant>>(parProg(i))
/\ WF_<<coordinator, participant>>(coordProgB)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
fairness
| null |
Spec == Init /\ [][progN]_<<coordinator, participant>> /\ fairness
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
Spec
| null |
AC1 == [] \A i, j \in participants :
\/ participant[i].decision # commit
\/ participant[j].decision # abort
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC1
| null |
AC2 == [] ( (\E i \in participants : participant[i].decision = commit)
=> (\A j \in participants : participant[j].vote = yes))
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC2
| null |
AC3_1 == [] ( (\E i \in participants : participant[i].decision = abort)
=> \/ (\E j \in participants : participant[j].vote = no)
\/ (\E j \in participants : participant[j].faulty)
\/ coordinator.faulty)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC3_1
| null |
AC4 == [] /\ (\A i \in participants : participant[i].decision = commit
=> [](participant[i].decision = commit))
/\ (\A j \in participants : participant[j].decision = abort
=> [](participant[j].decision = abort))
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC4
| null |
AC3_2 == <> \/ \A i \in participants : participant[i].decision \in {abort, commit}
\/ \E j \in participants : participant[j].faulty
\/ coordinator.faulty
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC3_2
| null |
FaultyStable == /\ \A i \in participants : [](participant[i].faulty => []participant[i].faulty)
/\ [](coordinator.faulty => [] coordinator.faulty)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
FaultyStable
| null |
VoteStable == \A i \in participants :
\/ [](participant[i].vote = yes)
\/ [](participant[i].vote = no)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
VoteStable
| null |
StrongerAC2 == [] ( (\E i \in participants : participant[i].decision = commit)
=> /\ (\A j \in participants : participant[j].vote = yes)
/\ coordinator.decision = commit)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
StrongerAC2
| null |
StrongerAC3_1 == [] ( (\E i \in participants : participant[i].decision = abort)
=> \/ (\E j \in participants : participant[j].vote = no)
\/ /\ \E j \in participants : participant[j].faulty
/\ coordinator.decision = abort
\/ /\ coordinator.faulty
/\ coordinator.decision = undecided)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
StrongerAC3_1
| null |
NoRecovery == [] /\ \A i \in participants : participant[i].alive <=> ~participant[i].faulty
/\ coordinator.alive <=> ~coordinator.faulty
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
NoRecovery
| null |
DecisionReachedNoFault == (\A i \in participants : participant[i].alive)
~> (\A k \in participants : participant[k].decision # undecided)
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
DecisionReachedNoFault
| null |
AbortImpliesNoVote == [] ( (\E i \in participants : participant[i].decision = abort)
=> (\E j \in participants : participant[j].vote = no))
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AbortImpliesNoVote
| null |
AC5 == <> \A i \in participants : \/ participant[i].decision \in {abort, commit}
\/ participant[i].faulty
|
definition
|
acp
|
[] |
acp/ACP_SB.tla
|
AC5
| null |
Perms == Permutations(participants)
|
definition
|
acp
|
[
"ACP_SB",
"TLC"
] |
acp/ACP_SB_TLC.tla
|
Perms
| null |
AC4_alt == [][ /\ (\A i \in participants : participant[i].decision = commit
=> (participant'[i].decision = commit))
/\ (\A j \in participants : participant[j].decision = abort
=> (participant'[j].decision = abort))]_<<participant>>
|
definition
|
acp
|
[
"ACP_SB",
"TLC"
] |
acp/ACP_SB_TLC.tla
|
AC4_alt
| null |
Sched == INSTANCE SchedulingAllocator
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
Sched
| null |
Messages ==
[type : {"request", "allocate", "return"},
clt : Clients,
rsrc : SUBSET Resources]
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
Messages
| null |
TypeInvariant ==
/\ Sched!TypeInvariant
/\ requests \in [Clients -> SUBSET Resources]
/\ holding \in [Clients -> SUBSET Resources]
/\ network \in SUBSET Messages
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
TypeInvariant
| null |
Init ==
/\ Sched!Init
/\ requests = [c \in Clients |-> {}]
/\ holding = [c \in Clients |-> {}]
/\ network = {}
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
Init
| null |
Request(c,S) ==
/\ requests[c] = {} /\ holding[c] = {}
/\ S # {} /\ requests' = [requests EXCEPT ![c] = S]
/\ network' = network \cup {[type |-> "request", clt |-> c, rsrc |-> S]}
/\ UNCHANGED <<unsat,alloc,sched,holding>>
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
Request
| null |
RReq(m) ==
/\ m \in network /\ m.type = "request"
/\ alloc[m.clt] = {}
/\ unsat' = [unsat EXCEPT ![m.clt] = m.rsrc]
/\ network' = network \ {m}
/\ UNCHANGED <<alloc,sched,requests,holding>>
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
RReq
| null |
Allocate(c,S) ==
/\ Sched!Allocate(c,S)
/\ network' = network \cup {[type |-> "allocate", clt |-> c, rsrc |-> S]}
/\ UNCHANGED <<requests,holding>>
|
definition
|
allocator
|
[
"Naturals",
"FiniteSets",
"Sequences"
] |
allocator/AllocatorImplementation.tla
|
Allocate
| null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.