Documentation

CslibFrontier.Computability.Distributed.SetAgreement.AtomicSnapshot.WaitFree

Wait-free O(n²) step and shared-register operation complexity #

Defines remainingSteps, remainingRegOps, and isRegAccessStep, proving unconditional O(n²) per-process wait-free completion bounds (exists_solo_completion, [AAD+93], Lemma 3.4, p. 10).

Main definitions #

Main results #

Wait-free O(n²) step complexity (Lemma 3.4) #

Remaining protocol steps (including local loop-boundary evaluations) for process i to finish its current operation (0 when idle).

Remaining shared-register operations (Read or Write, excluding purely local transitions) for process i to finish its current operation (0 when idle).

def Cslib.Distributed.SetAgreement.isRegAccessStep {P : Type u_1} {Data : Type u_2} (s : SnapshotState P Data) (i : P) :

Whether transition stepSnapshot ord dInit s (.step i) performs a shared-register Read or Write (true) versus a local loop evaluation (false).

theorem Cslib.Distributed.SetAgreement.remainingSteps_le_quad {P : Type u_1} {Data : Type u_2} [Fintype P] (ord : ScanOrder P) (ps : ProcSnapshotState P Data) (hrem : ∀ (st : ActiveScan P Data), ps = ProcSnapshotState.scanning st → st.rem.length ≤ ord.elems.length) :
remainingSteps ord ps ≤ (2 * Fintype.card P + 2) * (Fintype.card P + 1) + 1

Unbounded sequence-numbered single-writer step for #7504 (after Afek et al., Lemma 3.4, p. 10): in every state with st.rem.length ≤ n, remainingSteps is at most (2n + 2)(n + 1) + 1 = 2n² + 4n + 3 where n = Fintype.card P.

theorem Cslib.Distributed.SetAgreement.remainingRegOps_invokeScan {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) {s s' : SnapshotState P Data} {i : P} (h : stepSnapshot ord dInit s (SnapshotEvent.invokeScan i) = some s') :

Unbounded sequence-numbered single-writer step for #7504 (after Afek et al., Lemma 3.4, p. 10): immediately after invokeScan i, remainingRegOps equals 2 * n * (n + 1) (O(n²) shared-register reads, bounded across subsequent steps by remainingSteps_lt_of_step).

theorem Cslib.Distributed.SetAgreement.remainingRegOps_invokeUpdate {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) {s s' : SnapshotState P Data} {i : P} {val : Data} (h : stepSnapshot ord dInit s (SnapshotEvent.invokeUpdate i val) = some s') :

Unbounded sequence-numbered single-writer step for #7504 (after Afek et al., Lemma 3.4, p. 10): immediately after invokeUpdate i val, remainingRegOps equals 2 * n * (n + 1) + 1 (O(n²) shared-register reads plus 1 write, bounded across subsequent steps by remainingSteps_lt_of_step).

theorem Cslib.Distributed.SetAgreement.proc_eq_of_other_event {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) {s s' : SnapshotState P Data} {ev : SnapshotEvent P Data} {i : P} (hne : ev ≠ SnapshotEvent.invokeScan i ∧ (∀ (v : Data), ev ≠ SnapshotEvent.invokeUpdate i v) ∧ ev ≠ SnapshotEvent.step i) (h : stepSnapshot ord dInit s ev = some s') :
s'.proc i = s.proc i

Any event performed by another process j ≠ i leaves i's local state and remainingSteps completely unchanged.

theorem Cslib.Distributed.SetAgreement.remainingSteps_eq_of_other {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) {s s' : SnapshotState P Data} {ev : SnapshotEvent P Data} {i : P} (hne : ev ≠ SnapshotEvent.invokeScan i ∧ (∀ (v : Data), ev ≠ SnapshotEvent.invokeUpdate i v) ∧ ev ≠ SnapshotEvent.step i) (h : stepSnapshot ord dInit s ev = some s') :
remainingSteps ord (s'.proc i) = remainingSteps ord (s.proc i)
theorem Cslib.Distributed.SetAgreement.remainingSteps_lt_of_step {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) {s s' : SnapshotState P Data} {i : P} (h : stepSnapshot ord dInit s (SnapshotEvent.step i) = some s') :

Unbounded sequence-numbered single-writer step for #7504 (after Afek et al., Lemma 3.4, p. 10): every atomic .step i of an active process i strictly decreases remainingSteps ord (s.proc i), and decreases remainingRegOps whenever a shared register is accessed (isRegAccessStep).

theorem Cslib.Distributed.SetAgreement.step_enabled_of_not_idle {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) (s : SnapshotState P Data) (i : P) (hact : s.proc i ≠ ProcSnapshotState.idle) :
∃ (s' : SnapshotState P Data), stepSnapshot ord dInit s (SnapshotEvent.step i) = some s'

Whenever s.proc i ≠ .idle, .step i is enabled (stepSnapshot ord dInit s (.step i) returns some s').

theorem Cslib.Distributed.SetAgreement.exists_solo_completion {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] (ord : ScanOrder P) (dInit : Data) (s : SnapshotState P Data) (i : P) :
∃ (k : ℕ) (s' : SnapshotState P Data), k ≤ remainingSteps ord (s.proc i) ∧ (snapshotLTS ord dInit).MTr s (List.replicate k (SnapshotEvent.step i)) s' ∧ s'.proc i = ProcSnapshotState.idle

Unbounded sequence-numbered single-writer step for #7504 (after Afek et al., Lemma 3.4, p. 10): from any state s, running process i alone drives i to .idle in at most remainingSteps ord (s.proc i) transitions.