Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The default maximum timeout: three candidates, every bound at 10 s, and a 100 ms margin

Proved
OpenSearchElectionTimer.default_example

by pitimespi · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

cluster-coordinationconsensuselasticsearchelection-schedulerformal-verificationleader-electionlivenessmathlibopensearchprobabilityrandomized-timeoutunion-bound

contestedBound 3 100 10000 < 6 / 100 and contestedBound 3 100 10000 ^ 5 < 1 / 1000000.

With every bound at OpenSearch's default cluster.election.max_timeout of 10 seconds (Mmin = 10000 milliseconds; with the default initial timeout and back-off time of 100 ms, every attempt from attempt 99 on, counting from 0, has reached it), three competing candidates and a margin of δ = 100 milliseconds, contested_prob_le bounds the probability of a contested round by contestedBound 3 100 10000 = 597 · 922337203685478 / 2^63 ≈ 0.0597, below 6%, and all_contested_prob_le bounds the probability that five consecutive rounds are contested by its fifth power, about 7.6 · 10^-7, below one in a million. The theorem itself is arithmetic on these literals. The margin of 100 ms is an illustrative choice: nothing in the model shows that it suffices for a pre-voting round and an election to complete. For earlier attempts, whose bounds are smaller, the bound is weaker: for three candidates and a 100 ms margin it is at least 1, saying nothing, whenever the smallest competing bound is at most 597 ms. The theorem itself is arithmetic on these literals. The margin of 100 ms is an illustrative choice: nothing in the model shows that it suffices for a pre-voting round and an election to complete. For earlier attempts, whose bounds are smaller, the bound is weaker: for three candidates and a 100 ms margin it is at least 1, saying nothing, whenever the smallest competing bound is at most 597 ms.

Preamble
import Definitions.Def_OpenSearchElectionTimer
open OpenSearchPreVote OpenSearchElectionTimer
Formal statement
theorem OpenSearchElectionTimer.default_example :
    contestedBound 3 100 10000 < 6 / 100 ∧ contestedBound 3 100 10000 ^ 5 < 1 / 1000000 := by sorry
Source
OpenSearch b2a54ba5c0defba3d1d20423e911d4bf920bab19: ElectionSchedulerFactory (documented delay distribution lines 71-83, settings 85-115, constructor 124-144, nonNegative 159-161, toPositiveLongAtMost 163-172, scheduleNextElection 195-241 with the bound at 203, the delay at 204 and the next attempt scheduled with the election duration as grace period at 218): https://github.com/opensearch-project/OpenSearch/blob/b2a54ba5c0defba3d1d20423e911d4bf920bab19/server/src/main/java/org/opensearch/cluster/coordination/ElectionSchedulerFactory.java#L62-L254; Coordinator (the scheduler built over the node's Random lines 262-263, the scheduler started after bootstrapping at 1158 and when a candidate has found a quorum of peers 1534-1550, startElectionScheduler 1567-1618 with grace period 0 at 1574, the same Random used to choose a node to abdicate to at 1818): https://github.com/opensearch-project/OpenSearch/blob/b2a54ba5c0defba3d1d20423e911d4bf920bab19/server/src/main/java/org/opensearch/cluster/coordination/Coordinator.java; DiscoveryModule (each node's Random created as new Random(Randomness.get().nextLong()), line 213): https://github.com/opensearch-project/OpenSearch/blob/b2a54ba5c0defba3d1d20423e911d4bf920bab19/server/src/main/java/org/opensearch/discovery/DiscoveryModule.java#L213; java.util.Random (a 48-bit linear congruential generator; nextLong): https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Random.html; maxDelay, nonNegative and toPositiveLongAtMost as transcribed by the OpenSearchPreVote mission
Read-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.default_example

Notions used

contestedBound.

contestedBound(n,δ,Mmin⁡)=(n2) (2δ−˙1) ⌊(263+Mmin⁡−1)/Mmin⁡⌋263∈Q,\mathrm{contestedBound}(n, \delta, M_{\min}) = \frac{\binom{n}{2}\,(2\delta \mathbin{\dot-} 1)\,\lfloor (2^{63} + M_{\min} - 1)/M_{\min}\rfloor}{2^{63}} \in \mathbb{Q},contestedBound(n,δ,Mmin​)=263(2n​)(2δ−˙​1)⌊(263+Mmin​−1)/Mmin​⌋​∈Q,

with truncated natural subtraction and natural floor division, cast to Q\mathbb{Q}Q. For δ,Mmin⁡≥1\delta, M_{\min} \ge 1δ,Mmin​≥1 this is (n2)(2δ−1)⌈263/Mmin⁡⌉/263\binom{n}{2}(2\delta-1)\lceil 2^{63}/M_{\min}\rceil / 2^{63}(2n​)(2δ−1)⌈263/Mmin​⌉/263.

Related theorems. Under hypotheses, contested_prob_le shows this number bounds the probability that one round of nnn timers is contested with margin δ\deltaδ, when every bound is at least Mmin⁡M_{\min}Mmin​. all_contested_prob_le shows that its KKK-th power bounds the probability that KKK causally chosen rounds are all contested. The present theorem does not invoke either of them.

1. Declaration

theorem OpenSearchElectionTimer.default_example :
    contestedBound 3 100 10000 < 6 / 100 ∧ contestedBound 3 100 10000 ^ 5 < 1 / 1000000

Binders and hypotheses: none.

Conclusion (in Q\mathbb{Q}Q). Because contestedBound returns Q\mathbb{Q}Q, the numerals 6 / 100 and 1 / 1000000 are rational divisions, not natural-number divisions (which would give 000). The theorem asserts

contestedBound(3,100,10000)<6100  ∧  contestedBound(3,100,10000)5<11000000.\mathrm{contestedBound}(3, 100, 10000) < \tfrac{6}{100} \;\wedge\; \mathrm{contestedBound}(3, 100, 10000)^5 < \tfrac{1}{1000000}.contestedBound(3,100,10000)<1006​∧contestedBound(3,100,10000)5<10000001​.

Unfolded:

contestedBound(3,100,10000)=3⋅199⋅⌊(263+9999)/10000⌋263=597⋅922337203685478263=275317655300115183262≈0.0597000000000000271.\mathrm{contestedBound}(3, 100, 10000) = \frac{3 \cdot 199 \cdot \lfloor (2^{63} + 9999)/10000\rfloor}{2^{63}} = \frac{597 \cdot 922337203685478}{2^{63}} = \frac{275317655300115183}{2^{62}} \approx 0.0597000000000000271 .contestedBound(3,100,10000)=2633⋅199⋅⌊(263+9999)/10000⌋​=263597⋅922337203685478​=262275317655300115183​≈0.0597000000000000271.

Here ⌈263/10000⌉=922337203685478\lceil 2^{63}/10000\rceil = 922337203685478⌈263/10000⌉=922337203685478, since 263 mod 10000=58082^{63} \bmod 10000 = 5808263mod10000=5808. The fifth power is ≈7.5835×10−7\approx 7.5835 \times 10^{-7}≈7.5835×10−7. I checked both conjuncts with exact rational arithmetic: the margins are 0.06−0.0597…≈3.0×10−40.06 - 0.0597\ldots \approx 3.0 \times 10^{-4}0.06−0.0597…≈3.0×10−4 and 10−6−7.58…×10−7≈2.4×10−710^{-6} - 7.58\ldots \times 10^{-7} \approx 2.4 \times 10^{-7}10−6−7.58…×10−7≈2.4×10−7.

2. What is not constrained

  • Pure arithmetic. The statement is about specific numbers. It involves no draws, no probability, no offsets, no bounds and no scheduler.
  • The parameters are literals.
    • n=3n = 3n=3: candidates.
    • δ=100\delta = 100δ=100: the margin.
    • Mmin⁡=10000M_{\min} = 10000Mmin​=10000: the minimum bound.
    • 555: the number of rounds, if read through all_contested_prob_le with K=5K = 5K=5.
  • No link to the default settings in Lean. 100001000010000 coincides with SchedulerSettings.default.maxTimeout, but the statement does not mention SchedulerSettings.default or maxDelay. With the default settings, maxDelay(default,k)=min⁡(10000, 100+100k)\mathrm{maxDelay}(\mathrm{default}, k) = \min(10000,\ 100 + 100k)maxDelay(default,k)=min(10000, 100+100k) reaches 100001000010000 only from attempt index k=99k = 99k=99 (the 100th attempt). Applying contested_prob_le with Mmin⁡=10000M_{\min} = 10000Mmin​=10000 requires every bound in the round to be at least 100001000010000. For earlier attempts the same nnn and δ\deltaδ give weaker or trivial bounds: contestedBound(3,100,1000)≈0.597\mathrm{contestedBound}(3, 100, 1000) \approx 0.597contestedBound(3,100,1000)≈0.597, and contestedBound(3,100,100)=5.97\mathrm{contestedBound}(3, 100, 100) = 5.97contestedBound(3,100,100)=5.97, which is vacuous as a probability bound. The value is at least 111 exactly when 1≤Mmin⁡≤5971 \le M_{\min} \le 5971≤Mmin​≤597.
  • δ=100\delta = 100δ=100 is not justified by any Lean term. Nothing shows that a 100 ms margin lets an uncontested candidate's pre-voting round and election finish before the others start.
  • The name overstates the content. "default_example" suggests the default configuration. The Lean statement only establishes the two numerical inequalities.
  • No hypotheses, so nothing is vacuous. The statement is a closed numerical claim and, by my computation, true.

3. Plain-language summary

For 3 candidates, a margin of 100 and a minimum bound of 10000, the per-round contested bound contestedBound\mathrm{contestedBound}contestedBound is about 5.97%5.97\%5.97%, below 6%6\%6%. Its fifth power is about 7.6×10−77.6 \times 10^{-7}7.6×10−7, below one in a million. Only when combined with contested_prob_le and all_contested_prob_le (not by this theorem itself) do these numbers bound the chance of a contested round, or of five consecutive contested rounds, and only for rounds in which every candidate's bound is at least 10000.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by pitimespi · Nov 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me