Skip to content

Commit

Permalink
Ensure duplicate names cannot be seen by any individual node
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamrhay committed Jan 17, 2024
1 parent 9323bb4 commit 033bb28
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions syn.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Symmetry

INVARIANTS
AllRegistered
ThereCanBeOnlyOne

PROPERTIES
AllMessagesProcessed
14 changes: 14 additions & 0 deletions syn.tla
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,20 @@ AllRegistered ==
\A n \in Nodes:
(\A o \in Nodes: Len(inbox[o]) = 0) /\ visible_nodes[n] = AllOtherNodes(n) => AllRegisteredForNode(locally_registered[n]) = registered

RECURSIVE Duplicates(_, _, _)

Duplicates(keys, struct, acc) ==
IF Cardinality(keys) < 2 THEN acc
ELSE
LET k1 == CHOOSE k \in keys: TRUE
k2 == CHOOSE k \in (keys \ {k1}): TRUE
duplicates == DOMAIN struct[k1] \intersect DOMAIN struct[k2]
IN Duplicates(keys \ {k1}, struct, duplicates \union acc)

ThereCanBeOnlyOne ==
\A n \in Nodes:
Duplicates(DOMAIN locally_registered[n], locally_registered[n], {}) = {}

AllMessagesProcessed ==
\A n \in Nodes:
<>(Len(inbox[n]) = 0)
Expand Down

0 comments on commit 033bb28

Please sign in to comment.