A round of competing timers is contested with probability at most contestedBound n δ Mmin
ProvedOpenSearchElectionTimer.contested_prob_leFor all natural numbers n, δ, Mmin with 1 ≤ n, 1 ≤ δ and 1 ≤ Mmin, every offset : Fin n → ℤ and every bound : Fin n → ℕ with Mmin ≤ bound i ≤ 2^63 for every i: the number of draws x : Fin n → Fin (2^64) with ¬ Uncontested offset bound δ x, divided by (2^64)^n, is at most contestedBound n δ Mmin = C(n, 2) · (2δ − 1) · ⌈2^63 / Mmin⌉ / 2^63.
Among n candidates with arbitrary offsets and bounds at least Mmin, the probability that no candidate fires at least δ before all the others is at most about C(n, 2) · (2δ − 1) / Mmin. In a contested round the first candidate to fire has a follower less than δ behind it, and the bound is C(n, 2) times that of close_pair_prob, a union bound over the pairs. It exceeds 1, and then says nothing, when C(n, 2) · (2δ − 1) exceeds about Mmin: for δ = 100 and Mmin = 10000, from n = 11 candidates on.
import Definitions.Def_OpenSearchElectionTimer open OpenSearchPreVote OpenSearchElectionTimer
theorem OpenSearchElectionTimer.contested_prob_le (n δ Mmin : Nat) (hn : 1 ≤ n) (hδ : 1 ≤ δ) (hM : 1 ≤ Mmin)
(offset : Fin n → Int) (bound : Fin n → Nat) (hbound : ∀ i, Mmin ≤ bound i ∧ bound i ≤ 2 ^ 63) :
((Finset.univ.filter (fun x => ¬ Uncontested offset bound δ x)).card : ℚ) / (2 ^ 64) ^ n ≤
contestedBound n δ Mmin := by sorryRead-back
What the Lean code literally says, in plain math · claude-opus-5-5 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: OpenSearchElectionTimer.contested_prob_le
Notions used
Draws and delays. A draw is an element of , read as the Java long . is if and otherwise. , a natural number, which lies in for .
Fire times. Let , and a draw vector . Candidate fires at
Uncontested.
(in ). Its negation is
For and , the negation holds iff and the two smallest fire times, counted with multiplicity, differ by less than (ties included). For , every draw is uncontested.
contestedBound.
with natural-number truncated subtraction and floor division (where ). For this is .
1. Declaration
theorem OpenSearchElectionTimer.contested_prob_le (n δ Mmin : Nat) (hn : 1 ≤ n) (hδ : 1 ≤ δ) (hM : 1 ≤ Mmin)
(offset : Fin n → Int) (bound : Fin n → Nat) (hbound : ∀ i, Mmin ≤ bound i ∧ bound i ≤ 2 ^ 63) :
((Finset.univ.filter (fun x => ¬ Uncontested offset bound δ x)).card : ℚ) / (2 ^ 64) ^ n ≤
contestedBound n δ Mmin
Binders and hypotheses, in order:
- ;
- ;
- ;
- ;
- ;
- ;
- .
Conclusion (in ). Here ranges over all functions :
Probability reading. The draws are independent and uniform on . The probability that no candidate fires at least before all the others is at most , approximately .
2. What is not constrained
- Offsets are arbitrary integers, fixed independently of the draws. They need not be ordered, distinct or non-negative.
- Bounds may differ between candidates. Each must lie in , and nothing ties them to
maxDelayor to anySchedulerSettings. - . Both sides are : a single candidate is always uncontested and . The statement holds but says nothing.
- is necessary. For the single (empty) draw vector is contested, because
Uncontestedneeds a witness. The left side would be and the right side . - is not needed for truth. For , every draw is uncontested when (a minimizer is a witness), so the left side is . The right side is also .
- is needed. For the right side is .
- The upper half of () appears not to be needed for truth. With a bound above , each delay value comes from at most of the draws, and .
- Trivial regime. The right side can be , which makes the statement trivially true. For example, with and this happens exactly when .
- Scope. This is a single round. The statement does not say that an uncontested round leads to a successful election, and is a free parameter not tied to any latency or election duration.
- Satisfiable, not vacuous. For example , , constant offsets, and .
3. Plain-language summary
Consider one round of competing election timers with arbitrary fixed offsets, bounds between and , and independent uniform 64-bit draws. The probability that no candidate fires at least ahead of every other is at most . That is times the right-hand side of close_pair_prob.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.