Skip to content

Commit

Permalink
YoYo leader election algorithm (#124)
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Merz <[email protected]>
  • Loading branch information
muenchnerkindl authored Mar 4, 2024
1 parent b7d2d8c commit bbd3768
Show file tree
Hide file tree
Showing 10 changed files with 925 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Here is a list of specs included in this repository, with links to the relevant
| [RFC 3506: Voucher Transaction System](specifications/byihive) | Santhosh Raju, Cherry G. Mathew, Fransisca Andriani | | | || |
| [TLA⁺ Level Checking](specifications/LevelChecking) | Leslie Lamport | | | | | |
| [Condition-Based Consensus](specifications/cbc_max) | Thanh Hai Tran, Igor Konnov, Josef Widder | | | | | |
| [Yo-Yo Leader Election](specifications/YoYo) | Ludovic Yvoz, Stephan Merz | | | || |

## Examples Elsewhere
Here is a list of specs stored in locations outside this repository, including submodules.
Expand Down
98 changes: 98 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5007,6 +5007,104 @@
]
}
]
},
{
"path": "specifications/YoYo",
"title": "Yo-Yo Leader Election",
"description": "Algorithm due to Nicola Santoro for leader election in a connected undirected network",
"sources": ["https://research.nicola-santoro.com/DADA.html"],
"authors": [
"Ludovic Yvoz",
"Stephan Merz"
],
"tags": [],
"modules": [
{
"path": "specifications/YoYo/YoYoNoPruning.tla",
"communityDependencies": [
"UndirectedGraphs"
],
"tlaLanguageVersion": 2,
"features": [],
"models": []
},
{
"path": "specifications/YoYo/MCYoYoNoPruning.tla",
"communityDependencies": [],
"tlaLanguageVersion": 2,
"features": [],
"models": [
{
"path": "specifications/YoYo/MCYoYoNoPruning.cfg",
"runtime": "00:00:01",
"size": "small",
"mode": "exhaustive search",
"features": [
"liveness"
],
"result": "success",
"distinctStates": 60,
"totalStates": 110,
"stateDepth": 19
}
]
},
{
"path": "specifications/YoYo/YoYoPruning.tla",
"communityDependencies": [
"UndirectedGraphs"
],
"tlaLanguageVersion": 2,
"features": [],
"models": []
},
{
"path": "specifications/YoYo/MCYoYoPruning.tla",
"communityDependencies": [],
"tlaLanguageVersion": 2,
"features": [],
"models": [
{
"path": "specifications/YoYo/MCYoYoPruning.cfg",
"runtime": "00:00:01",
"size": "small",
"mode": "exhaustive search",
"features": [
"ignore deadlock",
"liveness"
],
"result": "success",
"distinctStates": 102,
"totalStates": 157,
"stateDepth": 31
}
]
},
{
"path": "specifications/YoYo/YoYoAllGraphs.tla",
"communityDependencies": [
"UndirectedGraphs"
],
"tlaLanguageVersion": 2,
"features": [],
"models": [
{
"path": "specifications/YoYo/YoYoAllGraphs.cfg",
"runtime": "00:00:02",
"size": "medium",
"mode": "exhaustive search",
"features": [
"ignore deadlock",
"liveness"
],
"result": "success",
"distinctStates": 26731,
"totalStates": 48535,
"stateDepth": 39
}
]
}
]
}
]
}
9 changes: 9 additions & 0 deletions specifications/YoYo/MCYoYoNoPruning.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SPECIFICATION Spec

INVARIANTS
TypeOK
NeighborInv

PROPERTIES
NoNewSource
Liveness
18 changes: 18 additions & 0 deletions specifications/YoYo/MCYoYoNoPruning.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--------------------------- MODULE MCYoYoNoPruning ---------------------------
EXTENDS Integers

Nodes == 1 .. 5
Edges == {{1,2}, {1,5}, {3,4}, {3,5}, {4,5}}

(*
Nodes == {2,3,4,5,7,11,12,14,20,31,41}
Edges == {{2,31}, {3,11}, {3,12}, {3,14}, {4,14}, {4,20},
{5,11}, {5,12}, {5,20}, {7,20}, {7,31},
{11,12}, {12,20}, {20,41}}
*)

VARIABLES phase, incoming, outgoing, mailbox

INSTANCE YoYoNoPruning

==============================================================================
12 changes: 12 additions & 0 deletions specifications/YoYo/MCYoYoPruning.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SPECIFICATION Spec

INVARIANTS
TypeOK
NeighborInv
FinishIffTerminated

PROPERTIES
\* NoNewSource -- fails for the small example graph
Liveness

CHECK_DEADLOCK FALSE
18 changes: 18 additions & 0 deletions specifications/YoYo/MCYoYoPruning.tla
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---------------------------- MODULE MCYoYoPruning ----------------------------
EXTENDS Integers

Nodes == 1 .. 5
Edges == {{1,2}, {1,5}, {3,4}, {3,5}, {4,5}}

(*
Nodes == {2,3,4,5,7,11,12,14,20,31,41}
Edges == {{2,31}, {3,11}, {3,12}, {3,14}, {4,14}, {4,20},
{5,11}, {5,12}, {5,20}, {7,20}, {7,31},
{11,12}, {12,20}, {20,41}}
*)

VARIABLES active, phase, incoming, outgoing, mailbox

INSTANCE YoYoPruning

==============================================================================
12 changes: 12 additions & 0 deletions specifications/YoYo/YoYoAllGraphs.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CONSTANT N = 5
SPECIFICATION Spec

INVARIANTS
TypeOK
NeighborInv
FinishIffTerminated

PROPERTIES
Liveness

CHECK_DEADLOCK FALSE
Loading

0 comments on commit bbd3768

Please sign in to comment.