Repeated contests become exponentially unlikely once the per-round bound is below 1, even against an adaptive scheduler
ProvedOpenSearchElectionTimer.all_contested_prob_leFor all natural numbers n, K, δ, Mmin with 1 ≤ n, 1 ≤ δ and 1 ≤ Mmin, and all functions offset : Fin K → (Fin K → Fin n → Fin (2^64)) → Fin n → ℤ and bound : Fin K → (Fin K → Fin n → Fin (2^64)) → Fin n → ℕ (the offsets and bounds of round k for candidate i, given the draw X of all K rounds) such that
- every bound lies between
Mminand2^63:Mmin ≤ bound k X i ≤ 2^63for allk,Xandi; - the offsets and bounds of round
kdepend only on the draws of the earlier rounds: for allk,XandX', ifX m = X' mfor everym < k, thenoffset k X = offset k X'andbound k X = bound k X';
the number of draws X : Fin K → Fin n → Fin (2^64) such that every round is contested, ¬ Uncontested (offset k X) (bound k X) δ (X k) for every k : Fin K, divided by (2^64)^(n K), is at most contestedBound n δ Mmin ^ K.
An adversary that schedules the network, choosing deterministically when each candidate's timer of round k starts and with which bound, in reaction to everything drawn in the earlier rounds but not to the draws of round k or later, cannot make K rounds of the same n candidates (each drawing afresh in every round) all contested with probability above contestedBound n δ Mmin ^ K. That bound decreases exponentially in K when contestedBound n δ Mmin < 1 and says nothing otherwise.
import Definitions.Def_OpenSearchElectionTimer open OpenSearchPreVote OpenSearchElectionTimer
theorem OpenSearchElectionTimer.all_contested_prob_le (n K δ Mmin : Nat) (hn : 1 ≤ n) (hδ : 1 ≤ δ) (hM : 1 ≤ Mmin)
(offset : Fin K → (Fin K → Fin n → Fin (2 ^ 64)) → Fin n → Int)
(bound : Fin K → (Fin K → Fin n → Fin (2 ^ 64)) → Fin n → Nat)
(hbound : ∀ k X i, Mmin ≤ bound k X i ∧ bound k X i ≤ 2 ^ 63)
(hcausal : ∀ k X X', (∀ m : Fin K, m < k → X m = X' m) → offset k X = offset k X' ∧ bound k X = bound k X') :
((Finset.univ.filter (fun X : Fin K → Fin n → Fin (2 ^ 64) =>
∀ k, ¬ Uncontested (offset k X) (bound k X) δ (X k))).card : ℚ) / (2 ^ 64) ^ (n * K) ≤
contestedBound n δ Mmin ^ K := 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.all_contested_prob_le
Notions used
Draws and delays. A draw is an element of , read as the Java long . is if and otherwise. .
Fire times. Given , and , candidate fires at
Uncontested. . For and , its negation ("contested") holds iff and the two smallest fire times, counted with multiplicity, differ by less than .
contestedBound. . For this is .
1. Declaration
theorem OpenSearchElectionTimer.all_contested_prob_le (n K δ Mmin : Nat) (hn : 1 ≤ n) (hδ : 1 ≤ δ) (hM : 1 ≤ Mmin)
(offset : Fin K → (Fin K → Fin n → Fin (2 ^ 64)) → Fin n → Int)
(bound : Fin K → (Fin K → Fin n → Fin (2 ^ 64)) → Fin n → Nat)
(hbound : ∀ k X i, Mmin ≤ bound k X i ∧ bound k X i ≤ 2 ^ 63)
(hcausal : ∀ k X X', (∀ m : Fin K, m < k → X m = X' m) → offset k X = offset k X' ∧ bound k X = bound k X') :
((Finset.univ.filter (fun X : Fin K → Fin n → Fin (2 ^ 64) =>
∀ k, ¬ Uncontested (offset k X) (bound k X) δ (X k))).card : ℚ) / (2 ^ 64) ^ (n * K) ≤
contestedBound n δ Mmin ^ K
Binders and hypotheses, in order:
- ;
- ;
- ;
- .
- : for each round and each full draw matrix , an offset vector .
- : likewise, a bound vector .
- : for all , and , .
- : for all , and , if for every round with (numeric order on round indices), then and , as functions on . In words: round 's offsets and bounds depend on only through the draws of strictly earlier rounds.
Conclusion (in ):
Probability reading. is candidate 's draw in round , and all draws are independent and uniform on . The offsets and bounds of each round are chosen by a deterministic strategy that sees only the draws of earlier rounds. The probability that all rounds are contested is at most , with . Equivalently, the probability that none of the first rounds is uncontested is at most .
2. What is not constrained
- The strategy is arbitrary, subject only to and .
- Offsets may be any integers and may vary with and with past draws, including other candidates' past draws.
- Nothing requires rounds to be ordered in time: round 's fire times may precede round 's.
- Nothing requires offsets to relate to earlier fire times or grace periods.
- Nothing requires bounds to relate to
maxDelayor to grow with .
- What the strategy cannot do. It is deterministic. It cannot depend on the draws of round itself, so it cannot react within a round to who fired first. It cannot depend on later rounds. There is no randomness other than the draws.
- The same candidates take part in every round. Each draws a fresh value each round. No candidate can sit out a round or join later, and is fixed.
- Edge cases:
- : both sides equal . The quantifier over rounds is empty, , and .
- with : , and the left side is (a lone candidate is always uncontested).
- is necessary when . For every round is contested, so the left side is while the right side is .
- is not needed for truth. For every round is uncontested when , and .
- is needed. For , .
- Trivial regime. If the statement is trivially true. For example, with and this happens exactly when .
- Scope. The statement says nothing about what happens in an uncontested round. It does not relate "round " to the scheduler's attempt ; the docstring calls grouping timers into rounds an abstraction.
- Satisfiable, not vacuous. Constant (draw-independent) offsets and bounds satisfy .
3. Plain-language summary
Consider successive rounds of competing timers, with fresh independent uniform 64-bit draws in each round. An adversary chooses each round's offsets and bounds (bounds between and ), knowing only the draws of earlier rounds. Then the probability that every one of the rounds is contested is at most . The adversary in the statement cannot see the current round's draws, and the set of candidates is the same in every round.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.