invariant() is not preserved by handlePublishRequest in isolation
ProvedOpenSearchCoordination.javaInvariant_not_localThere exist a coordination state cs and a publish request p (payload type Unit) such that cs satisfies javaInvariant for the default election strategy, cs.handlePublishRequest p succeeds with some state cs' and response, and cs' does not satisfy javaInvariant for the default strategy.
In the witness, node 0 is in term 1 with an accepted term-0 state whose configurations are {1, 2, 3}; it holds a join vote of node 4 and has not won an election. It accepts a term-1 state whose configurations are {4}; its join votes are then an election quorum while electionWon is false. Whether invariant() holds along an execution therefore depends on what the other nodes did: it is a property of the cluster, which the OpenSearchSafety mission proves at every cluster-manager-eligible node of its cluster model, assuming compatible bootstrap configurations and the default election strategy (OpenSearchSafety.javaInvariant_reachable).
import Definitions.Def_OpenSearchCoordination
theorem OpenSearchCoordination.javaInvariant_not_local :
∃ (cs : CoordinationState Unit) (p : PublishRequest Unit) (cs' : CoordinationState Unit) (r : PublishResponse),
cs.javaInvariant ElectionStrategy.DEFAULT_INSTANCE ∧ cs.handlePublishRequest p = .ok (cs', r) ∧
¬ cs'.javaInvariant ElectionStrategy.DEFAULT_INSTANCE := 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.javaInvariant_not_local
Notions used
Coordination states over Unit. In this statement the payload type is Unit, so the cluster states' "everything else" field carries no information. A coordination state has nine fields:
- ;
- ;
- , a cluster state with a term, a version, a metadata version, last committed and last accepted configurations, an optional cluster-manager id, two UUID flags and the unit payload;
- and ;
- and ;
- ;
- .
Abbreviations, all read from the accepted state:
- : its term;
- : its version;
- and : its configurations.
Default election quorum. is the strategy whose extra constraint is always true. Hence
where holds iff strictly more than half of 's ids occur in .
The Java invariant. is the conjunction of:
- (i) ;
- (ii) ;
- (iii) if , then ; otherwise ;
- (iv) ;
- (v) is empty .
The handler. , with , works as follows:
- It fails if .
- Otherwise, if and , it fails, except in the term-0 compatibility case. There it accepts iff names a cluster manager different from the stored one.
- In every other case it accepts.
Accepting returns .
1. Declaration
Binders and hypotheses. None.
Conclusion. An existential:
where are coordination states over Unit, is a publish request over Unit, and is a publish response. There is a state satisfying the Java invariant under the default strategy which accepts some publish request and thereby reaches a state violating the invariant.
Which conjuncts a witness can break. A successful handlePublishRequest replaces only the accepted state, by one whose term equals . So conjuncts (i), (iv) and (v) automatically hold after the step. A witness must break (ii) or (iii):
- (ii) breaks when the new accepted configurations change the quorum test.
- (iii) breaks when the election is won and the new accepted version exceeds .
A witness. I checked this one by evaluating the definitions. Let be:
- local node , current term ;
- accepted state of term and version , with both configurations ;
- join votes , ;
- published version and no publish votes.
This satisfies (i)–(v). Now take equal to its accepted state but with version . The request is accepted, because and . The result has but , so (iii) fails.
2. What is not constrained
- A pure existence claim. It fixes the payload type
Unitand the default strategy. It does not characterize which states or requests break the invariant. - Nothing about reachability. It does not say that such a state and request can occur in a run of a cluster: no reachability or cluster model is involved. The state need only satisfy the five local conjuncts.
- Not vacuous. It is a satisfiable existential (witness above).
- A statement about scope. Its content is a limitation of local reasoning:
javaInvariantis not an invariant of the single-node handlerhandlePublishRequest. This explains whyjavaInvariant_preservedomits that handler. It does not imply that the other omitted handlers preserve the invariant; forhandleCommitthey do not (see the read-back ofjavaInvariant_preserved).
3. Plain-language summary
The five Java invariant assertions are not preserved by handlePublishRequest taken alone. Some state satisfies them under the default strategy, accepts a publish request, and ends up violating them. For example, an election winner whose last published version is accepts a newer version of its own term from a publish request, so its published version falls behind its accepted version.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.