LatticeProduct
The componentwise product of two join-semilattices.
Given two Quilted types A and B, the pair (a, b) forms a new join-semilattice whose join (piece) is applied to each component independently:
(a₁, b₁).piece(a₂, b₂) = (a₁.piece(a₂), b₁.piece(b₂))This is monotone by construction: componentwise join of two semilattices is itself a semilattice. The three lattice laws follow directly from the laws already satisfied by A and B:
idempotent
p.piece(p) == pcommutative
p.piece(q) == q.piece(p)associative
p.piece(q).piece(r) == p.piece(q.piece(r))
Use on the coordination-free path: combine two CoordinationFree values into a single atomic snapshot via the us.tractat.kuilt.warp.zip combinator in :kuilt-warp.
Type Parameters
the first component lattice type.
the second component lattice type.
Samples
val r1 = ReplicaId("r1")
val r2 = ReplicaId("r2")
// Two replicas each carry a (counter, tags) pair.
val replicaA = LatticeProduct.of(GCounter.of(r1 to 3L), GSet.of("alpha"))
val replicaB = LatticeProduct.of(GCounter.of(r2 to 7L), GSet.of("beta"))
// Componentwise join: counter sums, set unions.
val merged = replicaA.piece(replicaB)
check(merged.first.value == 10L) // 3 + 7
check(merged.second.elements == setOf("alpha", "beta"))
// Idempotent: merging again changes nothing.
check(merged.piece(replicaA) == merged)Properties
Functions
The union of both components' causal dots.
The elementwise max of both components' compaction floors — the floor counterpart of the causalDots union above.
Componentwise join: each component absorbs the corresponding component of other.