Documentation

CslibFrontier.Computability.Distributed.Paxos.Basic

Crash-Stop Single-Decree Synod Protocol Step #

This module formalizes a crash-stop intermediate step towards Lamport's Single-Decree Synod consensus protocol (§2 of [Lam98]; §2 of [Lam01]), and not the crash-recovery cited results of those papers. Over separate prepare and accept quorum families (QuorumSystem) with cross-phase intersection, we model the four Synod phases (Phase1a/1b/2a/2b) as a ghost-free asynchronous message-passing labelled transition system (Cslib.LTS) allowing arbitrary message reordering, duplication, packet loss/omission, and permanent crash-stop node failures (crashed : Bool).

Step scope and model deviations: In [Lam98] (§1.3, §2.3, Appendix A2 Forget) and [Lam01] (§2.1, §2.5), nodes may fail by stopping and later restart using persistent stable storage (lastTried, maxBal, maxVoted) while losing volatile per-round state; here crashes are permanent (crashed : Bool), while .prepare p r resets per-round proposer fields (proposed, promised, maxVote). Phase 2b uses [Lam01] §2.2's mb ≤ b voting guard (allowsVote, updating maxBal := some b) rather than [Lam98] §2.3 step (4)'s b = nextBal[q]. Section 3 Multi-Paxos state-machine / ledger replication also remains open under issue #7207. The quorum generalization implements the cross-phase condition of [HMS17], §5 Eq. (3), in this crash-stop kernel: prepare quorums need not intersect each other, and accept quorums need not intersect each other. Only an earlier accept quorum and a later prepare quorum are intersected in the agreement proof. This does not add persistent-storage recovery or dynamic reconfiguration.

The protocol state (SynodState) is completely ghost-free: proposers, acceptors, and learners store only the operational registers read by protocol transitions, and packet drops genuinely erase messages from the live network buffer msgs. Safety invariants (the crash-stop P2^c / B3 quorum-witness condition on Phase2a proposals and P1^a promise–vote monotonicity) are proved inductively over a non-dropping shadow execution (traceMsgs) and projected onto all reachable states via network monotonicity.

Main definitions #

Main results #

References #

Proposer-owned ballots and protocol messages #

structure Cslib.Distributed.Paxos.Ballot (Proposer : Type u_1) :
Type u_1

A ballot number (round, proposer) uniquely owned by proposer, ordered lexicographically first by round and then by proposer ([Lam98]; [Lam01]).

  • round : ℕ

    Nonnegative round / sequence number.

  • proposer : Proposer

    Unique proposer owning this ballot.

Instances For
    theorem Cslib.Distributed.Paxos.Ballot.ext_iff {Proposer : Type u_1} {x y : Ballot Proposer} :
    theorem Cslib.Distributed.Paxos.Ballot.ext {Proposer : Type u_1} {x y : Ballot Proposer} (round : x.round = y.round) (proposer : x.proposer = y.proposer) :
    x = y
    def Cslib.Distributed.Paxos.instDecidableEqBallot.decEq {Proposer✝ : Type u_1} [DecidableEq Proposer✝] (x✝ x✝¹ : Ballot Proposer✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqBallot {Proposer✝ : Type u_1} [DecidableEq Proposer✝] :
    DecidableEq (Ballot Proposer✝)
    def Cslib.Distributed.Paxos.Ballot.toLexProd {Proposer : Type u_1} (b : Ballot Proposer) :
    Lex (ℕ × Proposer)

    Order-embedding of Ballot Proposer into the lexicographic product ℕ ×ₗ Proposer.

    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instLinearOrderBallot {Proposer : Type u_1} [LinearOrder Proposer] :
    LinearOrder (Ballot Proposer)
    @[simp]
    theorem Cslib.Distributed.Paxos.Ballot.lt_iff {Proposer : Type u_1} [LinearOrder Proposer] (a b : Ballot Proposer) :
    @[simp]
    theorem Cslib.Distributed.Paxos.Ballot.le_iff {Proposer : Type u_1} [LinearOrder Proposer] (a b : Ballot Proposer) :
    structure Cslib.Distributed.Paxos.Vote (Proposer : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    A vote (ballot, value) cast by an acceptor in Phase 2b and reported in Phase 1b.

    • ballot : Ballot Proposer

      Ballot at which the vote was cast.

    • value : V

      Decree value accepted at ballot.

    theorem Cslib.Distributed.Paxos.Vote.ext {Proposer : Type u_1} {V : Type u_2} {x y : Vote Proposer V} (ballot : x.ballot = y.ballot) (value : x.value = y.value) :
    x = y
    theorem Cslib.Distributed.Paxos.Vote.ext_iff {Proposer : Type u_1} {V : Type u_2} {x y : Vote Proposer V} :
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqVote {Proposer✝ : Type u_1} {V✝ : Type u_2} [DecidableEq Proposer✝] [DecidableEq V✝] :
    DecidableEq (Vote Proposer✝ V✝)
    def Cslib.Distributed.Paxos.instDecidableEqVote.decEq {Proposer✝ : Type u_1} {V✝ : Type u_2} [DecidableEq Proposer✝] [DecidableEq V✝] (x✝ x✝¹ : Vote Proposer✝ V✝) :
    Decidable (x✝ = x✝¹)
    inductive Cslib.Distributed.Paxos.Msg (Proposer : Type u_1) (Acceptor : Type u_2) (V : Type u_3) :
    Type (max (max u_1 u_2) u_3)

    Network packets of Lamport's Single-Decree Synod protocol ([Lam98]; [Lam01]).

    • phase1a {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} (b : Ballot Proposer) : Msg Proposer Acceptor V

      Phase 1a (prepare): proposer requests promises for ballot b.

    • phase1b {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} (a : Acceptor) (b : Ballot Proposer) (maxVoted : Option (Vote Proposer V)) : Msg Proposer Acceptor V

      Phase 1b (promise): acceptor a promises not to vote in ballots < b, reporting its highest-numbered prior vote maxVoted.

    • phase2a {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} (b : Ballot Proposer) (v : V) : Msg Proposer Acceptor V

      Phase 2a (accept): proposer of ballot b proposes decree value v.

    • phase2b {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} (a : Acceptor) (b : Ballot Proposer) (v : V) : Msg Proposer Acceptor V

      Phase 2b (accepted): acceptor a casts its vote for (b, v).

    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqMsg {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] :
    DecidableEq (Msg Proposer✝ Acceptor✝ V✝)
    def Cslib.Distributed.Paxos.instDecidableEqMsg.decEq {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] (x✝ x✝¹ : Msg Proposer✝ Acceptor✝ V✝) :
    Decidable (x✝ = x✝¹)

    Ghost-free node and global protocol states #

    structure Cslib.Distributed.Paxos.ProposerState (Proposer : Type u_1) (Acceptor : Type u_2) (V : Type u_3) :
    Type (max (max u_1 u_2) u_3)

    Operational local state of a proposer (zero ghost history).

    • input : V

      Proposer's initial client input value.

    • round : Option ℕ

      Active ballot round owned by this proposer (none before its first prepare).

    • proposed : Bool

      Whether this proposer has already emitted Phase2a in its current round.

    • promised : Finset Acceptor

      Acceptors from which this proposer has received Phase1b for its current round.

    • maxVote : Option (Vote Proposer V)

      Highest-ballot vote reported among promised acceptors in the current round.

    • crashed : Bool

      Whether this proposer has crashed.

    theorem Cslib.Distributed.Paxos.ProposerState.ext {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : ProposerState Proposer Acceptor V} (input : x.input = y.input) (round : x.round = y.round) (proposed : x.proposed = y.proposed) (promised : x.promised = y.promised) (maxVote : x.maxVote = y.maxVote) (crashed : x.crashed = y.crashed) :
    x = y
    theorem Cslib.Distributed.Paxos.ProposerState.ext_iff {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : ProposerState Proposer Acceptor V} :
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqProposerState {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] :
    DecidableEq (ProposerState Proposer✝ Acceptor✝ V✝)
    def Cslib.Distributed.Paxos.instDecidableEqProposerState.decEq {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] (x✝ x✝¹ : ProposerState Proposer✝ Acceptor✝ V✝) :
    Decidable (x✝ = x✝¹)
    structure Cslib.Distributed.Paxos.AcceptorState (Proposer : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    Operational local state of an acceptor (zero ghost history).

    • maxBal : Option (Ballot Proposer)

      Highest ballot promised in Phase 1b or voted in Phase 2b (none initially).

    • maxVoted : Option (Vote Proposer V)

      Highest-ballot vote cast in Phase 2b (none before first vote).

    • crashed : Bool

      Whether this acceptor has crashed.

    theorem Cslib.Distributed.Paxos.AcceptorState.ext {Proposer : Type u_1} {V : Type u_2} {x y : AcceptorState Proposer V} (maxBal : x.maxBal = y.maxBal) (maxVoted : x.maxVoted = y.maxVoted) (crashed : x.crashed = y.crashed) :
    x = y
    theorem Cslib.Distributed.Paxos.AcceptorState.ext_iff {Proposer : Type u_1} {V : Type u_2} {x y : AcceptorState Proposer V} :
    def Cslib.Distributed.Paxos.instDecidableEqAcceptorState.decEq {Proposer✝ : Type u_1} {V✝ : Type u_2} [DecidableEq Proposer✝] [DecidableEq V✝] (x✝ x✝¹ : AcceptorState Proposer✝ V✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqAcceptorState {Proposer✝ : Type u_1} {V✝ : Type u_2} [DecidableEq Proposer✝] [DecidableEq V✝] :
    DecidableEq (AcceptorState Proposer✝ V✝)
    structure Cslib.Distributed.Paxos.AcceptedVote (Proposer : Type u_1) (Acceptor : Type u_2) (V : Type u_3) :
    Type (max (max u_1 u_2) u_3)

    A Phase 2b vote (acceptor, ballot, value) recorded by a learner.

    • acceptor : Acceptor

      Acceptor that sent Phase2b.

    • ballot : Ballot Proposer

      Ballot number of the vote.

    • value : V

      Accepted decree value.

    theorem Cslib.Distributed.Paxos.AcceptedVote.ext_iff {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : AcceptedVote Proposer Acceptor V} :
    theorem Cslib.Distributed.Paxos.AcceptedVote.ext {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : AcceptedVote Proposer Acceptor V} (acceptor : x.acceptor = y.acceptor) (ballot : x.ballot = y.ballot) (value : x.value = y.value) :
    x = y
    def Cslib.Distributed.Paxos.instDecidableEqAcceptedVote.decEq {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] (x✝ x✝¹ : AcceptedVote Proposer✝ Acceptor✝ V✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqAcceptedVote {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] :
    DecidableEq (AcceptedVote Proposer✝ Acceptor✝ V✝)
    structure Cslib.Distributed.Paxos.LearnerState (Proposer : Type u_1) (Acceptor : Type u_2) (V : Type u_3) :
    Type (max (max u_1 u_2) u_3)

    Operational local state of a learner (zero ghost history).

    • received : Finset (AcceptedVote Proposer Acceptor V)

      Phase 2b votes received so far by this learner.

    • learned : Option V

      Write-once learned decree value (none until a quorum of matching Phase 2b votes arrives).

    • crashed : Bool

      Whether this learner has crashed.

    theorem Cslib.Distributed.Paxos.LearnerState.ext {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : LearnerState Proposer Acceptor V} (received : x.received = y.received) (learned : x.learned = y.learned) (crashed : x.crashed = y.crashed) :
    x = y
    theorem Cslib.Distributed.Paxos.LearnerState.ext_iff {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} {x y : LearnerState Proposer Acceptor V} :
    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqLearnerState {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] :
    DecidableEq (LearnerState Proposer✝ Acceptor✝ V✝)
    def Cslib.Distributed.Paxos.instDecidableEqLearnerState.decEq {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {V✝ : Type u_3} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq V✝] (x✝ x✝¹ : LearnerState Proposer✝ Acceptor✝ V✝) :
    Decidable (x✝ = x✝¹)
    structure Cslib.Distributed.Paxos.SynodState (Proposer : Type u_1) (Acceptor : Type u_2) (Learner : Type u_3) (V : Type u_4) :
    Type (max (max (max u_1 u_2) u_3) u_4)

    Ghost-free global configuration of the Single-Decree Synod protocol: live network packet set paired with local proposer, acceptor, and learner states.

    • msgs : Finset (Msg Proposer Acceptor V)

      Currently in-flight packets on the asynchronous network (packets may be reordered, redelivered/duplicated, or erased by .drop).

    • proposers : Proposer → ProposerState Proposer Acceptor V

      Local state of each proposer.

    • acceptors : Acceptor → AcceptorState Proposer V

      Local state of each acceptor.

    • learners : Learner → LearnerState Proposer Acceptor V

      Local state of each learner.

    theorem Cslib.Distributed.Paxos.SynodState.ext {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} {x y : SynodState Proposer Acceptor Learner V} (msgs : x.msgs = y.msgs) (proposers : x.proposers = y.proposers) (acceptors : x.acceptors = y.acceptors) (learners : x.learners = y.learners) :
    x = y
    theorem Cslib.Distributed.Paxos.SynodState.ext_iff {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} {x y : SynodState Proposer Acceptor Learner V} :
    def Cslib.Distributed.Paxos.initState {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (inputs : Proposer → V) :
    SynodState Proposer Acceptor Learner V

    Initial global state for proposer input assignment inputs.

    Asynchronous transitions and Cslib.LTS #

    inductive Cslib.Distributed.Paxos.SynodAction (Proposer : Type u_1) (Acceptor : Type u_2) (Learner : Type u_3) (V : Type u_4) :
    Type (max (max (max u_1 u_2) u_3) u_4)

    Transition labels of the asynchronous Synod LTS, covering all four Paxos phases plus packet loss (.drop), crash-stop failures (.crash*), and stuttering (.stutter).

    • prepare {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (p : Proposer) (r : ℕ) : SynodAction Proposer Acceptor Learner V

      Proposer p initiates Phase 1a at a fresh strictly higher round r.

    • recvPhase1a {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (a : Acceptor) (b : Ballot Proposer) : SynodAction Proposer Acceptor Learner V

      Acceptor a processes Phase1a(b) from the network.

    • recvPhase1b {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (p : Proposer) (a : Acceptor) (b : Ballot Proposer) (mv : Option (Vote Proposer V)) : SynodAction Proposer Acceptor Learner V

      Proposer p processes Phase1b(a, b, mv) from the network (and emits Phase2a upon completing a quorum of promises).

    • recvPhase2a {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (a : Acceptor) (b : Ballot Proposer) (v : V) : SynodAction Proposer Acceptor Learner V

      Acceptor a processes Phase2a(b, v) from the network.

    • recvPhase2b {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (l : Learner) (a : Acceptor) (b : Ballot Proposer) (v : V) : SynodAction Proposer Acceptor Learner V

      Learner l processes Phase2b(a, b, v) from the network.

    • drop {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (m : Msg Proposer Acceptor V) : SynodAction Proposer Acceptor Learner V

      Network drops packet m from msgs.

    • crashProposer {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (p : Proposer) : SynodAction Proposer Acceptor Learner V

      Proposer p suffers a crash-stop failure.

    • crashAcceptor {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (a : Acceptor) : SynodAction Proposer Acceptor Learner V

      Acceptor a suffers a crash-stop failure.

    • crashLearner {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (l : Learner) : SynodAction Proposer Acceptor Learner V

      Learner l suffers a crash-stop failure.

    • stutter {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} : SynodAction Proposer Acceptor Learner V

      Dummy stuttering step leaving the global state unchanged.

    @[instance_reducible]
    instance Cslib.Distributed.Paxos.instDecidableEqSynodAction {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {Learner✝ : Type u_3} {V✝ : Type u_4} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq Learner✝] [DecidableEq V✝] :
    DecidableEq (SynodAction Proposer✝ Acceptor✝ Learner✝ V✝)
    def Cslib.Distributed.Paxos.instDecidableEqSynodAction.decEq {Proposer✝ : Type u_1} {Acceptor✝ : Type u_2} {Learner✝ : Type u_3} {V✝ : Type u_4} [DecidableEq Proposer✝] [DecidableEq Acceptor✝] [DecidableEq Learner✝] [DecidableEq V✝] (x✝ x✝¹ : SynodAction Proposer✝ Acceptor✝ Learner✝ V✝) :
    Decidable (x✝ = x✝¹)
    def Cslib.Distributed.Paxos.mergeVote {Proposer : Type u_1} {V : Type u_2} [LinearOrder Proposer] (cur incoming : Option (Vote Proposer V)) :
    Option (Vote Proposer V)

    Combine a proposer's running highest vote with a newly reported Phase1b vote.

    def Cslib.Distributed.Paxos.aboveMaxBal {Proposer : Type u_1} [LinearOrder Proposer] (maxBal : Option (Ballot Proposer)) (b : Ballot Proposer) :

    Whether ballot b strictly exceeds an acceptor's maxBal (the Phase 1b promise condition).

    def Cslib.Distributed.Paxos.allowsVote {Proposer : Type u_1} [LinearOrder Proposer] (maxBal : Option (Ballot Proposer)) (b : Ballot Proposer) :

    Whether ballot b is at least an acceptor's maxBal (the Phase 2b voting condition).

    def Cslib.Distributed.Paxos.synodEnabled {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} (s : SynodState Proposer Acceptor Learner V) (act : SynodAction Proposer Acceptor Learner V) :

    Guard predicate specifying when act is enabled in state s.

    Instances For
      @[instance_reducible]
      instance Cslib.Distributed.Paxos.instDecidableSynodEnabled {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [DecidableEq Proposer] [DecidableEq Acceptor] [DecidableEq V] (s : SynodState Proposer Acceptor Learner V) (act : SynodAction Proposer Acceptor Learner V) :
      def Cslib.Distributed.Paxos.synodStepCore {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (dropErases : Bool) (qs : QuorumSystem Acceptor) (s : SynodState Proposer Acceptor Learner V) (act : SynodAction Proposer Acceptor Learner V) :
      SynodState Proposer Acceptor Learner V

      Shared transition kernel parameterized by whether .drop erases from msgs.

      def Cslib.Distributed.Paxos.synodStep {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) (s : SynodState Proposer Acceptor Learner V) (act : SynodAction Proposer Acceptor Learner V) :
      SynodState Proposer Acceptor Learner V

      State transition function of the asynchronous Single-Decree Synod protocol.

      def Cslib.Distributed.Paxos.synodLts {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) :
      LTS (SynodState Proposer Acceptor Learner V) (SynodAction Proposer Acceptor Learner V)

      Asynchronous labelled transition system (Cslib.LTS) of Lamport's Single-Decree Synod protocol.

      Instances For
        instance Cslib.Distributed.Paxos.instDeterministicSynodLts {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) :
        def Cslib.Distributed.Paxos.Reachable {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) (inputs : Proposer → V) (s : SynodState Proposer Acceptor Learner V) :

        Reachable qs inputs s holds when s is reachable from initState inputs in synodLts qs.

        theorem Cslib.Distributed.Paxos.reachable_initState {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) (inputs : Proposer → V) :
        Reachable qs inputs (initState inputs)

        Initial state initState inputs is reachable.

        theorem Cslib.Distributed.Paxos.Reachable.trans {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] {qs : QuorumSystem Acceptor} {inputs : Proposer → V} {s s' : SynodState Proposer Acceptor Learner V} (hs : Reachable qs inputs s) (hreach : (synodLts qs).CanReach s s') :
        Reachable qs inputs s'

        Transitivity of Synod reachability along multi-step transitions.

        def Cslib.Distributed.Paxos.traceMsgs {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) (s₀ : SynodState Proposer Acceptor Learner V) (xl : List (SynodAction Proposer Acceptor Learner V)) :
        Finset (Msg Proposer Acceptor V)

        The cumulative finite set of packets emitted along execution trace xl from s₀ (ignoring .drop erasures).

        def Cslib.Distributed.Paxos.ChosenAt {Proposer : Type u_1} {Acceptor : Type u_2} {V : Type u_3} [DecidableEq Acceptor] (qs : QuorumSystem Acceptor) (msgs : Finset (Msg Proposer Acceptor V)) (b : Ballot Proposer) (v : V) :

        Value v is chosen at ballot b relative to packet set msgs when every acceptor in some quorum Q ∈ qs.acceptQuorums has emitted Phase2b(a, b, v).

        def Cslib.Distributed.Paxos.SynodState.LearnedAt {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [DecidableEq Acceptor] (qs : QuorumSystem Acceptor) (s : SynodState Proposer Acceptor Learner V) (l : Learner) (b : Ballot Proposer) (v : V) :

        Learner l has learned value v at ballot b in state s when l has received Phase2b(a, b, v) from every acceptor in some quorum Q ∈ qs.acceptQuorums.

        Shadow non-dropping simulation #

        theorem Cslib.Distributed.Paxos.mem_traceMsgs_of_mem_msgs {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) {s₀ s : SynodState Proposer Acceptor Learner V} {xl : List (SynodAction Proposer Acceptor Learner V)} (hmtr : (synodLts qs).MTr s₀ xl s) {m : Msg Proposer Acceptor V} (hm : m ∈ s.msgs) :
        m ∈ traceMsgs qs s₀ xl

        Every packet currently in s.msgs along a valid trace xl belongs to traceMsgs qs s₀ xl.

        Global inductive invariant over synodLtsNoDrop #

        Main safety theorems #

        theorem Cslib.Distributed.Paxos.phase2a_unique_of_ballot_crashStop {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) {inputs : Proposer → V} {xl : List (SynodAction Proposer Acceptor Learner V)} {s : SynodState Proposer Acceptor Learner V} (hmtr : (synodLts qs).MTr (initState inputs) xl s) {b : Ballot Proposer} {v₁ v₂ : V} (h₁ : Msg.phase2a b v₁ ∈ traceMsgs qs (initState inputs) xl) (h₂ : Msg.phase2a b v₂ ∈ traceMsgs qs (initState inputs) xl) :
        v₁ = v₂

        Crash-stop helper step towards single-proposal per ballot in [Lam98] §2.1 (B1), §2.2–§2.3 and [Lam01] §2.2, §2.5 (not the crash-recovery cited protocol): along any execution trace of synodLts, at most one value is ever proposed in Phase2a for any given ballot b.

        theorem Cslib.Distributed.Paxos.chosenAt_implies_higher_phase2a_eq_crashStop {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) {inputs : Proposer → V} {xl : List (SynodAction Proposer Acceptor Learner V)} {s : SynodState Proposer Acceptor Learner V} (hmtr : (synodLts qs).MTr (initState inputs) xl s) {b b' : Ballot Proposer} {v v' : V} (hchosen : ChosenAt qs (traceMsgs qs (initState inputs) xl) b v) (h2a : Msg.phase2a b' v' ∈ traceMsgs qs (initState inputs) xl) (hle : b ≤ b') :
        v' = v

        Crash-stop intermediate step towards the inductive ballot-choice invariant of [Lam98] §2.1 (Lemma) and [Lam01] §2.2 (P2^b–P2^c), and not the crash-recovery cited result: along any crash-stop synodLts execution, if an accept quorum Q ∈ qs.acceptQuorums has voted (b, v) in Phase 2b, then every Phase2a(b', v') emitted in the trace with b ≤ b' satisfies v' = v.

        theorem Cslib.Distributed.Paxos.paxos_agreement_crashStop {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) {inputs : Proposer → V} {s : SynodState Proposer Acceptor Learner V} (hr : Reachable qs inputs s) {l₁ l₂ : Learner} {b₁ b₂ : Ballot Proposer} {v₁ v₂ : V} (h₁ : SynodState.LearnedAt qs s l₁ b₁ v₁) (h₂ : SynodState.LearnedAt qs s l₂ b₂ v₂) :
        v₁ = v₂

        Crash-stop intermediate step towards Single-Decree Synod agreement in [Lam98] §2.1 (Theorem 1, Appendix A2) and [Lam01] §2.2 (P2), §2.3, and not the crash-recovery cited result: in any reachable crash-stop Synod state, any two values v₁, v₂ learned by any two learners l₁, l₂ at any two ballots b₁, b₂ satisfy v₁ = v₂.

        theorem Cslib.Distributed.Paxos.Reachable.learned_eq_some_iff {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] {qs : QuorumSystem Acceptor} {inputs : Proposer → V} {s : SynodState Proposer Acceptor Learner V} (hr : Reachable qs inputs s) {l : Learner} {v : V} :
        (s.learners l).learned = some v ↔ ∃ (b : Ballot Proposer), SynodState.LearnedAt qs s l b v

        Crash-stop Synod learner-register characterization: in any reachable crash-stop Synod state, learner l's operational learned register holds some v if and only if l has learned v at some ballot b.

        theorem Cslib.Distributed.Paxos.paxos_validity_crashStop {Proposer : Type u_1} {Acceptor : Type u_2} {Learner : Type u_3} {V : Type u_4} [LinearOrder Proposer] [DecidableEq Acceptor] [DecidableEq Learner] [DecidableEq V] (qs : QuorumSystem Acceptor) {inputs : Proposer → V} {s : SynodState Proposer Acceptor Learner V} (hr : Reachable qs inputs s) {l : Learner} {v : V} (hl : (s.learners l).learned = some v) :
        ∃ (p : Proposer), inputs p = v

        Crash-stop intermediate step towards Single-Decree Synod nontriviality/validity in [Lam98] §1.2 and [Lam01] §2.1, and not the crash-recovery cited result: in any reachable crash-stop Synod state, any value v learned by any learner l equals some proposer's initial input.