Finite-batch log-append universal construction over single-use consensus cells #
This module formalizes the finite-invocation-batch (P), unhelped log-append step over idealized
single-use ConsensusCell slots (after [Her91], §4.1, pp. 143–146, Figure 14 p. 145 &
Theorem 14 p. 146) toward #7199. As Herlihy observes ([Her91], §4.1, p. 144), omitting the
announce[1..n] helping array makes log-append nonblocking rather than wait-free across unbounded
invocation streams: here P indexes a finite batch of invocations (Fintype P), slots are
modeled as idealized predetermined-winner ConsensusCells under ValidSlotSchedule rather than
Protocol executions, and [Her91]'s announce/helping array and §4.2 cell reclamation remain
open in #7199.
Within this finite-batch log-append model:
- Each
ConsensusCell αmodels a single-use consensus slot whoseproposeoperation returns the unique agreed winner for that slot (propose_eq). applyLogreplays the deterministic sequential state machineM(SeqSpec State Op Resp) fromM.initalong a list of agreed(caller, operation)commands, andslotLogreads the agreed prefix of lengthkfromslot(slotLog_eqshows all callers reconstruct the identical log prefix without shared locks).universalInvokeexecutes a tagged operation(p, op)starting from the settled log lengthstartSlotobserved when the invocation begins, proposing(p, op)to consecutive consensus slots untilpwins a slotkand then returning the exact sequential response ofM.stepapplied toapplyLog M (slotLog slot (p, op) k).- Under
ValidSlotSchedule(consensus validity, start-time causality, and at-most-once winning across the finite invocation batchP), pigeonhole onFintype.card Pproves completion within at mostFintype.card Pslot attempts (universalInvoke_terminates), unique per-invocation linearization slots (universalInvoke_slotIdx_injective), and Herlihy–Wing linearizability preserving sequential state-machine responses and real-time precedence (universalInvoke_spec,universalInvoke_linearizable_of_validSlotSchedule).
Main definitions #
Cslib.Distributed.SharedMemory.SeqSpec: deterministic sequential state-machine specification.Cslib.Distributed.SharedMemory.ConsensusCell: idealized single-use consensus slot (proposeandpropose_eq), with computable constructorConsensusCell.ofWinner.Cslib.Distributed.SharedMemory.applyLog,Cslib.Distributed.SharedMemory.slotLog: sequential log replay and prefix reconstruction from consensus slots.Cslib.Distributed.SharedMemory.UniversalResult: completed invocation output (slotIdx,resp).Cslib.Distributed.SharedMemory.universalInvokeAux,Cslib.Distributed.SharedMemory.universalInvoke: finite-batch log-append universal invocation.Cslib.Distributed.SharedMemory.SlotActive,Cslib.Distributed.SharedMemory.ValidSlotSchedule: validity and causality conditions on a concurrent consensus-slot execution overP.
Main results #
Cslib.Distributed.SharedMemory.universalInvoke_terminates: every invocationp : Punder aValidSlotSchedulecompletes withinFintype.card Pconsensus slots fromstartSlot p.Cslib.Distributed.SharedMemory.universalInvoke_spec: linearizable state-machine safety — every completed invocation owns its consensus slotk = res.slotIdx, returns the exact sequential response(M.step (applyLog M (slotLog slot probe k)) (ops p)).2, and advances the replayed sequential state toapplyLog M (slotLog slot probe (k + 1)).Cslib.Distributed.SharedMemory.universalInvoke_slotIdx_injective: distinct invocations win distinct consensus log indices (giving a strict total linearization order onP).Cslib.Distributed.SharedMemory.universalInvoke_linearizable_of_validSlotSchedule: finite-batch linearizability underValidSlotSchedule— every invocation completes withinFintype.card Pslots with a unique log slot, exact sequential state-machine response, and real-time precedence ((res p).slotIdx < startSlot q → (res p).slotIdx < (res q).slotIdx).Cslib.Distributed.SharedMemory.universalInvoke_slotIdx_bijective_of_validSlotSchedule: when all invocations start at0underValidSlotSchedule, the winning slots form a bijectionP ≃ Fin (Fintype.card P)permuting allFintype.card Poperations into a single sequential execution ofM.