Documentation

CslibFrontier.Computability.Distributed.DijkstraScholten.Basic

Asynchronous diffusing computations and the Dijkstra–Scholten overlay #

This module models asynchronous diffusing computations and the single-parent message-passing termination-detection overlay as a milestone step toward #7286, after [DS80] (inspected in author manuscript EWD687a, EWD687a - 0–5, PDF pp. 3–8).

Given a process type P and a distinguished initiator root : P, a global State P is completely ghost-free:

Compared with EWD687a's abstract directed-graph formulation (atomic edge-deficit updates, no incoming edges at the environment, and arbitrary "cornet" pointed bags deferring non-engagement signals subject to guard G), lts root models asynchronous in-flight packets and the concrete single-parent eager-acknowledgement policy:

  1. Action.sendBasic src dst: an active process src emits basic message ⟨src, dst⟩ and increments deficit src.
  2. Action.recvBasic src dst: delivering ⟨src, dst⟩ ∈ basicMsgs sets active dst := true. If dst ≠ root and parent dst = none, dst attaches to the engagement tree via parent dst := some src; otherwise (dst = root or dst is already engaged in the tree), dst keeps its existing parent and immediately emits a signal to src.
  3. Action.becomeIdle p: an active process p turns active p := false.
  4. Action.recvSignal p: delivering an in-flight signal p ∈ signals decrements deficit p.
  5. Action.detach p q: an idle non-root process p ≠ root with deficit p = 0 and parent p = some q detaches (parent p := none) and emits a signal to q.

root detects termination (State.Terminated root) when active root = false ∧ deficit root = 0. Both the labelled transition system lts root and multi-step execution runTrace? root share one executable transition function step? root, enabling kernel decide trace verification.

Main definitions #

Main results #

References #

Ghost-free local state of a process in the Dijkstra–Scholten overlay (EWD687a - 2–5, PDF pp. 5–8): active status in the diffusing computation, outgoing deficit counter deficit, and optional engagement-tree parent.

  • active : Bool

    Whether the process is currently active in the underlying diffusing computation.

  • deficit : ℕ

    Outgoing basic messages sent minus acknowledgement signals received (D in EWD687a).

  • parent : Option P

    Incoming engagement-tree parent (none at root and when neutral/detached).

Instances For
    theorem Cslib.Distributed.DijkstraScholten.ProcState.ext {P : Type u_1} {x y : ProcState P} (active : x.active = y.active) (deficit : x.deficit = y.deficit) (parent : x.parent = y.parent) :
    x = y
    @[instance_reducible]

    An in-flight point-to-point basic message of the diffusing computation from src to dst.

    • src : P

      Sender process, whose deficit was incremented on transmission.

    • dst : P

      Recipient process.

    Instances For
      theorem Cslib.Distributed.DijkstraScholten.BasicMsg.ext {P : Type u_1} {x y : BasicMsg P} (src : x.src = y.src) (dst : x.dst = y.dst) :
      x = y
      @[instance_reducible]

      Global configuration of an asynchronous diffusing computation with the Dijkstra–Scholten control overlay.

      theorem Cslib.Distributed.DijkstraScholten.State.ext {P : Type u_1} {x y : State P} (proc : x.proc = y.proc) (basicMsgs : x.basicMsgs = y.basicMsgs) (signals : x.signals = y.signals) :
      x = y
      @[instance_reducible]

      Computable equality check on global states over a finite process type P.

      Initial configuration of a diffusing computation rooted at root: only root is active, all deficits are 0, all parent pointers are none, and all channels are empty.

      @[simp]
      theorem Cslib.Distributed.DijkstraScholten.initState_active {P : Type u_1} [DecidableEq P] (root p : P) :
      ((initState root).proc p).active = decide (p = root)

      Transition labels of the asynchronous Dijkstra–Scholten overlay.

      • sendBasic {P : Type u_1} (src dst : P) : Action P

        Active src sends a basic message to dst, incrementing deficit src.

      • recvBasic {P : Type u_1} (src dst : P) : Action P

        Recipient dst receives in-flight basic message ⟨src, dst⟩.

      • becomeIdle {P : Type u_1} (p : P) : Action P

        Active process p becomes idle.

      • recvSignal {P : Type u_1} (p : P) : Action P

        Process p receives an in-flight signal and decrements deficit p.

      • detach {P : Type u_1} (p q : P) : Action P

        Idle non-root p with deficit p = 0 and parent p = some q detaches and signals q.

      Instances For
        @[instance_reducible]

        Post-state of Action.recvBasic src dst for diffusing root root. If dst ≠ root and (s.proc dst).parent = none (which in every reachable state implies dst is idle with deficit = 0), dst attaches with parent := some src; otherwise (dst = root or dst is already engaged in the tree), dst keeps its parent and emits a signal to src.

        Root local termination condition (EWD687a - 2–5, PDF pp. 5–8): root is idle and its deficit has returned to 0.

        Instances For
          @[instance_reducible]

          Global quiescence of the network and control overlay: every process is idle with zero deficit and parent = none, and both basic-message and signal channels are empty.

          Instances For

            The underlying diffusing computation has ceased: all processes are idle and no basic messages are in flight, though acknowledgement signals and tree detachments may still be draining.

            Instances For
              def Cslib.Distributed.DijkstraScholten.step? {P : Type u_1} [DecidableEq P] (root : P) (s : State P) :
              Action P → Option (State P)

              Executable single-step transition evaluator for the Dijkstra–Scholten overlay rooted at root. Returns some s' iff action a is enabled in s with post-state s'.

              def Cslib.Distributed.DijkstraScholten.runTrace? {P : Type u_1} [DecidableEq P] (root : P) (s : State P) (tr : List (Action P)) :

              Execute a finite action trace tr from s under step? root.

              Labelled transition system for the asynchronous Dijkstra–Scholten overlay rooted at root.

              Instances For
                @[instance_reducible]
                instance Cslib.Distributed.DijkstraScholten.instDecidableTr {P : Type u_1} [Fintype P] [DecidableEq P] (root : P) (s : State P) (a : Action P) (s' : State P) :
                Decidable ((lts root).Tr s a s')

                Computable transition check for (lts root).Tr s a s' over a finite process type P.

                A global configuration s is reachable in the Dijkstra–Scholten overlay rooted at root if lts root can reach s from initState root.

                theorem Cslib.Distributed.DijkstraScholten.Reachable.step {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {a : Action P} (hr : Reachable root s) (htr : (lts root).Tr s a s') :
                Reachable root s'
                theorem Cslib.Distributed.DijkstraScholten.Reachable.mtr {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {tr : List (Action P)} (hr : Reachable root s) (hmtr : (lts root).MTr s tr s') :
                Reachable root s'

                Every label at every state has at most one successor in lts root.

                @[simp]
                theorem Cslib.Distributed.DijkstraScholten.tr_sendBasic_iff {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {src dst : P} :
                (lts root).Tr s (Action.sendBasic src dst) s' ↔ (s.proc src).active = true ∧ s.sendBasicState src dst = s'
                @[simp]
                theorem Cslib.Distributed.DijkstraScholten.tr_recvBasic_iff {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {src dst : P} :
                (lts root).Tr s (Action.recvBasic src dst) s' ↔ { src := src, dst := dst } ∈ s.basicMsgs ∧ s.recvBasicState root src dst = s'
                @[simp]
                theorem Cslib.Distributed.DijkstraScholten.tr_becomeIdle_iff {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {p : P} :
                @[simp]
                theorem Cslib.Distributed.DijkstraScholten.tr_recvSignal_iff {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {p : P} :
                @[simp]
                theorem Cslib.Distributed.DijkstraScholten.tr_detach_iff {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {p q : P} :
                (lts root).Tr s (Action.detach p q) s' ↔ (p ≠ root ∧ (s.proc p).active = false ∧ (s.proc p).deficit = 0 ∧ (s.proc p).parent = some q) ∧ s.detachState p q = s'
                theorem Cslib.Distributed.DijkstraScholten.mtr_iff_runTrace?_eq_some {P : Type u_1} [DecidableEq P] {root : P} {s s' : State P} {tr : List (Action P)} :
                (lts root).MTr s tr s' ↔ runTrace? root s tr = some s'

                Multi-step transitions in lts root coincide with executable runTrace? evaluation.