Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 2: a Metropolis–Hastings kernel satisfies detailed balance iff α=0\alpha=0α=0 a.e. off RRR and α(x,y)r(x,y)=α(y,x)\alpha(x,y)r(x,y)=\alpha(y,x)α(x,y)r(x,y)=α(y,x) a.e. on RRR

Proved
TierneyMH.Reversibility.theorem2_detailed_balance_iff

by mikedeng1 · Sep 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

detailed-balancemetropolis-hastingsp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1reversibility

Let π\piπ be a probability measure on a measurable space (E,E)(E,\mathcal E)(E,E), let QQQ be a Markov transition kernel on EEE (the proposal), and let α:E×E→[0,1]\alpha:E\times E\to[0,1]α:E×E→[0,1] be measurable (the acceptance probability). Let PPP be the Metropolis–Hastings kernel P(x,dy)=Q(x,dy)α(x,y)+δx(dy)∫(1−α(x,u))Q(x,du)P(x,dy)=Q(x,dy)\alpha(x,y)+\delta_x(dy)\int(1-\alpha(x,u))Q(x,du)P(x,dy)=Q(x,dy)α(x,y)+δx​(dy)∫(1−α(x,u))Q(x,du), and put μ(dx,dy)=π(dx)Q(x,dy)\mu(dx,dy)=\pi(dx)Q(x,dy)μ(dx,dy)=π(dx)Q(x,dy) and μT(dx,dy)=μ(dy,dx)\mu^T(dx,dy)=\mu(dy,dx)μT(dx,dy)=μ(dy,dx). Let RRR be any symmetric set on which μ\muμ and μT\mu^TμT are mutually absolutely continuous and off which they are mutually singular, and let rrr be any version of dμR/dμRTd\mu_R/d\mu^T_RdμR​/dμRT​ with 0<r<∞0<r<\infty0<r<∞ and r(x,y)=1/r(y,x)r(x,y)=1/r(y,x)r(x,y)=1/r(y,x) everywhere (Proposition 1). Then PPP satisfies detailed balance, π(dx)P(x,dy)=π(dy)P(y,dx)\pi(dx)P(x,dy)=\pi(dy)P(y,dx)π(dx)P(x,dy)=π(dy)P(y,dx), if and only if

  1. α\alphaα is μ\muμ-almost everywhere zero on RcR^cRc, and
  2. α\alphaα satisfies
α(x,y) r(x,y)=α(y,x)μ-almost everywhere on R.\alpha(x,y)\,r(x,y)=\alpha(y,x)\qquad\mu\text{-almost everywhere on }R.α(x,y)r(x,y)=α(y,x)μ-almost everywhere on R.

This gives necessary and sufficient conditions on the proposal kernel and the acceptance probability for a Metropolis–Hastings sampler to be reversible with respect to π\piπ on a general state space, with no density or dominating measure assumed. The standard Metropolis–Hastings acceptance probability and many special cases of the literature (common dominating measure, deterministic proposals, dimension-changing moves) are instances.

Formalization Note The paper states the theorem for "the detailed balance condition (4)", μ(dx,dy)α(x,y)=μT(dx,dy)α(y,x)\mu(dx,dy)\alpha(x,y)=\mu^T(dx,dy)\alpha(y,x)μ(dx,dy)α(x,y)=μT(dx,dy)α(y,x), which the text on pp. 2–3 identifies with detailed balance (2) of the kernel; the statement here uses (2) for the kernel itself, as Mathlib's Kernel.IsReversible (mhKernel Q α) π. The pair (R,r)(R,r)(R,r) is universally quantified, so the theorem holds for every version. μ=π⊗Q\mu=\pi\otimes Qμ=π⊗Q is π ⊗ₘ Q, μT\mu^TμT is its image under the swap, and "μ\muμ-a.e. on RRR" is almost everywhere for the restriction of μ\muμ to RRR. α\alphaα and rrr are ℝ≥0∞-valued.

Preamble
import Mathlib
import Definitions.Def_TierneyMH_Shared_mhKernel
import Definitions.Def_TierneyMH_Shared_IsSymmetricSplit
import Definitions.Def_TierneyMH_Shared_IsRatioVersion

open TierneyMH.Shared

open MeasureTheory ProbabilityTheory
open scoped ENNReal
Formal statement
namespace TierneyMH.Reversibility

/-- **Theorem 2** (Tierney 1998, p. 3). Let `π` be a probability measure and `Q` a Markov kernel
on a measurable space `E`, let `α : E × E → [0, 1]` be measurable, and put
`μ(dx, dy) = π(dx) Q(x, dy)` (`μ = π ⊗ₘ Q`). Let `(R, r)` be **any** pair given by
Proposition 1 for `μ`. Then the Metropolis–Hastings kernel `mhKernel Q α` of Eq. (1) satisfies
detailed balance with respect to `π` if and only if
* (i) `α = 0` `μ`-almost everywhere on `Rᶜ`, and
* (ii) `α(x, y) r(x, y) = α(y, x)` `μ`-almost everywhere on `R`.

The paper names detailed balance in the form (4) `μ(dx, dy) α(x, y) = μᵀ(dx, dy) α(y, x)`,
which the text on pp. 2–3 identifies with (2) for the kernel (1); the statement here uses (2)
itself, `Kernel.IsReversible (mhKernel Q α) π`. -/
theorem theorem2_detailed_balance_iff {E : Type*} [MeasurableSpace E]
    (π : Measure E) [IsProbabilityMeasure π] (Q : Kernel E E) [IsMarkovKernel Q]
    (α : E × E → ℝ≥0∞) (hα_meas : Measurable α) (hα_le : ∀ p, α p ≤ 1)
    (R : Set (E × E)) (r : E × E → ℝ≥0∞)
    (hR : IsSymmetricSplit (π ⊗ₘ Q) R) (hr : IsRatioVersion (π ⊗ₘ Q) R r) :
    Kernel.IsReversible (mhKernel Q α) π ↔
      ((∀ᵐ p ∂((π ⊗ₘ Q).restrict Rᶜ), α p = 0) ∧
        (∀ᵐ p ∂((π ⊗ₘ Q).restrict R), α p * r p = α p.swap)) := by sorry

end TierneyMH.Reversibility
Source
L. Tierney, A Note on Metropolis–Hastings Kernels for General State Spaces, Ann. Appl. Probab. 8(1) (1998) 1–9, DOI 10.1214/aoap/1027961031, p. 3, Theorem 2
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me