Documentation

CslibFrontier.Probability.MarkovChain.Mixing

Total-variation mixing of finite Markov chains #

For a Markov chain P on a finite state space with a distribution π, define the worst-case statistical distances after t steps

and the mixing time t_mix(ε) = min {t | d(t) ≤ ε} (Cslib.Probability.MarkovChain.mixingTime, [LP17], (4.30)). Here ‖μ - ν‖_TV is cslib's statistical distance dist μ ν, which is the total-variation distance max_A |μ A - ν A| (half of Mathlib's tvDist). The mixing time takes values in ℕ∞ and is ⊤ exactly when d(t) > ε for every t, so no irreducibility or aperiodicity hypothesis is built in.

For stationary π: d(t) ≤ d̄(t) ≤ 2 d(t) (Lemma 4.10), d̄ is submultiplicative (Lemma 4.11), both are non-increasing (Exercise 4.2), d(ℓ t) ≤ (2 d(t))^ℓ ((4.32)) and t_mix(ε) ≤ ⌈log₂ ε⁻¹⌉ t_mix(1/4) ((4.34)). The submultiplicativity proof runs a common kernel from an optimal coupling (Cslib.Probability.PMF.dist_bind_le_mul).

Main definitions #

Main results #

References #

noncomputable def Cslib.Probability.MarkovChain.distToStationary {S : Type u_1} [Fintype S] (P : MarkovChain S) (π : PMF S) (t : ℕ) :

d(t) = max_x ‖Pᵗ(x, ·) - π‖_TV, the worst-case statistical distance to π after t steps ([LP17], (4.22)).

noncomputable def Cslib.Probability.MarkovChain.distPair {S : Type u_1} [Fintype S] (P : MarkovChain S) (t : ℕ) :

d̄(t) = max_{x,y} ‖Pᵗ(x, ·) - Pᵗ(y, ·)‖_TV, the worst-case statistical distance between two copies of the chain after t steps ([LP17], (4.23)).

noncomputable def Cslib.Probability.MarkovChain.mixingTime {S : Type u_1} [Fintype S] (P : MarkovChain S) (π : PMF S) (ε : ℝ) :

The mixing time t_mix(ε) = min {t | d(t) ≤ ε} ([LP17], (4.30)), or ⊤ if d(t) > ε for every t.

theorem Cslib.Probability.MarkovChain.dist_le_distToStationary {S : Type u_1} [Fintype S] (P : MarkovChain S) (π : PMF S) (t : ℕ) (x : S) :
dist ((P ^ t).step x) π ≤ P.distToStationary π t
theorem Cslib.Probability.MarkovChain.distToStationary_le {S : Type u_1} [Fintype S] (P : MarkovChain S) (π : PMF S) {t : ℕ} {ε : ℝ} (h : ∀ (x : S), dist ((P ^ t).step x) π ≤ ε) (hε : 0 ≤ ε) :
theorem Cslib.Probability.MarkovChain.dist_le_distPair {S : Type u_1} [Fintype S] (P : MarkovChain S) (t : ℕ) (x y : S) :
dist ((P ^ t).step x) ((P ^ t).step y) ≤ P.distPair t
theorem Cslib.Probability.MarkovChain.distPair_le {S : Type u_1} [Fintype S] (P : MarkovChain S) {t : ℕ} {ε : ℝ} (h : ∀ (x y : S), dist ((P ^ t).step x) ((P ^ t).step y) ≤ ε) (hε : 0 ≤ ε) :
P.distPair t ≤ ε
theorem Cslib.Probability.MarkovChain.IsStationary.dist_le_of_forall_mem_support {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} (hπ : P.IsStationary π) {t : ℕ} {x : S} {δ : ℝ} (h : ∀ y ∈ π.support, dist ((P ^ t).step y) ((P ^ t).step x) ≤ δ) :
dist ((P ^ t).step x) π ≤ δ

If after t steps the chain started at x is within δ of the chain started at every state in the support of a stationary π, then it is within δ of π.

d(t) ≤ d̄(t) for stationary π ([LP17], Lemma 4.10).

d̄(t) ≤ 2 d(t) ([LP17], Lemma 4.10); this holds for every π.

d(t) is non-increasing for stationary π ([LP17], Exercise 4.2).

d̄(t) is non-increasing ([LP17], Exercise 4.2).

Submultiplicativity d̄(s + t) ≤ d̄(s) d̄(t) ([LP17], Lemma 4.11).

theorem Cslib.Probability.MarkovChain.distPair_mul_le {S : Type u_1} [Fintype S] {P : MarkovChain S} (ℓ t : ℕ) :
P.distPair (ℓ * t) ≤ P.distPair t ^ ℓ

d̄(ℓ t) ≤ d̄(t)^ℓ ([LP17], (4.29)).

theorem Cslib.Probability.MarkovChain.IsStationary.distToStationary_mul_le {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} (hπ : P.IsStationary π) (ℓ t : ℕ) :
P.distToStationary π (ℓ * t) ≤ (2 * P.distToStationary π t) ^ ℓ

d(ℓ t) ≤ (2 d(t))^ℓ for stationary π ([LP17], (4.32)).

theorem Cslib.Probability.MarkovChain.IsStationary.dist_mul_le_mul {S : Type u_1} [Fintype S] {π : PMF S} {P₁ P₂ : MarkovChain S} (hπ₂ : P₂.IsStationary π) {δ₁ δ₂ : ℝ} (hb₁ : ∀ (x : S), dist (P₁.step x) π ≤ δ₁) (hb₂ : ∀ (y : S), dist (P₂.step y) π ≤ δ₂) (x : S) :
dist ((P₁ * P₂).step x) π ≤ δ₁ * (2 * δ₂)

Running a chain P₁ within δ₁ of π followed by a π-stationary chain P₂ within δ₂ of π produces a chain within δ₁ * (2 * δ₂) of π.

theorem Cslib.Probability.MarkovChain.dist_prod_ofFn_le {S : Type u_1} [Fintype S] {t : ℕ} (ht : 1 ≤ t) (Ps : Fin t → MarkovChain S) {π : PMF S} (hstat : ∀ (i : Fin t), (Ps i).IsStationary π) {δ : ℝ} (hδ : ∀ (i : Fin t) (x : S), dist ((Ps i).step x) π ≤ δ) (x : S) :
dist ((List.ofFn Ps).prod.step x) π ≤ 1 / 2 * (2 * δ) ^ t

Composing t ≥ 1 π-stationary Markov chains Ps 0, …, Ps (t - 1), each within statistical distance δ of π from every start state, contracts statistical distance to at most (1 / 2) * (2 * δ) ^ t ([ANS10], arXiv:0912.5424v3, Section 5.3, Theorem 5.6, PDF p. 25 / printed p. 24).

Sharpened t-step stationary contraction d(t) ≤ (1 / 2) * (2 d(1)) ^ t for 1 ≤ t.

theorem Cslib.Probability.MarkovChain.mixingTime_eq_top_iff {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} (ε : ℝ) :
P.mixingTime π ε = ⊤ ↔ ∀ (t : ℕ), ε < P.distToStationary π t
theorem Cslib.Probability.MarkovChain.mixingTime_le_of_distToStationary_le {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} {ε : ℝ} {t : ℕ} (h : P.distToStationary π t ≤ ε) :
P.mixingTime π ε ≤ ↑t
theorem Cslib.Probability.MarkovChain.distToStationary_le_of_mixingTime_eq {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} {ε : ℝ} {t : ℕ} (h : P.mixingTime π ε = ↑t) :
theorem Cslib.Probability.MarkovChain.IsStationary.mixingTime_le_iff {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} (hπ : P.IsStationary π) (ε : ℝ) (t : ℕ) :
P.mixingTime π ε ≤ ↑t ↔ P.distToStationary π t ≤ ε

For stationary π, the chain is ε-mixed after t steps exactly when t_mix(ε) ≤ t.

theorem Cslib.Probability.MarkovChain.IsStationary.mixingTime_le_ceil_logb_mul {S : Type u_1} [Fintype S] {P : MarkovChain S} {π : PMF S} (hπ : P.IsStationary π) {ε : ℝ} (hε : 0 < ε) :
P.mixingTime π ε ≤ ↑⌈Real.logb 2 ε⁻¹⌉₊ * P.mixingTime π (1 / 4)

t_mix(ε) ≤ ⌈log₂ ε⁻¹⌉ t_mix(1/4) for stationary π and 0 < ε ([LP17], (4.34)).