Internal trace write-step monotonicity and last-idle-step helpers #
Internal trace predicates (isWriteStep, lastIdleStep) and register-sequence monotonicity lemmas
shared across ScanLoopInv, TraceInv, TracePreservation, LinearizationChunks, and
Linearizability; never re-exported through AtomicSnapshot.
Main definitions #
Cslib.Distributed.SetAgreement.SnapshotTrace.isWriteStep,Cslib.Distributed.SetAgreement.SnapshotTrace.lastIdleStep: trace write and last-idle steps.
Main results #
Cslib.Distributed.SetAgreement.SnapshotTrace.reg_step_iff,Cslib.Distributed.SetAgreement.SnapshotTrace.seq_mono_and_const_of_eq,Cslib.Distributed.SetAgreement.SnapshotTrace.exists_writeStep_of_seq_ne,Cslib.Distributed.SetAgreement.SnapshotTrace.exists_last_writeStep_of_seq_pos: register monotonicity and write lookup.Cslib.Distributed.SetAgreement.getElem_completeHistoryAt_of_status_ne: preserved non-matching history entries.
Predicate identifying when event t < τ.events.length is the atomic register write of
update_j (proc j = .readyToWrite ... and events[t] = .step j).
Single-step register change characterization: reg j changes at step t if and only if
isWriteStep τ j t holds, in which case (reg j).seq increments by 1.
Sequence numbers on reg j are monotone along any trace, and equal across [t₁, t₂] iff
reg j is constant across [t₁, t₂].
If ((τ.stateAt t₁).reg j).seq ≠ ((τ.stateAt t₂).reg j).seq for t₁ ≤ t₂ ≤ τ.events.length,
then j executed an atomic register write isWriteStep τ j w at some step t₁ ≤ w < t₂.
If (τ.stateAt t).reg j has .seq > 0 (t ≤ τ.events.length), there is a most recent
isWriteStep τ j w with w < t such that (τ.stateAt t).reg j = (τ.stateAt (w + 1)).reg j and
no write by j occurred in [w + 1, t).
Proof-only helper: the largest step index m ≤ t at which (τ.stateAt m).proc i = .idle
(well-defined since m = 0 always has (τ.stateAt 0).proc i = .idle).
Monotonicity of lastIdleStep with respect to any earlier idle step m ≤ t.
Recurrence for lastIdleStep i (t + 1) when proc i is non-idle at step t + 1.
History entry lookup when its updated status differs from newSt.