Stable elections succeed: some stable election execution ends with the candidate elected
ProvedOpenSearchProgress.election_possibleFor every payload type V, cluster parameters P with P.InitCompatible and P.strategy = ElectionStrategy.DEFAULT_INSTANCE, every cluster W with Reachable P W, every node c, term t and list of node ids Q such that
cand every member ofQare cluster-manager-eligible;Qis a quorum of(W.node c).lastCommittedConfigurationand of(W.node c).lastAcceptedConfiguration;cand every member ofQare in a term belowt;- every member of
Qhas an accepted state no fresher thanc's:(W.node q).lastAcceptedTerm < (W.node c).lastAcceptedTerm, or the terms are equal and(W.node q).lastAcceptedVersionOrMetadataVersion ≤ (W.node c).lastAcceptedVersionOrMetadataVersion;
there is a cluster W' with ElectionExec P c t Q (W.node c).lastAcceptedTerm (W.node c).lastAcceptedVersion W W', (W'.node c).currentTerm = t and (W'.node c).electionWon = true.
The theorem asserts only that such an execution exists. In the proof's witness, c handles its own start-join request for t, every voter not yet in term t handles it and sends its join, and c handles every voter's join; the stable period allows each of these steps, so the premises of election_won are reached.
import Definitions.Def_OpenSearchProgress open OpenSearchCoordination OpenSearchSafety OpenSearchProgress
theorem OpenSearchProgress.election_possible {V : Type} (P : Params) (hP : P.InitCompatible)
(hes : P.strategy = ElectionStrategy.DEFAULT_INSTANCE) (W : Cluster V) (hW : Reachable P W)
(c : NodeId) (t : Nat) (Q : List NodeId) (hc : P.eligible c = true) (hQ : ∀ q ∈ Q, P.eligible q = true)
(hquorum : (W.node c).lastCommittedConfiguration.hasQuorum Q = true ∧
(W.node c).lastAcceptedConfiguration.hasQuorum Q = true)
(hterm : ∀ q, q = c ∨ q ∈ Q → (W.node q).currentTerm < t)
(hfresh : ∀ q ∈ Q, (W.node q).lastAcceptedTerm < (W.node c).lastAcceptedTerm ∨
((W.node q).lastAcceptedTerm = (W.node c).lastAcceptedTerm ∧
(W.node q).lastAcceptedVersionOrMetadataVersion ≤ (W.node c).lastAcceptedVersionOrMetadataVersion)) :
∃ W', ElectionExec P c t Q (W.node c).lastAcceptedTerm (W.node c).lastAcceptedVersion W W' ∧
(W'.node c).currentTerm = t ∧ (W'.node c).electionWon = true := 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: OpenSearchProgress.election_possible
Notions used
The full expansions are in readback_Def_OpenSearchProgress.md.
Node-state notation. For a node state :
- is the current term;
- and are the term and version of the last accepted state;
- is that state's metadata version if its term is 0, and its version otherwise;
- and are its last committed and last accepted configurations;
- is
electionWon.
means that strictly more than half of the ids of configuration occur in the list . It is false for an empty and for .
The election period is a finite, possibly empty, sequence of Steps from to , each of one of the following kinds. Here is the acting node's state.
-
bootstrap of a node outside .
-
start-join at any node , on a request from an eligible in term , where or ( and ). It succeeds iff . The node then moves to term (clearing votes, setting
startedJoinSinceLastRebootand resettingelectionWon) and sends the join . -
join: a node handles a sent join addressed to it.
handleJoinsucceeds iff:- the term matches;
- the node has started a join since its last restart;
- the join's last accepted (term, version) is not above the node's in the order "term first, then version within the same term";
- the node's is non-empty.
It then adds the source's id, if the source is flagged cluster-manager, and recomputes
electionWon. Under the default strategy the new value is "votes are a quorum of both and ". -
publish: any node handles any sent publication, except that and members of may accept only publications with key .
-
respond and commit: unrestricted.
-
restart of an eligible node outside .
-
restartAny of a non-eligible node.
There is no step that sends a new publication. In this theorem, of .
1. Declaration
The universally quantified variables and hypotheses, in order:
| Name | Type / statement |
|---|---|
V (implicit) | Type |
P | Params |
hP | |
hes | |
W | Cluster V |
hW | |
c | node id (candidate) |
t | (election term) |
Q | list of node ids (voters) |
hc | |
hQ | |
hquorum | |
hterm | |
hfresh |
Conclusion.
In words: from there is at least one stable election period for , and at whose end is in term and has won. Since , such a period contains at least 's start-join into , which is on a request whose requester is ; the guard of the period requires this. It also contains at least one successful handleJoin at after that start-join.
2. What is not constrained
- Existence only. The theorem asserts that some stable election period leads to 's victory. It does not say that every period does, or that one must. It says nothing about which steps are used, how many, in what order, or what other nodes do along the way.
- Model-relative. The existential ranges over executions of the model. In the model, a start-join needs no
StartJoinRequestmessage: any node may act on a request "from" any eligible node. TheCoordinator's own guards are not modelled. The witness execution may therefore use any steps the period admits. For example, a voter may join 's term before itself does. - No
hconfhypothesis.hquorumimplies and are non-empty, and that . hfreshis the right measure, at only.hfreshuses , exactly the measure thathandleJoincompares, and it holds at . The period's freshness bound uses . The witness may use only steps that keep the voters' joins acceptable.hcis needed. A start-join's requester must be eligible, and the period lets term be entered only on a request whose requester is .- Other nodes are unconstrained. Nodes outside are unconstrained at : any term, possibly , possibly elected in some other term.
- Implicit claim about other winners. The conclusion makes a winner of term in a cluster reachable from ; every election step is a
Step. The Safety definitions' invariant fieldInv.won_uniquesays at most one node wins each term. So the theorem implicitly asserts that its hypotheses exclude a in which another node has already won term , or has published in it. No hypothesis says so directly. It would have to follow fromhquorum,hterm(no voter has reached ),hfreshand reachability. - Vacuity. The hypotheses are satisfiable. Take eligible nodes 1 and 2, bootstrap configuration only, and the default strategy. Bootstrap both nodes with the same term-0 state (version 0, metadata version 0). Set , , . A witness period:
- node 1 start-joins on its own request for term 1;
- node 2 start-joins on node 1's request;
- node 1 handles both joins and wins.
3. Plain-language summary
Suppose a reachable cluster under the default strategy satisfies:
- the eligible candidate and the eligible voters are all below term ;
- is a majority of both of 's configurations;
- no voter's last accepted state is fresher than 's.
Then the model has a stable election period, with no competing elections and no new publications, at the end of which is in term and has won. It is an existence result. Together with election_vote_accepted and election_won it describes possible progress; it does not claim that progress is inevitable.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.