Documentation

CslibFrontier.Probability.MarkovChain.HittingTime

Expected hitting and return times of finite Markov chains #

Let P : MarkovChain V be a Markov chain on a finite state space V, with transition probabilities P x y. Probabilities and expectations live in ℝ≥0∞, so that expected values may be infinite and need no summability side conditions.

For a target state v, let τ_v = min {t ≥ 0 | X_t = v} be the hitting time of v. The probability P_x(τ_v > t) that the chain started at x avoids v at times 0, …, t is survival P v t x, defined by conditioning on the first step. It depends only on the first t steps of the chain, so it is computed exactly from P. The expected hitting time is defined by the tail-sum formula E_x[τ_v] = ∑' t, P_x(τ_v > t) (hittingTime), which is exact for random variables with values in ℕ ∪ {∞}; it is not a finite-horizon approximation. Likewise the expected return time E_v[τ⁺_v], where τ⁺_v = min {t ≥ 1 | X_t = v}, is ∑' t, P_v(τ⁺_v > t) (returnTime).

The results are the classical facts about these quantities Levin and Peres, Sections 1.5 and 10.2:

The simple random walk on a graph (Cslib.Probability.MarkovChain.randomWalk) is the main instance.

Main definitions #

Main results #

References #

theorem Cslib.Probability.MarkovChain.sum_apply {V : Type u_1} [Fintype V] (P : MarkovChain V) (x : V) :
∑ y : V, (P.step x) y = 1

The transition probabilities from each state sum to 1.

noncomputable def Cslib.Probability.MarkovChain.survival {V : Type u_1} [Fintype V] [DecidableEq V] (P : MarkovChain V) (v : V) :
ℕ → V → ENNReal

survival P v t x is the probability P_x(τ_v > t) that the chain with transition probabilities P, started at x, avoids v at all times 0, …, t.

noncomputable def Cslib.Probability.MarkovChain.firstHit {V : Type u_1} [Fintype V] [DecidableEq V] (P : MarkovChain V) (v : V) :
ℕ → V → ENNReal

firstHit P v t x is the probability P_x(τ_v = t) that the chain started at x visits v for the first time at time t.

noncomputable def Cslib.Probability.MarkovChain.hittingTime {V : Type u_1} [Fintype V] [DecidableEq V] (P : MarkovChain V) (v x : V) :

The expected hitting time E_x[τ_v] of v from x, by the tail-sum formula E_x[τ_v] = ∑' t, P_x(τ_v > t). It is 0 when x = v and may be ∞.

noncomputable def Cslib.Probability.MarkovChain.returnSurvival {V : Type u_1} [Fintype V] [DecidableEq V] (P : MarkovChain V) (v : V) :

returnSurvival P v t is the probability P_v(τ⁺_v > t) that the chain started at v does not return to v at any of the times 1, …, t.

noncomputable def Cslib.Probability.MarkovChain.returnTime {V : Type u_1} [Fintype V] [DecidableEq V] (P : MarkovChain V) (v : V) :

The expected return time E_v[τ⁺_v] to v, by the tail-sum formula E_v[τ⁺_v] = ∑' t, P_v(τ⁺_v > t).

Survival probabilities #

@[simp]
theorem Cslib.Probability.MarkovChain.survival_self {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) :
P.survival v t v = 0
theorem Cslib.Probability.MarkovChain.survival_zero_of_ne {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) :
P.survival v 0 x = 1
theorem Cslib.Probability.MarkovChain.survival_succ_of_ne {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) (t : ℕ) :
P.survival v (t + 1) x = ∑ y : V, (P.step x) y * P.survival v t y
theorem Cslib.Probability.MarkovChain.survival_le_one {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) (x : V) :
P.survival v t x ≤ 1

Survival probabilities are probabilities.

theorem Cslib.Probability.MarkovChain.survival_ne_top {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) (x : V) :
P.survival v t x ≠ ⊤
theorem Cslib.Probability.MarkovChain.survival_add_le {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {S : Set V} (hS : ∀ a ∈ S, ∀ (b : V), (P.step a) b ≠ 0 → b ∈ S) {v : V} {m : ℕ} {c : ENNReal} (hc : ∀ y ∈ S, P.survival v m y ≤ c) (t : ℕ) (x : V) :
x ∈ S → P.survival v (t + m) x ≤ c * P.survival v t x

Markov property of survival. If, from every state of a set S closed under transitions, the probability of avoiding v for m more steps is at most c, then P_x(τ_v > t + m) ≤ c * P_x(τ_v > t) for x ∈ S.

theorem Cslib.Probability.MarkovChain.survival_succ_le {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) (x : V) :
P.survival v (t + 1) x ≤ P.survival v t x

Survival probabilities do not increase with time.

theorem Cslib.Probability.MarkovChain.survival_antitone {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v x : V) :
Antitone fun (t : ℕ) => P.survival v t x
theorem Cslib.Probability.MarkovChain.survival_succ_add_le {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) (y : V) (t : ℕ) :
P.survival v (t + 1) x + (P.step x) y * (1 - P.survival v t y) ≤ 1

One step towards y lowers the survival probability by P x y times the probability of hitting v from y.

theorem Cslib.Probability.MarkovChain.exists_survival_lt_one {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (h : Relation.ReflTransGen (fun (a b : V) => (P.step a) b ≠ 0) x v) :
∃ (m : ℕ), P.survival v m x < 1

If v is reachable from x along transitions of positive probability, then the chain from x hits v within some finite time with positive probability.

Expected hitting and return times #

theorem Cslib.Probability.MarkovChain.hittingTime_eq_of_ne {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) :
P.hittingTime v x = 1 + ∑ y : V, (P.step x) y * P.hittingTime v y

First-step equation for expected hitting times.

theorem Cslib.Probability.MarkovChain.returnTime_eq {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) :
P.returnTime v = 1 + ∑ y : V, (P.step v) y * P.hittingTime v y

First-step equation for the expected return time.

theorem Cslib.Probability.MarkovChain.mul_survival_le_hittingTime {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) (x : V) :
(↑t + 1) * P.survival v t x ≤ P.hittingTime v x

Markov's inequality for hitting times: the probability of avoiding v up to time t is at most E_x[τ_v] / (t + 1).

theorem Cslib.Probability.MarkovChain.hittingTime_ne_top {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {S : Set V} (hS : ∀ a ∈ S, ∀ (b : V), (P.step a) b ≠ 0 → b ∈ S) {v : V} (hreach : ∀ y ∈ S, Relation.ReflTransGen (fun (a b : V) => (P.step a) b ≠ 0) y v) {x : V} (hx : x ∈ S) :

Finiteness of hitting times. If every state of a set S closed under transitions reaches v along transitions of positive probability, the expected hitting time of v from every state of S is finite: the survival probabilities decay geometrically.

The triangle inequality #

theorem Cslib.Probability.MarkovChain.firstHit_self_succ {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) :
P.firstHit v (t + 1) v = 0
theorem Cslib.Probability.MarkovChain.firstHit_zero_of_ne {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) :
P.firstHit v 0 x = 0
theorem Cslib.Probability.MarkovChain.firstHit_succ_of_ne {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {v x : V} (hx : x ≠ v) (t : ℕ) :
P.firstHit v (t + 1) x = ∑ y : V, (P.step x) y * P.firstHit v t y
theorem Cslib.Probability.MarkovChain.sum_firstHit_add_survival {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v : V) (t : ℕ) (x : V) :
∑ j ∈ Finset.range (t + 1), P.firstHit v j x + P.survival v t x = 1

By time t, the chain has either visited v for the first time at some time j ≤ t or avoided it.

theorem Cslib.Probability.MarkovChain.survival_le_survival_add_sum {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} (v w : V) (t : ℕ) (x : V) :
P.survival w t x ≤ P.survival v t x + ∑ j ∈ Finset.range (t + 1), P.firstHit v j x * P.survival w (t - j) v

To avoid w up to time t, the chain either avoids v or visits v first at some time j ≤ t and then avoids w for the remaining t - j steps.

Triangle inequality for expected hitting times: E_x[τ_w] ≤ E_x[τ_v] + E_v[τ_w].

Kac's formula #

theorem Cslib.Probability.MarkovChain.mul_returnTime_eq {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {π : V → ENNReal} (hπ : ∀ (y : V), ∑ x : V, π x * (P.step x) y = π y) (v : V) (hfin : ∑ x : V, π x * P.hittingTime v x ≠ ⊤) :
π v * P.returnTime v = ∑ x : V, π x

Kac's formula. If π is a stationary measure (∑ x, π x * P x y = π y) and the π-average of the hitting times of v is finite, then π v * E_v[τ⁺_v] = ∑ x, π x. For a stationary distribution, the expected return time to v is 1 / π v.

theorem Cslib.Probability.MarkovChain.IsStationary.mul_returnTime_eq_one {V : Type u_1} [Fintype V] [DecidableEq V] {P : MarkovChain V} {π : PMF V} (h : P.IsStationary π) (v : V) (hfin : ∀ (x : V), π x ≠ 0 → P.hittingTime v x ≠ ⊤) :
π v * P.returnTime v = 1

Kac's formula for a stationary distribution π: if the hitting times of v are finite from every state in the support of π, then π v * E_v[τ⁺_v] = 1.