PROPERTY // 01
Commutativity
merge(A, B) = merge(B, A). Updates can arrive in any arbitrary order across network hops without altering the final converged state. Packet reordering by routers causes zero divergence.
When multiple independent nodes mutate document states concurrently without central lock orchestration, mathematical guarantees must ensure all peers reach identical states regardless of network latency, message interleaving, or packet drops.
Algebraic Foundations
For any two replicas to converge deterministically after merging incoming state updates, the merge function must satisfy three fundamental algebraic properties.
PROPERTY // 01
merge(A, B) = merge(B, A). Updates can arrive in any arbitrary order across network hops without altering the final converged state. Packet reordering by routers causes zero divergence.
PROPERTY // 02
merge(merge(A, B), C) = merge(A, merge(B, C)). Grouping of synchronization packets does not alter outcomes. Batched sync bundles compute identical values to single-message broadcasts.
PROPERTY // 03
merge(A, A) = A. Receiving the exact same update twice (duplicate packets, retry loops, dropped acknowledgments) does not duplicate data or trigger accidental state duplication.
State-Based (CvRDT): Nodes transmit their entire monotonic state payload during sync. Extremely simple and fault tolerant, but payload sizes grow proportionally with history unless compaction runs.
Operation-Based (CmRDT): Nodes transmit discrete atomic operations (e.g., insert(char, id, origin)). Requires an underlying causal messaging transport.
Delta-State (d-CRDT): The modern standard used by Yjs and Automerge. Nodes track mutations since their peer's last known state vector, transmitting only compact binary diffs.
Topological Architectures
How local nodes discover peers, stream binary deltas, and maintain partition resilience across varied network environments.
TOPOLOGY // A
Clients connect to an ultra-lightweight, zero-knowledge WebSocket relay server (such as Cloudflare Workers or an Elixir cluster). The relay never executes application business logic or parses payloads; it simply echoes authenticated, encrypted binary deltas to matching room subscribers.
TOPOLOGY // B
Nodes discover peers on the local LAN using mDNS or broadcast beacons, or across the internet via transient STUN/TURN signaling. Once paired, data updates flow directly from machine to machine with zero intermediation.
Conflict Resolution Taxonomy
Different data domains demand different merge semantics. A collaborative text document requires character preservation, while an account balance requires scalar summation.
| Data Structure | Primitive Type | Resolution Strategy | Common Use Case |
|---|---|---|---|
| PN-Counter | Scalar Integer | Monotonically increasing Positive/Negative vector summation | Likes, upvotes, inventory tallies, page counters |
| LWW-Register | Atomic Value | Highest Lamport timestamp with client-UUID tiebreak | User profile avatar, title changes, toggle flags |
| MV-Register | Multi-Value | Preserves all concurrent conflicting values for user triage | Medical records, high-stakes accounting entries |
| OR-Set | Collection | Unique tag attached to each element; Add takes precedence over Delete | Tags, collaborative to-do items, multi-select lists |
| YATA / Fugue | Sequence / Tree | Deterministic interleaved character insertion tree without tombstone bloat | Rich text editors, source code, collaborative canvases |
| Merkle Search Tree | Key-Value Store | Content-addressed balanced prefix tree for logarithmic diff reconciliation | Syncing multi-gigabyte client databases efficiently |