abstract fun apply(state: S, action: A): S Returns the successor state after applying action to state.
Must be pure and deterministic: no side effects, no mutable shared state, no I/O. Both optimistic apply and replay call this method — identical inputs must always yield identical outputs.