Documentation

CslibFrontier.Computability.Distributed.CRDT.Monotonicity

Semilattice Irrevocable-Emission Coordination-Free Consistency ↔ Monotonicity #

This module formalizes a semilattice irrevocable-emission and monotone-observation model step toward #7502 for coordination-free distributed query evaluation over partitionable CvRDT semilattices (motivated by Hellerstein's CALM Conjecture [Hel10], §4.1 Conjecture 1, and the relational-transducer characterization of Ameloot, Neven, and Van den Bussche [ANVdB11], §§2.1, 3–6, Proposition 11, Theorem 12, and Corollary 13).

In a partitionable asynchronous CvRDT network over finite replica set P and state semilattice S ([SemilatticeSup S]):

Main theorems in the semilattice model #

  1. Exact Semilattice iff Characterization (semilatticeCoordinationFreeConsistent_iff_monotone): Over any multi-replica network ([Nontrivial P], i.e. at least two distinct replicas), an irrevocable fact-emission query emit : S → Finset Fact is coordination-free consistent if and only if Monotone emit holds on the state semilattice S (using the two-replica split-brain horizontal partition construction of [ANVdB11], §6, proof of Theorem 12). Moreover, when Monotone emit holds, any all-pairs gossip schedule brings every replica's accumulated irrevocable output to the exact global answer emit (globalMergedState cfg) (emitted_eq_global_of_monotone), whereas on a 1-node network ([Subsingleton P]) every query trivially avoids cross-replica retraction (semilatticeCoordinationFreeConsistent_of_subsingleton, matching [ANVdB11], §4 Example 2).
  2. Preorder-Valued Observable Queries (semilatticeObservableConsistent_iff_monotone): Generalizes the characterization to arbitrary [Preorder Out] local observations q : S → Out (SemilatticeObservableConsistent P q ↔ Monotone q under [Nontrivial P]).
  3. Positive Monotone CRDT Queries: Threshold queries on GCounter (gcounterThresholdEmit, gcounterThresholdBool) and membership / monotone selection-projection queries on GSet (gsetMemEmit, gsetFilterImage) are proved coordination-free consistent.
  4. Negative Non-Monotone CRDT Queries (Split-Brain Retraction Refutations): Set emptiness (gsetIsEmptyEmit, [ANVdB11], §5 Example 10), negation / tombstone set difference (TwoPhaseSet.elements), and exact count (gcounterExactCountEmit k) all fail monotonicity and are refuted as coordination-free consistent over any [Nontrivial P].

Model scope relative to primary sources #

This module models local query evaluation emit : S → Finset Fact and q : S → Out over abstract SemilatticeSup S replica states and gossip merges rather than the full relational transducer networks (N, Π) over database schemas (S_in, S_sys, S_msg, S_mem) with Id/All system relations, network-topology independence, obliviousness equivalence, and syntactic Datalog / FO+while / Dedalus characterizations of [ANVdB11] (§§2–8, Theorems 6, 12, 16, 18 & Corollaries 13, 14, 17). Those database-transducer and query-language characterizations remain open under #7502.

Main definitions #

Main results #

References #

Semilattice Irrevocable-Emission Gossip Model #

def Cslib.Distributed.CRDT.globalMergedState {P : Type u_1} {S : Type u_2} [Fintype P] [Nonempty P] [SemilatticeSup S] (cfg : P → S) :
S

Globally converged semilattice state ⨆ p : P, cfg p across all replicas p : P.

def Cslib.Distributed.CRDT.gossipReplicaStates {P : Type u_1} {S : Type u_2} [DecidableEq P] [SemilatticeSup S] (cfg : P → S) (hops : List (P × P)) :
P → S

Replica states resulting from folding asynchronous (· ⊔ ·) gossip merges hops from cfg.

structure Cslib.Distributed.CRDT.IrrevocableReplicaState (P : Type u_1) (S : Type u_2) (Fact : Type u_3) :
Type (max (max u_1 u_2) u_3)

Distributed state of replicas running a semilattice CvRDT alongside an irrevocable output accumulator emitted : P → Finset Fact (modeling append-only transition outputs out(ρ) = ⋃_n out(τ_n) as in [ANVdB11], §2.1 & §3, pp. 3–4).

  • replica : P → S

    Current local semilattice state at each replica.

  • emitted : P → Finset Fact

    Cumulative set of facts irrevocably emitted at each replica so far.

theorem Cslib.Distributed.CRDT.IrrevocableReplicaState.ext {P : Type u_1} {S : Type u_2} {Fact : Type u_3} {x y : IrrevocableReplicaState P S Fact} (replica : x.replica = y.replica) (emitted : x.emitted = y.emitted) :
x = y
def Cslib.Distributed.CRDT.initIrrevocableState {P : Type u_1} {S : Type u_2} {Fact : Type u_3} (emit : S → Finset Fact) (cfg : P → S) :

Initial coordination-free configuration: before any cross-replica messages are exchanged, each replica p evaluates and emits emit (cfg p) purely from its own local state cfg p.

def Cslib.Distributed.CRDT.gossipEmitStep {P : Type u_1} {S : Type u_2} {Fact : Type u_3} [DecidableEq P] [SemilatticeSup S] [DecidableEq Fact] (emit : S → Finset Fact) (st : IrrevocableReplicaState P S Fact) (hop : P × P) :

One asynchronous gossip-and-emit step along directed pair hop = (src, dst): dst merges src's state via (· ⊔ ·) and irrevocably appends emit evaluated at its updated state.

def Cslib.Distributed.CRDT.runGossipEmit {P : Type u_1} {S : Type u_2} {Fact : Type u_3} [DecidableEq P] [SemilatticeSup S] [DecidableEq Fact] (emit : S → Finset Fact) (cfg : P → S) (hops : List (P × P)) :

Execute a finite schedule hops : List (P × P) of asynchronous gossip merges starting from initIrrevocableState emit cfg.

def Cslib.Distributed.CRDT.SemilatticeCoordinationFreeConsistent (P : Type u_1) [Fintype P] [DecidableEq P] [Nonempty P] {S : Type u_2} {Fact : Type u_3} [SemilatticeSup S] [DecidableEq Fact] (emit : S → Finset Fact) :

Coordination-free consistency in the semilattice irrevocable-emission model (step toward #7502, motivated by [Hel10], §4.1 Conjecture 1, and [ANVdB11], §§4–5): across all partitioned initial assignments cfg : P → S and all asynchronous gossip schedules hops, no replica ever irrevocably emits a split-brain fact outside the globally converged answer emit (globalMergedState cfg).

Every monotone query emit : S → Finset Fact is coordination-free consistent over any nonempty finite replica set P.

Semilattice irrevocable-emission coordination-free consistency characterization step (toward #7502, adapting the split-brain horizontal-partition argument of [ANVdB11], §6 Theorem 12 & Corollary 13, p. 8, to SemilatticeSup S states, motivated by [Hel10], §4.1 Conjecture 1): over any finite network P with at least two distinct replicas ([Nontrivial P]), SemilatticeCoordinationFreeConsistent P emit holds if and only if Monotone emit.

theorem Cslib.Distributed.CRDT.emitted_eq_global_of_monotone {P : Type u_1} {S : Type u_2} {Fact : Type u_3} [Fintype P] [DecidableEq P] [SemilatticeSup S] [DecidableEq Fact] [Nonempty P] {emit : S → Finset Fact} (hmono : Monotone emit) (cfg : P → S) {hops : List (P × P)} (hcovers : ∀ (src dst : P), (src, dst) ∈ hops) (p : P) :
(runGossipEmit emit cfg hops).replica p = globalMergedState cfg ∧ (runGossipEmit emit cfg hops).emitted p = emit (globalMergedState cfg)

Under Monotone emit, any gossip schedule hops that covers every ordered pair (src, dst) (∀ src dst, (src, dst) ∈ hops) converges every replica p's state to globalMergedState cfg and its cumulative irrevocable output to the exact global answer emit (globalMergedState cfg).

Single-replica degeneracy step (toward #7502, after [ANVdB11], §4 Example 2, p. 5): on a 1-replica network ([Subsingleton P]), SemilatticeCoordinationFreeConsistent P emit holds for every emit (even non-monotone ones), confirming that [Nontrivial P] (2 ≤ |P|) in semilatticeCoordinationFreeConsistent_iff_monotone is necessary.

Preorder-Valued Observable Queries (q : S → Out) #

def Cslib.Distributed.CRDT.SemilatticeObservableConsistent (P : Type u_1) [Fintype P] [DecidableEq P] [Nonempty P] {S : Type u_2} {Out : Type u_3} [SemilatticeSup S] [Preorder Out] (q : S → Out) :

Semilattice observable-query consistency over [Preorder Out]: at every point along any asynchronous gossip schedule hops from any partitioned configuration cfg : P → S, every replica's local observation q (state p) is bounded above in Out by the globally converged answer q (globalMergedState cfg) (for instance, on Bool with false ≤ true, once a local predicate becomes true it never flips back to false upon merging remote partitions).

Every monotone observation q : S → Out is observable-consistent over any nonempty finite replica set P.

Semilattice observable-query consistency characterization step (toward #7502): over any finite network P with [Nontrivial P], SemilatticeObservableConsistent P q holds if and only if Monotone q.

Positive Monotone CRDT Query Instantiations #

Threshold fact emission on GCounter Q (k ≤ c.value), e.g. quorum/threshold crossing ([Hel10], §3.4.3 & §4.1, PDF pp. 9, 11).

Boolean threshold observation decide (k ≤ c.value) on GCounter Q.

def Cslib.Distributed.CRDT.gsetMemEmit {α : Type u_1} [DecidableEq α] (x : α) (s : Finset α) :

Existential / element-membership fact emission on GSet α (Finset α).

def Cslib.Distributed.CRDT.gsetFilterImage {α : Type u_1} {β : Type u_2} [DecidableEq β] (pred : α → Bool) (f : α → β) (s : Finset α) :

Monotone relational selection-and-projection query (s.filter (pred · = true)).image f on GSet α.

theorem Cslib.Distributed.CRDT.monotone_gsetFilterImage {α : Type u_1} {β : Type u_2} [DecidableEq β] (pred : α → Bool) (f : α → β) :

Negative Non-Monotone CRDT Query Instantiations (Split-Brain Retractions) #

Emptiness fact emission on GSet α (s = ∅, [ANVdB11], §5 Example 10, p. 7).

Exact-count fact emission on GCounter Q (c.value = k).

Semilattice emptiness non-monotonicity step (toward #7502, after [ANVdB11], §5 Example 10, p. 7): set emptiness is non-monotone and therefore cannot be evaluated coordination-freely without split-brain retraction over [Nontrivial P].

Set difference / tombstone negation (TwoPhaseSet.elements : s ↦ s.added \ s.removed) is non-monotone in TwoPhaseSet α and therefore suffers split-brain retraction as an irrevocable emission query over [Nontrivial P].

Exact-count queries (c.value = k) on GCounter Q ([Nonempty Q]) fail monotonicity for every k : ℕ and therefore cannot be evaluated coordination-freely without split-brain retraction over [Nontrivial P].