Documentation

CslibFrontier.Probability.MarkovChain.Basic

Markov chains on discrete state spaces #

A Markov chain P : MarkovChain S is a transition kernel S → PMF S: P x is the law of the next state from x, and P x y is the transition probability. Chains on a fixed state space form a monoid under composition of kernels, (P * Q) x = (P x).bind Q, so P ^ t is the t-step kernel and pow_add gives the Chapman–Kolmogorov equations.

A distribution π is stationary if π.bind P = π (π = πP, [LP17], (1.14)), and P is reversible with respect to π if it satisfies detailed balance π x * P x y = π y * P y x ([LP17], (1.29)). Detailed balance implies stationarity ([LP17], Proposition 1.20).

The kernel representation reuses the library's PMF and statistical-distance APIs directly. Mathlib's measure-theoretic ProbabilityTheory.Kernel.Invariant and ProbabilityTheory.Kernel.IsReversible are the measurable-space analogues of IsStationary and IsReversible; no finiteness of S is assumed here.

Main definitions #

Main results #

References #

structure Cslib.Probability.MarkovChain (S : Type u_1) :
Type u_1

A Markov chain on a discrete state space S, given by its transition kernel.

  • step : S → PMF S

    The law of the next state from the current state.

Instances For
    @[instance_reducible]
    theorem Cslib.Probability.MarkovChain.ext {S : Type u_1} {P Q : MarkovChain S} (h : ∀ (x : S), P.step x = Q.step x) :
    P = Q
    theorem Cslib.Probability.MarkovChain.ext_iff {S : Type u_1} {P Q : MarkovChain S} :
    P = Q ↔ ∀ (x : S), P.step x = Q.step x
    @[instance_reducible]
    noncomputable instance Cslib.Probability.MarkovChain.instMonoid {S : Type u_1} :

    Composition of kernels: first P, then Q.

    @[simp]
    theorem Cslib.Probability.MarkovChain.mul_apply {S : Type u_1} (P Q : MarkovChain S) (x : S) :
    (P * Q).step x = (P.step x).bind Q.step
    @[simp]
    theorem Cslib.Probability.MarkovChain.pow_succ_apply {S : Type u_1} (P : MarkovChain S) (t : ℕ) (x : S) :
    (P ^ (t + 1)).step x = ((P ^ t).step x).bind P.step
    theorem Cslib.Probability.MarkovChain.pow_succ_apply' {S : Type u_1} (P : MarkovChain S) (t : ℕ) (x : S) :
    (P ^ (t + 1)).step x = (P.step x).bind (P ^ t).step
    theorem Cslib.Probability.MarkovChain.pow_add_apply {S : Type u_1} (P : MarkovChain S) (s t : ℕ) (x : S) :
    (P ^ (s + t)).step x = ((P ^ s).step x).bind (P ^ t).step

    Chapman–Kolmogorov: P^{s+t}(x, ·) = Σ_y P^s(x, y) P^t(y, ·).

    π is a stationary distribution of P: π = πP ([LP17], (1.14)).

    P is reversible with respect to π, i.e. satisfies the detailed balance equations ([LP17], (1.29)).

    theorem Cslib.Probability.MarkovChain.IsStationary.bind_pow {S : Type u_1} {P : MarkovChain S} {π : PMF S} (h : P.IsStationary π) (t : ℕ) :
    π.bind (P ^ t).step = π

    A stationary distribution of P is invariant under P ^ t.

    theorem Cslib.Probability.MarkovChain.IsStationary.pow {S : Type u_1} {P : MarkovChain S} {π : PMF S} (h : P.IsStationary π) (t : ℕ) :
    (P ^ t).IsStationary π

    A stationary distribution of P is a stationary distribution of P ^ t.

    theorem Cslib.Probability.MarkovChain.IsStationary.mul {S : Type u_1} {P₁ P₂ : MarkovChain S} {π : PMF S} (h₁ : P₁.IsStationary π) (h₂ : P₂.IsStationary π) :
    (P₁ * P₂).IsStationary π

    Stationarity is preserved under chain composition (P₁ * P₂).

    Detailed balance implies stationarity ([LP17], Proposition 1.20).