handleStartJoin re-establishes invariant()
ProvedOpenSearchCoordination.handleStartJoin_javaInvariantFor every election strategy es and coordination state cs with cs.lastAcceptedTerm ≤ cs.currentTerm (nothing else is assumed): if cs.handleStartJoin r = .ok (cs', j) then cs'.javaInvariant es. Moving to a higher term discards the votes and the election, which makes the last four assertions of invariant() hold whatever held before; the first, assumed of cs, survives because the current term grows and the accepted state is unchanged.
import Definitions.Def_OpenSearchCoordination
theorem OpenSearchCoordination.handleStartJoin_javaInvariant {V : Type} (es : ElectionStrategy) (cs : CoordinationState V) (r : StartJoinRequest)
(cs' : CoordinationState V) (j : Join) (hcs : cs.lastAcceptedTerm ≤ cs.currentTerm)
(h : cs.handleStartJoin r = .ok (cs', j)) : cs'.javaInvariant es := 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: OpenSearchCoordination.handleStartJoin_javaInvariant
Notions used
Coordination states. A coordination state has nine fields:
- ;
- ;
- , a cluster state with a term, a version, last committed and last accepted configurations, and other fields;
- and , vote collections (lists of ids);
- and ;
- ;
- .
Abbreviations, all read from the accepted state:
- : its term;
- : its version;
- : its metadata version if the term is , otherwise its version;
- and : its two configurations.
Quorums.
- is the strict-majority test. It is false whenever is empty.
- An election strategy is an arbitrary Boolean function .
- .
The Java invariant. is the conjunction of:
- (i) ;
- (ii) ;
- (iii) if , then ; otherwise ;
- (iv) ;
- (v) is empty .
The handler. fails if . Otherwise it returns updated as follows:
- ;
- ;
- ;
- ;
- ;
- and .
The accepted state and the local node are unchanged. The handler also returns a join.
1. Declaration
Binders.
- (implicit);
- : an election strategy;
- : a coordination state;
- : a start-join request;
- : a coordination state;
- : a join.
Hypotheses, in order.
- : ;
- : .
Conclusion. . Unfolded with the handler's result:
- (i) . This follows from and .
- (ii) . The right side is false.
- (iii) .
- (iv) This holds vacuously.
- (v) The publish votes are empty.
2. What is not constrained
- need not satisfy the Java invariant. Only conjunct (i) is assumed, as . The other four conjuncts are re-established by the reset, whatever 's votes, flags and published version were.
- is arbitrary. No monotonicity is needed.
- and are constrained only through . The request's source node is arbitrary.
- Not vacuous. The hypotheses are satisfiable: any with and any with a larger term work.
3. Plain-language summary
A successful start-join, applied to any state whose last-accepted term is at most its current term, produces a state that satisfies all five Java invariant assertions, for every election strategy. This works because start-join clears the votes, resets the won flag and published version, and moves to a strictly larger term.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.