LatticeOp

class LatticeOp<S>(val name: String, val kind: OpKind, val apply: (state: S, replicaIndex: Int, random: Random) -> S)

One named operation a binding can perform against its state.

The alphabet is the binding's whole vocabulary: LatticeLawHarness draws from it to build the randomised causal pool, and LatticeLawHarness.criticalShapes names its members to construct the shapes that must be reached on every seed rather than on a lucky one. One alphabet driving both is the point — a constructed shape and a random trajectory cannot drift into describing different sets of operations.

Parameters

name

the identifier a critical shape uses to name this op. Unique within an alphabet.

kind

see OpKind — declared, because it is not computable.

apply

produce the next state. replicaIndex is 0 until replicaCount; derive whatever identity the type needs from it. random is the pool builder's stream — see the determinism note below.

An op named by a critical shape must be deterministic in its target. A shape like put · remove · put only means anything if all three touch the same key, so an op that draws its key from random cannot appear in one. Declare a target-pinned variant for the shape and let the roaming variant serve random exploration. This is not merely advice: the harness asserts every step of every shape changed the state, so a shape whose remove wanders off the key its put created fails rather than quietly becoming decoration.

Constructors

Link copied to clipboard
constructor(name: String, kind: OpKind, apply: (state: S, replicaIndex: Int, random: Random) -> S)

Properties

Link copied to clipboard
val apply: (state: S, replicaIndex: Int, random: Random) -> S
Link copied to clipboard
Link copied to clipboard

Functions

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