set

fun set(replica: ReplicaId, timestamp: Long, value: V): LWWRegister<V>

Write value tagged with (timestamp, replica).

Precondition — tag uniqueness. The (replica, timestamp) pair MUST uniquely identify this write. Calling set(r, ts, v1) and then set(r, ts, v2) with the same (replica, timestamp) violates this contract. Under piece, the tie-break else -> this assumes equal tags mean equal values; a duplicate tag with a different value produces non-deterministic convergence — which replica "wins" depends on merge order, not write order.

In practice: use a monotonic source for timestamp per replica (e.g., a logical clock that increments on every write) and never reuse a (replica, timestamp) pair. This is not enforced at runtime.