LatticeProduct

@Serializable
class LatticeProduct<A : Quilted<A>, B : Quilted<B>>(val first: A, val second: B) : Quilted<LatticeProduct<A, B>>

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) == p

  • commutative 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

A

the first component lattice type.

B

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)

Constructors

Link copied to clipboard
constructor(first: A, second: B)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val first: A

the first component.

Link copied to clipboard
val second: B

the second component.

Functions

Link copied to clipboard
open override fun causalDots(): Set<Dot>

The union of both components' causal dots.

Link copied to clipboard
open override fun causalFloor(): VersionVector

The elementwise max of both components' compaction floors — the floor counterpart of the causalDots union above.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun piece(other: LatticeProduct<A, B>): LatticeProduct<A, B>

Componentwise join: each component absorbs the corresponding component of other.

Link copied to clipboard
open override fun toString(): String