Kolmogorov's criterion for reversibility
StructureStochastic matrix#✓fully proved
For a natural number \(M\), a stochastic matrix of size \(M + 1\) is a square matrix \(P = (P_{ij})\) indexed by the states \(\{0, 1, \dots, M\}\), with real entries \(P_{ij} \ge 0\) for all states \(i, j\), whose rows sum to \(1\): \(\sum_j P_{ij} = 1\) for every \(i\). It is the transition matrix of a Markov chain on these \(M + 1\) states.
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
prob : Fin (M + 1) → Fin (M + 1) → ℝ
MathlibExt/Probability/KolmogorovCycleNecessity.lean:64
Used by 78
DefinitionMatrix powers of a stochastic matrix#✓fully proved
For a stochastic matrix \(P\) on the finite state space \(\{0, 1, \dots, M\}\) and \(n \in \mathbb{N}\), the \(n\)-th matrix power \(P^n\) is defined by \(P^0 = I\), the identity matrix, and \((P^{n+1})_{ij} = \sum_k P(i, k) (P^n)_{kj}\). The entry \((P^n)_{ij}\) is the probability of moving from state \(i\) to state \(j\) in exactly \(n\) steps.
def matPow (P : StochasticMatrix M) : ℕ → (Fin (M + 1) → Fin (M + 1) → ℝ)
| 0 => fun i j => if i = j then 1 else 0
| n + 1 => fun i j => ∑ k, P.prob i k * P.matPow n k j
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 1 · Used by 29
DefinitionIrreducible stochastic matrix#✓fully proved
Let \(P\) be a stochastic matrix on the finite state space \(\{0, 1, \dots, M\}\) and write \(P^n\) for its \(n\)-th matrix power. Then \(P\) is irreducible if for all states \(i\) and \(j\) there is an \(n \ge 1\) with \((P^n)_{ij} > 0\); that is, every state can be reached from every state, itself included, in a positive number of steps.
def IsIrreducible (P : StochasticMatrix M) : Prop :=
∀ i j : Fin (M + 1), ∃ n : ℕ, 0 < n ∧ 0 < P.matPow n i j
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 2 · Used by 8
StructureProbability distribution on a finite state space#✓fully proved
A probability distribution on the finite state space \(\{0, 1, \dots, M\}\) is a function \(\pi\) from the states to \(\mathbb{R}\) with \(\pi(i) \ge 0\) for every state \(i\) and \(\sum_i \pi(i) = 1\).
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
val : Fin (M + 1) → ℝ
MathlibExt/Probability/KolmogorovCycleNecessity.lean:87
Used by 8
DefinitionStationary distribution#✓fully proved
A probability distribution \(\pi\) on the finite state space \(\{0, 1, \dots, M\}\) is stationary for a stochastic matrix \(P\) on the same states if \(\pi P = \pi\), that is, \(\sum_i \pi(i) P(i, j) = \pi(j)\) for every state \(j\).
def IsStationary (P : StochasticMatrix M) (π : Distribution M) : Prop :=
∀ j, ∑ i, π.val i * P.prob i j = π.val j
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:86
Uses 2 · Used by 4
DefinitionDetailed balance#✓fully proved
A probability distribution \(\pi\) and a stochastic matrix \(P\) on the finite state space \(\{0, 1, \dots, M\}\) satisfy the detailed balance (reversibility) equations when \(\pi(i) P(i, j) = \pi(j) P(j, i)\) for all states \(i\) and \(j\).
def DetailedBalance (P : StochasticMatrix M) (π : Distribution M) : Prop :=
∀ i j : Fin (M + 1), π.val i * P.prob i j = π.val j * P.prob j i
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:86
Uses 2 · Used by 6
DefinitionReversible stochastic matrix#✓fully proved
A stochastic matrix \(P\) on the finite state space \(\{0, 1, \dots, M\}\) is reversible if there is a probability distribution \(\pi\) on the states that is stationary for \(P\) and satisfies the detailed balance equations \(\pi(i) P(i, j) = \pi(j) P(j, i)\) for all states \(i, j\).
def IsReversible (P : StochasticMatrix M) : Prop :=
∃ π : Distribution M, P.IsStationary π ∧ P.DetailedBalance π
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:86
Uses 4 · Used by 2
StructureKolmogorov's cycle condition#✓fully proved
A stochastic matrix \(P\) on the finite state space \(\{0, 1, \dots, M\}\) satisfies Kolmogorov's cycle condition when (1) for all states \(x, y\), \(P(x, y) > 0\) implies \(P(y, x) > 0\); and (2) for every \(n \ge 0\) and every loop of states \(x_0, x_1, \dots, x_n\) with \(x_n = x_0\) and \(\prod_{i=0}^{n-1} P(x_{i+1}, x_i) > 0\), we have \(\prod_{i=0}^{n-1} P(x_i, x_{i+1}) = \prod_{i=0}^{n-1} P(x_{i+1}, x_i)\).
structure KolmogorovCycleCondition (P : StochasticMatrix M) : Prop where
symm_support : ∀ x y : Fin (M + 1), P.prob x y > 0 → P.prob y x > 0
cycle_prod : ∀ (n : ℕ) (c : Fin (n + 1) → Fin (M + 1)), c 0 = c (Fin.last n) →
(∏ i : Fin n, P.prob (c i.succ) (c i.castSucc)) > 0 →
(∏ i : Fin n, P.prob (c i.castSucc) (c i.succ)) =
(∏ i : Fin n, P.prob (c i.succ) (c i.castSucc))
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 1 · Used by 6
TheoremDetailed balance implies stationarity#✓fully proved
Let \(P\) be a stochastic matrix on the finite state space \(\{0, 1, \dots, M\}\) and let \(\pi\) be a probability distribution on the same states. If \(\pi\) and \(P\) satisfy the detailed balance equations \(\pi(i) P(i, j) = \pi(j) P(j, i)\) for all states \(i, j\), then \(\pi\) is stationary for \(P\): \(\sum_i \pi(i) P(i, j) = \pi(j)\) for every state \(j\).
theorem detailedBalance_isStationary (P : StochasticMatrix M) (π : Distribution M)
(hdb : P.DetailedBalance π) : P.IsStationary π
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:86
Uses 4 · Used by 1
LemmaPowers of a stochastic matrix are nonnegative#✓fully proved
Every entry of every power of a stochastic matrix is nonnegative.
lemma matPow_nonneg (P : StochasticMatrix M) : ∀ (n : ℕ) (i j : Fin (M + 1)),
0 ≤ P.matPow n i j
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 2 · Used by 9
TheoremDetailed balance distributions of irreducible chains are positive#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the finite state space \(\{0, 1, \dots, M\}\). If a probability distribution \(\pi\) satisfies the detailed balance equations \(\pi(i) P(i, j) = \pi(j) P(j, i)\) for all states \(i, j\), then \(\pi(i) > 0\) for every state \(i\).
theorem distribution_pos_of_irreducible_detailedBalance
(P : StochasticMatrix M) (π : Distribution M)
(hirr : P.IsIrreducible) (hdb : P.DetailedBalance π) :
∀ i, 0 < π.val i
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
structure Distribution (M : ℕ) where
val : Fin (M + 1) → ℝ
nonneg : ∀ i, 0 ≤ val i
sum_one : ∑ i, val i = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:86
Uses 6 · Used by 1
TheoremKolmogorov's cycle theorem, necessity half#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the finite state space \(\{0, 1, \dots, M\}\). If \(P\) is reversible, that is, some probability distribution \(\pi\) is stationary for \(P\) and satisfies the detailed balance equations \(\pi(i) P(i, j) = \pi(j) P(j, i)\) for all states \(i, j\), then \(P\) satisfies Kolmogorov's cycle condition: (1) for all states \(x, y\), \(P(x, y) > 0\) implies \(P(y, x) > 0\); and (2) for every \(n \ge 0\) and every loop of states \(x_0, x_1, \dots, x_n\) with \(x_n = x_0\) and \(\prod_{i=0}^{n-1} P(x_{i+1}, x_i) > 0\), we have \(\prod_{i=0}^{n-1} P(x_i, x_{i+1}) = \prod_{i=0}^{n-1} P(x_{i+1}, x_i)\).
theorem kolmogorov_cycle_necessity {M : ℕ} (P : StochasticMatrix M)
(hirr : P.IsIrreducible) (hrev : P.IsReversible) :
P.KolmogorovCycleCondition
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 8
DefinitionForward path product#✓fully proved
For a stochastic matrix \(P\) and a path of states \(x_0, x_1, \dots, x_k\), the path product is the real number \(\prod_{i=0}^{k-1} P(x_i, x_{i+1})\), the product of the forward transition probabilities along the path. For the empty path and for a path consisting of a single state it is \(1\).
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 1 · Used by 10
LemmaPath products are nonnegative#✓fully proved
Let \(P\) be a stochastic matrix on the states \(\{0, \dots, M\}\). For every path (finite list of states), the product of the forward transition probabilities \(P(x, y)\) over consecutive states \(x, y\) along the path is nonnegative.
lemma listPathProduct_nonneg (P : StochasticMatrix M) (path : List (Fin (M + 1))) :
0 ≤ listPathProduct P path
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
Uses 2 · Used by 3
DefinitionRatio product along a path#✓fully proved
For a stochastic matrix \(P\) and a path of states \(x_0, x_1, \dots, x_k\), the ratio product is the real number \(\prod_{i=0}^{k-1} \frac{P(x_i, x_{i+1})}{P(x_{i+1}, x_i)}\), where a quotient with denominator \(0\) is taken to be \(0\). For the empty path and for a path consisting of a single state it is \(1\).
This is the quantity that defines the "cycle weight" used to construct a reversible measure from Kolmogorov's cycle condition.
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 1 · Used by 10
LemmaThe ratio product is nonnegative#✓fully proved
For a stochastic matrix \(P\), the ratio product along every path of states is nonnegative.
lemma listRatioProduct_nonneg (P : StochasticMatrix M) (path : List (Fin (M + 1))) :
0 ≤ listRatioProduct P path
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 2 · Used by 1
LemmaPositive paths have positive ratio product#✓fully proved
Let \(P\) be a stochastic matrix such that \(P(x, y) > 0\) implies \(P(y, x) > 0\) for all states \(x\) and \(y\). If the forward path product along a path of states is positive, then the ratio product along that path is positive.
lemma listRatioProduct_pos_of_listPathProduct_pos (P : StochasticMatrix M)
(hsymm : ∀ x y : Fin (M + 1), P.prob x y > 0 → P.prob y x > 0)
(path : List (Fin (M + 1))) (h : 0 < listPathProduct P path) :
0 < listRatioProduct P path
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 4 · Used by 2
LemmaPaths from positive matrix powers#✓fully proved
Let \(P\) be a stochastic matrix on the states \(\{0, \dots, M\}\). If \(n > 0\) and the \((i, j)\) entry of the \(n\)-th matrix power \(P^n\) is positive, then there is a path from \(i\) to \(j\) (a finite list of states starting at \(i\) and ending at \(j\)) along which the product of the transition probabilities \(P(x, y)\) over consecutive states \(x, y\) is positive.
lemma exists_path_of_matPow_pos (P : StochasticMatrix M) :
∀ (n : ℕ) (i j : Fin (M + 1)), 0 < n → 0 < P.matPow n i j →
∃ path : List (Fin (M + 1)),
path.head? = some i ∧ path.getLast? = some j ∧ 0 < listPathProduct P path
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
Uses 3 · Used by 1
TheoremIrreducible chains have positive paths#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the states \(\{0, \dots, M\}\). For any two states \(i, j\) there is a path from \(i\) to \(j\) (a finite list of states starting at \(i\) and ending at \(j\)) along which the product of the transition probabilities \(P(x, y)\) over consecutive states \(x, y\) is strictly positive.
theorem IsIrreducible.exists_path {P : StochasticMatrix M} (hirr : P.IsIrreducible)
(i j : Fin (M + 1)) :
∃ path : List (Fin (M + 1)),
path.head? = some i ∧ path.getLast? = some j ∧ 0 < listPathProduct P path
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
Uses 5 · Used by 4
LemmaFirst step of the ratio product#✓fully proved
Let \(P\) be a stochastic matrix, \(n\) a natural number and \(c_0, c_1, \dots, c_{n+1}\) states. Then the ratio product along \(c_0, c_1, \dots, c_{n+1}\) equals \(\frac{P(c_0, c_1)}{P(c_1, c_0)}\) times the ratio product along \(c_1, \dots, c_{n+1}\), where a quotient with denominator \(0\) is taken to be \(0\).
lemma listRatioProduct_cons_ofFn (P : StochasticMatrix M) (n : ℕ)
(c : Fin (n + 2) → Fin (M + 1)) :
listRatioProduct P (c 0 :: List.ofFn (fun i : Fin (n + 1) => c i.succ)) =
(P.prob (c 0) (c 1) / P.prob (c 1) (c 0)) *
listRatioProduct P (List.ofFn (fun i : Fin (n + 1) => c i.succ))
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 2 · Used by 1
LemmaThe ratio product as a finite product#✓fully proved
Let \(P\) be a stochastic matrix, \(n\) a natural number and \(c_0, c_1, \dots, c_n\) states. Then the ratio product along \(c_0, c_1, \dots, c_n\) equals \(\prod_{i=0}^{n-1} \frac{P(c_i, c_{i+1})}{P(c_{i+1}, c_i)}\), where a quotient with denominator \(0\) is taken to be \(0\).
lemma listRatioProduct_ofFn (P : StochasticMatrix M) :
∀ (n : ℕ) (c : Fin (n + 1) → Fin (M + 1)),
listRatioProduct P (List.ofFn c) =
∏ i : Fin n, (P.prob (c i.castSucc) (c i.succ) /
P.prob (c i.succ) (c i.castSucc) : ℝ)
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 3 · Used by 1
LemmaThe ratio product around a loop is one#✓fully proved
Let \(P\) be a stochastic matrix satisfying Kolmogorov's cycle condition, and let \(x_0, x_1, \dots, x_n\) be a path of states with \(n \ge 1\) and \(x_0 = x_n\) such that \(P(x_{i+1}, x_i) > 0\) for every \(i < n\). Then the ratio product along \(x_0, x_1, \dots, x_n\) equals \(1\).
lemma listRatioProduct_cycle_eq_one (P : StochasticMatrix M)
(hcycle : P.KolmogorovCycleCondition)
(path : List (Fin (M + 1))) (hlen : 2 ≤ path.length) (hne : path ≠ [])
(hloop : path.head hne = path.getLast hne)
(hpos : ∀ i : Fin (path.length - 1),
0 < P.prob (path.get ⟨i + 1, by omega⟩) (path.get ⟨i, by omega⟩)) :
listRatioProduct P path = 1
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 4 · Used by 1
DefinitionCycle weight#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the states \(\{0, \dots, M\}\) and fix a reference state \(i_0\). The cycle weight of a state \(j\) relative to \(i_0\) is the product of the ratios \(P(x, y) / P(y, x)\) over consecutive states \(x, y\) along a path (a finite list of states) from \(i_0\) to \(j\) whose product of transition probabilities \(P(x, y)\) over consecutive states is positive, where a ratio with \(P(y, x) = 0\) counts as \(0\); such a path exists by irreducibility, and one is fixed by choice.
For chains satisfying Kolmogorov's cycle condition this value does not depend on the chosen path, and the weights give a reversible measure.
noncomputable def cycleWeight (P : StochasticMatrix M) (hirr : P.IsIrreducible)
(i₀ : Fin (M + 1)) (j : Fin (M + 1)) : ℝ :=
listRatioProduct P (Classical.choose (hirr.exists_path i₀ j))
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 5 · Used by 3
LemmaRatio product of joined paths#✓fully proved
Let \(P\) be a stochastic matrix and let \(x_0, \dots, x_k\) and \(y_0, \dots, y_l\) be paths of states with \(x_k = y_0\). Then the ratio product along the joined path \(x_0, \dots, x_k, y_1, \dots, y_l\) equals the ratio product along \(x_0, \dots, x_k\) times the ratio product along \(y_0, \dots, y_l\).
lemma listRatioProduct_append (P : StochasticMatrix M) :
∀ (l1 l2 : List (Fin (M + 1))) (hne1 : l1 ≠ []) (hne2 : l2 ≠ []),
l1.getLast hne1 = l2.head hne2 →
listRatioProduct P (l1 ++ l2.tail) =
listRatioProduct P l1 * listRatioProduct P l2
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 2 · Used by 1
LemmaPositive path products have positive steps#✓fully proved
Let \(P\) be a stochastic matrix on the states \(\{0, \dots, M\}\), and let \(l\) be a path (a finite list of states) whose \(i\)-th state, counting from \(0\), is \(l_i\). If the product of the transition probabilities \(P(x, y)\) over consecutive states \(x, y\) along \(l\) is positive, then \(P(l_i, l_{i+1}) > 0\) for every \(i\) such that \(i + 1\) is less than the length of \(l\).
lemma listPathProduct_pos_implies_transitions (P : StochasticMatrix M)
(l : List (Fin (M + 1))) (hpos : 0 < listPathProduct P l)
(i : ℕ) (hi : i + 1 < l.length) :
0 < P.prob (l.get ⟨i, by omega⟩) (l.get ⟨i + 1, hi⟩)
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
Uses 3 · Used by 1
LemmaJoining positive paths#✓fully proved
Let \(P\) be a stochastic matrix on the states \(\{0, \dots, M\}\), and let \(l_1, l_2\) be nonempty paths (finite lists of states) such that the last state of \(l_1\) is the first state of \(l_2\). If the products of the transition probabilities \(P(x, y)\) over consecutive states \(x, y\) along \(l_1\) and along \(l_2\) are both positive, then so is the product along the path that follows \(l_1\) and then \(l_2\) with its first state removed.
lemma listPathProduct_append_pos (P : StochasticMatrix M)
(l1 l2 : List (Fin (M + 1))) (hne1 : l1 ≠ []) (hne2 : l2 ≠ [])
(hjoin : l1.getLast hne1 = l2.head hne2)
(h1 : 0 < listPathProduct P l1) (h2 : 0 < listPathProduct P l2) :
0 < listPathProduct P (l1 ++ l2.tail)
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
Uses 3 · Used by 2
TheoremPath independence of cycle weight#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the states \(\{0, \dots, M\}\) satisfying Kolmogorov's cycle condition, and let \(i_0, j\) be states. If two paths (finite lists of states) both start at \(i_0\), end at \(j\), and have positive product of the transition probabilities \(P(x, y)\) over consecutive states \(x, y\), then the products of the ratios \(P(x, y) / P(y, x)\) over consecutive states \(x, y\) along the two paths are equal.
This is the key step that makes the cycle weight well-defined and ultimately produces a reversible measure.
theorem cycleWeight_path_independent (P : StochasticMatrix M)
(hcycle : P.KolmogorovCycleCondition) (hirr : P.IsIrreducible) (i₀ j : Fin (M + 1))
(path1 path2 : List (Fin (M + 1)))
(h1 : path1.head? = some i₀) (h1' : path1.getLast? = some j)
(h2 : path2.head? = some i₀) (h2' : path2.getLast? = some j)
(hp1 : 0 < listPathProduct P path1) (hp2 : 0 < listPathProduct P path2) :
listRatioProduct P path1 = listRatioProduct P path2
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
def listPathProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => P.prob a b * listPathProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:73
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 11 · Used by 1
LemmaRatio product after appending a state#✓fully proved
Let \(P\) be a stochastic matrix, \(x_0, \dots, x_k\) a path of states and \(j\) a state. Then the ratio product along \(x_0, \dots, x_k, j\) equals the ratio product along \(x_0, \dots, x_k\) times \(\frac{P(x_k, j)}{P(j, x_k)}\), where a quotient with denominator \(0\) is taken to be \(0\).
lemma listRatioProduct_snoc (P : StochasticMatrix M) :
∀ (path : List (Fin (M + 1))) (j : Fin (M + 1)) (hne : path ≠ []),
listRatioProduct P (path ++ [j]) =
listRatioProduct P path *
(P.prob (path.getLast hne) j /
P.prob j (path.getLast hne))
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def listRatioProduct (P : StochasticMatrix M) : List (Fin (M + 1)) → ℝ
| [] => 1
| [_] => 1
| a :: b :: rest => (P.prob a b / P.prob b a) * listRatioProduct P (b :: rest)
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:92
Uses 2 · Used by 1
LemmaCycle weights along a positive transition#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the states \(\{0, \dots, M\}\) satisfying Kolmogorov's cycle condition, fix a reference state \(i_0\), and write \(w(j)\) for the cycle weight of a state \(j\) relative to \(i_0\). If \(i, j\) are states with \(P(i, j) > 0\), then \(w(i) \cdot P(i, j) / P(j, i) = w(j)\).
lemma cycleWeight_extend (P : StochasticMatrix M)
(hcycle : P.KolmogorovCycleCondition) (hirr : P.IsIrreducible)
(i₀ i j : Fin (M + 1)) (hPij : 0 < P.prob i j) :
cycleWeight P hirr i₀ i *
(P.prob i j / P.prob j i) =
cycleWeight P hirr i₀ j
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def cycleWeight (P : StochasticMatrix M) (hirr : P.IsIrreducible)
(i₀ : Fin (M + 1)) (j : Fin (M + 1)) : ℝ :=
listRatioProduct P (Classical.choose (hirr.exists_path i₀ j))
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:243
Uses 10 · Used by 1
TheoremDetailed balance for cycle weights#✓fully proved
Let \(P\) be an irreducible stochastic matrix on the states \(\{0, \dots, M\}\) satisfying Kolmogorov's cycle condition, fix a reference state \(i_0\), and write \(w(j)\) for the cycle weight of a state \(j\) relative to \(i_0\). Then for all states \(i, j\) we have \(w(i) \cdot P(i, j) = w(j) \cdot P(j, i)\).
theorem cycleWeight_detailed_balance (P : StochasticMatrix M)
(hcycle : P.KolmogorovCycleCondition) (hirr : P.IsIrreducible)
(i₀ i j : Fin (M + 1)) :
cycleWeight P hirr i₀ i * P.prob i j =
cycleWeight P hirr i₀ j * P.prob j i
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
noncomputable def cycleWeight (P : StochasticMatrix M) (hirr : P.IsIrreducible)
(i₀ : Fin (M + 1)) (j : Fin (M + 1)) : ℝ :=
listRatioProduct P (Classical.choose (hirr.exists_path i₀ j))
MathlibExt/Probability/KolmogorovCycleSufficiency.lean:243
Uses 5 · Used by 1
TheoremKolmogorov's cycle theorem, sufficiency#✓fully proved
For an irreducible finite Markov chain satisfying the cycle condition, there exists a reversible measure: a distribution satisfying the detailed balance equations (and hence stationary).
theorem kolmogorov_cycle_sufficiency {M : ℕ} (P : StochasticMatrix M)
(hirr : P.IsIrreducible) (hcycle : P.KolmogorovCycleCondition) :
P.IsReversible
structure StochasticMatrix (M : ℕ) where
prob : Fin (M + 1) → Fin (M + 1) → ℝ
nonneg : ∀ i j, 0 ≤ prob i j
row_sum : ∀ i, ∑ j, prob i j = 1
MathlibExt/Probability/KolmogorovCycleNecessity.lean:63
Uses 14
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.