Skip to content

Commit

Permalink
Add a simpler variant of the MonotonicReduction that just drops the c…
Browse files Browse the repository at this point in the history
…ommon prefix but leaves the Terms untouched.

Signed-off-by: Markus Alexander Kuppe <[email protected]>
  • Loading branch information
lemmy committed Oct 31, 2024
1 parent 2ee56ac commit b3dfc3f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tla/consensus/MCabs.tla
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,20 @@ MaxDivergence ==
\A i, j \in Servers :
Abs(Len(cLogs[i]) - Len(cLogs[j])) <= 2

MonotonicReduction ==
LET TailFrom(seq, idx) == SubSeq(seq, idx + 1, Len(seq))
\* Find the longest common prefix of all logs and drop it from all logs.
\* We realign the terms in the remaining suffixes to start at StartTerm.
commonPrefixBound == Len(LongestCommonPrefix(Range(cLogs)))
-----

TailFrom(seq, idx) ==
SubSeq(seq, idx + 1, Len(seq))

MonotonicReductionLongestCommonPrefix ==
\* Find the longest common prefix of all logs and drop it from all logs.
LET commonPrefixBound == Len(LongestCommonPrefix(Range(cLogs)))
IN [ s \in Servers |-> TailFrom(cLogs[s], commonPrefixBound) ]

MonotonicReductionLongestCommonPrefixAndTerms ==
\* Find the longest common prefix of all logs and drop it from all logs.
\* We also realign the terms in the remaining suffixes to start at StartTerm.
LET commonPrefixBound == Len(LongestCommonPrefix(Range(cLogs)))
minTerm ==
\* 3) The minimum term out of all minima.
Min({
Expand All @@ -103,6 +112,7 @@ MonotonicReduction ==
\cup {0}) : s \in Servers})
IN [ s \in Servers |->
[ i \in 1..Len(cLogs[s]) - commonPrefixBound |->
cLogs[s][i + commonPrefixBound] - minTerm ] ]
MonotonicReduction ==
MonotonicReductionLongestCommonPrefixAndTerms

====

0 comments on commit b3dfc3f

Please sign in to comment.