Approximately counting proper colorings
ProvedMarkovMixing.approximate_countingLet be a graph on vertices with maximum degree , fix colors, and let be the set of proper -colorings (colorings giving adjacent vertices distinct colors). Set , which is positive when .
The theorem (Theorem 14.12 of Levin–Peres–Wilmer) asserts: for any error tolerance and failure probability there exist a number of seeds , a seed alphabet size , and an estimator — a function assigning a real number to each of the strings of independent uniform seeds — such that:
- the seed budget is explicitly polynomial: ;
- with probability at least over the uniform seed string, the estimate is a -approximation of the reciprocal of the count: the fraction of seed strings with
is at least .
This is the sampling-to-counting reduction of Jerrum–Valiant–Vazirani instantiated for colorings: expressing as a telescoping product of marginal probabilities, estimating each factor by sampling colorings with the rapidly mixing Glauber dynamics of this mission's goal, and amplifying. It makes the count of proper colorings approximable to any precision in polynomial time — a fully polynomial randomized approximation scheme.
Retired — this statement is true but empty
Replaced by MarkovMixing.colorings_self_reducibility. Proved by punai (accepted), whose submission says the same thing this note says. The proof stands and is unaffected by the retirement.
The estimator is existentially quantified with nothing tying it to any algorithm, so , and satisfy every clause. The gap is in the book's phrasing as much as in this rendering: LPW's Theorem 14.12 says "there is a random variable which can be simulated using no more than … uniform random variables", and simulated is the whole content — a claim about an algorithm, of which pure existence of a real-valued function carries none. A faithful formalization would have to model the sampler itself.
The replacement carries the half of the proof that is a mathematical statement: with the proper colourings agreeing with a fixed at every vertex ,
The sampling half is carried by Theorem 14.8 and the mission goal. (The bound stated there also corrects the book, which asserts : on the four-cycle with edges , and , the ratio is .)
import Definitions.Def_mm_transport import Mathlib.Analysis.SpecialFunctions.Log.Basic
namespace MarkovMixing
/-- **Theorem 14.12** (LPW), approximately counting colorings: for
`q > 2Δ`, with `c(q,Δ) = 1 − Δ/(q−Δ)`, there is an estimator `W`, computed
from at most `⌈(n log n + n log(3n/ε))/c(q,Δ)⌉ ⌈27qn²/(ηε²)⌉` independent
uniform random seeds, which with probability at least `1 − η` lies within a
`(1 ± ε)` factor of `|Ω|⁻¹`, where `Ω` is the set of proper `q`-colorings. -/
theorem approximate_counting {Vv : Type*} [Fintype Vv] [DecidableEq Vv]
[Nonempty Vv] (G : SimpleGraph Vv) [DecidableRel G.Adj] (q : ℕ)
(hq : 2 * G.maxDegree < q) (η ε : ℝ) (hη : 0 < η) (hη1 : η < 1)
(hε : 0 < ε) (hε1 : ε < 1) :
∃ (T K : ℕ) (W : (Fin T → Fin K) → ℝ), 0 < K ∧
(T : ℝ) ≤
(⌈((Fintype.card Vv : ℝ) * Real.log (Fintype.card Vv) +
(Fintype.card Vv) * Real.log (3 * (Fintype.card Vv) / ε)) /
(1 - (G.maxDegree : ℝ) / ((q : ℝ) - G.maxDegree))⌉₊ : ℝ) *
(⌈27 * (q : ℝ) * (Fintype.card Vv : ℝ) ^ 2 / (η * ε ^ 2)⌉₊ : ℝ) ∧
1 - η ≤
((Finset.univ.filter fun s : Fin T → Fin K =>
(1 - ε) / (Fintype.card {c : Vv → Fin q // IsProperColoring G c} : ℝ) ≤ W s ∧
W s ≤ (1 + ε) / (Fintype.card {c : Vv → Fin q // IsProperColoring G c} : ℝ)).card : ℝ) /
(K : ℝ) ^ T := by
sorry
end MarkovMixingRead-back
What the Lean code literally says, in plain math · claude-fable-5
Read-back: approximate_counting
Let be a finite, nonempty type with decidable equality, a simple graph on with decidable adjacency, and a natural number with , where is 's maximum degree. Let be reals with and . Write and let be the number of proper -colorings of — maps giving adjacent vertices distinct colors — cast to .
The theorem asserts the existence of natural numbers and and of a real-valued function defined on the set of sequences (i.e. on "seed strings"), such that all three of the following hold:
-
.
-
A size bound on (as a real number):
where each is the ceiling into (clamping negative reals to ), then cast back to and multiplied; , , are naturals cast to ; and -style subtractions are real subtractions; is the real logarithm (with the junk convention for , which is not triggered here since and ); and divisions are Lean's total real division (the denominator is nonzero and positive under ).
- A success-probability bound: among all sequences , letting be the number of those satisfying
one has
where the denominator is .
Junk-value and edge-case behavior the meaning depends on: the divisions are total real division, so if has no proper -coloring () both bounds equal and the counted condition becomes , i.e. exactly. If there is exactly one (empty) sequence and , so condition 3 reduces to , satisfiable by the single value lying in the interval.
Note carefully what is and is not claimed: the statement only asserts that some , , and some arbitrary function with these three properties exist. No algorithm, computability, randomness structure, Markov chain, or any relationship between and the Glauber dynamics or the graph (beyond the numerical interval around ) is asserted — is an unrestricted real-valued function on seed strings, constrained only by the counting inequality in item 3 and , only by items 1–2.
Confirmed by the mission captain (proposal self-audit).