Generalized election-timer round: fire times and uncontested rounds for arbitrary delays
DefinitionOpenSearchLivenessAbstractcluster-coordinationconsensusformal-verificationlivenessopensearchzen2
For a round of an election-timer competition, each candidate has an integer offset and a delay function over all draws. The fire time of candidate on draw is its offset plus its delay for . A round is uncontested with margin when some candidate fires at least before every other candidate.
Definition code
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Finset.Card
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Card
import Mathlib.Logic.Equiv.Prod
import Mathlib.Order.Interval.Finset.Basic
import Mathlib.Tactic
namespace OpenSearchLivenessAbstract
/-- Fire time of candidate `i`: its offset plus its delay for draw `x i`. -/
def fireTime {n : Nat} (offset : Fin n → Int) (delay : Fin n → Fin (2 ^ 64) → Int)
(x : Fin n → Fin (2 ^ 64)) (i : Fin n) : Int :=
offset i + delay i (x i)
/-- A round is uncontested with margin `δ`: some candidate fires at least `δ`
before every other candidate. -/
def Uncontested {n : Nat} (offset : Fin n → Int) (delay : Fin n → Fin (2 ^ 64) → Int)
(δ : Nat) (x : Fin n → Fin (2 ^ 64)) : Prop :=
∃ i, ∀ j, j ≠ i → fireTime offset delay x i + δ ≤ fireTime offset delay x j
instance {n : Nat} (offset : Fin n → Int) (delay : Fin n → Fin (2 ^ 64) → Int)
(δ : Nat) : DecidablePred (Uncontested offset delay δ) := fun x => by
unfold Uncontested; infer_instance
end OpenSearchLivenessAbstract
Source
OpenSearch cluster coordination, pinned revision b2a54ba5c0defba3d1d20423e911d4bf920bab19 (org.opensearch.cluster.coordination); liveness/timer gap-closure analysis, new theorems mechanized from the branch's OpenSearchCoordination/OpenSearchPreVote/OpenSearchSafety/OpenSearchProgress missions.