Documentation

CslibFrontier.Computability.Distributed.Paxos.Quorums

Phase-specific Paxos quorums #

QuorumSystem has separate prepare and accept families. Every prepare quorum intersects every accept quorum; quorums in the same phase need not intersect. This is the quorum condition used by Flexible Paxos [HMS17]. The operational safety proof in Paxos.Basic consumes this interface directly.

QuorumSystem.Supports describes a live cohort containing a quorum for each phase, the condition needed to start a ballot and complete it. QuorumSystem.AvailableFor instead allows different failure families in the two phases, distinguishing leader-election availability from availability after a leader has prepared its ballot.

The finite-set results in this module are original library formulations:

These are quorum and availability statements, not assertions of unconditional asynchronous protocol termination. Protocol liveness additionally needs its delivery and leader hypotheses.

Two nonempty quorum families whose members intersect across phases. Same-phase intersection is not required. Prepare quorums collect promises; accept quorums certify a chosen value.

A prepare quorum is nonempty because it intersects an accept quorum.

An accept quorum is nonempty because it intersects a prepare quorum.

A cohort supports both phases when it contains a prepare quorum and an accept quorum.

Instances For
    @[instance_reducible]

    Supporting both phases is decidable by checking the two finite quorum families.

    A cohort supporting both phases contains at least one acceptor.

    theorem Cslib.Distributed.Paxos.QuorumSystem.supports_union {P : Type u_1} [DecidableEq P] (qs : QuorumSystem P) {Q₁ Q₂ : Finset P} (h₁ : Q₁ ∈ qs.prepareQuorums) (h₂ : Q₂ ∈ qs.acceptQuorums) :
    qs.Supports (Q₁ ∪ Q₂)

    The union of a prepare quorum and an accept quorum supports both phases.

    structure Cslib.Distributed.Paxos.QuorumSystem.AvailableFor {P : Type u_1} [DecidableEq P] (qs : QuorumSystem P) (prepareFaults acceptFaults : Set (Finset P)) :

    Availability against possibly different failure families in the prepare and accept phases. Each allowed fault set leaves some quorum of the corresponding phase entirely correct.

    def Cslib.Distributed.Paxos.thresholdQuorums {P : Type u_1} [Fintype P] [DecidableEq P] {qPrepare qAccept : ℕ} (hPrepare : qPrepare ≤ Fintype.card P) (hAccept : qAccept ≤ Fintype.card P) (hInter : Fintype.card P < qPrepare + qAccept) :

    All subsets meeting the respective cardinality thresholds form a phase-specific quorum system when each threshold is feasible and their sum exceeds the number of acceptors.

    @[simp]
    theorem Cslib.Distributed.Paxos.mem_thresholdQuorums_prepare_iff {P : Type u_1} [Fintype P] [DecidableEq P] {qPrepare qAccept : ℕ} (hPrepare : qPrepare ≤ Fintype.card P) (hAccept : qAccept ≤ Fintype.card P) (hInter : Fintype.card P < qPrepare + qAccept) (Q : Finset P) :
    Q ∈ (thresholdQuorums hPrepare hAccept hInter).prepareQuorums ↔ qPrepare ≤ Q.card

    Membership in the prepare family is exactly the prepare cardinality threshold.

    @[simp]
    theorem Cslib.Distributed.Paxos.mem_thresholdQuorums_accept_iff {P : Type u_1} [Fintype P] [DecidableEq P] {qPrepare qAccept : ℕ} (hPrepare : qPrepare ≤ Fintype.card P) (hAccept : qAccept ≤ Fintype.card P) (hInter : Fintype.card P < qPrepare + qAccept) (Q : Finset P) :
    Q ∈ (thresholdQuorums hPrepare hAccept hInter).acceptQuorums ↔ qAccept ≤ Q.card

    Membership in the accept family is exactly the accept cardinality threshold.

    theorem Cslib.Distributed.Paxos.exists_thresholdQuorums_iff {P : Type u_1} [Fintype P] [DecidableEq P] {qPrepare qAccept : ℕ} (hPrepare : qPrepare ≤ Fintype.card P) (hAccept : qAccept ≤ Fintype.card P) :
    (∃ (qs : QuorumSystem P), (∀ (Q : Finset P), Q ∈ qs.prepareQuorums ↔ qPrepare ≤ Q.card) ∧ ∀ (Q : Finset P), Q ∈ qs.acceptQuorums ↔ qAccept ≤ Q.card) ↔ Fintype.card P < qPrepare + qAccept

    Exact cross-intersection criterion for feasible cardinality thresholds. Feasibility rules out the vacuous case of an empty quorum family with a threshold larger than the universe.

    theorem Cslib.Distributed.Paxos.thresholdQuorums_availableFor_iff {P : Type u_1} [Fintype P] [DecidableEq P] {qPrepare qAccept : ℕ} (hPrepare : qPrepare ≤ Fintype.card P) (hAccept : qAccept ≤ Fintype.card P) (hInter : Fintype.card P < qPrepare + qAccept) (prepareFaults acceptFaults : Set (Finset P)) :
    (thresholdQuorums hPrepare hAccept hInter).AvailableFor prepareFaults acceptFaults ↔ (∀ F ∈ prepareFaults, qPrepare + F.card ≤ Fintype.card P) ∧ ∀ F ∈ acceptFaults, qAccept + F.card ≤ Fintype.card P

    A threshold family remains available precisely when each permitted fault set leaves enough acceptors for that phase's threshold. The two phases may use different failure families.

    Equal strict-majority families recover classical Paxos: each quorum contains at least Fintype.card P - t acceptors, with 2 * t < Fintype.card P.

    @[simp]

    The classical prepare quorum cardinality test.

    @[simp]

    The classical accept quorum cardinality test.

    theorem Cslib.Distributed.Paxos.exists_availableFor_iff {P : Type u_1} [Fintype P] [DecidableEq P] (prepareFaults acceptFaults : Set (Finset P)) (hp : prepareFaults.Nonempty) (ha : acceptFaults.Nonempty) :
    (∃ (qs : QuorumSystem P), qs.AvailableFor prepareFaults acceptFaults) ↔ ∀ F₁ ∈ prepareFaults, ∀ F₂ ∈ acceptFaults, F₁ ∪ F₂ ≠ Finset.univ

    Two nonempty failure families admit an available phase-specific quorum system exactly when no prepare fault set and accept fault set together cover the acceptor universe. Sufficiency uses the complements of the respective fault sets as quorums. No closure assumption on either failure family is needed.

    theorem Cslib.Distributed.Paxos.exists_availableFor_card_iff {P : Type u_1} [Fintype P] [DecidableEq P] (fPrepare fAccept : ℕ) :
    (∃ (qs : QuorumSystem P), qs.AvailableFor {F : Finset P | F.card ≤ fPrepare} {F : Finset P | F.card ≤ fAccept}) ↔ fPrepare + fAccept < Fintype.card P

    Sharp asymmetric crash-availability threshold: prepare quorums can tolerate fPrepare faults and accept quorums can tolerate fAccept faults exactly when their sum is below the number of acceptors. In particular, requiring the same fault budget in both phases recovers the strict-majority resilience bound.