Every election attempt waits between one millisecond and its bound, after the grace period
ProvedOpenSearchPreVote.attemptDelay_boundsFor valid scheduler settings s (s.Valid), every attempt number k, every drawn random number r (any integer) and every grace period g: 1 ≤ maxDelay s k, and g + 1 ≤ attemptDelay s k r g ≤ g + maxDelay s k. With maxDelay s k = min(maxTimeout, initialTimeout + k · backoffTime) and attemptDelay s k r g = (nonNegative r mod maxDelay s k) + 1 + g, this is the range (0, maxDelay] of the scheduler's documentation (ESF:71-83) shifted by the grace period, and the assertion 0 < upperBound of toPositiveLongAtMost (ESF:170) always holds.
import Definitions.Def_OpenSearchPreVote open OpenSearchCoordination OpenSearchPreVote
theorem OpenSearchPreVote.attemptDelay_bounds (s : SchedulerSettings) (hs : s.Valid) (k : Nat) (r : Int)
(g : Nat) :
1 ≤ maxDelay s k ∧ g + 1 ≤ attemptDelay s k r g ∧ attemptDelay s k r g ≤ g + maxDelay s 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: OpenSearchPreVote.attemptDelay_bounds
Notions used
Scheduler settings. A settings value is four natural numbers: , , and . The docstring says these are milliseconds. is the conjunction:
- ;
- ;
- ;
- ;
- .
Delay bound and delay.
- , in natural-number arithmetic.
- is if and otherwise, for any integer .
- , with natural-number ; when the returns its dividend.
- .
1. Declaration
Binders and hypothesis.
- : scheduler settings;
- : ;
- : the attempt index;
- : the random number;
- : the grace period.
Conclusion.
Unfolded, with :
- ;
- .
2. What is not constrained
- The random number. is any integer, including integers outside Java's long range. There, is just the absolute value.
- The grace period. is any natural number. It is not tied to or to , although the definition's docstring says those are the values Java uses.
- The attempt index. is any natural number.
- Which parts of matter. As far as I can see, only and (from ) are needed. Together they give , and the delay bounds follow from . The other bounds of , and , play no role.
- Why the hypothesis matters. Without , can be , for example with initialTimeout and backoffTime . Then the first conjunct fails, and degenerates to .
- What is not stated. Nothing is said about the distribution of the delay, about which values in are attained, or about the relation between successive attempts.
- Vacuity. None. is satisfiable, for example by the defaults .
3. Plain-language summary
For valid scheduler settings, the delay bound of every attempt is at least . The delay of every attempt lies between and plus that bound, whatever the random number and whatever the grace period .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.