Motivation
The Metropolis algorithm turns a simple random walk into a Markov chain with a prescribed stationary distribution, by accepting or rejecting the walk's proposals. It is the basic tool of Markov chain Monte Carlo, and the practical question it raises is quantitative: how many steps are needed before the chain's distribution is close to the target? For most chains used in practice there is no rigorous answer.
Diaconis and Saloff-Coste (Ann. Appl. Probab. 6 (1996) 695–750) developed logarithmic Sobolev inequalities for finite Markov chains as a tool for exactly this question. Their first illustration, stated as Theorem 1.1 in the introduction, is the Metropolis chain for the binomial distribution: a one-dimensional chain for which the spectral gap gives a bound of order n2 steps, while the log-Sobolev constant gives the correct order nlogn. This mission formalizes that theorem and the chain of results the paper uses to prove it: the log-Sobolev constant of a product chain, of the hypercube walk, of the Ehrenfest chain, a comparison principle, and a discrete-time convergence bound.
Setting
Let X be a finite set. A Markov kernel K on X is a matrix with K(x,y)≥0 and ∑yK(x,y)=1; Kl(x,⋅), written Kxl, is the law of the chain after l steps from x. A probability π on X is invariant if ∑xπ(x)K(x,y)=π(y); throughout, π charges every point. (K,π) is reversible if π(x)K(x,y)=π(y)K(y,x).
For real functions f,g on X write ⟨f,g⟩=∑xf(x)g(x)π(x), ∥f∥2=⟨f,f⟩1/2, Ef=∑xf(x)π(x) and Var(f)=∥f−Ef∥22. The Dirichlet form is E(f,g)=⟨(I−K)f,g⟩, and
L(f)=x∑∣f(x)∣2log∥f∥22∣f(x)∣2π(x).
The spectral gap and the log-Sobolev constant are
λ=inf{Var(f)E(f,f):Var(f)=0},α=inf{L(f)E(f,f):L(f)=0}.
For reversible K, βmin is the smallest eigenvalue of K. The total variation distance is ∥μ−ν∥TV=maxA⊆X∣μ(A)−ν(A)∣.
The chain of the goal lives on X={0,1,…,n}, n≥1, with the binomial distribution π(x)=2−n(xn). The base chain is the nearest-neighbour walk K(x,x±1)=1/2 for 1≤x≤n−1, holding with probability 1/2 at 0 and at n. The Metropolis chain M accepts a proposed move x→y=x with probability min{1,π(y)/π(x)}, so M(x,y)=K(x,y)min{1,π(y)/π(x)} for y=x, and M(x,x)=1−∑y=xM(x,y). Explicitly, M(x,x+1)=21 for x≤(n−1)/2 and M(x,x+1)=2(x+1)n−x above, symmetrically for x−1; this is the kernel (1.9) of the paper.
Two auxiliary chains appear in the proof: the hypercube walk on {−1,1}n, which flips a uniformly chosen coordinate, and the Ehrenfest chain P(x,x+1)=(n−x)/n, P(x,x−1)=x/n on {0,…,n}, which records the number of coordinates equal to 1.
Formalization targets
Goal: Theorem 1.1 (upper bound)
For every n≥1, every starting point x, every c>0 and every integer l,
∥Mxl−π∥TV≤e1−cwhenever l≥2n(logn+2c).
The goal is stated about the explicit chain (1.9) only; it fixes the constants as printed.
Milestones
- Example 1.1, (1.9). The Metropolis construction gives the six-case kernel (1.9), and π(x)M(x,y)=π(y)M(y,x).
- Example 3.1. The two-point chain on {−1,1} has π≡1/2, λ=2 and α=λ/2=1.
- Lemma 3.2. The product chain (2.9) of d chains, with the product measure (2.10), has λ=d1miniλi and α=d1miniαi.
- Example 3.2. The hypercube walk is that product of two-point chains and has α=λ/2=1/n.
- Lemma 3.1. 2α≤λ for every chain.
- Lemma 3.3. If E′≤AE and aπ≤π′ with A,a>0, then λ′≤aAλ and α′≤aAα.
- Example 3.3. The Ehrenfest chain is the projection of the hypercube walk, with λ=2/n and α(P)=1/n; 21P(x,y)≤M(x,y)≤P(x,y) for x=y, so EM≤EP≤2EM; hence n1≤λ(M)≤n2 and 2n1≤α(M)≤n1.
- Corollary 3.8. For reversible (K,π) and π(x)≤1/e, with λ∗=min{λ,1+βmin}, ∥Kxm/π−1∥2≤(1+2e2)1/2e−c for m≥4α1loglogπ(x)1+λ∗c+1.
- Example 3.4. M(x,x)≥2/(n+3), βmin≥−1+4/(n+3), and ∥Mxl/π−1∥2≤(1+2e2)1/2e−c for l≥2n(logn+2c)+1.
Significance
The theorem shows that the Metropolis chain for the binomial distribution mixes in 2nlogn+O(n) steps, matching the lower bound of order nlogn quoted in the paper's converse. The spectral gap λ(M)≍1/n together with π∗=2−n only yields order n2; the improvement comes from replacing log(1/π∗) by loglog(1/π∗), which is what the log-Sobolev constant buys. The intermediate results are reusable on their own: the tensorization of λ and α (Lemma 3.2), the comparison principle (Lemma 3.3) and the discrete-time bound (Corollary 3.8) apply to any finite chain, and the exact log-Sobolev constants of the two-point chain, the hypercube and the Ehrenfest chain are standard inputs elsewhere.
All results are proved in the paper (the gap λ=2/n of the Ehrenfest chain is quoted there as known). To our knowledge none of them is machine-checked: there is no log-Sobolev constant of a Markov chain in Mathlib or on the platform. The work is to formalize the known proofs.
Difficulty
The natural first idea is to bound the distance to stationarity by the spectral gap: ∥Kxl/π−1∥22≤π(x)−1β2l. With π(x) as small as 2−n and 1−β≍1/n, this needs l of order n2, so no amount of care with this argument reaches the theorem. The proof instead goes through the log-Sobolev constant, which is hard to compute even for simple chains: the paper obtains α(M) only through a sequence of exact computations (two points, products, a projection) followed by a comparison. Each step involves the nonlinear functional L, whose tensorization and behaviour under comparison of measures are less elementary than those of the variance. The passage from continuous to discrete time also needs control of βmin, since a chain with eigenvalue near −1 does not converge.
Formalization scope
The state space {0,…,n} is Fin (n + 1), {−1,1} is Fin 2 (0↦−1, 1↦1), and {−1,1}n is Fin n → Fin 2. Kernels are real matrices Matrix V V ℝ; stochasticity, invariance, irreducibility, reversibility (detailed balance), total variation, the rows Kxl, the product chain (2.9) and the generic Metropolis rule are the published MarkovMixing definitions (mm_basic, mm_mixing, mm_continuous, mm_mcmc). Functions are real valued. Time l is a natural number and thresholds are compared in R.
λ, α and βmin are defined variationally as real infima (sInf). βmin is the minimum of the Rayleigh quotient ⟨Kf,f⟩/⟨f,f⟩, which is the smallest eigenvalue for reversible chains. The eigenvalue-based MarkovMixing.spectralGap is not used, since it equals λ only for reversible chains. Two hypotheses are added where Lean's conventions would otherwise falsify a statement: Lemma 3.2 assumes every factor has at least two points (Lean evaluates the infimum over an empty set as 0, the paper as +∞), and Corollary 3.8 assumes 1+βmin>0 (Lean evaluates c/0 as 0, the paper as +∞). Lemmas 3.1 and 3.3 are stated without the section's irreducibility assumption, which they do not need.
A trivializing formalization is ruled out: the goal mentions only the explicit chain M, the binomial distribution, Mxl and total variation, not a chain assumed to have α≥1/(2n); positivity and invariance of π are never dropped; and no statement relies on a junk value of sInf, Real.log or division. The converse half of Theorem 1.1, maxx∥Mxl−π∥TV≥41+o(1) for l≤8nlogn, is asymptotic and proved in the paper only by citation; it is not part of the mission. The second statement of Corollary 3.8 (the uniform bound on ∣k2n(x,y)−1∣) is also left out.
A complete development needs the semigroup Ht=e−t(I−K) and the hypercontractivity theorem of the paper (Theorem 3.5) on the way to Corollary 3.8, a spectral decomposition of reversible kernels, and the entropy inequalities behind Lemmas 3.2 and 3.3. The general results (Lemmas 3.1–3.3, Corollary 3.8) are reusable beyond this mission. Contributions to any milestone, and alternative routes to the goal, are welcome.
Selected references
- P. Diaconis and L. Saloff-Coste, Logarithmic Sobolev inequalities for finite Markov chains, Ann. Appl. Probab. 6(3) (1996), 695–750. https://doi.org/10.1214/aoap/1034968224
- P. Diaconis and L. Saloff-Coste, What do we know about the Metropolis algorithm?, J. Comput. System Sci. 57 (1998), 20–36 (reference [18] of the paper, in its preprint form). https://doi.org/10.1006/jcss.1998.1576
- D. A. Levin, Y. Peres and E. L. Wilmer, Markov Chains and Mixing Times, AMS, 2009 (source of the published
MarkovMixing definitions). https://doi.org/10.1090/mbk/058