Documentation

CslibFrontier.Computability.Distributed.SetAgreement.AtomicSnapshot.LinearizationChunks

Internal linearization chunk construction and prefix validity #

Constructs step-indexed linearization chunks (linScansAt, linUpdatesAt, linChunk, linPrefix) from TraceInv and proves duplicate-freeness, sequential validity, and real-time chunk ordering; never re-exported through AtomicSnapshot.

Main definitions #

Main results #

noncomputable def Cslib.Distributed.SetAgreement.SnapshotTrace.linScanPoint {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (invStep resp : ℕ) (snap : P → Data) :

Witness serialization step in (invStep, resp] selected for a completed scan returning snap (returns 0 when no such witness exists).

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.linScanPoint_spec {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) {invStep resp : ℕ} {snap : P → Data} (hex : ∃ (v : ℕ), invStep + 1 ≤ v ∧ v ≤ resp ∧ memSnapshot (τ.stateAt v).reg = snap) :
invStep + 1 ≤ τ.linScanPoint invStep resp snap ∧ τ.linScanPoint invStep resp snap ≤ resp ∧ memSnapshot (τ.stateAt (τ.linScanPoint invStep resp snap)).reg = snap

Specification satisfied by linScanPoint when a witnessing snapshot step exists.

noncomputable def Cslib.Distributed.SetAgreement.SnapshotTrace.linScansAt {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (t : ℕ) :

Final-history indices of completed scans serialized at step t.

def Cslib.Distributed.SetAgreement.SnapshotTrace.linUpdatesAt {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (t : ℕ) :

Final-history indices of completed updates that wrote at step t.

noncomputable def Cslib.Distributed.SetAgreement.SnapshotTrace.linChunk {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (t : ℕ) :

Completed operations linearized at trace step t (scans before the atomic write at t).

noncomputable def Cslib.Distributed.SetAgreement.SnapshotTrace.linPrefix {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (k : ℕ) :

Linearization prefix covering trace steps 0, …, k - 1.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.mem_linScansAt_iff {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (t id : ℕ) :
id ∈ τ.linScansAt t ↔ ∃ (hId : id < (τ.stateAt τ.events.length).history.length) (r : ℕ) (sn : P → Data), (τ.stateAt τ.events.length).history[id].status = SnapshotOpStatus.doneScan r sn ∧ τ.linScanPoint (τ.stateAt τ.events.length).history[id].invStep r sn = t

Membership characterization for linScansAt.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.mem_linUpdatesAt_iff {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (t id : ℕ) :

Membership characterization for linUpdatesAt.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.eq_of_mem_linChunk {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) {t₁ t₂ x : ℕ} (h₁ : x ∈ τ.linChunk t₁) (h₂ : x ∈ τ.linChunk t₂) :
t₁ = t₂

Every linearized index appears in at most one step chunk linChunk τ t.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.nodup_linPrefix {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (k : ℕ) :

linPrefix τ k is duplicate-free for every k.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.linPrefix_valid {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (hinv : ∀ m ≤ τ.events.length, τ.TraceInv m) (k : ℕ) :
k ≤ τ.events.length + 1 → seqSnapshotValid (fun (x : P) => dInit) (τ.stateAt τ.events.length).history (τ.linPrefix k) ∧ (k ≤ τ.events.length → seqSnapshotMemAfter (fun (x : P) => dInit) (τ.stateAt τ.events.length).history (τ.linPrefix k) = memSnapshot (τ.stateAt k).reg)

By induction on k ≤ τ.events.length + 1, linPrefix τ k is valid against seqSnapshotValid and replays to memSnapshot (τ.stateAt k).reg for k ≤ τ.events.length.

theorem Cslib.Distributed.SetAgreement.SnapshotTrace.linChunk_lt_of_realTime {P : Type u_1} {Data : Type u_2} [Fintype P] [DecidableEq P] {ord : ScanOrder P} {dInit : Data} (τ : SnapshotTrace ord dInit) (inv : τ.TraceInv τ.events.length) {t₁ t₂ i j r : ℕ} {recJ : SnapshotOpRecord P Data} (hi : i ∈ τ.linChunk t₁) (hj : j ∈ τ.linChunk t₂) (hresp_i : (τ.stateAt τ.events.length).history[i]?.bind SnapshotOpRecord.respStep? = some r) (hget_j : (τ.stateAt τ.events.length).history[j]? = some recJ) (hr_le : r ≤ recJ.invStep) :
t₁ < t₂

Real-time precedence between linearization chunks: if i completes by step r and j is invoked at or after step r, then i's chunk index is strictly smaller than j's.