Documentation

CslibFrontier.Computability.Distributed.SetAgreement.ImmediateSnapshot

Immediate snapshot schedules, the Borowsky–Gafni characterization, and IIS views #

As a step toward #7504 (leaving the asynchronous read/write and atomic-snapshot to IIS simulation open in #7504), this module formalizes one-shot Immediate Snapshot (IS) schedules and R-round Iterated Immediate Snapshot (IIS) full-information executions over an active process set U : Finset V, following [BG97] (§§3.4–3.6, PS pp. 5–6; see also [BG93b] and [HS99], §5.2).

Main definitions #

Main results #

References #

Union of a list of process blocks B₁, …, Bₖ.

@[simp]
@[simp]
theorem Cslib.Distributed.SetAgreement.unionBlocks_append {V : Type u_1} [DecidableEq V] (bs₁ bs₂ : List (Finset V)) :
unionBlocks (bs₁ ++ bs₂) = unionBlocks bs₁ ∪ unionBlocks bs₂
theorem Cslib.Distributed.SetAgreement.mem_unionBlocks {V : Type u_1} [DecidableEq V] {bs : List (Finset V)} {p : V} :
p ∈ unionBlocks bs ↔ ∃ B ∈ bs, p ∈ B

Prefix-union snapshot returned to process p by executing ordered concurrent blocks bs: if p appears in block Bⱼ, p observes B₁ ∪ ⋯ ∪ Bⱼ; if p ∉ unionBlocks bs, ∅.

theorem Cslib.Distributed.SetAgreement.blocksSnapshot_cons_of_mem {V : Type u_1} [DecidableEq V] {B : Finset V} {bs : List (Finset V)} {p : V} (hp : p ∈ B) :
blocksSnapshot (B :: bs) p = B
theorem Cslib.Distributed.SetAgreement.blocksSnapshot_cons_of_notMem {V : Type u_1} [DecidableEq V] {B : Finset V} {bs : List (Finset V)} {p : V} (hpB : p ∉ B) (hp : p ∈ unionBlocks bs) :
blocksSnapshot (B :: bs) p = B ∪ blocksSnapshot bs p
theorem Cslib.Distributed.SetAgreement.blocksSnapshot_append_of_mem_left {V : Type u_1} [DecidableEq V] {bs₁ bs₂ : List (Finset V)} {p : V} (hp : p ∈ unionBlocks bs₁) :
blocksSnapshot (bs₁ ++ bs₂) p = blocksSnapshot bs₁ p

A one-shot Immediate Snapshot (IS) schedule over active processes U : Finset V: an ordered partition (B₁, …, Bₖ) of U into nonempty pairwise-disjoint concurrent write-scan blocks ([BG97], §§3.4–3.5, p. 5).

  • blocks : List (Finset V)

    Ordered list of concurrent write-then-snapshot blocks.

  • blocks_nonempty (B : Finset V) : B ∈ self.blocks → B.Nonempty

    Every block in the schedule is nonempty.

  • blocks_pairwise_disjoint : List.Pairwise Disjoint self.blocks

    Distinct blocks in the schedule are pairwise disjoint.

  • union_blocks : unionBlocks self.blocks = U

    The union of all blocks equals the active process set U.

Instances For
    theorem Cslib.Distributed.SetAgreement.ISSchedule.ext {V : Type u_1} {inst✝ : DecidableEq V} {U : Finset V} {x y : ISSchedule U} (blocks : x.blocks = y.blocks) :
    x = y

    Auxiliary enumeration of ordered partitions of rem of length at most k.

    Computable Finset of all one-shot IS schedules on U.

    The unique one-shot IS schedule on the empty process set ∅.

    Snapshot set observed by process p in one-shot IS schedule π : ISSchedule U.

    theorem Cslib.Distributed.SetAgreement.ISSchedule.snapshot_of_notMem {V : Type u_1} [DecidableEq V] {U : Finset V} (π : ISSchedule U) {p : V} (hp : p ∉ U) :
    theorem Cslib.Distributed.SetAgreement.ISSchedule.snapshot_containment {V : Type u_1} [DecidableEq V] {U : Finset V} (π : ISSchedule U) {p q : V} (hp : p ∈ U) (hq : q ∈ U) :
    π.snapshot p ⊆ π.snapshot q ∨ π.snapshot q ⊆ π.snapshot p
    theorem Cslib.Distributed.SetAgreement.ISSchedule.snapshot_immediacy {V : Type u_1} [DecidableEq V] {U : Finset V} (π : ISSchedule U) {p q : V} (hq : q ∈ U) (hpq : p ∈ π.snapshot q) :
    π.snapshot p ⊆ π.snapshot q

    Borowsky–Gafni immediate-snapshot characterization #

    Borowsky–Gafni immediate-snapshot axioms for a set assignment S : V → Finset V over active processes U : Finset V ([BG97], §3.5, conditions 1–3, p. 5): inactive processes observe ∅, active snapshots lie in U, and active processes satisfy self-inclusion, containment, and immediacy.

    • outside (p : V) : p ∉ U → S p = ∅

      Non-participating processes have empty snapshot.

    • subset (p : V) : p ∈ U → S p ⊆ U

      Every active process's snapshot is a subset of U.

    • self_mem (p : V) : p ∈ U → p ∈ S p

      Self-inclusion: every active process observes itself (p ∈ S p).

    • containment (p : V) : p ∈ U → ∀ q ∈ U, S p ⊆ S q ∨ S q ⊆ S p

      Containment: any two active processes' snapshots are comparable under ⊆.

    • immediacy (p : V) : p ∈ U → ∀ q ∈ U, p ∈ S q → S p ⊆ S q

      Immediacy: if q observes p, then q observes everything p observed.

    Global Borowsky–Gafni immediate-snapshot axioms on all processes V ([BG97], §3.5, conditions 1–3, p. 5).

    • self_mem (p : V) : p ∈ S p

      Self-inclusion: ∀ p, p ∈ S p.

    • containment (p q : V) : S p ⊆ S q ∨ S q ⊆ S p

      Containment: ∀ p q, S p ⊆ S q ∨ S q ⊆ S p.

    • immediacy (p q : V) : p ∈ S q → S p ⊆ S q

      Immediacy: ∀ p q, p ∈ S q → S p ⊆ S q.

    Reconstruct the one-shot IS schedule on U corresponding to a set assignment S satisfying IsImmediateSnapshotOn U S.

    Two one-shot IS schedules on U with identical snapshot maps are equal.

    One-shot immediate-snapshot characterization step for #7504 (after Borowsky and Gafni, §3.5, conditions 1–3, p. 5): ordered partitions of U into nonempty disjoint blocks correspond bijectively to set assignments satisfying IsImmediateSnapshotOn U.

    One-shot immediate-snapshot characterization step for #7504 (after Borowsky and Gafni, §3.5, conditions 1–3, p. 5): full-system ordered partitions correspond bijectively to set assignments satisfying self-inclusion, containment, and immediacy.

    One-shot immediate-snapshot unique-schedule characterization step for #7504 (after Borowsky and Gafni, §3.5, conditions 1–3, p. 5): a map S : V → Finset V satisfies self-inclusion, containment, and immediacy if and only if there exists a unique one-shot IS schedule π on V with π.snapshot = S.

    R-round Iterated Immediate Snapshot (IIS) full-information views #

    structure Cslib.Distributed.SetAgreement.InitView (V : Type u_1) (Input : Type u_2) :
    Type (max u_1 u_2)

    Initial (0-round) IIS view of a process: its identity proc paired with its initial input input ([BG97], §3.5, p. 5).

    • proc : V

      Participating process identity.

    • input : Input

      Initial input value of proc.

    theorem Cslib.Distributed.SetAgreement.InitView.ext {V : Type u_1} {Input : Type u_2} {x y : InitView V Input} (proc : x.proc = y.proc) (input : x.input = y.input) :
    x = y
    theorem Cslib.Distributed.SetAgreement.InitView.ext_iff {V : Type u_1} {Input : Type u_2} {x y : InitView V Input} :
    x = y ↔ x.proc = y.proc ∧ x.input = y.input
    def Cslib.Distributed.SetAgreement.instDecidableEqInitView.decEq {V✝ : Type u_1} {Input✝ : Type u_2} [DecidableEq V✝] [DecidableEq Input✝] (x✝ x✝¹ : InitView V✝ Input✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Distributed.SetAgreement.instDecidableEqInitView {V✝ : Type u_1} {Input✝ : Type u_2} [DecidableEq V✝] [DecidableEq Input✝] :
    DecidableEq (InitView V✝ Input✝)
    structure Cslib.Distributed.SetAgreement.StepView (V : Type u_1) (View : Type u_2) :
    Type (max u_1 u_2)

    Single-step ((r + 1)-round) IIS view of a process: its identity proc paired with the Finset of round-r views observed in round r + 1 ([BG97], §3.5, p. 5).

    • proc : V

      Participating process identity.

    • seen : Finset View

      Immediate snapshot of prior-round views observed by proc.

    theorem Cslib.Distributed.SetAgreement.StepView.ext {V : Type u_1} {View : Type u_2} {x y : StepView V View} (proc : x.proc = y.proc) (seen : x.seen = y.seen) :
    x = y
    theorem Cslib.Distributed.SetAgreement.StepView.ext_iff {V : Type u_1} {View : Type u_2} {x y : StepView V View} :
    x = y ↔ x.proc = y.proc ∧ x.seen = y.seen
    def Cslib.Distributed.SetAgreement.instDecidableEqStepView.decEq {V✝ : Type u_1} {View✝ : Type u_2} [DecidableEq V✝] [DecidableEq View✝] (x✝ x✝¹ : StepView V✝ View✝) :
    Decidable (x✝ = x✝¹)
    @[instance_reducible]
    instance Cslib.Distributed.SetAgreement.instDecidableEqStepView {V✝ : Type u_1} {View✝ : Type u_2} [DecidableEq V✝] [DecidableEq View✝] :
    DecidableEq (StepView V✝ View✝)
    def Cslib.Distributed.SetAgreement.IISView (V : Type u_1) (Input : Type u_2) :
    ℕ → Type (max u_2 u_1)

    Full-information IIS local view after R rounds over processes V and inputs Input.

    def Cslib.Distributed.SetAgreement.decEqIISView {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] (R : ℕ) :
    DecidableEq (IISView V Input R)

    Explicit decidable equality on IISView V Input R.

    @[instance_reducible]
    instance Cslib.Distributed.SetAgreement.instDecidableEqIISView {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {R : ℕ} :
    DecidableEq (IISView V Input R)
    def Cslib.Distributed.SetAgreement.IISView.proc {V : Type u_1} {Input : Type u_2} {R : ℕ} :
    IISView V Input R → V

    Owner process identity of an R-round IIS view.

    def Cslib.Distributed.SetAgreement.IISView.carrier {V : Type u_1} {Input : Type u_2} [DecidableEq V] {R : ℕ} :
    IISView V Input R → Finset V

    Participating process carrier of an R-round IIS view: all processes whose initial inputs causally contributed to the view.

    def Cslib.Distributed.SetAgreement.IISView.carrierInputs {V : Type u_1} {Input : Type u_2} [DecidableEq Input] {R : ℕ} :
    IISView V Input R → Finset Input

    Set of initial input values causally observed in an R-round IIS view.

    theorem Cslib.Distributed.SetAgreement.IISView.proc_mem_carrier {V : Type u_1} {Input : Type u_2} [DecidableEq V] {R : ℕ} (v : IISView V Input R) :
    def Cslib.Distributed.SetAgreement.iisRun {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} :
    (Fin R → ISSchedule U) → V → IISView V Input R

    Execute R rounds of the full-information Iterated Immediate Snapshot (IIS) protocol on active process set U : Finset V from input assignment inp : V → Input along schedule sequence E : Fin R → ISSchedule U ([BG97], §3.5, p. 5).

    @[simp]
    theorem Cslib.Distributed.SetAgreement.iisRun_zero {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) (E : Fin 0 → ISSchedule U) (p : V) :
    iisRun inp E p = { proc := p, input := inp p }
    theorem Cslib.Distributed.SetAgreement.iisRun_succ {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin (R + 1) → ISSchedule U) (p : V) :
    iisRun inp E p = { proc := p, seen := Finset.image (iisRun inp (Fin.init E)) ((E (Fin.last R)).snapshot p) }
    @[simp]
    theorem Cslib.Distributed.SetAgreement.iisRun_proc {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) (p : V) :
    (iisRun inp E p).proc = p
    theorem Cslib.Distributed.SetAgreement.self_mem_carrier_iisRun {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) (p : V) :
    p ∈ (iisRun inp E p).carrier
    theorem Cslib.Distributed.SetAgreement.carrier_iisRun_subset {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) {p : V} (hp : p ∈ U) :
    (iisRun inp E p).carrier ⊆ U
    theorem Cslib.Distributed.SetAgreement.carrierInputs_iisRun {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) {p : V} (hp : p ∈ U) :
    theorem Cslib.Distributed.SetAgreement.iisRun_congr_carrier {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} {inp₁ inp₂ : V → Input} {R : ℕ} (E : Fin R → ISSchedule U) (p : V) (heq : ∀ q ∈ (iisRun inp₁ E p).carrier, inp₁ q = inp₂ q) :
    iisRun inp₁ E p = iisRun inp₂ E p

    View locality of R-round IIS runs: process p's view depends only on the initial inputs of processes in (iisRun inp₁ E p).carrier.

    theorem Cslib.Distributed.SetAgreement.carrier_iisRun_eq_singleton_of_solo {V : Type u_1} {Input : Type u_2} [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) {p : V} (hsolo : ∀ (r : Fin R), ∃ (tail : List (Finset V)), (E r).blocks = {p} :: tail) :
    (iisRun inp E p).carrier = {p}

    Solo-execution carrier property: if process p runs first alone ({p} :: tail) in every round of E, then (iisRun inp E p).carrier = {p}.

    Extend an IS schedule on U to all of Finset.univ by scheduling all remaining processes univ \ U concurrently in a single trailing block (when (univ \ U).Nonempty).

    theorem Cslib.Distributed.SetAgreement.iisRun_extendToUniv_of_mem {V : Type u_1} {Input : Type u_2} [Fintype V] [DecidableEq V] [DecidableEq Input] {U : Finset V} (inp : V → Input) {R : ℕ} (E : Fin R → ISSchedule U) {p : V} (hp : p ∈ U) :
    iisRun inp (fun (r : Fin R) => (E r).extendToUniv) p = iisRun inp E p

    IIS decision protocols and carrier-input validity #

    structure Cslib.Distributed.SetAgreement.IISProtocol (V : Type u_1) (Val : Type u_2) (R : ℕ) :
    Type (max u_1 u_2)

    An R-round deterministic decision protocol in the Iterated Immediate Snapshot (IIS) model: each process p : V maps its R-round IIS view to an output decision in Val.

    • decide : V → IISView V Val R → Val

      Per-process decision rule applied after R rounds of IIS.

    Global input validity of an R-round IIS protocol: in every full-system execution, every decided value is the initial input of some process in V.

    Carrier-input validity of an R-round IIS protocol: in every full-system execution, every process p decides an input belonging to a process in (iisRun inp E p).carrier (equivalently, in (iisRun inp E p).carrierInputs).

    Iterated immediate snapshot (IIS) carrier-validity step for #7504 (after the input-simplex extension argument of Herlihy and Shavit, Proof of Theorem 3.3, p. 881): because iisRun inp E p depends only on inp restricted to C = (iisRun inp E p).carrier, replacing all inputs outside C with inp p leaves p's R-round view unchanged while restricting all global inputs to C.image inp.