Plectis Atlas
Search

↑ and ↓ move, Enter opens, Esc closes.

How to use the Atlas

Each Atlas page is about one result from OpenAI’s mathematics release. It puts the paper’s theorem beside the Lean statement OpenAI wrote for a computer to check, and shows what outside groups found.

How to read a result

  1. Find a result. Press / and type a few words from its title, or click a subject on the map and then a dot. Each dot is one result and its papers.
  2. Read the first screen. The paper’s theorem is on the left. On the right is the statement OpenAI wrote in Lean, a language in which a computer checks every step of a proof. The line underneath gives how the two were linked and whether anyone has reviewed that they mean the same thing.
  3. See what the outside groups found. They answer two separate questions, each in its own words: whether the Lean says what the paper claims, and whether OpenAI’s proof passed Comparator, the program that checks the proof against the Lean. A pass means the proof proves the Lean statement, not that the Lean says what the paper says.
  4. Use the tabs for more. They hold the full papers, every Lean statement, each group’s full reasons with a link to its report, and related reading.

Try it on one result: the irrationality exponent of π

Words you will see

Family
OpenAI’s group of papers about one result. Each dot on the map is a family.
Lean statement
A theorem written in Lean with its proof left out (the file says sorry in its place). OpenAI supplies the proof in a separate file.
Comparator
The program that checks OpenAI’s proof against a Lean statement. A pass does not show that the Lean means what the paper says.
The outside groups
MathVet and Carlos Toledo’s cert-machine compared each family’s Lean statements with OpenAI’s description of the result and gave their verdicts in their own words. Other groups report Comparator runs.
Possible match
A paper theorem linked to a Lean statement by a citation in the Lean source, by an AI agent’s reading of both, or by words they share. No review that they mean the same thing is recorded.

Every term, in the glossaryThis guide as a page

Atlas collects these reports and links to them. It runs no checks itself.

Press ? to open this guide and Esc to close it.

Lean statement

Nine routing-density and representation estimates

Theorem selected for verification: OAI.ThorpNine.main

Lean statement: ThorpRouting.leanShow on the mapFamily 238.

A statement OpenAI wrote in Lean, a language in which a computer checks every step of a proof.

The Lean statement beside the paper

The paper states

Theorem 10.1 of Routing densities and representation contraction for Thorp sweeps

Theorem

There are absolute positive constants c,c',C such that for every dyadic n and every partition \lambda=(n-r,\rho)\vdash n,

\begin{aligned}\|F_n|_{V_\lambda}\|_{\op}&\le e^{-c h_n(r)}, \\ \Tr_{V_\lambda}F_n^4&\le \exp\{-c'\log D_\lambda+C h_n(r)\}.\end{aligned}

Consequently \|T_n|_{V_\lambda}\|_{\op} is at most \exp[-c_0\{\log D_\lambda+h_n(r)\}] for an absolute c_0>0.

Section 10, Compressed generators and adaptive alphabets Read it in the paper TeX source, line 28
Show the TeX
There are absolute positive constants $c,c',C$ such that for every
dyadic $n$ and every partition $\lambda=(n-r,\rho)\vdash n$,
\begin{align}
 \|F_n|_{V_\lambda}\|_{\op}&\le e^{-c h_n(r)},
       \\
 \Tr_{V_\lambda}F_n^4&\le
       \exp\{-c'\log D_\lambda+C h_n(r)\}.
       
\end{align}
Consequently $\|T_n|_{V_\lambda}\|_{\op}$ is at most
$\exp[-c_0\{\log D_\lambda+h_n(r)\}]$ for an absolute $c_0>0$.

Theorem 8.1 of Routing densities and representation contraction for Thorp sweeps

Theorem (Cycle density and Casimir contraction)

There are absolute constants a,C>0 such that for every dyadic n, every 1\le k\le n, and every x\in X_{n,k},

\|R_x\|_{L^{65/64}(u_{n,k})}\le e^{C h_n(k)}.

For every nontrivial partition \lambda\vdash n, put k=n-\lambda_1. Then

\|K_n(\lambda)\|_{\op}\le e^{-a h_n(k)},\qquad D_\lambda\Tr K_n(\lambda)^{65}\le e^{C h_n(k)}.

Consequently there is an absolute integer l for which \|\mu_n^{*l}-U_{S_n}\|_{\TV}\to0 as n\to\infty through powers of two. Here U_{S_n} is the uniform permutation law and total variation includes the factor 1/2. The same bound holds from every deterministic initial permutation. When n=2^d, these l sweeps take ld physical shuffles.

Section 8, Cycle traces and contraction by the transposition Casimir Read it in the paper TeX source, line 37
Show the TeX
There are absolute constants $a,C>0$ such that for every dyadic $n$,
every $1\le k\le n$, and every $x\in X_{n,k}$,
\[
 \|R_x\|_{L^{65/64}(u_{n,k})}\le e^{C h_n(k)}.
\]
For every nontrivial partition $\lambda\vdash n$, put $k=n-\lambda_1$.
Then
\[
 \|K_n(\lambda)\|_{\op}\le e^{-a h_n(k)},\qquad
 D_\lambda\Tr K_n(\lambda)^{65}\le e^{C h_n(k)}.
\]
Consequently there is an absolute integer $l$ for which
$\|\mu_n^{*l}-U_{S_n}\|_{\TV}\to0$ as $n\to\infty$ through powers of two.
Here $U_{S_n}$ is the uniform permutation law and total variation includes
the factor $1/2$.  The same bound holds from every deterministic initial
permutation.  When $n=2^d$, these $l$ sweeps take $ld$ physical shuffles.

Proposition 7.1 of Routing densities and representation contraction for Thorp sweeps

Proposition (Uniform sparse contact estimate)

There is an absolute constant C_*>0 such that for every dyadic n=2^d\ge2, every 1\le k<n, and every partition \lambda=(n-k,\beta)\vdash n,

\|T_n(\lambda)\|_{\op}^2 \le \min\left\{1,\left(\frac{C_*dk}{n}\right)^{k/2}\right\}.

For k=1 this operator is zero. In particular, with an absolute constant C independent of n,k,\lambda,

\|T_n(\lambda)\|_{\op}^2 \le C^k(1+d)^{Ck}(k/n)^{k/2}.

The same statements hold with the coordinate order reversed.

Section 7, Uniform contact cancellation on an exact injection level Read it in the paper TeX source, line 30
Show the TeX
There is an absolute constant $C_*>0$ such that for every dyadic
$n=2^d\ge2$, every $1\le k<n$, and every partition
$\lambda=(n-k,\beta)\vdash n$,
\begin{equation}
 \|T_n(\lambda)\|_{\op}^2
 \le \min\left\{1,\left(\frac{C_*dk}{n}\right)^{k/2}\right\}.
\end{equation}
For $k=1$ this operator is zero.  In particular, with an absolute
constant $C$ independent of $n,k,\lambda$,
\begin{equation}
 \|T_n(\lambda)\|_{\op}^2
 \le C^k(1+d)^{Ck}(k/n)^{k/2}.
\end{equation}
The same statements hold with the coordinate order reversed.

Theorem 9.1 of Routing densities and representation contraction for Thorp sweeps

Theorem

There are absolute constants c,C,\zeta>0, a number \delta\in(0,1), and an integer p_0 with the following properties. For every dyadic n and \lambda=(n-k,\beta)\vdash n with k\ge1,

\begin{aligned}W_n(\lambda)&\le e^{-c\Lambda_n(k)},\\ W_n(\lambda)&\le e^{C\Lambda_n(k)}f_\beta^{-\zeta}.\end{aligned}

Independently, for every 1\le k\le n, let X_{n,k} be the ordered injective k-tuples of positions, with uniform probability measure, and let \mathcal K_{n,k}(x,y)=(n)_k\Pr_{K_n}(x\mapsto y) be its kernel density. Then

\begin{aligned}\sup_x\E_y\mathcal K_{n,k}(x,y)^{1+\delta} &\le e^{C\Lambda_n(k)},\\ \operatorname{tr}_{X_{n,k}}K_n^{p_0} &\le e^{C\Lambda_n(k)}.\end{aligned}

Consequently, after changing absolute constants,

\begin{aligned}\|T_n|_{V_\lambda}\|_{\op} &\le \exp[-c\{\Lambda_n(k)+\log f_\beta\}], \\ W_n(\lambda)&\le e^{-c_1\Lambda_n(k)}D_\lambda^{-c_2}\end{aligned}

for absolute c_1,c_2>0.

Section 9, Harmonic restriction and cycle moments Read it in the paper TeX source, line 45
Show the TeX
There are absolute constants $c,C,\zeta>0$, a number $\delta\in(0,1)$,
and an integer $p_0$ with the following properties.  For every dyadic $n$
and $\lambda=(n-k,\beta)\vdash n$ with $k\ge1$,
\begin{align}
 W_n(\lambda)&\le e^{-c\Lambda_n(k)},\\
 W_n(\lambda)&\le e^{C\Lambda_n(k)}f_\beta^{-\zeta}.
 
\end{align}
Independently, for every $1\le k\le n$, let $X_{n,k}$ be the ordered injective $k$-tuples of positions, with
uniform probability measure, and let
$\mathcal K_{n,k}(x,y)=(n)_k\Pr_{K_n}(x\mapsto y)$ be its kernel density.
Then
\begin{align}
 \sup_x\E_y\mathcal K_{n,k}(x,y)^{1+\delta}
   &\le e^{C\Lambda_n(k)},\\
 \operatorname{tr}_{X_{n,k}}K_n^{p_0}
   &\le e^{C\Lambda_n(k)}.
\end{align}
Consequently, after changing absolute constants,
\begin{align}
 \|T_n|_{V_\lambda}\|_{\op}
   &\le \exp[-c\{\Lambda_n(k)+\log f_\beta\}],
       \\
 W_n(\lambda)&\le e^{-c_1\Lambda_n(k)}D_\lambda^{-c_2}
       
\end{align}
for absolute $c_1,c_2>0$.

Corollary 6.2 of Routing densities and representation contraction for Thorp sweeps

Corollary (Strong pointwise smoothing)

There are an absolute integer u\ge1 and an absolute C<\infty such that, for every N=2^d, every coordinate order, every 0\le l\le N, every x,y\in\mathcal X_{N,l}, and either H_N=T_N^*T_N or H_N=T_NT_N^*,

H_N^u(x,y)\le\frac{e^{Cl}}{(N)_l}.

In particular, with unnormalized regular trace on S_N,

\operatorname{Tr}_{\mathrm{reg}}|T_N|^{2u}\le e^{CN}.
Section 6, Exponential smoothing for every partial deck Read it in the paper TeX source, line 290
Show the TeX
There are an absolute integer $u\ge1$ and an absolute $C<\infty$
such that, for every $N=2^d$, every coordinate order, every
$0\le l\le N$, every $x,y\in\mathcal X_{N,l}$, and either
$H_N=T_N^*T_N$ or $H_N=T_NT_N^*$,
\begin{equation}
 H_N^u(x,y)\le\frac{e^{Cl}}{(N)_l}.
\end{equation}
In particular, with unnormalized regular trace on $S_N$,
\begin{equation}
 \operatorname{Tr}_{\mathrm{reg}}|T_N|^{2u}\le e^{CN}.
\end{equation}

Proposition 5.1 of Routing densities and representation contraction for Thorp sweeps

Proposition (High-height cycle tail)

There are absolute b,\delta>0 and an integer J_0\ge1 such that, uniformly in the tracked input injection of size r and for every integer J\ge J_0,

\begin{aligned}\log_2\E 2^{b\sum_{j\ge J}C_j}&\le O(r2^{-bJ}),\\ \log_2\E 2^{b\sum_jC_j}&\le O(r(r/n)^\delta).\end{aligned}

The first bound also holds with expectation conditional on all input-side switches and all output switches of heights at most s, for every integer 0\le s\le d with 2s<J, uniformly in the fixed switch values and with the same absolute implied constant.

Section 5, Certificate tails and numerical dense bounds Read it in the paper TeX source, line 5
Show the TeX
There are absolute $b,\delta>0$ and an integer $J_0\ge1$ such that, uniformly in the tracked input injection of size $r$ and for every integer $J\ge J_0$,
\begin{align}
 \log_2\E 2^{b\sum_{j\ge J}C_j}&\le O(r2^{-bJ}),\\
 \log_2\E 2^{b\sum_jC_j}&\le O(r(r/n)^\delta).
\end{align}
The first bound also holds with expectation conditional on all input-side
switches and all output switches of heights at most $s$, for every integer
$0\le s\le d$ with $2s<J$, uniformly in the fixed switch values and with
the same absolute implied constant.

Corollary 7.3 of Routing densities and representation contraction for Thorp sweeps

Corollary (Exponential sparse-level saving)

There are absolute constants C,d_0>0 such that for every dyadic n=2^d and \lambda=(n-k,\beta)\vdash n satisfying 1\le k<n and \log(n/k)\ge d^{3/4},

\|T_n(\lambda)\|_{\op}^2 \le e^{Ck}(k/n)^{k/4}.

For d\ge d_0, the factor e^{Ck} can be omitted.

Section 7, Uniform contact cancellation on an exact injection level Read it in the paper TeX source, line 303
Show the TeX
There are absolute constants $C,d_0>0$ such that for every dyadic
$n=2^d$ and $\lambda=(n-k,\beta)\vdash n$ satisfying
$1\le k<n$ and $\log(n/k)\ge d^{3/4}$,
\[
 \|T_n(\lambda)\|_{\op}^2
 \le e^{Ck}(k/n)^{k/4}.
\]
For $d\ge d_0$, the factor $e^{Ck}$ can be omitted.

Theorem 6.1 of Routing densities and representation contraction for Thorp sweeps

Theorem (Strong density bound in both orientations)

There are absolute constants p\in(1,2] and C<\infty such that, for every N=2^d, every coordinate order, every 0\le l\le N, either choice of H_N, and every x\in\mathcal X_{N,l},

\frac1{(N)_l}\sum_{y\in\mathcal X_{N,l}} \big((N)_lH_N(x,y)\big)^p\le e^{Cl}.

After increasing C, the same constants give

N^{-l}\sum_{y\in\{0,1\}^{dl}} \big(N^lH_N(x,y)\big)^p\le e^{Cl},

where the kernel is extended by zero on tuples with repeated positions. Both conclusions hold with rows replaced by columns.

Section 6, Exponential smoothing for every partial deck Read it in the paper TeX source, line 35
Show the TeX
There are absolute constants $p\in(1,2]$ and $C<\infty$ such that,
for every $N=2^d$, every coordinate order, every $0\le l\le N$,
either choice of $H_N$, and every $x\in\mathcal X_{N,l}$,
\begin{equation}
 \frac1{(N)_l}\sum_{y\in\mathcal X_{N,l}}
       \big((N)_lH_N(x,y)\big)^p\le e^{Cl}.
\end{equation}
After increasing $C$, the same constants give
\begin{equation}
 N^{-l}\sum_{y\in\{0,1\}^{dl}}
       \big(N^lH_N(x,y)\big)^p\le e^{Cl},
\end{equation}
where the kernel is extended by zero on tuples with repeated positions.
Both conclusions hold with rows replaced by columns.

Proposition 6.3 of Routing densities and representation contraction for Thorp sweeps

Proposition (Strong tail-dimension bound)

There are absolute constants a>0 and C<\infty such that, for every dyadic N, every coordinate order, and every partition \lambda=(N-k,\beta)\vdash N, with \beta=(\lambda_2,\lambda_3,\ldots)\vdash k,

\|T_N(\lambda)\|_{\mathrm{op}}^2 \le e^{Ck}D_\beta^{-a}.

Here D_\beta=\dim V_\beta, including D_\varnothing=1. One may take a=1/p'=(p-1)/p for the exponent in Theorem n:strong-density.

Section 6, Exponential smoothing for every partial deck Read it in the paper TeX source, line 344
Show the TeX
There are absolute constants $a>0$ and $C<\infty$ such that, for
every dyadic $N$, every coordinate order, and every partition
$\lambda=(N-k,\beta)\vdash N$, with
$\beta=(\lambda_2,\lambda_3,\ldots)\vdash k$,
\begin{equation}
 \|T_N(\lambda)\|_{\mathrm{op}}^2
       \le e^{Ck}D_\beta^{-a}.
\end{equation}
Here $D_\beta=\dim V_\beta$, including $D_\varnothing=1$.
One may take $a=1/p'=(p-1)/p$ for the exponent in
Theorem~\ref{n:strong-density}.

OpenAI’s Lean states

theorem ThorpNine.main :    ThorpNine.Adaptive.Thorp.AdaptiveBounds.MainStatement ∧    ThorpNine.Casimir.Thorp.CasimirBounds.MainStatement ∧    ThorpNine.Dense.Thorp.DenseTruncation.MainStatement ∧    ThorpNine.Contact.Thorp.SparseContact.MainStatement ∧    ThorpNine.Harmonic.Thorp.HarmonicBounds.MainStatement ∧    ThorpNine.Smoothing.Thorp.StrongSmoothing.MainStatement ∧    ThorpNine.Tail.Thorp.StrongTail.MainStatement ∧    ThorpNine.HighTail.Thorp.HighHeight.MainStatement ∧    ThorpNine.SparseSaving.Thorp.SparseRegime.MainStatement := by  sorry

sorry stands in for the proof here. OpenAI’s proof is in a separate file, and Comparator checks it against this statement.

OpenAI’s proof of it:

Comparator’s settings for this file

Linked by a source reading. An AI agent read both sources and linked them. No person has reviewed the link. How they were linked

What the outside groups found

Each group assessed family 238’s Lean as a whole; each Comparator run is of this statement. MathVet and cert-machine agree on how much of the advertised result the Lean statements express.

MathVet

“full”

Family 238: its Lean expresses or implies the whole advertised result.

“ThorpResults.remaining_main (ThorpRemaining) is a conjunction whose last conjunct OptimalOrderMain := IsTheta atTop (mixingTime d) (log (2^d)) states exactly the Θ(log N) mixing for N = 2^d cards, with mixingTime d := sInf {t | distance d t ≤ 1/4}, distance d t := tv (law d t) (uniform d) the total-variation distance of the full permutation law (and InformationMain records that lawFrom from any starting deck has the same distance, plus distance d (2048 d) → 0); the 12 other challenge files are supporting Fourier/representation estimates (regular_trace_smoothing, binary_sweep_contraction_and_mixing, robust_permanent, ...). All of them state estimates for the same hand-built Thorp shuffle.” Their assessment

Definitions the group asks readers to compare with the paper: Custom Thorp shuffle and 'mixing time': step (d+1) c := (pairSwitch d c on the head bit, then rotate the coordinate order) on State d := Equiv.Perm (Fin d → Bool) with Coins (d+1) = (Fin d → Bool) → Bool iid fair coins, fairMass, tv, mixingTime d := sInf {t | distance d t ≤ 1/4}; this is the standard pair-swap-and-interleave Thorp shuffle and TV-from-uniform with ε = 1/4, but it is a hand-written model and the Θ-statement hides explicit constants (1600d, 2048d, ...). OccupiedOverlap shows an axiom_files hit (HookModel.lean) that is a doc-comment false positive.

Did OpenAI’s proof of this statement pass Comparator?

No run reported

Carlos Toledo’s cert-machine

“MATCHES”

Family 238: its Lean expresses or implies the whole advertised result.

Their record names nothing missing. Their assessment

Did OpenAI’s proof of this statement pass Comparator?

  • Acceptance reported

    Their label: “CERTIFIED”, 10 October 2026 their report

    Re-run through Comparator with the independent nanoda kernel switched on: Lean’s kernel and nanoda both accept OpenAI’s solution.

A Comparator pass checks OpenAI’s proof of this Lean statement. It does not show that the statement says everything the paper says. Atlas links these reports and has not repeated any run.

Read every group’s full assessment on the family page.

Reading the Lean statement

OpenAI’s own note on what this Lean statement covers

“The conditional high-height estimate requires a sufficiently large cutoff height $J$ that exceeds twice the number $s$ of coordinates in the fixed low block, so $J>2s$. These are the earlier nine statements associated with the paper; its changed later statements and six other result blocks are outside this scope.”

An AI agent drafted an interpretation of that note, classifying this statement as “unclear”. No human review of the draft is recorded.

How to read it

  • theorem name : claim := by sorry: the claim is everything between the first colon and :=, and sorry holds the place of the proof.
  • ∧ is “and”.

Pointing at a linked name in the complete file below shows its definition.

Definitions needed to read it

Local definitions the statement names, followed through the definitions they name in turn. The match is by name in the source text, so a name reached only through notation can be missed; the full file is below.

  • abbreviation OAI.ThorpNine.Adaptive.Thorp.Card line 11

    abbrev Card (d : ℕ) := Fin d → Bool
  • definition OAI.ThorpNine.Adaptive.Thorp.switchFun line 13

    def switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)
  • definition OAI.ThorpNine.Adaptive.Thorp.pairSwitch line 25

    def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }
  • definition OAI.ThorpNine.Adaptive.Thorp.Butterfly line 31

    def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)
  • definition OAI.ThorpNine.Adaptive.Thorp.childLift line 35

    def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]
  • definition OAI.ThorpNine.Adaptive.Thorp.butterflyPerm line 41

    def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))
  • definition OAI.ThorpNine.Adaptive.Thorp.SwitchIndex line 45

    def SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)
  • definition OAI.ThorpNine.Adaptive.Thorp.decodeButterfly line 59

    def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))
  • abbreviation OAI.ThorpNine.Adaptive.Thorp.Specht.Cell line 69

    abbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.row line 71

    def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.col line 73

    def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.rowIndex line 78

    noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩
  • abbreviation OAI.ThorpNine.Adaptive.Thorp.Specht.Tabloid line 81

    abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.baseTabloid line 86

    noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.tabloidAct line 88

    noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where
    Show the remaining 12 lines
      toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.tabloidRep line 115

    noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where
    Show the remaining 9 lines
      toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rfl
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.delta line 127

    noncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.colGroup line 130

    noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symm
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.permSign line 136

    noncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.alternator line 143

    noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ c
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.polytabloid line 150

    noncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.space line 153

    noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.subrepresentation line 171

    noncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩
  • definition OAI.ThorpNine.Adaptive.Thorp.Specht.representation line 174

    noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentation

18 more definitions are reached the same way; the full file lists them.

How the statements were linked

Linked by Codex source review 4, an AI agent, in a source reading of the Lean source and the paper. No person has reviewed these links, which compare statements, not proofs.

  1. The AdaptiveBounds component gives norm decay exp(-c*h), a fourth-trace bound exp(-c_prime*log(D)+C*h), and sweep norm decay exp(-c0*(log(D)+h)). These are the three displayed conclusions of Theorem 10.1. The Lean theorem ThorpNine.main combines nine assertions; this link covers only AdaptiveBounds.

  2. The CasimirBounds component bounds the 65/64 density moment, the operator K at the level scale, and D times its sixty-fifth trace moment, then gives vanishing worst-start variation after l*d physical shuffles. Theorem 8.1 has these same exponents, scales and mixing consequence. This link covers only CasimirBounds in the nine-part Lean statement.

  3. SparseContact.MainStatement has the squared norm bound min(1,(Cstar*d*k/n)^(k/2)), vanishing at k=1, and its C^k*(1+d)^(C*k)*(k/n)^(k/2) consequence. Proposition 7.1 gives these three estimates for 1 ≤ k < n and both coordinate orientations. This link covers only the contact part of the Lean statement.

  4. HarmonicBounds.MainStatement includes both level and tail decay for W, the injection density and trace moments with delta and p0, and the combined sweep and representation-dimension estimates. Theorem 9.1 lists these same bounds at Λₙ(k), including absolute positive constants. This source covers the harmonic component of the bundle.

  5. StrongSmoothing.MainStatement gives a fixed integer power u whose reflected injection kernel is bounded by exp(C*l)/(2^d)_l for every coordinate order and either orientation. It also bounds the regular absolute even trace by exp(C*2^d). These are the two conclusions of Corollary 6.2. This link covers only StrongSmoothing in ThorpNine.main.

  6. HighHeight.MainStatement gives the high-level log-two exponential moment O(k*2^(-b*J)), the full sparse moment O(k*(k/n)^delta), and the conditional version fixing lower output switches when 2s < J. Proposition 5.1 has the same three conclusions, uniformly over the tracked injection. It is one component, so it must not stand for the whole nine-result bundle.

  7. SparseRegime.MainStatement assumes log(n/k) ≥ d^(3/4) and gives exp(C*k)*(k/n)^(k/4), with the exponential factor omitted above an absolute depth threshold. Corollary 7.3 has the same assumptions and estimates. This source covers only the sparse component.

  8. The DensityAt part of StrongTail.MainStatement asserts the injection-normalized p-moment bound and the power-normalized bound, for rows and columns, every order and both reflected kernels. Theorem 6.1 states those bounds for some p in (1,2]. The additional tail representation bound belongs to the companion strong-tail statement.

    Limit recorded: “Only the DensityAt part is compared here; the nine-component theorem also includes unrelated estimates.”

  9. The StrongTail component bounds the squared sweep norm by exp(C*k)*D_tail^(-(p-1)/p), using the density exponent p in (1,2]. This is the representation estimate in Proposition 6.3. The formal sweep operator is configured for the standard and reversed orders, while the paper states every coordinate order.

    Limit recorded: “This relation concerns the named StrongTail component only. The DenseTruncation component remains without an accepted link: its all-depth, fixed-rho quantifiers differ from the paper uniform-rho interval statement with a sufficiently-large-size threshold.”

How a source reading links statements: a named reader, here an AI agent, read the Lean source and the paper at the pinned versions and recorded which Lean declaration states which paper statement, how the two relate and what the link leaves out. Statement Map checks that both texts and every named declaration exist at those versions. It does not check the mathematics, and no person has reviewed these readings.

Which proof did Comparator accept, and what does that show?

One group reports that Comparator accepted OpenAI’s solution for this Lean statement: Carlos Toledo’s cert-machine. Each group reports its own Comparator run for this Lean statement. Atlas has not repeated the runs.

Carlos Toledo’s cert-machine

How they ran it, in their words

Every Comparator challenge re-run on Linux with nanoda switched on, decided by a preregistered rule; every family’s challenge statements read against OpenAI’s headline, clause by clause. Decider: Comparator (leanprover/comparator d03acab1 = tag v4.34.0, built with the release’s toolchain v4.34.1), lean4export 076e8e57, landrun 811cfff5, nanoda_lib 3a240721 — on GitHub’s Linux runners (.github/workflows/openai-math-kernel.yml), one j…

  • Accepted Their term: “CERTIFIED”.

    Re-run through Comparator with the independent nanoda kernel switched on: Lean’s kernel and nanoda both accept OpenAI’s solution.

    Reported 10 October 2026, at the release version shown here. Original verification report

What an accepted Comparator run would establish

If Comparator is run under this configuration and accepts, the solution proves the configured theorem using only the allowed axioms, and the Lean kernel accepts every step.

This configuration lists no definition holes, so every definition the statement uses is compared as it is written in this file.

Allowed axioms: propext, Quot.sound, Classical.choice

Acceptance leaves open whether the Lean statement means the same thing as the paper’s theorem, whether the paper’s other claims are correct, and whether the result is new. Those questions require comparing the definitions and statements, reviewing the paper’s arguments, and reading the earlier literature.

What is still unchecked

As far as Atlas records, nobody has reviewed these questions.

  • No person has compared this Lean statement with Theorem 10.1, Theorem 8.1, Proposition 7.1, Theorem 9.1, Corollary 6.2, Proposition 5.1, Corollary 7.3, Theorem 6.1 and Proposition 6.3; only the AI agent’s source reading above records how they relate.
  • Only an AI-drafted interpretation of OpenAI’s note on what this statement covers is recorded.
  • Checking the paper’s proof, and whether its result is new, is a separate question: Comparator says nothing about either.

More about this statement

  • Commentary The constant in the Lean statement depends on the exact density, so there is no uniform rate over an interval as in the paper. Robert Joseph George, Do the Lean statements in openai/math match their papers?, 2026-10-07 Source

Questions to resolve when comparing this statement with the paper

  • The AI draft scope reading could not tell from OpenAI's note how much of a paper's theorem this file states.
  • The draft scope reading depends on mathematics a specialist should settle.
  • 357 local vocabulary declarations to read.

Where to read more

Supporting material

The Lean statement’s complete file

2,579 lines, copied from release version fd4aeeb. A name defined in this file links to its line; pointing at the name shows its definition.

Declared in this fileOpenAI’s library at fd4aeebOther linked names open the current documentation for Mathlib, Lean’s mathematical library.

Links in the file: 1,261 to its own declarations, 1,611 to Mathlib’s documentation. 167 declared names also link to the same declaration in OpenAI’s library. 36 identifiers stay plain because they resolve to no single declaration: variables Lean binds automatically, notation, or names the scan of the pinned sources did not find. OpenAI uses Mathlib version d13f23b. The linked documentation describes the current version, so names that have since changed may be missing there.

import Mathlibnamespace OAInamespace ThorpNine.Adaptivenamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))def SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.SparseContactopen scoped BigOperatorsnoncomputable def sweepOperator (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (reverse : Bool) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ) (Specht.relabelledUnitary μ e)    (fun ω : SwitchIndex d → Bool => if reverse then      (butterflyPerm d (decodeButterfly d ω))⁻¹ else butterflyPerm d (decodeButterfly d ω))end Thorp.SparseContactnamespace Thorp.Casimiropen scoped BigOperators Classicalopen Filternoncomputable def levelScale (n k : ℕ) : ℝ :=  (k:ℝ) * (1 + Real.log ((n:ℝ)/(k:ℝ)))end Thorp.Casimirnamespace Thorp.AdaptiveBoundsopen scoped BigOperators Classicalopen Casimirnoncomputable def positiveSquare {V : Type*} [NormedAddCommGroup V]    [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] (T : V →L[ℂ] V) : V →L[ℂ] V :=  T * T.adjointnoncomputable def F (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ)    (rev : Bool) : Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  positiveSquare (V := Specht.hilbertSpace μ) (SparseContact.sweepOperator d μ e rev)noncomputable def fourthTrace (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (rev : Bool) : ℝ :=  (LinearMap.trace ℂ (Specht.hilbertSpace μ) ((F d μ e rev)^4).toLinearMap).redef MainStatement : Prop :=  ∃ c c' C c₀ : ℝ, 0<c ∧ 0<c' ∧ 0<C ∧ 0<c₀ ∧    ∀ (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ) (rev : Bool),      let h := levelScale (2^d) (μ.card-μ.rowLen 0)      let D : ℝ := Module.finrank ℂ (Specht.space μ)      ‖F d μ e rev‖ ≤ Real.exp (-c*h) ∧      fourthTrace d μ e rev ≤ Real.exp (-c'*Real.log D+C*h) ∧      ‖SparseContact.sweepOperator d μ e rev‖ ≤ Real.exp (-c₀*(Real.log D+h))end Thorp.AdaptiveBoundsend ThorpNine.Adaptiverun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Casimirnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef Coins : ℕ → Type  | 0 => Unit  | d + 1 => Card d → Boolinstance (d : ℕ) : Fintype (Coins d) := by  cases d <;> dsimp [Coins] <;> infer_instancedef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def rotate (d : ℕ) : Equiv.Perm (Card d) where  toFun x i := x (finRotate d i)  invFun x i := x ((finRotate d).symm i)  left_inv x := by funext i; simp only [Equiv.apply_symm_apply]  right_inv x := by funext i; simp only [Equiv.symm_apply_apply]def step : (d : ℕ) → Coins d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, ξ => rotate (d + 1) * pairSwitch ξdef run (d : ℕ) : (t : ℕ) → (Fin t → Coins d) → Equiv.Perm (Card d)  | 0, _ => 1  | t + 1, ω => step d (ω (Fin.last t)) * run d t (fun i => ω i.castSucc)noncomputable def law (d t : ℕ) (g : Equiv.Perm (Card d)) : ℝ :=  (Fintype.card {ω : Fin t → Coins d // run d t ω = g} : ℝ) /    (Fintype.card (Fin t → Coins d) : ℝ)def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]noncomputable def tupleProbability {Ω β : Type*} [Fintype Ω] [DecidableEq β]    (P : Ω → Equiv.Perm β) (x y : ι → β) : ℝ := by  classical  exact finiteMean (fun ω => if ∀ i, P ω (x i) = y i then 1 else 0)end Thorp.PairRoutingnamespace Thorpopen scoped BigOperatorsopen Filterabbrev BenesCoins (d : ℕ) := (SwitchIndex d → Bool) × (SwitchIndex d → Bool)def palindromePerm (d : ℕ) (ω : BenesCoins d) : Equiv.Perm (Card d) :=  butterflyPerm d (decodeButterfly d ω.1) * (butterflyPerm d (decodeButterfly d ω.2)).symmnoncomputable def palindromeRowMoment (d : ℕ) {ι : Type*} [Fintype ι]    (e : ι ↪ Card d) (a : ℝ) : ℝ :=  finiteMean (fun f : ι ↪ Card d =>    ((Fintype.card (ι ↪ Card d):ℝ)*PairRouting.tupleProbability (palindromePerm d) e f)^(1+a))end Thorpnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.CasimirBoundsopen scoped BigOperators Classicalopen Filternoncomputable def levelScale (n k : ℕ) : ℝ :=  (k:ℝ) * (1 + Real.log ((n:ℝ)/(k:ℝ)))noncomputable def K (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ)    (Specht.relabelledUnitary μ e) (palindromePerm d)noncomputable def traceMoment (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (r : ℕ) : ℝ :=  (LinearMap.trace ℂ (Specht.hilbertSpace μ) ((K d μ e)^r).toLinearMap).renoncomputable def fromDistance (d t : ℕ) (σ : Equiv.Perm (Card d)) : ℝ :=  (1/2:ℝ) * ∑ g : Equiv.Perm (Card d),    |law d t (g*σ⁻¹) - 1/(Nat.factorial (2^d):ℝ)|def MainStatement : Prop :=  ∃ a C : ℝ, 0 < a ∧ 0 < C ∧    (∀ d k : ℕ, 1 ≤ k → k ≤ 2^d → ∀ x : Fin k ↪ Card d,      (palindromeRowMoment d x (1/64))^(64/65:ℝ) ≤        Real.exp (C*levelScale (2^d) k)) ∧    (∀ (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ),      0 < μ.card-μ.rowLen 0 →        ‖K d μ e‖ ≤ Real.exp (-a*levelScale (2^d) (μ.card-μ.rowLen 0)) ∧        (Module.finrank ℂ (Specht.space μ):ℝ) * traceMoment d μ e 65 ≤          Real.exp (C*levelScale (2^d) (μ.card-μ.rowLen 0))) ∧    (∃ l : ℕ, 0 < l ∧ ∀ starts : (d : ℕ) → Equiv.Perm (Card d),      Tendsto (fun d => fromDistance d (l*d) (starts d)) atTop (nhds 0))end Thorp.CasimirBoundsend ThorpNine.Casimirrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Densenamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))variable {α : Type*} [Fintype α] [DecidableEq α]noncomputable def orbitSet (p : Equiv.Perm α) (x : α) : Finset α :=  Finset.univ.filter (p.SameCycle x)end Thorpnamespace Thorp.RoutingNetworkopen scoped BigOperatorsopen Filtervariable {α ι : Type*} [Fintype α] [DecidableEq α] [Fintype ι] [DecidableEq ι]variable {A : ℕ}abbrev SelectedCycle (p : Equiv.Perm (α)) (S : Finset (α)) :=  {C : Finset (α) // (∃ x, C = orbitSet p x) ∧ C ⊆ S}noncomputable instance (p : Equiv.Perm (α)) (S : Finset (α)) :    Fintype (SelectedCycle p S) := Fintype.ofFinite _end Thorp.RoutingNetworknamespace Thorpopen scoped BigOperatorsopen Filtersectionvariable {β : Type*} [Fintype β] [DecidableEq β]def pairLayer (ξ : β → Bool) : Equiv.Perm (Bool × β) where  toFun x := (Bool.xor x.1 (ξ x.2),x.2)  invFun x := (Bool.xor x.1 (ξ x.2),x.2)  left_inv x := by    rcases x with ⟨b,x⟩    change (Bool.xor (Bool.xor b (ξ x)) (ξ x),x) = (b,x)    cases b <;> cases ξ x <;> rfl  right_inv x := by    rcases x with ⟨b,x⟩    change (Bool.xor (Bool.xor b (ξ x)) (ξ x),x) = (b,x)    cases b <;> cases ξ x <;> rflenddef coinStepEquiv (d : ℕ) : (SwitchIndex (d+1) → Bool) ≃    ((SwitchIndex d → Bool) × (SwitchIndex d → Bool)) × (Card d → Bool) where  toFun ω := ((fun i => ω (Sum.inr (false,i)),fun i => ω (Sum.inr (true,i))),    fun x => ω (Sum.inl x))  invFun ω := Sum.elim ω.2 (fun bi => if bi.1 then ω.1.2 bi.2 else ω.1.1 bi.2)  left_inv ω := by    funext i    cases i with    | inl x => rfl    | inr bi => cases bi with | mk b i => cases b <;> rfl  right_inv ω := by    rcases ω with ⟨⟨ω₀,ω₁⟩,ξ⟩    rfldef headTailEquiv (d : ℕ) : Card (d+1) ≃ Bool × Card d :=  (Fin.consEquiv (fun _ : Fin (d+1) => Bool)).symmend Thorpnamespace Thorp.CycleColoringopen scoped BigOperatorsopen Filtervariable {α : Type*} [Fintype α] [DecidableEq α]def alternatingPerm (p : Equiv.Perm α) : Equiv.Perm (Bool × α) where  toFun x := if x.1 then (false,p x.2) else (true,x.2)  invFun x := if x.1 then (false,x.2) else (true,p.symm x.2)  left_inv x := by rcases x with ⟨b,x⟩; cases b <;> simp  right_inv x := by rcases x with ⟨b,x⟩; cases b <;> simpend Thorp.CycleColoringnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]def required (x : ι → Bool × α) (c : ι → Bool) (i : ι) : Bool := Bool.xor (x i).1 (c i)def Compatible (x : ι → Bool × α) (c : ι → Bool) : Prop :=  ∀ i j, (x i).2 = (x j).2 → required x c i = required x c jdef colors (x : ι → Bool × α) (ξ : α → Bool) (i : ι) : Bool :=  Bool.xor (x i).1 (ξ (x i).2)omit [Fintype ι] [Fintype α] [DecidableEq α] inlemma required_colors (x : ι → Bool × α) (ξ : α → Bool) (i : ι) :    required x (colors x ξ) i = ξ (x i).2 := by  simp only [required,colors]  cases (x i).1 <;> cases ξ (x i).2 <;> rflomit [Fintype ι] [Fintype α] [DecidableEq α] inlemma colors_compatible (x : ι → Bool × α) (ξ : α → Bool) : Compatible x (colors x ξ) := by  intro i j he  simp only [required_colors,he]omit [Fintype ι] [Fintype α] [DecidableEq α] inlemma Compatible.tail_injective {x : ι ↪ Bool × α} {c : ι → Bool} (hc : Compatible x c) (b : Bool) :    Function.Injective (fun i : {i : ι // c i = b} => (x i.val).2) := by  intro i j he  apply Subtype.ext  apply x.injective  apply Prod.ext  · have hh := hc i j he    simp only [required,i.property,j.property] at hh    cases h₀ : (x i.val).1 <;> cases h₁ : (x j.val).1 <;> cases b <;> simp_all  · exact hedef childEmbedding (x : ι ↪ Bool × α) (c : ι → Bool) (hc : Compatible x c) (b : Bool) :    {i : ι // c i = b} ↪ α := ⟨fun i => (x i.val).2,hc.tail_injective b⟩noncomputable def labelSet (e : ι ↪ Bool × α) : Finset (Bool × α) := Finset.univ.image edef alternatingProjection (p : Bool → Equiv.Perm α) : Equiv.Perm α := (p false).symm * p truenoncomputable def alternatingCycles (e : ι ↪ Bool × α) (p : Bool → Equiv.Perm α) : ℕ :=  Fintype.card (RoutingNetwork.SelectedCycle    (CycleColoring.alternatingPerm (alternatingProjection p)) (labelSet e))def switchedEmbedding (e : ι ↪ Bool × α) (ξ : α → Bool) : ι ↪ Bool × α :=  e.trans (pairLayer ξ).toEmbeddingend Thorp.PairRoutingnamespace Thorpopen scoped BigOperatorsopen Filterabbrev BenesCoins (d : ℕ) := (SwitchIndex d → Bool) × (SwitchIndex d → Bool)def palindromePerm (d : ℕ) (ω : BenesCoins d) : Equiv.Perm (Card d) :=  butterflyPerm d (decodeButterfly d ω.1) * (butterflyPerm d (decodeButterfly d ω.2)).symmdef sandwichShuffle {A B C D E F : Type*} :    ((A × B) × C) × ((D × E) × F) ≃ ((A × D) × (B × E)) × (F × C) where  toFun x := (((x.1.1.1,x.2.1.1),(x.1.1.2,x.2.1.2)),(x.2.2,x.1.2))  invFun x := (((x.1.1.1,x.1.2.1),x.2.2),((x.1.1.2,x.1.2.2),x.2.1))  left_inv _ := rfl  right_inv _ := rfldef benesStepEquiv (d : ℕ) : BenesCoins (d+1) ≃    (BenesCoins d × BenesCoins d) × ((Card d → Bool) × (Card d → Bool)) :=  (Equiv.prodCongr (coinStepEquiv d) (coinStepEquiv d)).trans sandwichShufflenoncomputable def palindromeCost : (d : ℕ) → {ι : Type*} → [Fintype ι] →    (ι ↪ Card d) → BenesCoins d → ℕ  | 0, _, _, _, _ => 0  | d+1, _, _, e, ω =>      let σ := benesStepEquiv d ω      let x := e.trans (headTailEquiv d).toEmbedding      let c := PairRouting.colors x σ.2.1      let hc := PairRouting.colors_compatible x σ.2.1      PairRouting.alternatingCycles (PairRouting.switchedEmbedding x σ.2.1)          (fun b => palindromePerm d (if b then σ.1.2 else σ.1.1)) +        palindromeCost d (PairRouting.childEmbedding x c hc false) σ.1.1 +        palindromeCost d (PairRouting.childEmbedding x c hc true) σ.1.2end Thorpnamespace Thorp.DenseTruncationopen scoped BigOperatorsdef AdmissibleCycleLaw (j : ℕ) (p : ℕ → ℝ) : Prop :=  (∀ l, 0 ≤ p l) ∧ HasSum p 1 ∧    ∀ l, p l ≤ ((l + 1 : ℕ) : ℝ) / (2 : ℝ) ^ (j - 1)noncomputable def h (j : ℕ) : ℝ :=  sSup {z : ℝ | ∃ p : ℕ → ℝ, AdmissibleCycleLaw j p ∧    z = ∑' l : ℕ, p l / ((l + 1 : ℕ) : ℝ)}def AdmissibleAllocation (ρ : ℝ) (x : ℕ → ℝ) : Prop :=  (∀ j, 0 ≤ x j ∧ x j ≤ 1) ∧    (∑' j : ℕ, x j / (2 : ℝ) ^ (j + 1)) ≤ ρnoncomputable def H (ρ : ℝ) : ℝ :=  sSup {z : ℝ | ∃ x : ℕ → ℝ, AdmissibleAllocation ρ x ∧    z = (1 / 2 : ℝ) * ∑' j : ℕ, h (j + 1) * x j}noncomputable def entropyCorrection (ρ : ℝ) : ℝ :=  (-ρ - (1 - ρ) * Real.log (1 - ρ)) / (ρ * Real.log 2)noncomputable def densityExponent (d r : ℕ) (x : Fin r ↪ Card d)    (ω : BenesCoins d) : ℝ :=  palindromeCost d x ω +    Real.log (((2 ^ d).descFactorial r : ℝ) / ((2 : ℝ) ^ d) ^ r) / Real.log 2def MainStatement : Prop :=  ∀ ρ : ℝ, 0 < ρ → ∀ ε : ℝ, 0 < ε →    ∃ c : ℝ, 0 < c ∧ ∀ d r : ℕ, 1 ≤ d → 1 ≤ r →      (r : ℝ) / (2 : ℝ) ^ d = ρ → ∀ x : Fin r ↪ Card d,      finiteMean (fun ω : BenesCoins d =>        if (r : ℝ) * (H ρ + entropyCorrection ρ + ε) < densityExponent d r x ω        then (1 : ℝ) else 0) ≤ Real.exp (-c * r)end Thorp.DenseTruncationend ThorpNine.Denserun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Contactnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))def SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.SparseContactopen scoped BigOperatorsnoncomputable def sweepOperator (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (reverse : Bool) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ) (Specht.relabelledUnitary μ e)    (fun ω : SwitchIndex d → Bool => if reverse then      (butterflyPerm d (decodeButterfly d ω))⁻¹ else butterflyPerm d (decodeButterfly d ω))def MainStatement : Prop :=  ∃ Cstar C : ℝ, 0 < Cstar ∧ 0 < C ∧    ∀ (d : ℕ), 1 ≤ d → ∀ (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ),      let k := μ.card - μ.rowLen 0      1 ≤ k → k < 2^d → ∀ reverse : Bool,        ‖sweepOperator d μ e reverse‖^2 ≤          min 1 ((Cstar * d * k / (2:ℝ)^d) ^ ((k:ℝ)/2)) ∧        (k = 1 → sweepOperator d μ e reverse = 0) ∧        ‖sweepOperator d μ e reverse‖^2 ≤          C^k * (1+(d:ℝ))^(C*k) * ((k:ℝ)/(2:ℝ)^d)^((k:ℝ)/2)end Thorp.SparseContactend ThorpNine.Contactrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Harmonicnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]noncomputable def tupleProbability {Ω β : Type*} [Fintype Ω] [DecidableEq β]    (P : Ω → Equiv.Perm β) (x y : ι → β) : ℝ := by  classical  exact finiteMean (fun ω => if ∀ i, P ω (x i) = y i then 1 else 0)end Thorp.PairRoutingnamespace Thorpopen scoped BigOperatorsopen Filterabbrev BenesCoins (d : ℕ) := (SwitchIndex d → Bool) × (SwitchIndex d → Bool)def palindromePerm (d : ℕ) (ω : BenesCoins d) : Equiv.Perm (Card d) :=  butterflyPerm d (decodeButterfly d ω.1) * (butterflyPerm d (decodeButterfly d ω.2)).symmend Thorpnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.SparseContactopen scoped BigOperatorsnoncomputable def sweepOperator (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (reverse : Bool) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ) (Specht.relabelledUnitary μ e)    (fun ω : SwitchIndex d → Bool => if reverse then      (butterflyPerm d (decodeButterfly d ω))⁻¹ else butterflyPerm d (decodeButterfly d ω))end Thorp.SparseContactnamespace Thorp.StrongSmoothingdef coordinateRelabel (d : ℕ) (order : Equiv.Perm (Fin d)) : Equiv.Perm (Card d) where  toFun x := fun i => x (order.symm i)  invFun x := fun i => x (order i)  left_inv x := by funext i; simp  right_inv x := by funext i; simpdef sweep (d : ℕ) (order : Equiv.Perm (Fin d)) (ω : SwitchIndex d → Bool) :    Equiv.Perm (Card d) :=  coordinateRelabel d order * butterflyPerm d (decodeButterfly d ω) *    (coordinateRelabel d order)⁻¹abbrev Tuples (d l : ℕ) := Fin l ↪ Card dnoncomputable def sweepKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  fun x y => PairRouting.tupleProbability (sweep d order) x ynoncomputable def reflectedKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) (orientation : Bool) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  let A := sweepKernel d l order  if orientation then A * A.transpose else A.transpose * Aend Thorp.StrongSmoothingnamespace Thorp.StrongTailopen scoped BigOperators Classicalopen Spechtdef tailDiagram (μ : YoungDiagram) : YoungDiagram :=  YoungDiagram.ofRowLens μ.rowLens.tail μ.rowLens_sorted.pairwise.tail.sortedGEend Thorp.StrongTailnamespace Thorp.Casimiropen scoped BigOperators Classicalopen Filternoncomputable def levelScale (n k : ℕ) : ℝ :=  (k:ℝ) * (1 + Real.log ((n:ℝ)/(k:ℝ)))noncomputable def K (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ)    (Specht.relabelledUnitary μ e) (palindromePerm d)end Thorp.Casimirnamespace Thorp.HarmonicBoundsopen scoped BigOperators Classicalopen _root_.OAI.ThorpNine.Harmonic.Thorp.Casimir StrongSmoothingabbrev tail (μ : YoungDiagram) := StrongTail.tailDiagram μnoncomputable def W (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ) : ℝ := ‖K d μ e‖noncomputable def tupleTrace (d k : ℕ) (order : Equiv.Perm (Fin d)) (rev : Bool) (p : ℕ) : ℝ :=  Matrix.trace ((reflectedKernel d k order rev)^p)def MainStatement : Prop :=  ∃ c C ζ δ cTail c₁ c₂ : ℝ, ∃ p₀ : ℕ,    0<c ∧ 0<C ∧ 0<ζ ∧ 0<δ ∧ δ<1 ∧ 0<cTail ∧ 0<c₁ ∧ 0<c₂ ∧ 0<p₀ ∧    (∀ (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ),      0<μ.card-μ.rowLen 0 →      let L := levelScale (2^d) (μ.card-μ.rowLen 0)      let f : ℝ := Module.finrank ℂ (Specht.space (tail μ))      let D : ℝ := Module.finrank ℂ (Specht.space μ)      W d μ e ≤ Real.exp (-c*L) ∧      W d μ e ≤ Real.exp (C*L)*f^(-ζ) ∧      (∀ rev : Bool, ‖SparseContact.sweepOperator d μ e rev‖ ≤        Real.exp (-cTail*(L+Real.log f))) ∧      W d μ e ≤ Real.exp (-c₁*L)*D^(-c₂)) ∧    (∀ d k : ℕ, 1≤k → k≤2^d → ∀ (order : Equiv.Perm (Fin d)) (rev : Bool),      (∀ x : Tuples d k,        finiteMean (fun y => ((Fintype.card (Tuples d k):ℝ)*          reflectedKernel d k order rev x y)^(1+δ)) ≤        Real.exp (C*levelScale (2^d) k)) ∧      tupleTrace d k order rev p₀ ≤ Real.exp (C*levelScale (2^d) k))end Thorp.HarmonicBoundsend ThorpNine.Harmonicrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Smoothingnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]noncomputable def tupleProbability {Ω β : Type*} [Fintype Ω] [DecidableEq β]    (P : Ω → Equiv.Perm β) (x y : ι → β) : ℝ := by  classical  exact finiteMean (fun ω => if ∀ i, P ω (x i) = y i then 1 else 0)end Thorp.PairRoutingnamespace Thorp.StrongSmoothingdef coordinateRelabel (d : ℕ) (order : Equiv.Perm (Fin d)) : Equiv.Perm (Card d) where  toFun x := fun i => x (order.symm i)  invFun x := fun i => x (order i)  left_inv x := by funext i; simp  right_inv x := by funext i; simpdef sweep (d : ℕ) (order : Equiv.Perm (Fin d)) (ω : SwitchIndex d → Bool) :    Equiv.Perm (Card d) :=  coordinateRelabel d order * butterflyPerm d (decodeButterfly d ω) *    (coordinateRelabel d order)⁻¹abbrev Tuples (d l : ℕ) := Fin l ↪ Card dnoncomputable def sweepKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  fun x y => PairRouting.tupleProbability (sweep d order) x ynoncomputable def reflectedKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) (orientation : Bool) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  let A := sweepKernel d l order  if orientation then A * A.transpose else A.transpose * Anoncomputable def regularAbsoluteEvenTrace (d : ℕ) (order : Equiv.Perm (Fin d)) (u : ℕ) : ℝ :=  Matrix.trace ((reflectedKernel d (2^d) order false)^u)def MainStatement : Prop :=  ∃ u : ℕ, 1 ≤ u ∧ ∃ C : ℝ,    (∀ d l : ℕ, l ≤ 2^d → ∀ order : Equiv.Perm (Fin d), ∀ orientation : Bool,      ∀ x y : Tuples d l,        ((reflectedKernel d l order orientation)^u) x y ≤          Real.exp (C*l)/((2^d).descFactorial l:ℝ)) ∧    (∀ d : ℕ, ∀ order : Equiv.Perm (Fin d),      regularAbsoluteEvenTrace d order u ≤ Real.exp (C*(2:ℝ)^d))end Thorp.StrongSmoothingend ThorpNine.Smoothingrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.Tailnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]noncomputable def tupleProbability {Ω β : Type*} [Fintype Ω] [DecidableEq β]    (P : Ω → Equiv.Perm β) (x y : ι → β) : ℝ := by  classical  exact finiteMean (fun ω => if ∀ i, P ω (x i) = y i then 1 else 0)end Thorp.PairRoutingnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.SparseContactopen scoped BigOperatorsnoncomputable def sweepOperator (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (reverse : Bool) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ) (Specht.relabelledUnitary μ e)    (fun ω : SwitchIndex d → Bool => if reverse then      (butterflyPerm d (decodeButterfly d ω))⁻¹ else butterflyPerm d (decodeButterfly d ω))end Thorp.SparseContactnamespace Thorp.StrongSmoothingdef coordinateRelabel (d : ℕ) (order : Equiv.Perm (Fin d)) : Equiv.Perm (Card d) where  toFun x := fun i => x (order.symm i)  invFun x := fun i => x (order i)  left_inv x := by funext i; simp  right_inv x := by funext i; simpdef sweep (d : ℕ) (order : Equiv.Perm (Fin d)) (ω : SwitchIndex d → Bool) :    Equiv.Perm (Card d) :=  coordinateRelabel d order * butterflyPerm d (decodeButterfly d ω) *    (coordinateRelabel d order)⁻¹abbrev Tuples (d l : ℕ) := Fin l ↪ Card dnoncomputable def sweepKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  fun x y => PairRouting.tupleProbability (sweep d order) x ynoncomputable def reflectedKernel (d l : ℕ) (order : Equiv.Perm (Fin d)) (orientation : Bool) :    Matrix (Tuples d l) (Tuples d l) ℝ :=  let A := sweepKernel d l order  if orientation then A * A.transpose else A.transpose * Aend Thorp.StrongSmoothingnamespace Thorp.StrongTailopen scoped BigOperators Classicalopen Spechtdef tailDiagram (μ : YoungDiagram) : YoungDiagram :=  YoungDiagram.ofRowLens μ.rowLens.tail μ.rowLens_sorted.pairwise.tail.sortedGEend Thorp.StrongTailnamespace Thorp.StrongTailopen scoped BigOperators Classicalopen StrongSmoothingdef DensityAt (p C : ℝ) : Prop :=  ∀ (d l : ℕ), l ≤ 2^d → ∀ (order : Equiv.Perm (Fin d)) (rev : Bool)    (x : StrongSmoothing.Tuples d l),    let H := StrongSmoothing.reflectedKernel d l order rev    (Thorp.finiteMean (fun y => ((Fintype.card (StrongSmoothing.Tuples d l):ℝ)*H x y)^p)      ≤ Real.exp (C*l)) ∧    (Thorp.finiteMean (fun y => ((Fintype.card (StrongSmoothing.Tuples d l):ℝ)*H y x)^p)      ≤ Real.exp (C*l)) ∧    (((2:ℝ)^d)^l)⁻¹ * (∑ y, ((((2:ℝ)^d)^l)*H x y)^p) ≤ Real.exp (C*l) ∧    (((2:ℝ)^d)^l)⁻¹ * (∑ y, ((((2:ℝ)^d)^l)*H y x)^p) ≤ Real.exp (C*l)end Thorp.StrongTailnamespace Thorp.StrongTailopen scoped BigOperators Classicalopen Specht UnitaryFinitedef MainStatement : Prop :=  ∃ p Cdensity C : ℝ, 1 < p ∧ p ≤ 2 ∧ DensityAt p Cdensity ∧    ∀ (d : ℕ) (μ : YoungDiagram) (e : Card d ≃ Specht.Cell μ) (rev : Bool),      ‖SparseContact.sweepOperator d μ e rev‖^2 ≤       Real.exp (C*(μ.card-μ.rowLen 0 : ℕ)) *       (Module.finrank ℂ (Specht.space (tailDiagram μ)):ℝ)^(-((p-1)/p))end Thorp.StrongTailend ThorpNine.Tailrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.HighTailnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))noncomputable def finiteMean {Ω : Type*} [Fintype Ω] (f : Ω → ℝ) : ℝ :=  (∑ ω, f ω) / Fintype.card Ωdef SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))variable {α : Type*} [Fintype α] [DecidableEq α]noncomputable def orbitSet (p : Equiv.Perm α) (x : α) : Finset α :=  Finset.univ.filter (p.SameCycle x)end Thorpnamespace Thorp.RoutingNetworkopen scoped BigOperatorsopen Filtervariable {α ι : Type*} [Fintype α] [DecidableEq α] [Fintype ι] [DecidableEq ι]variable {A : ℕ}abbrev SelectedCycle (p : Equiv.Perm (α)) (S : Finset (α)) :=  {C : Finset (α) // (∃ x, C = orbitSet p x) ∧ C ⊆ S}noncomputable instance (p : Equiv.Perm (α)) (S : Finset (α)) :    Fintype (SelectedCycle p S) := Fintype.ofFinite _end Thorp.RoutingNetworknamespace Thorpopen scoped BigOperatorsopen Filterdef cardSplit : (r s : ℕ) → Card (s+r) ≃ Card r × Card s  | 0, s =>    { toFun := fun x => ((fun i => Fin.elim0 i), x)      invFun := fun x => x.2      left_inv := fun _ => rfl      right_inv := fun x => by        apply Prod.ext        · exact Subsingleton.elim _ _        · rfl }  | r+1, s =>    { toFun := fun x => (Fin.cons (x 0) ((cardSplit r s (Fin.tail x)).1),        (cardSplit r s (Fin.tail x)).2)      invFun := fun x => Fin.cons (x.1 0) ((cardSplit r s).symm (Fin.tail x.1,x.2))      left_inv := by        intro x        simp only [Fin.cons_zero, Fin.tail_cons, Prod.mk.eta, Equiv.symm_apply_apply, Fin.cons_self_tail]      right_inv := by        intro x        simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail] }def assembleBits : (r s : ℕ) → (Card r × SwitchIndex s → Bool) →    (Card s × SwitchIndex r → Bool) → SwitchIndex (s+r) → Bool  | 0, _, lo, _, i => lo ((fun j => Fin.elim0 j), i)  | r+1, s, _, hi, Sum.inl y => hi ((cardSplit r s y).2,Sum.inl (cardSplit r s y).1)  | r+1, s, lo, hi, Sum.inr (b,i) => assembleBits r s      (fun j => lo (Fin.cons b j.1,j.2)) (fun j => hi (j.1,Sum.inr (b,j.2))) isectionvariable {β : Type*} [Fintype β] [DecidableEq β]def pairLayer (ξ : β → Bool) : Equiv.Perm (Bool × β) where  toFun x := (Bool.xor x.1 (ξ x.2),x.2)  invFun x := (Bool.xor x.1 (ξ x.2),x.2)  left_inv x := by    rcases x with ⟨b,x⟩    change (Bool.xor (Bool.xor b (ξ x)) (ξ x),x) = (b,x)    cases b <;> cases ξ x <;> rfl  right_inv x := by    rcases x with ⟨b,x⟩    change (Bool.xor (Bool.xor b (ξ x)) (ξ x),x) = (b,x)    cases b <;> cases ξ x <;> rflenddef coinStepEquiv (d : ℕ) : (SwitchIndex (d+1) → Bool) ≃    ((SwitchIndex d → Bool) × (SwitchIndex d → Bool)) × (Card d → Bool) where  toFun ω := ((fun i => ω (Sum.inr (false,i)),fun i => ω (Sum.inr (true,i))),    fun x => ω (Sum.inl x))  invFun ω := Sum.elim ω.2 (fun bi => if bi.1 then ω.1.2 bi.2 else ω.1.1 bi.2)  left_inv ω := by    funext i    cases i with    | inl x => rfl    | inr bi => cases bi with | mk b i => cases b <;> rfl  right_inv ω := by    rcases ω with ⟨⟨ω₀,ω₁⟩,ξ⟩    rfldef headTailEquiv (d : ℕ) : Card (d+1) ≃ Bool × Card d :=  (Fin.consEquiv (fun _ : Fin (d+1) => Bool)).symmend Thorpnamespace Thorp.CycleColoringopen scoped BigOperatorsopen Filtervariable {α : Type*} [Fintype α] [DecidableEq α]def alternatingPerm (p : Equiv.Perm α) : Equiv.Perm (Bool × α) where  toFun x := if x.1 then (false,p x.2) else (true,x.2)  invFun x := if x.1 then (false,x.2) else (true,p.symm x.2)  left_inv x := by rcases x with ⟨b,x⟩; cases b <;> simp  right_inv x := by rcases x with ⟨b,x⟩; cases b <;> simpend Thorp.CycleColoringnamespace Thorp.PairRoutingopen scoped BigOperatorsopen Filtervariable {ι α : Type*} [Fintype ι] [Fintype α] [DecidableEq α]def required (x : ι → Bool × α) (c : ι → Bool) (i : ι) : Bool := Bool.xor (x i).1 (c i)def Compatible (x : ι → Bool × α) (c : ι → Bool) : Prop :=  ∀ i j, (x i).2 = (x j).2 → required x c i = required x c jdef colors (x : ι → Bool × α) (ξ : α → Bool) (i : ι) : Bool :=  Bool.xor (x i).1 (ξ (x i).2)omit [Fintype ι] [Fintype α] [DecidableEq α] inlemma required_colors (x : ι → Bool × α) (ξ : α → Bool) (i : ι) :    required x (colors x ξ) i = ξ (x i).2 := by  simp only [required,colors]  cases (x i).1 <;> cases ξ (x i).2 <;> rflomit [Fintype ι] [Fintype α] [DecidableEq α] inlemma colors_compatible (x : ι → Bool × α) (ξ : α → Bool) : Compatible x (colors x ξ) := by  intro i j he  simp only [required_colors,he]omit [Fintype ι] [Fintype α] [DecidableEq α] inlemma Compatible.tail_injective {x : ι ↪ Bool × α} {c : ι → Bool} (hc : Compatible x c) (b : Bool) :    Function.Injective (fun i : {i : ι // c i = b} => (x i.val).2) := by  intro i j he  apply Subtype.ext  apply x.injective  apply Prod.ext  · have hh := hc i j he    simp only [required,i.property,j.property] at hh    cases h₀ : (x i.val).1 <;> cases h₁ : (x j.val).1 <;> cases b <;> simp_all  · exact hedef childEmbedding (x : ι ↪ Bool × α) (c : ι → Bool) (hc : Compatible x c) (b : Bool) :    {i : ι // c i = b} ↪ α := ⟨fun i => (x i.val).2,hc.tail_injective b⟩noncomputable def labelSet (e : ι ↪ Bool × α) : Finset (Bool × α) := Finset.univ.image edef alternatingProjection (p : Bool → Equiv.Perm α) : Equiv.Perm α := (p false).symm * p truenoncomputable def alternatingCycles (e : ι ↪ Bool × α) (p : Bool → Equiv.Perm α) : ℕ :=  Fintype.card (RoutingNetwork.SelectedCycle    (CycleColoring.alternatingPerm (alternatingProjection p)) (labelSet e))def switchedEmbedding (e : ι ↪ Bool × α) (ξ : α → Bool) : ι ↪ Bool × α :=  e.trans (pairLayer ξ).toEmbeddingend Thorp.PairRoutingnamespace Thorpsectionopen scoped BigOperatorsopen Filterabbrev BenesCoins (d : ℕ) := (SwitchIndex d → Bool) × (SwitchIndex d → Bool)def palindromePerm (d : ℕ) (ω : BenesCoins d) : Equiv.Perm (Card d) :=  butterflyPerm d (decodeButterfly d ω.1) * (butterflyPerm d (decodeButterfly d ω.2)).symmdef sandwichShuffle {A B C D E F : Type*} :    ((A × B) × C) × ((D × E) × F) ≃ ((A × D) × (B × E)) × (F × C) where  toFun x := (((x.1.1.1,x.2.1.1),(x.1.1.2,x.2.1.2)),(x.2.2,x.1.2))  invFun x := (((x.1.1.1,x.1.2.1),x.2.2),((x.1.1.2,x.1.2.2),x.2.1))  left_inv _ := rfl  right_inv _ := rfldef benesStepEquiv (d : ℕ) : BenesCoins (d+1) ≃    (BenesCoins d × BenesCoins d) × ((Card d → Bool) × (Card d → Bool)) :=  (Equiv.prodCongr (coinStepEquiv d) (coinStepEquiv d)).trans sandwichShufflenoncomputable def palindromeCost : (d : ℕ) → {ι : Type*} → [Fintype ι] →    (ι ↪ Card d) → BenesCoins d → ℕ  | 0, _, _, _, _ => 0  | d+1, _, _, e, ω =>      let σ := benesStepEquiv d ω      let x := e.trans (headTailEquiv d).toEmbedding      let c := PairRouting.colors x σ.2.1      let hc := PairRouting.colors_compatible x σ.2.1      PairRouting.alternatingCycles (PairRouting.switchedEmbedding x σ.2.1)          (fun b => palindromePerm d (if b then σ.1.2 else σ.1.1)) +        palindromeCost d (PairRouting.childEmbedding x c hc false) σ.1.1 +        palindromeCost d (PairRouting.childEmbedding x c hc true) σ.1.2endnoncomputable def palindromeLowCost (H : ℕ) : (d : ℕ) → {ι : Type*} → [Fintype ι] →    (ι ↪ Card d) → BenesCoins d → ℕ  | 0, _, _, _, _ => 0  | d+1, _, _, e, ω =>      let σ := benesStepEquiv d ω      let x := e.trans (headTailEquiv d).toEmbedding      let c := PairRouting.colors x σ.2.1      let hc := PairRouting.colors_compatible x σ.2.1      (if d+1 ≤ H then PairRouting.alternatingCycles (PairRouting.switchedEmbedding x σ.2.1)          (fun b => palindromePerm d (if b then σ.1.2 else σ.1.1)) else 0) +        palindromeLowCost H d (PairRouting.childEmbedding x c hc false) σ.1.1 +        palindromeLowCost H d (PairRouting.childEmbedding x c hc true) σ.1.2end Thorpnamespace Thorp.HighHeightopen scoped BigOperators Classicalnoncomputable def highCost (J d : ℕ) {ι : Type*} [Fintype ι]    (x : ι ↪ Card d) (ω : BenesCoins d) : ℕ :=  palindromeCost d x ω-palindromeLowCost (J-1) d x ωdef MainStatement : Prop :=  ∃ b δ C : ℝ, 0<b ∧ 0<δ ∧ 0<C ∧ ∃ J₀ : ℕ, 1≤J₀ ∧    (∀ d k : ℕ, ∀ x : Fin k ↪ Card d, ∀ J : ℕ, J₀≤J →      Real.log (finiteMean (fun ω : BenesCoins d => ((2:ℝ)^b)^(highCost J d x ω)))/Real.log 2 ≤        C*k*(2:ℝ)^(-b*J)) ∧    (∀ d k : ℕ, ∀ x : Fin k ↪ Card d,      Real.log (finiteMean (fun ω : BenesCoins d => ((2:ℝ)^b)^(palindromeCost d x ω)))/Real.log 2 ≤        C*k*((k:ℝ)/(2:ℝ)^d)^δ) ∧    (∀ r s k : ℕ, ∀ x : Fin k ↪ Card (s+r), ∀ J : ℕ, J₀≤J → 2*s<J →      ∀ (X : SwitchIndex (s+r) → Bool) (lo : Card r × SwitchIndex s → Bool),      Real.log (finiteMean (fun hi : Card s × SwitchIndex r → Bool =>        ((2:ℝ)^b)^(highCost J (s+r) x (assembleBits r s lo hi,X))))/Real.log 2 ≤          C*k*(2:ℝ)^(-b*J))end Thorp.HighHeightend ThorpNine.HighTailrun_cmd do  Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {}  let matcherCache := Lean.mkIdent    (Lean.mkPrivateNameCore `Lean.Meta.Match.Match `Lean.Meta.Match.matcherExt)  Lean.Elab.Command.elabCommand (← `(command|    run_cmd Lean.modifyEnv fun env => Lean.EnvExtension.setState $matcherCache env {}))namespace ThorpNine.SparseSavingnamespace Thorpopen scoped BigOperatorsopen Filterabbrev Card (d : ℕ) := Fin d → Booldef switchFun {d : ℕ} (ξ : Card d → Bool) (x : Card (d + 1)) : Card (d + 1) :=  Fin.cons (Bool.xor (x 0) (ξ (Fin.tail x))) (Fin.tail x)theorem switchFun_involutive {d : ℕ} (ξ : Card d → Bool) :    Function.Involutive (switchFun ξ) := by  intro x  funext i  refine Fin.cases ?_ (fun j => ?_) i  · simp only [switchFun, Fin.cons_zero, Fin.tail_cons]    cases x 0 <;> cases ξ (Fin.tail x) <;> rfl  · simp [switchFun, Fin.tail]def pairSwitch {d : ℕ} (ξ : Card d → Bool) : Equiv.Perm (Card (d + 1)) :=  { toFun := switchFun ξ    invFun := switchFun ξ    left_inv := switchFun_involutive ξ    right_inv := switchFun_involutive ξ }def Butterfly : ℕ → Type  | 0 => Unit  | d + 1 => (Card d → Bool) × (Bool → Butterfly d)def childLift {d : ℕ} (p : Bool → Equiv.Perm (Card d)) : Equiv.Perm (Card (d + 1)) where  toFun x := Fin.cons (x 0) (p (x 0) (Fin.tail x))  invFun x := Fin.cons (x 0) ((p (x 0)).symm (Fin.tail x))  left_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.symm_apply_apply, Fin.cons_self_tail]  right_inv x := by simp only [Fin.cons_zero, Fin.tail_cons, Equiv.apply_symm_apply, Fin.cons_self_tail]def butterflyPerm : (d : ℕ) → Butterfly d → Equiv.Perm (Card d)  | 0, _ => 1  | d + 1, b => pairSwitch b.1 * childLift (fun ε => butterflyPerm d (b.2 ε))def SwitchIndex : ℕ → Type  | 0 => Empty  | d + 1 => Sum (Card d) (Bool × SwitchIndex d)instance (d : ℕ) : Fintype (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (Fintype Empty)  | succ d ih => exact inferInstanceAs (Fintype (Sum (Card d) (Bool × SwitchIndex d)))instance (d : ℕ) : DecidableEq (SwitchIndex d) := by  induction d with  | zero => exact inferInstanceAs (DecidableEq Empty)  | succ d ih => exact inferInstanceAs (DecidableEq (Sum (Card d) (Bool × SwitchIndex d)))def decodeButterfly : (d : ℕ) → (SwitchIndex d → Bool) → Butterfly d  | 0, _ => ()  | d + 1, ω => (fun y => ω (Sum.inl y), fun ε =>      decodeButterfly d (fun i => ω (Sum.inr (ε,i))))end Thorpnamespace Thorp.Spechtopen scoped BigOperators Classicalabbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells}def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) :=  YoungDiagram.mem_iff_lt_colLen.mp x.2noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) :=  ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩abbrev Tabloid (μ : YoungDiagram) :=  {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p}noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) :    Equiv.Perm (Tabloid μ) where  toFun f := ⟨fun x => f.1 (p⁻¹ x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p⁻¹, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  invFun f := ⟨fun x => f.1 (p x), by    obtain ⟨q,hq⟩ := f.2    refine ⟨q*p, ?_⟩    funext x    simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩  left_inv f := by apply Subtype.ext; funext x; simp  right_inv f := by apply Subtype.ext; funext x; simp@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ))    (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by  ext f x  rfl@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) :    tabloidAct (p*q) = tabloidAct p * tabloidAct q := by  ext f x  simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply]noncomputable def tabloidRep (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where  toFun p :=    { toFun := fun v f => v (tabloidAct p⁻¹ f)      map_add' := by intros; rfl      map_smul' := by intros; rfl }  map_one' := by ext v f; simp  map_mul' p q := by    ext v f    simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply]    rflnoncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ :=  fun g => if g=f then 1 else 0noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where  carrier := {p | ∀ x, col (p x) = col x}  one_mem' := by intro x; rfl  mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x)  inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symmnoncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ :=  ((Equiv.Perm.sign p : ℤ) : ℂ)sectionvariable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V]noncomputable def alternator (C : Subgroup (Equiv.Perm α))    (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by  classical  exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ cendnoncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ :=  alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ))noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) :=  Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ)))lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) :    tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ))    (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by  induction hv using Submodule.span_induction with  | mem v hv =>    obtain ⟨q,rfl⟩ := hv    change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ    rw [←map_mul]    exact orbit_mem_space μ (p*q)  | zero => simp  | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw  | smul a v hv ih => simpa using (space μ).smul_mem a ihnoncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) :=  ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩noncomputable def representation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (space μ) :=  (subrepresentation μ).toRepresentationend Thorp.Spechtnamespace Thorp.PermutationHilbertopen scoped BigOperators ComplexConjugate Classicalopen Complexvariable {X : Type*} [Fintype X]abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ Xend Thorp.PermutationHilbertnamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def hilbertEquiv (μ : YoungDiagram) :    (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) :=  (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symmnoncomputable def hilbertSpace (μ : YoungDiagram) :    Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMapend Thorp.Spechtnamespace Thorp.UnitaryFinitesectionopen scoped BigOperators ComplexConjugate Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]noncomputable def continuousRepresentation (ρ : Representation ℂ G V) : G →* (V →L[ℂ] V) where  toFun g := (ρ g).toContinuousLinearMap  map_one' := by ext v; simp  map_mul' g h := by ext v; simpendopen scoped BigOperators Classicalvariable {G : Type*} [Group G] [Fintype G]variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V]variable {Ω Ξ : Type*} [Fintype Ω] [Fintype Ξ]noncomputable def sampleOperator (ρ : Representation ℂ G V) (P : Ω → G) : V →L[ℂ] V :=  (Fintype.card Ω:ℂ)⁻¹ • ∑ ω,continuousRepresentation ρ (P ω)end Thorp.UnitaryFinitenamespace Thorp.Spechtopen scoped BigOperators Classicalnoncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ :=  (hilbertEquiv μ).submoduleMap (space μ)noncomputable def unitaryRepresentation (μ : YoungDiagram) :    Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) :=  ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ)variable {α ι : Type*} [Fintype α] [Fintype ι]noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) :    Representation ℂ (Equiv.Perm α) (hilbertSpace μ) :=  (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHomend Thorp.Spechtnamespace Thorp.SparseContactopen scoped BigOperatorsnoncomputable def sweepOperator (d : ℕ) (μ : YoungDiagram)    (e : Card d ≃ Specht.Cell μ) (reverse : Bool) :    Specht.hilbertSpace μ →L[ℂ] Specht.hilbertSpace μ :=  UnitaryFinite.sampleOperator (V := Specht.hilbertSpace μ) (Specht.relabelledUnitary μ e)    (fun ω : SwitchIndex d → Bool => if reverse then      (butterflyPerm d (decodeButterfly d ω))⁻¹ else butterflyPerm d (decodeButterfly d ω))end Thorp.SparseContactnamespace Thorp.SparseRegimedef MainStatement : Prop :=  ∃ (C : ℝ) (d₀ : ℕ), 0 < C ∧ 0 < d₀ ∧    ∀ (d : ℕ) (μ : YoungDiagram) (e : Thorp.Card d ≃ Thorp.Specht.Cell μ),      let k := μ.card - μ.rowLen 0      1 ≤ k → k < 2^d → (d:ℝ)^((3:ℝ)/4) ≤ Real.log ((2:ℝ)^d/k) →      ∀ rev : Bool,        ‖Thorp.SparseContact.sweepOperator d μ e rev‖^2 ≤          Real.exp (C*k)*((k:ℝ)/(2:ℝ)^d)^((k:ℝ)/4) ∧        (d₀ ≤ d → ‖Thorp.SparseContact.sweepOperator d μ e rev‖^2 ≤          ((k:ℝ)/(2:ℝ)^d)^((k:ℝ)/4))end Thorp.SparseRegimeend ThorpNine.SparseSavingtheorem ThorpNine.main :    ThorpNine.Adaptive.Thorp.AdaptiveBounds.MainStatement ∧    ThorpNine.Casimir.Thorp.CasimirBounds.MainStatement ∧    ThorpNine.Dense.Thorp.DenseTruncation.MainStatement ∧    ThorpNine.Contact.Thorp.SparseContact.MainStatement ∧    ThorpNine.Harmonic.Thorp.HarmonicBounds.MainStatement ∧    ThorpNine.Smoothing.Thorp.StrongSmoothing.MainStatement ∧    ThorpNine.Tail.Thorp.StrongTail.MainStatement ∧    ThorpNine.HighTail.Thorp.HighHeight.MainStatement ∧    ThorpNine.SparseSaving.Thorp.SparseRegime.MainStatement := by  sorryend OAI
Every extracted statement of the accompanying papers

The statements the atlas extracted automatically from each accompanying paper’s TeX source, with links to the full sources.

Optimal-order mixing of the Thorp shuffle

Theorem (Optimal-order mixing)

As d\to\infty,

\|q_d^{*(1600d)}-U_n\|_{\mathrm{TV}}\longrightarrow0.

For every integer t\ge0,

\|q_d^{*t}-U_n\|_{\mathrm{TV}} \ge 1-\frac{2^{tn/2}}{n!}.

Consequently the mixing time at distance 1/4 satisfies

t_{\mathrm{mix}}(d)\ge \left\lceil\frac2n\log_2\frac{3n!}{4}\right\rceil =2d-O(1), \qquad t_{\mathrm{mix}}(d)=\Theta(d).
Section 1, Introduction Read it in the paper TeX source, line 53
Show the TeX
As $d\to\infty$,
\[
 \|q_d^{*(1600d)}-U_n\|_{\mathrm{TV}}\longrightarrow0.
\]
For every integer $t\ge0$,
\[
 \|q_d^{*t}-U_n\|_{\mathrm{TV}}
 \ge 1-\frac{2^{tn/2}}{n!}.
\]
Consequently the mixing time at distance $1/4$ satisfies
\[
 t_{\mathrm{mix}}(d)\ge
 \left\lceil\frac2n\log_2\frac{3n!}{4}\right\rceil
 =2d-O(1),
 \qquad t_{\mathrm{mix}}(d)=\Theta(d).
\]

From partial permutation information to Fourier bounds

Theorem (Complementary cosets control Fourier matrices)

Partition X into b nonempty sets M_1,\ldots,M_b. Put H_i=H_{M_i}. Suppose f is a nonnegative measure on G of mass at most one and, for every g\in G and i,

f(gH_i)\le \frac{B}{[G:H_i]}.

For every u>0 and every irreducible \rho of degree D,

\|\widehat f(\rho)\|_{\HS}^2 \le bBC_uD^{-1+(u+2)/b}.

There is also an independent orbit-span proof of the bound

\|\widehat f(\rho)\|_{\op}^2 \le bBC_uD^{-1+(u+2)/b}.

No restriction is imposed on block sizes or on the multiplicities in \rho|_{H_1\times\cdots\times H_b}.

Section 1, What partial observations can determine Read it in the paper TeX source, line 18
Show the TeX
Partition $X$ into $b$ nonempty sets $M_1,\ldots,M_b$. Put $H_i=H_{M_i}$. Suppose $f$ is a nonnegative measure on $G$ of mass at most one and, for every $g\in G$ and $i$,
\begin{equation}
 f(gH_i)\le \frac{B}{[G:H_i]}.
\end{equation}
For every $u>0$ and every irreducible $\rho$ of degree $D$,
\begin{equation}
 \|\widehat f(\rho)\|_{\HS}^2
 \le bBC_uD^{-1+(u+2)/b}.
\end{equation}
There is also an independent orbit-span proof of the bound
\begin{equation}
 \|\widehat f(\rho)\|_{\op}^2
 \le bBC_uD^{-1+(u+2)/b}.
\end{equation}
No restriction is imposed on block sizes or on the multiplicities in $\rho|_{H_1\times\cdots\times H_b}$.

Conditional permutations in a revealed switching environment

Theorem (Conditional permutation and full-deck mixing)

Let n=2^d, and start the shuffle from any deterministic deck. After J(s_0+1) sweeps, where s_0=400 and J=40000, the conditional free-slot law defined above satisfies

\sup_{\text{initial layouts}}\E_{\mathcal E} \|\nu_{\mathcal E}-U_{n/2}\|_{\TV}\longrightarrow0 \qquad(d\longrightarrow\infty).

Consequently the full-deck law approaches uniform, uniformly in the starting deck, after 16\,040\,400d physical shuffles. For every integer t\ge0, after t physical shuffles the full-deck distance from uniform is at least 1-2^{tn/2}/n!. Thus the full-deck mixing time is of order d.

Section 1, Introduction Read it in the paper TeX source, line 11
Show the TeX
Let $n=2^d$, and start the shuffle from any deterministic deck.
After $J(s_0+1)$ sweeps, where $s_0=400$ and $J=40000$, the conditional free-slot law defined above satisfies
\[
 \sup_{\text{initial layouts}}\E_{\mathcal E}
       \|\nu_{\mathcal E}-U_{n/2}\|_{\TV}\longrightarrow0
       \qquad(d\longrightarrow\infty).
\]
Consequently the full-deck law approaches uniform, uniformly in the starting deck, after $16\,040\,400d$ physical shuffles. For every integer $t\ge0$, after $t$ physical shuffles the full-deck distance from uniform is at least
$1-2^{tn/2}/n!$. Thus the full-deck mixing time is of order $d$.

Routing densities and representation contraction for Thorp sweeps

Theorem (Routing density and representation contraction)

There are absolute constants \eta,c,C>0 such that, with a=1/1000,

\log\E_{y\sim u_{N,k}}R_x(y)^{1+a} \le Ck(k/N)^\eta \qquad(1\le k\le N),

uniformly over every starting injection x. For every sufficiently large dyadic N and every nontrivial irreducible representation,

T_N(\lambda)=0\quad\hbox{or}\quad \|T_N(\lambda)\|_{\op}\le D_\lambda^{-c}.

Consequently an absolute number of forward sweeps has worst-start total-variation distance from uniform tending to zero as d\to\infty.

Section 1, Introduction Read it in the paper TeX source, line 30
Show the TeX
There are absolute constants $\eta,c,C>0$ such that, with $a=1/1000$,
\[
 \log\E_{y\sim u_{N,k}}R_x(y)^{1+a}
 \le Ck(k/N)^\eta
 \qquad(1\le k\le N),
\]
uniformly over every starting injection $x$. For every sufficiently
large dyadic $N$ and every nontrivial irreducible representation,
\[
 T_N(\lambda)=0\quad\hbox{or}\quad
 \|T_N(\lambda)\|_{\op}\le D_\lambda^{-c}.
\]
Consequently an absolute number of forward sweeps has worst-start
total-variation distance from uniform tending to zero as $d\to\infty$.

Row–column symmetry and contraction of coordinate sweeps

Theorem (Weighted sweep moments)

There are positive weights W_\lambda, an absolute finite p_*, and real exponents 2\le p_d\le p_* such that, for every d\ge1 and every \lambda\vdash2^d,

D_\lambda^{3/4}\le W_\lambda\le D_\lambda, \qquad W_\lambda\|K_d(\lambda)\|_{p_d}^{p_d}\le1.

Consequently \|K_d(\lambda)\|_{\rm op}\le D_\lambda^{-3/(4p_*)}.

Section 1, Introduction Read it in the paper TeX source, line 60
Show the TeX
There are positive weights $W_\lambda$, an absolute finite $p_*$, and real
exponents $2\le p_d\le p_*$ such that, for every $d\ge1$ and every
$\lambda\vdash2^d$,
\begin{equation}
 D_\lambda^{3/4}\le W_\lambda\le D_\lambda,
 \qquad W_\lambda\|K_d(\lambda)\|_{p_d}^{p_d}\le1.
\end{equation}
Consequently $\|K_d(\lambda)\|_{\rm op}\le D_\lambda^{-3/(4p_*)}$.
Corollary (Optimal order of mixing)

There is an absolute constant C such that, for every d\ge1,

\left\lceil\frac2N\log_2\frac{3N!}{4}\right\rceil \le t_{\rm mix}(d)\le Cd, \qquad N=2^d.

In particular t_{\rm mix}(d)=\Theta(d), and its lower bound is 2d-O(1).

Section 1, Introduction Read it in the paper TeX source, line 93
Show the TeX
There is an absolute constant $C$ such that, for every $d\ge1$,
\[
 \left\lceil\frac2N\log_2\frac{3N!}{4}\right\rceil
 \le t_{\rm mix}(d)\le Cd,
 \qquad N=2^d.
\]
In particular $t_{\rm mix}(d)=\Theta(d)$, and its lower bound is
$2d-O(1)$.

Random-subspace tests and trace smoothing for coordinate sweeps

Theorem (Regular-trace smoothing)

There is an absolute P\ge2 such that for every dyadic n\ge2,

\operatorname{Tr}_{\rm reg}|Q_n|^P\le1+n^{-10}.

If v is an integer with 2v\ge P, then v independent sweeps have total-variation distance at most \frac12n^{-5} from uniform, from every deterministic initial deck. Here \|\mu-\nu\|_{\rm TV}=\tfrac12\sum_g|\mu(g)-\nu(g)|.

Section 1, Introduction Read it in the paper TeX source, line 24
Show the TeX
There is an absolute $P\ge2$ such that for every dyadic $n\ge2$,
\begin{equation}
 \operatorname{Tr}_{\rm reg}|Q_n|^P\le1+n^{-10}.
\end{equation}
If $v$ is an integer with $2v\ge P$, then $v$ independent sweeps have total-variation distance at most $\frac12n^{-5}$ from uniform, from every deterministic initial deck. Here $\|\mu-\nu\|_{\rm TV}=\tfrac12\sum_g|\mu(g)-\nu(g)|$.

Compatibility entropy and the spectrum of a Thorp sweep

Theorem (Weighted compatibility)

There are absolute constants L,C_0>0 such that the following holds. Put m=\sqrt n, assume m/2\le A,D\le2m, and take m sufficiently large that \theta=1-L/\log m>0. For all nonnegative functions w_i:S_D\to[0,\infty) and v_k:S_A\to[0,\infty),

\frac{n!}{|R||C|}\, \mathbb E_U\!\left[\mathbf1_{\mathcal I} \prod_{i=1}^A w_i(r_i)\prod_{k=1}^D v_k(c_k)\right] \le e^{C_0n^{.54}} \prod_{i=1}^A(\mathbb E w_i^{1/\theta})^\theta \prod_{k=1}^D(\mathbb E v_k^{1/\theta})^\theta .

The expectations on the right are uniform on the indicated symmetric groups, and logarithms are natural.

Section 1, Introduction Read it in the paper TeX source, line 24
Show the TeX
There are absolute constants $L,C_0>0$ such that the following holds. Put $m=\sqrt n$, assume $m/2\le A,D\le2m$, and take $m$ sufficiently large that $\theta=1-L/\log m>0$. For all nonnegative functions $w_i:S_D\to[0,\infty)$ and $v_k:S_A\to[0,\infty)$,
\begin{equation}
 \frac{n!}{|R||C|}\,
 \mathbb E_U\!\left[\mathbf1_{\mathcal I}
       \prod_{i=1}^A w_i(r_i)\prod_{k=1}^D v_k(c_k)\right]
 \le e^{C_0n^{.54}}
       \prod_{i=1}^A(\mathbb E w_i^{1/\theta})^\theta
       \prod_{k=1}^D(\mathbb E v_k^{1/\theta})^\theta .
\end{equation}
The expectations on the right are uniform on the indicated symmetric groups, and logarithms are natural.
Theorem (A bounded regular moment)

There is an absolute finite p_*>0 such that, for every dyadic n,

Z_n(p_*)\le1+\frac1{16}.

For every integer M\ge p_*, M independent forward sweeps have worst-start total-variation distance at most 1/8 from uniform.

Section 1, Introduction Read it in the paper TeX source, line 45
Show the TeX
There is an absolute finite $p_*>0$ such that, for every dyadic $n$,
\begin{equation}
 Z_n(p_*)\le1+\frac1{16}.
\end{equation}
For every integer $M\ge p_*$, $M$ independent forward sweeps have worst-start total-variation distance at most $1/8$ from uniform.
Corollary (Singular ranks and full-deck mixing)

For every nontrivial \lambda\vdash n and 1\le r\le D_\lambda,

s_r(T_{n,\lambda})\le(16D_\lambda r)^{-1/(2p_*)}.

If s_j(T_n) denotes the full regular singular list, including all multiplicities and zeros, then

s_j(T_n)\le j^{-1/(2p_*)}\qquad(1\le j\le n!).

The constant singular value is the first value. The physical Thorp chain has worst-start 1/4 mixing time \Theta(d); more precisely its lower bound is 2d-O(1). For every fixed integer M>p_*, the worst-start total-variation distance after Md physical shuffles tends to zero as d\to\infty.

Section 1, Introduction Read it in the paper TeX source, line 53
Show the TeX
For every nontrivial $\lambda\vdash n$ and $1\le r\le D_\lambda$,
\[
 s_r(T_{n,\lambda})\le(16D_\lambda r)^{-1/(2p_*)}.
\]
If $s_j(T_n)$ denotes the full regular singular list, including all multiplicities and zeros, then
\[
 s_j(T_n)\le j^{-1/(2p_*)}\qquad(1\le j\le n!).
\]
The constant singular value is the first value. The physical Thorp chain has worst-start $1/4$ mixing time $\Theta(d)$; more precisely its lower bound is $2d-O(1)$. For every fixed integer $M>p_*$, the worst-start total-variation distance after $Md$ physical shuffles tends to zero as $d\to\infty$.

Signed tensor densities and diagram budgets for the Thorp shuffle

Theorem (A moment bound for every signed occurrence)

For each sufficiently small fixed \bar\eta>0, choose a sufficiently small \bar\kappa>0 with \bar\kappa<\bar\eta/256. There is an integer r\ge1, depending only on these fixed constants, such that for every d\ge1, every \lambda\vdash n=2^d, and every occurrence (ten:spin:eq:1),

\log\!\left(D_\lambda\operatorname{Tr}_{V_\lambda}(B_n^*B_n)^r\right) \le\eta_d F(\alpha,\beta)+g_n(l),

where

\eta_d=\bar\eta\left(1-\frac1{2\sqrt d}\right),\qquad \kappa_d=\bar\kappa\left(1-\frac1{2\sqrt d}\right),\qquad g_n(l)=\max\{0,\kappa_d l\log n-l\log(n/l)\}.

Set g_n(0)=0 and interpret the logarithm of a zero trace as -\infty.

Section 1, Introduction Read it in the paper TeX source, line 48
Show the TeX
For each sufficiently small fixed $\bar\eta>0$, choose a sufficiently
small $\bar\kappa>0$ with $\bar\kappa<\bar\eta/256$. There is an
integer $r\ge1$, depending only on these fixed constants, such that for
every $d\ge1$, every $\lambda\vdash n=2^d$, and every
occurrence~\eqref{ten:spin:eq:1},
\begin{equation}
 \log\!\left(D_\lambda\operatorname{Tr}_{V_\lambda}(B_n^*B_n)^r\right)
 \le\eta_d F(\alpha,\beta)+g_n(l),
\end{equation}
where
\[
 \eta_d=\bar\eta\left(1-\frac1{2\sqrt d}\right),\qquad
 \kappa_d=\bar\kappa\left(1-\frac1{2\sqrt d}\right),\qquad
 g_n(l)=\max\{0,\kappa_d l\log n-l\log(n/l)\}.
\]
Set $g_n(0)=0$ and interpret the logarithm of a zero trace as $-\infty$.
Corollary (Fixed-sweep convergence of the full deck)

There is an absolute positive integer L such that

\mathbb E_{U_{S_n}}|f_{d,L}-1|^2\longrightarrow0 \qquad(d\longrightarrow\infty).

The convergence is uniform over starting orders. Moreover t_{\mathrm{mix}}(d)=\Theta(d).

Section 1, Introduction Read it in the paper TeX source, line 82
Show the TeX
There is an absolute positive integer $L$ such that
\[
 \mathbb E_{U_{S_n}}|f_{d,L}-1|^2\longrightarrow0
 \qquad(d\longrightarrow\infty).
\]
The convergence is uniform over starting orders. Moreover
$t_{\mathrm{mix}}(d)=\Theta(d)$.

Conditional coordinate sweeps and analytic transfer

Theorem (Binary sweep contraction)

There are absolute constants g>0 and d_0 such that, for d\ge d_0 and every \lambda\vdash 2^d,

\|K_\lambda\|_{\op}\le D_\lambda^{-g}.

The sign representation is annihilated. There is an absolute positive integer w such that the law after w independent sweeps converges to uniform in total variation as d\to\infty, uniformly over deterministic initial decks.

Section 1, Introduction Read it in the paper TeX source, line 54
Show the TeX
There are absolute constants \(g>0\) and \(d_0\) such that, for \(d\ge d_0\)
and every \(\lambda\vdash 2^d\),
\[
 \|K_\lambda\|_{\op}\le D_\lambda^{-g}.
\]
The sign representation is annihilated. There is an absolute positive integer \(w\)
such that the law after \(w\) independent sweeps converges to uniform in
total variation as \(d\to\infty\), uniformly over deterministic initial
decks.
Proposition (Support obstruction)

For every integer t\ge0,

\|q_d^{*t}-U_N\|_{\TV}\ge1-\frac{2^{tN/2}}{N!}.

Consequently,

t_{\rm mix}(d)\ge \left\lceil\frac2N\log_2\!\left(\frac{3N!}{4}\right)\right\rceil =2d-O(1).
Section 1, Introduction Read it in the paper TeX source, line 68
Show the TeX
For every integer \(t\ge0\),
\[
 \|q_d^{*t}-U_N\|_{\TV}\ge1-\frac{2^{tN/2}}{N!}.
\]
Consequently,
\[
 t_{\rm mix}(d)\ge
 \left\lceil\frac2N\log_2\!\left(\frac{3N!}{4}\right)\right\rceil
 =2d-O(1).
\]

A strict four-row permanent inequality and permutation moments

Theorem (A robust four-row inequality)

There are absolute constants p_0\in(4/3,2) and \varepsilon>0 with the following property. Let \nu be a probability measure on S_4 such that

\|\nu-u\|_{\TV}<\varepsilon, \qquad \nu\{\pi:\pi(i)=j\}=\frac14\quad(1\le i,j\le4).

Then every four nonnegative functions on \{1,2,3,4\} satisfy

\E_\nu\prod_{i=1}^4f_i(\pi(i))\le\prod_{i=1}^4\|f_i\|_{p_0}.
Section 1, Introduction Read it in the paper TeX source, line 14
Show the TeX
There are absolute constants $p_0\in(4/3,2)$ and $\varepsilon>0$ with the following property. Let $\nu$ be a probability measure on $S_4$ such that
\[
 \|\nu-u\|_{\TV}<\varepsilon,
 \qquad
 \nu\{\pi:\pi(i)=j\}=\frac14\quad(1\le i,j\le4).
\]
Then every four nonnegative functions on $\{1,2,3,4\}$ satisfy
\begin{equation}
 \E_\nu\prod_{i=1}^4f_i(\pi(i))\le\prod_{i=1}^4\|f_i\|_{p_0}.
\end{equation}
Theorem (A fixed moment with a degree saving)

There exist an even integer r\ge2 and \eta>0, independent of N, such that for every dyadic N and every \lambda\vdash N,

D_\lambda\Tr B_N(\lambda)^r\le D_\lambda^{1-\eta}.

Consequently there is an absolute integer q for which the total-variation distance of q independent forward sweeps from uniform tends to zero as N\to\infty, uniformly over the starting deck.

Section 1, Introduction Read it in the paper TeX source, line 46
Show the TeX
There exist an even integer $r\ge2$ and $\eta>0$, independent of $N$, such that for every dyadic $N$ and every $\lambda\vdash N$,
\begin{equation}
 D_\lambda\Tr B_N(\lambda)^r\le D_\lambda^{1-\eta}.
\end{equation}
Consequently there is an absolute integer $q$ for which the total-variation distance of $q$ independent forward sweeps from uniform tends to zero as $N\to\infty$, uniformly over the starting deck.

Statement comparison

A shareable summary of this page: the proposed paper match, what the Lean statement expresses, and which reviews are recorded.

Plectis Atlas

Nine routing-density and representation estimates

Family 238: Optimal logarithmic mixing of the Thorp shuffle

Linked by an AI agent’s source reading

Theorem

There are absolute positive constants c,c',C such that for every dyadic n and every partition \lambda=(n-r,\rho)\vdash n,

\begin{aligned}\|F_n|_{V_\lambda}\|_{\op}&\le e^{-c h_n(r)}, \\ \Tr_{V_\lambda}F_n^4&\le \exp\{-c'\log D_\lambda+C h_n(r)\}.\end{aligned}

Consequently \|T_n|_{V_\lambda}\|_{\op} is at most \exp[-c_0\{\log D_\lambda+h_n(r)\}] for an absolute c_0>0.

Routing densities and representation contraction for Thorp sweeps

TeX label rec:adaptive-main, build/sections/09-adaptive-alphabets.tex, line 28

Also linked: Theorem 8.1, Proposition 7.1, Theorem 9.1, Corollary 6.2, Proposition 5.1, Corollary 7.3, Theorem 6.1, Proposition 6.3.

The Lean statement says

theorem ThorpNine.main :    ThorpNine.Adaptive.Thorp.AdaptiveBounds.MainStatement ∧    ThorpNine.Casimir.Thorp.CasimirBounds.MainStatement ∧    ThorpNine.Dense.Thorp.DenseTruncation.MainStatement ∧    ThorpNine.Contact.Thorp.SparseContact.MainStatement ∧    ThorpNine.Harmonic.Thorp.HarmonicBounds.MainStatement ∧    ThorpNine.Smoothing.Thorp.StrongSmoothing.MainStatement ∧    ThorpNine.Tail.Thorp.StrongTail.MainStatement ∧    ThorpNine.HighTail.Thorp.HighHeight.MainStatement ∧    ThorpNine.SparseSaving.Thorp.SparseRegime.MainStatement := by  sorry

A Lean statement states the theorem and leaves its proof as sorry on purpose. OpenAI’s proof is in a separate solution module, and a program called Comparator checks that proof against this statement.

An AI agent read the Lean source and the paper and linked them. No person has reviewed the link.One group reports that Comparator accepted a run for this Lean statement at the release version shown here.Statement review: none recorded

357 local vocabulary declarationsAllowed axioms: propext, Quot.sound, Classical.choiceopenai/math at fd4aeebwcook04.github.io/plectis-atlas/statements/ThorpRouting.html