Documentation

CslibFrontier.Computability.Distributed.SelfStabilization.Basic

Self-stabilizing labelled transition systems #

This module formalizes self-stabilization over a general labelled transition system Cslib.LTS, following Dijkstra (p. 643, right column).

Given lts : LTS State Label and a target set Legitimate : Set State of legitimate configurations, SelfStabilizing lts Legitimate requires:

  1. Closure (closed): every transition from a legitimate state produces a legitimate state (requirement (2) on p. 643 of Dijkstra);
  2. Deadlock-freedom (no_terminal): no state is terminal (∀ s, ¬ lts.IsTerminal s), so at least one transition is enabled in every configuration (implying requirement (1) on p. 643);
  3. Worst-case finite convergence (converges): CorruptedStep lts Legitimate is well-founded, ruling out infinite executions that remain outside Legitimate under any adversarial enabled schedule without fairness assumptions.

Source conditions (3) and (4) on p. 643 of Dijkstra—that each privilege occurs in some legitimate state (3) and that every pair of legitimate states is mutually reachable by a path of transitions (4)—are requirements of Dijkstra's legitimate-state specification that lie outside the scope of this generic SelfStabilizing predicate and are stated separately by concrete protocol modules where applicable.

From SelfStabilizing, every infinite execution lts.OmegaExecution ss μs enters Legitimate at some step k₀ and remains in Legitimate at all steps k ≥ k₀ (SelfStabilizing.eventually_legitimate), and every initial state admits at least one infinite execution (SelfStabilizing.exists_omegaExecution). Conversely, any infinite execution that never visits Legitimate refutes SelfStabilizing (not_selfStabilizing_of_omegaExecution). We also provide a worst-case step-bound constructor (SelfStabilizing.of_mTr_bound) and daemon-refinement transfer from a larger transition relation to a deadlock-free sub-relation (SelfStabilizing.of_subLTS).

Main definitions #

Main results #

References #

def Cslib.Distributed.SelfStabilization.CorruptedStep {State : Type u} {Label : Type v} (lts : LTS State Label) (Legitimate : Set State) (s' s : State) :

One transition step from an illegitimate configuration s ∉ Legitimate to s', oriented as CorruptedStep lts Legitimate s' s so that WellFounded (CorruptedStep lts Legitimate) expresses the absence of infinite sequences of corrupted transitions s₀ → s₁ → s₂ → ⋯ remaining outside Legitimate.

structure Cslib.Distributed.SelfStabilization.SelfStabilizing {State : Type u} {Label : Type v} (lts : LTS State Label) (Legitimate : Set State) :

A labelled transition system lts is self-stabilizing with respect to Legitimate (Dijkstra, p. 643, right column) if Legitimate is closed under transitions, no configuration is terminal, and corrupted transitions outside Legitimate are well-founded.

  • closed ⦃s : State⦄ : s ∈ Legitimate → ∀ ⦃μ : Label⦄ ⦃s' : State⦄, lts.Tr s μ s' → s' ∈ Legitimate

    Requirement (2) of Dijkstra (p. 643): legitimate states are closed under every transition.

  • no_terminal (s : State) : ¬lts.IsTerminal s

    Deadlock-freedom (Dijkstra, p. 643): every state enables at least one transition.

  • converges : WellFounded (CorruptedStep lts Legitimate)

    Finite-step convergence (Dijkstra, p. 643): no infinite chain of steps remains outside Legitimate, under any adversarial scheduler without fairness assumptions.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.exists_tr {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (h : SelfStabilizing lts Legitimate) (s : State) :
∃ (μ : Label) (s' : State), lts.Tr s μ s'

Every configuration in a self-stabilizing LTS has at least one outgoing transition.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.mTr_mem {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (h : SelfStabilizing lts Legitimate) {s s' : State} {μs : List Label} (hs : s ∈ Legitimate) (hmtr : lts.MTr s μs s') :
s' ∈ Legitimate

Legitimate is closed under finite multistep transitions LTS.MTr.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.omegaExecution_mem_of_le {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (h : SelfStabilizing lts Legitimate) {ss : ωSequence State} {μs : ωSequence Label} (hexec : lts.OmegaExecution ss μs) {k₀ k : ℕ} (hk₀ : ss k₀ ∈ Legitimate) (hle : k₀ ≤ k) :
ss k ∈ Legitimate

Once an infinite execution visits Legitimate at index k₀, every state at k ≥ k₀ stays in Legitimate.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.eventually_legitimate {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (h : SelfStabilizing lts Legitimate) {ss : ωSequence State} {μs : ωSequence Label} (hexec : lts.OmegaExecution ss μs) :
∃ (k₀ : ℕ), ∀ k ≥ k₀, ss k ∈ Legitimate

Every infinite execution of a self-stabilizing LTS reaches Legitimate in finitely many steps and remains in Legitimate forever thereafter.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.exists_omegaExecution {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (h : SelfStabilizing lts Legitimate) (s₀ : State) :
∃ (ss : ωSequence State) (μs : ωSequence Label), ss 0 = s₀ ∧ lts.OmegaExecution ss μs

Because no state is terminal, every initial state s₀ admits an infinite execution starting at s₀.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.of_mTr_bound {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} (B : ℕ) (hclosed : ∀ ⦃s : State⦄, s ∈ Legitimate → ∀ ⦃μ : Label⦄ ⦃s' : State⦄, lts.Tr s μ s' → s' ∈ Legitimate) (hno_term : ∀ (s : State), ¬lts.IsTerminal s) (hbound : ∀ ⦃s₀ : State⦄ ⦃μs : List Label⦄ ⦃s' : State⦄, lts.MTr s₀ μs s' → B ≤ μs.length → s' ∈ Legitimate) :
SelfStabilizing lts Legitimate

Uniform finite-horizon criterion: if Legitimate is closed under transitions, no state is terminal, and every B-step execution ends in Legitimate, then lts is self-stabilizing.

theorem Cslib.Distributed.SelfStabilization.SelfStabilizing.of_subLTS {State : Type u} {Label₁ : Type v} {Label₂ : Type w} {sub : LTS State Label₁} {sup : LTS State Label₂} {Legitimate : Set State} (hsup : SelfStabilizing sup Legitimate) (hsub_tr : ∀ ⦃s : State⦄ ⦃μ₁ : Label₁⦄ ⦃s' : State⦄, sub.Tr s μ₁ s' → ∃ (μ₂ : Label₂), sup.Tr s μ₂ s') (hno_term : ∀ (s : State), ¬sub.IsTerminal s) :
SelfStabilizing sub Legitimate

Daemon refinement: if every transition of sub is realized by some transition of sup and sub has no terminal states, then SelfStabilizing sup Legitimate implies SelfStabilizing sub Legitimate.

theorem Cslib.Distributed.SelfStabilization.not_selfStabilizing_of_omegaExecution {State : Type u} {Label : Type v} {lts : LTS State Label} {Legitimate : Set State} {ss : ωSequence State} {μs : ωSequence Label} (hexec : lts.OmegaExecution ss μs) (hbad : ∀ (k : ℕ), ss k ∉ Legitimate) :
¬SelfStabilizing lts Legitimate

Any infinite execution that never visits Legitimate refutes SelfStabilizing.