Asynchronous message-passing executions, happens-before causality, and consistent cuts #
This module formalizes finite causally well-formed asynchronous point-to-point message-passing
executions over a process type P, Lamport's happens-before strict partial order [Lam78],
causal concurrency, executable causal-past computation, and downward-closed consistent cuts
[Mat89].
An Execution P records a finite sequence steps : List (Step P) of process steps:
Step.internal actor: an internal step at processactor,Step.send actor dest: a point-to-point message send fromactortodest,Step.recv actor sendIdx: receipt atactorof the message sent at earlier trace indexsendIdx < i(recv_valid), with at-most-once delivery per sent message (recv_injective).
Events E.Event wrap Fin E.steps.length so that E.Event carries Lamport's causal
PartialOrder (≤ for HappensBeforeLe, < for HappensBefore) without colliding with the
linear trace-index order on Fin.
Relationship to Cslib.DistributedConsistency #
Upstream Cslib.DistributedConsistency (AbstractExecution.hb) models axiomatic replicated-data
consistency following Burckhardt (2014), taking session order and visibility relations over an
abstract event set where acyclicity (NoCircularCausality) is an explicit hypothesis. Here
Execution P models operational asynchronous message-passing traces whose happens-before relation
is unconditionally a PartialOrder / IsStrictOrder with executable O(n²) decidability,
supporting operational Lamport scalar clocks, Fidge–Mattern vector clocks, and Charron-Bost's
clock-dimension lower bound in companion modules.
Main definitions #
Cslib.Distributed.VectorClock.Step: local, send, or receive process step.Cslib.Distributed.VectorClock.Execution: causally well-formed finite message-passing execution.Cslib.Distributed.VectorClock.Execution.Event: event of an execution carrying the causalPartialOrder.Cslib.Distributed.VectorClock.Execution.ProgramOrder,Cslib.Distributed.VectorClock.Execution.MessageOrder,Cslib.Distributed.VectorClock.Execution.CausalStep: direct same-process and send-to-receive causal edges.Cslib.Distributed.VectorClock.Execution.HappensBefore,Cslib.Distributed.VectorClock.Execution.HappensBeforeLe: strict and reflexive causal ordering onE.Event.Cslib.Distributed.VectorClock.Execution.Concurrent: causal incomparability onE.Event.Cslib.Distributed.VectorClock.Execution.causalPast,Cslib.Distributed.VectorClock.Execution.causalPastLe: computableFinsetof causal predecessors of an event.Cslib.Distributed.VectorClock.Execution.IsConsistentCut: downward-closed event subsets (consistent global cuts).Cslib.Distributed.VectorClock.Execution.ofInternal,Cslib.Distributed.VectorClock.Execution.IsValidSteps,Cslib.Distributed.VectorClock.Execution.ofValidSteps: constructors for communication-free local schedules anddecide-validated concrete step traces.Cslib.Distributed.VectorClock.Execution.map: pushforward of an execution along a process renamingP → Q.
Main results #
Cslib.Distributed.VectorClock.Execution.happensBefore_idx_lt: causal precedence strictly respects trace indices, establishing acyclicity.Cslib.Distributed.VectorClock.Execution.instPartialOrderEvent,Cslib.Distributed.VectorClock.Execution.instIsStrictOrderEventHappensBefore:PartialOrderandIsStrictOrderinstances onE.Event.Cslib.Distributed.VectorClock.Execution.mem_causalPast,Cslib.Distributed.VectorClock.Execution.instDecidableHappensBefore: exact characterization of the forward dynamic-programming causal-past table and decidability ofHappensBefore.Cslib.Distributed.VectorClock.Execution.causal_trichotomy: any two events are equal, ordered byHappensBeforein one direction, orConcurrent.Cslib.Distributed.VectorClock.Execution.IsConsistentCut.union,Cslib.Distributed.VectorClock.Execution.IsConsistentCut.inter: consistent cuts form a distributive sublattice under∪and∩.Cslib.Distributed.VectorClock.Execution.IsConsistentCut.send_mem_of_recv_mem: consistent cuts contain no orphan message receives.Cslib.Distributed.VectorClock.Execution.map_happensBeforeLe_iff: injective process renaming induces an order-isomorphism on causal event posets.
References #
A single local or communication step in an asynchronous message-passing execution over
process type P. A .recv actor sendIdx step references the trace index sendIdx of the
matching .send step whose message is delivered.
- internal {P : Type u} (actor : P) : Step P
Internal computation step at process
actor. - send {P : Type u} (actor dest : P) : Step P
Point-to-point message send from
actortodest. - recv {P : Type u} (actor : P) (sendIdx : ℕ) : Step P
Receipt at
actorof the message sent at trace indexsendIdx.
Instances For
The process executing a given Step.
A finite causally well-formed asynchronous point-to-point message-passing execution over
processes P. Every .recv actor sIdx step references a strictly earlier .send src actor
step (sIdx < i), and each sent message is delivered at most once (recv_injective).
Linearly indexed sequence of steps in the execution.
- recv_valid (i : Fin self.steps.length) (p : P) (sIdx : ℕ) : self.steps[i] = Step.recv p sIdx → ∃ (hs : sIdx < ↑i) (src : P), self.steps[sIdx] = Step.send src p
Every receive step references a strictly earlier send step addressed to the receiver.
- recv_injective (i j : Fin self.steps.length) (p₁ p₂ : P) (sIdx : ℕ) : self.steps[i] = Step.recv p₁ sIdx → self.steps[j] = Step.recv p₂ sIdx → i = j
Each sent message is received at most once along the execution.
The empty execution with zero events.
Communication-free execution consisting solely of internal steps on procs.
Executable Boolean check certifying that steps : List (Step P) forms a causally well-formed
Execution P (enabling Execution.ofValidSteps steps (by decide) in module clients).
Construct an Execution P from a step list certified by IsValidSteps steps = true.
An event of execution E, wrapping its trace index in E.steps so that E.Event carries
Lamport's causal happens-before PartialOrder without conflicting with the trace-index linear
order on Fin E.steps.length.
Trace index of the event in
E.steps.
Instances For
The process at which event e occurs.
Direct causality and Lamport's happens-before poset #
Lamport's strict happens-before relation ([Lam78]), defined as the transitive closure
of CausalStep.
Instances For
Reflexive-transitive causal ordering on events (e₁ = e₂ ∨ E.HappensBefore e₁ e₂).
Instances For
If e₂.step = .recv p e₁.idx.val, then MessageOrder e₁ e₂ holds.
Direct causal steps strictly advance the execution trace index.
Causal precedence strictly respects trace indices (e₁ ≺ e₂ → e₁.idx < e₂.idx), witnessing
acyclicity of happens-before in every well-formed execution.
Reflexive causal precedence implies non-strict trace-index ordering.
Strict HappensBefore is irreflexive.
Strict HappensBefore is transitive.
Strict HappensBefore is asymmetric.
HappensBeforeLe holds iff the events are equal or related by strict HappensBefore.
HappensBeforeLe is reflexive.
HappensBeforeLe is transitive.
HappensBeforeLe is antisymmetric.
Every strict HappensBefore edge implies HappensBeforeLe.
Distinct events related by HappensBeforeLe are related by strict HappensBefore.
Same-process program order implies HappensBefore.
Non-strict same-process trace order implies HappensBeforeLe.
Point-to-point message order implies HappensBefore.
Same-process events are ordered by HappensBeforeLe iff their trace indices are ordered.
Same-process events are ordered by HappensBefore iff their trace indices are strictly
ordered.
In Execution.ofInternal procs, causal ordering reduces purely to same-process program
order.
Concurrency #
Concurrency is irreflexive.
Concurrent events are distinct.
Concurrency is symmetric.
Causal trichotomy: any two events in E are equal, strictly ordered by HappensBefore in one
direction, or Concurrent.
Executable causal-past dynamic programming and decidability #
Forward dynamic-programming table computing, for the first k events of E, the reflexive
causal-past index list of each event < k. Pattern-matching on the recursive list forces kernel
WHNF evaluation once per step during decide.
Executable Boolean decision procedure for E.HappensBeforeLe e₁ e₂.
decideHappensBeforeLe returns true iff HappensBeforeLe holds.
The computable Finset of events in the reflexive causal past of e ({x | x ≼ e}).
The computable Finset of events in the strict causal past of e ({x | x ≺ e}).
Consistent cuts #
Characterization of consistent cuts via reflexive HappensBeforeLe.
Consistent cuts are downward closed under HappensBeforeLe.
Consistent cuts are closed under binary union.
Consistent cuts are closed under binary intersection.
The strict causal past of any event is a consistent cut.
The reflexive causal past of any event is a consistent cut.
Absence of orphan receives: if a consistent cut C contains a receive event e, it also
contains the matching earlier send event eSend.
Process renaming functoriality #
An injective process renaming preserves and reflects HappensBeforeLe.