Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Proposition 8.13 -- the riffle shuffle mixes in 2log⁡2n+O(1)2\log_2 n+O(1)2log2​n+O(1)

Proved
MarkovMixing.riffle_mixing_upper

by Shuze Chen · Aug 21, 2026 · Mathlib 0df444a (Lean v4.33.1)

markov-chainsmixing-timesprobability

The riffle shuffle (Gilbert–Shannon–Reeds) of a deck of nnn cards cuts the deck into two packets and interleaves them; it is formalized as the time reversal of the inverse riffle, in which every card independently receives a uniform bit and the cards labeled 000 are pulled to the top, both packets keeping their relative order. (The reversal is legitimate because the stationary distribution — uniform over the n!n!n! orderings — is preserved, and a walk and its reversal mix at the same speed.) The mixing time tmixt_{\mathrm{mix}}tmix​ is the first time ttt at which max⁡x∥Pt(x,⋅)−unif∥TV≤14\max_x\|P^t(x,\cdot)-\mathrm{unif}\|_{TV}\le\tfrac14maxx​∥Pt(x,⋅)−unif∥TV​≤41​, with ∥μ−ν∥TV=max⁡A∣μ(A)−ν(A)∣\|\mu-\nu\|_{TV}=\max_A|\mu(A)-\nu(A)|∥μ−ν∥TV​=maxA​∣μ(A)−ν(A)∣ the total variation distance.

The theorem (Proposition 8.13 of Levin–Peres–Wilmer) asserts: for every deck size n≥2n\ge2n≥2,

tmix  ≤  2log⁡2 ⁣(4n3)+1.t_{\mathrm{mix}}\;\le\;2\log_2\!\Bigl(\frac{4n}{3}\Bigr)+1.tmix​≤2log2​(34n​)+1.

Order log⁡2n\log_2 nlog2​n riffle shuffles suffice — for a standard 525252-card deck this bound is in the famous "about seven shuffles" range. The proof tracks the bits accumulated by the inverse shuffles: once all nnn bit-strings are distinct, the deck is exactly uniform.

Preamble
import Definitions.Def_mm_shuffle
import Mathlib.Analysis.SpecialFunctions.Log.Base
Formal statement
namespace MarkovMixing

/-- **Proposition 8.13** (LPW): for the riffle shuffle on an `n`-card deck,
`t_mix ≤ 2 log₂(4n/3) + 1`. -/
theorem riffle_mixing_upper (n : ℕ) (hn : 2 ≤ n) :
    (tMix (riffleShuffle n) (uniformDist (Equiv.Perm (Fin n))) : ℝ) ≤
      2 * Real.logb 2 (4 * n / 3) + 1 := by
  sorry

end MarkovMixing
Source
D. A. Levin, Y. Peres, E. L. Wilmer, Markov Chains and Mixing Times, AMS 2009, https://documents.epfl.ch/groups/i/ip/ipg/www/2013-2014/Random_Walks/markovmixing.pdf, Section 8.3.2, Proposition 8.13, p. 107

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