Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Singh Theorem: CUE Palm variance and Hua ensemble definitions

Definition
Singh

by Hix_Lab · Nov 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

cuerandom-matrix-theory

Definitions for the Singh Theorem: the conditional (Palm) variance VN(s)V_N(s)VN​(s) (cueV) of log⁡∣Λ′(θ1)∣−log⁡∣Λ′(θ2)∣\log|\Lambda'(\theta_1)| - \log|\Lambda'(\theta_2)|log∣Λ′(θ1​)∣−log∣Λ′(θ2​)∣ for an adjacent eigenangle pair of a Haar unitary at normalized gap sss, the circle weight average Ew0[S2]E_{w_0}[S^2]Ew0​​[S2] (circleE), and the Hua ensemble Pn,2P_{n,2}Pn,2​ (huaMeasure).

Definition code
import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.MeasureTheory.Measure.Haar.OfBasis



/-!
# Singh Theorem: definitions

Shared definitions; `Challenge.lean` restates this text verbatim.
-/

open MeasureTheory Finset Real Filter Topology
open scoped ENNReal NNReal

namespace Singh

variable {n : ℕ}

/-- Ordered pairs `a < b`. -/
def pairs (n : ℕ) : Finset (Fin n × Fin n) := univ.filter fun p => p.1 < p.2

/-- `fL x = log|sin(x/2)|`; `log|e^{iφ}-e^{iψ}| = log 2 + fL(φ-ψ)`. -/
noncomputable def fL (x : ℝ) : ℝ := Real.log (sin (x / 2))

/-- `log|Λ'(θ₁)| - log|Λ'(θ₂)|` for eigenangles `θ₁ = -δ/2`, `θ₂ = δ/2` and the remaining
angles `θ`: the common factor `|e^{iθ₁}-e^{iθ₂}|` cancels. -/
noncomputable def Xd (δ : ℝ) (θ : Fin n → ℝ) : ℝ := ∑ k, (fL (θ k + δ / 2) - fL (θ k - δ / 2))

/-- Adjacency: no remaining angle lies in the arc `(-δ/2, δ/2)`. -/
noncomputable def boxD (n : ℕ) (δ : ℝ) : Set (Fin n → ℝ) :=
  Set.pi Set.univ fun _ => Set.Ioo (δ / 2) (2 * π - δ / 2)

/-- Weyl density of the remaining angles given eigenangles at `±δ/2`, before restriction:
`∏_{a<b} |e^{iθ_a}-e^{iθ_b}|^2 ∏_k |e^{iθ_k}-e^{-iδ/2}|^2 |e^{iθ_k}-e^{iδ/2}|^2`
up to a constant factor. -/
noncomputable def pwRaw (δ : ℝ) (θ : Fin n → ℝ) : ℝ :=
  (∏ p ∈ pairs n, sin ((θ p.1 - θ p.2) / 2) ^ 2)
    * ∏ k, (sin ((θ k - δ / 2) / 2) ^ 2 * sin ((θ k + δ / 2) / 2) ^ 2)

/-- Conditional (Palm) weight of the remaining angles for an adjacent pair at gap `δ`. -/
noncomputable def pw (δ : ℝ) (θ : Fin n → ℝ) : ℝ := (boxD n δ).indicator (pwRaw δ) θ

/-- Conditional variance of `Xd δ` under the Palm weight. -/
noncomputable def palmVar (n : ℕ) (δ : ℝ) : ℝ :=
  (∫ θ : Fin n → ℝ, Xd δ θ ^ 2 * pw δ θ) / (∫ θ : Fin n → ℝ, pw δ θ)
    - ((∫ θ : Fin n → ℝ, Xd δ θ * pw δ θ) / (∫ θ : Fin n → ℝ, pw δ θ)) ^ 2

/-- `V s = Var(log|Λ'(θ₁)| - log|Λ'(θ₂)| | s)` for an adjacent pair at normalized gap `s`,
under the Weyl density of the remaining `N-2` eigenangles. -/
noncomputable def cueV (N : ℕ) (s : ℝ) : ℝ := palmVar (N - 2) (2 * Real.pi / N * s)

/-- `∏_k ∏_{j≠k} |u_k - u_j| = ∏_{j<k} (u_j-u_k)^2`. -/
noncomputable def vdm (u : Fin n → ℝ) : ℝ := ∏ k, ∏ j ∈ univ.erase k, |u k - u j|

/-- `G(u) = ∏_k (1+u_k^2)`. -/
noncomputable def bigG (u : Fin n → ℝ) : ℝ := ∏ k, (1 + u k ^ 2)

/-- Unnormalized Hua weight with `h = 2`. -/
noncomputable def huaWeight (u : Fin n → ℝ) : ℝ := vdm u / bigG u ^ (n + 2)

/-- Normalizing constant. -/
noncomputable def huaZ (n : ℕ) : ℝ := ∫ u : Fin n → ℝ, huaWeight u

/-- Normalized Hua density. -/
noncomputable def huaDensity (u : Fin n → ℝ) : ℝ≥0 :=
  (huaWeight u / huaZ n).toNNReal

/-- The Hua ensemble `P_{n,2}` as a measure on `ℝ^n`. -/
noncomputable def huaMeasure (n : ℕ) : Measure (Fin n → ℝ) :=
  volume.withDensity fun u => (huaDensity u : ℝ≥0∞)

/-- The open box `(0, 2π)^n`. -/
noncomputable def boxC (n : ℕ) : Set (Fin n → ℝ) := Set.pi Set.univ fun _ => Set.Ioo 0 (2 * π)

/-- Circle weight `∏_{a<b} sin^2((θ_a-θ_b)/2) ∏_k sin^4(θ_k/2)`, proportional to
`∏_{a<b} |e^{iθ_a}-e^{iθ_b}|^2 ∏_k |1-e^{iθ_k}|^4`. -/
noncomputable def wC (θ : Fin n → ℝ) : ℝ :=
  (∏ p ∈ pairs n, sin ((θ p.1 - θ p.2) / 2) ^ 2) * ∏ k, sin (θ k / 2) ^ 4

/-- `S = (1/2) ∑_k cot(θ_k/2)`. -/
noncomputable def Ssum (θ : Fin n → ℝ) : ℝ := (1 / 2) * ∑ k, cos (θ k / 2) / sin (θ k / 2)

/-- `E_{w₀}[S^2]` for the circle weight on `n` angles. -/
noncomputable def circleE (n : ℕ) : ℝ :=
  (∫ θ in boxC n, Ssum θ ^ 2 * wC θ) / ∫ θ in boxC n, wC θ

end Singh
Source
J. Singh, https://github.com/jjsingh88/singh-constant (commit 792d985)
Read-back

What the Lean code literally says, in plain math · gemini-3.1-pro-preview

This file provides a series of definitions for a mathematical formulation involving configurations of points in Rn\mathbb{R}^nRn (represented via functions from an index set of size nnn to R\mathbb{R}R). Below is a summary of what the code literally asserts, organized by topic.

Foundational Sets and Variables

For any natural number n∈Nn \in \mathbb{N}n∈N:

  • pairs: Denoted here as PnP_nPn​, this is the set of ordered pairs of indices (a,b)∈{0,…,n−1}2(a, b) \in \{0, \dots, n-1\}^2(a,b)∈{0,…,n−1}2 such that a<ba < ba<b.
  • boxD: Given a real gap δ∈R\delta \in \mathbb{R}δ∈R, this is the open hypercube (δ2,2π−δ2)n⊂Rn(\frac{\delta}{2}, 2\pi - \frac{\delta}{2})^n \subset \mathbb{R}^n(2δ​,2π−2δ​)n⊂Rn.
  • boxC: This is the open hypercube (0,2π)n⊂Rn(0, 2\pi)^n \subset \mathbb{R}^n(0,2π)n⊂Rn.

(Note: In Lean, indices are typed as Fin n, and elements of Rn\mathbb{R}^nRn are formalized as total functions from Fin n to R\mathbb{R}R.)

Palm Variance Definitions

For n∈Nn \in \mathbb{N}n∈N, δ∈R\delta \in \mathbb{R}δ∈R, and an angle configuration θ∈Rn\theta \in \mathbb{R}^nθ∈Rn:

  • fL: A scalar function fL(x)=log⁡(sin⁡(x/2))f_L(x) = \log(\sin(x/2))fL​(x)=log(sin(x/2)). (Note: Lean's real logarithm returns 000 for all non-positive inputs, so fL(x)=0f_L(x) = 0fL​(x)=0 when sin⁡(x/2)≤0\sin(x/2) \le 0sin(x/2)≤0.)
  • Xd: The sum Xd(δ,θ)=∑k=0n−1(fL(θk+δ2)−fL(θk−δ2))X_d(\delta, \theta) = \sum_{k=0}^{n-1} \left( f_L(\theta_k + \frac{\delta}{2}) - f_L(\theta_k - \frac{\delta}{2}) \right)Xd​(δ,θ)=∑k=0n−1​(fL​(θk​+2δ​)−fL​(θk​−2δ​)).
  • pwRaw: An unnormalized weight function given by:
pwRaw(δ,θ)=(∏(a,b)∈Pnsin⁡2(θa−θb2))∏k=0n−1(sin⁡2(θk−δ/22)sin⁡2(θk+δ/22))\text{pwRaw}(\delta, \theta) = \left( \prod_{(a,b) \in P_n} \sin^2\left(\frac{\theta_a - \theta_b}{2}\right) \right) \prod_{k=0}^{n-1} \left( \sin^2\left(\frac{\theta_k - \delta/2}{2}\right) \sin^2\left(\frac{\theta_k + \delta/2}{2}\right) \right)pwRaw(δ,θ)=​(a,b)∈Pn​∏​sin2(2θa​−θb​​)​k=0∏n−1​(sin2(2θk​−δ/2​)sin2(2θk​+δ/2​))
  • pw: The conditional weight, which equals pwRaw(δ,θ)\text{pwRaw}(\delta, \theta)pwRaw(δ,θ) if θ∈boxD(n,δ)\theta \in \text{boxD}(n, \delta)θ∈boxD(n,δ), and 000 otherwise.
  • palmVar: The conditional variance palmVar(n,δ)\text{palmVar}(n, \delta)palmVar(n,δ), defined as the difference of two ratios of Lebesgue integrals over Rn\mathbb{R}^nRn:
∫RnXd(δ,θ)2pw(δ,θ) dθ∫Rnpw(δ,θ) dθ−(∫RnXd(δ,θ)pw(δ,θ) dθ∫Rnpw(δ,θ) dθ)2\frac{\int_{\mathbb{R}^n} X_d(\delta, \theta)^2 \text{pw}(\delta, \theta) \, d\theta}{\int_{\mathbb{R}^n} \text{pw}(\delta, \theta) \, d\theta} - \left( \frac{\int_{\mathbb{R}^n} X_d(\delta, \theta) \text{pw}(\delta, \theta) \, d\theta}{\int_{\mathbb{R}^n} \text{pw}(\delta, \theta) \, d\theta} \right)^2∫Rn​pw(δ,θ)dθ∫Rn​Xd​(δ,θ)2pw(δ,θ)dθ​−(∫Rn​pw(δ,θ)dθ∫Rn​Xd​(δ,θ)pw(δ,θ)dθ​)2

(Note: If the denominator integral evaluates to 000, Lean's division returns 000.)

  • cueV: Given N∈NN \in \mathbb{N}N∈N and s∈Rs \in \mathbb{R}s∈R, this evaluates to palmVar(N−2,2πNs)\text{palmVar}(N - 2, \frac{2\pi}{N}s)palmVar(N−2,N2π​s). (Note: Because N−2N-2N−2 uses natural number subtraction, if N<2N < 2N<2, it truncates to 000.)

Hua Ensemble Definitions

For n∈Nn \in \mathbb{N}n∈N and a configuration u∈Rnu \in \mathbb{R}^nu∈Rn:

  • vdm: A product of absolute differences vdm(u)=∏k=0n−1∏j≠k∣uk−uj∣\text{vdm}(u) = \prod_{k=0}^{n-1} \prod_{j \neq k} |u_k - u_j|vdm(u)=∏k=0n−1​∏j=k​∣uk​−uj​∣.
  • bigG: A scaling factor G(u)=∏k=0n−1(1+uk2)G(u) = \prod_{k=0}^{n-1} (1 + u_k^2)G(u)=∏k=0n−1​(1+uk2​).
  • huaWeight: The unnormalized weight WH(u)=vdm(u)G(u)n+2W_H(u) = \frac{\text{vdm}(u)}{G(u)^{n+2}}WH​(u)=G(u)n+2vdm(u)​.
  • huaZ: The normalization constant ZH(n)=∫RnWH(u) duZ_H(n) = \int_{\mathbb{R}^n} W_H(u) \, duZH​(n)=∫Rn​WH​(u)du.
  • huaDensity: The probability density, defined by projecting WH(u)ZH(n)\frac{W_H(u)}{Z_H(n)}ZH​(n)WH​(u)​ to the non-negative reals. (Note: If the ratio is negative, this evaluates to 000.)
  • huaMeasure: A measure on Rn\mathbb{R}^nRn defined by equipping the standard Lebesgue volume with the density huaDensity\text{huaDensity}huaDensity.

Circle Ensemble Definitions

For n∈Nn \in \mathbb{N}n∈N and an angle configuration θ∈Rn\theta \in \mathbb{R}^nθ∈Rn:

  • wC: The circle weight, defined as:
wC(θ)=(∏(a,b)∈Pnsin⁡2(θa−θb2))∏k=0n−1sin⁡4(θk2)w_C(\theta) = \left( \prod_{(a,b) \in P_n} \sin^2\left(\frac{\theta_a - \theta_b}{2}\right) \right) \prod_{k=0}^{n-1} \sin^4\left(\frac{\theta_k}{2}\right)wC​(θ)=​(a,b)∈Pn​∏​sin2(2θa​−θb​​)​k=0∏n−1​sin4(2θk​​)
  • Ssum: A trigonometric sum Ssum(θ)=12∑k=0n−1cos⁡(θk/2)sin⁡(θk/2)S_{\text{sum}}(\theta) = \frac{1}{2} \sum_{k=0}^{n-1} \frac{\cos(\theta_k/2)}{\sin(\theta_k/2)}Ssum​(θ)=21​∑k=0n−1​sin(θk​/2)cos(θk​/2)​. (Note: Lean's division returns 000 if sin⁡(θk/2)=0\sin(\theta_k/2) = 0sin(θk​/2)=0.)
  • circleE: The expected value circleE(n)\text{circleE}(n)circleE(n), defined as the ratio of Lebesgue integrals restricted to the domain boxC(n)\text{boxC}(n)boxC(n):
∫boxC(n)Ssum(θ)2wC(θ) dθ∫boxC(n)wC(θ) dθ\frac{\int_{\text{boxC}(n)} S_{\text{sum}}(\theta)^2 w_C(\theta) \, d\theta}{\int_{\text{boxC}(n)} w_C(\theta) \, d\theta}∫boxC(n)​wC​(θ)dθ∫boxC(n)​Ssum​(θ)2wC​(θ)dθ​

View graph

Get started

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

About Prove2Me

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

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me