Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition B.1: CLT p-values are asymptotically valid

Proved
LearnThenTest.clt_pvalue_asymptotically_valid

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

distribution-free-inferencefamily-wise-error-ratemultiple-testingp-valuesrisk-control

Let L1,L2,…L_1,L_2,\dotsL1​,L2​,… be i.i.d. real losses with finite mean R=E[L1]R=\mathbb E[L_1]R=E[L1​] and finite, positive variance. Let α≤R\alpha\le Rα≤R; this covers the null hypothesis Hj:R(λj)>α\mathcal H_j:R(\lambda_j)>\alphaHj​:R(λj​)>α and its boundary R=αR=\alphaR=α. For each nnn, let R^n=1n∑i=1nLi\hat R_n=\frac1n\sum_{i=1}^nL_iR^n​=n1​∑i=1n​Li​ and let σ^n=(((L1−R^n)2+⋯+(Ln−R^n)2)/(n−1))1/2\hat\sigma_n=\Big(\big((L_1-\hat R_n)^2+\dots+(L_n-\hat R_n)^2\big)/(n-1)\Big)^{1/2}σ^n​=(((L1​−R^n​)2+⋯+(Ln​−R^n​)2)/(n−1))1/2 be the empirical standard deviation, and let Φ\PhiΦ be the standard normal distribution function. Then the CLT p-value

pnCLT=1−Φ(α−R^nσ^n/n)p^{\mathrm{CLT}}_n=1-\Phi\Big(\frac{\alpha-\hat R_n}{\hat\sigma_n/\sqrt n}\Big)pnCLT​=1−Φ(σ^n​/n​α−R^n​​)

is asymptotically valid: for every u∈[0,1]u\in[0,1]u∈[0,1],

lim sup⁡n→∞P(pnCLT≤u)≤u.\limsup_{n\to\infty}\mathbb P(p^{\mathrm{CLT}}_n\le u)\le u.n→∞limsup​P(pnCLT​≤u)≤u.

Formalization Note The paper prints σ^n=(∑i(Li−R^n)2)1/2/(n−1)\hat\sigma_n=\big(\sum_i(L_i-\hat R_n)^2\big)^{1/2}/(n-1)σ^n​=(∑i​(Li​−R^n​)2)1/2/(n−1), which is the empirical standard deviation it names divided by n−1\sqrt{n-1}n−1​; the statement uses the empirical standard deviation. The null is taken closed, α≤R\alpha\le Rα≤R, which strengthens the printed α<R\alpha<Rα<R. Under the strict null alone, pnCLT→1p^{\mathrm{CLT}}_n\to1pnCLT​→1 in probability by the law of large numbers, and the statement would hold for any consistent or even wrongly scaled σ^\hat\sigmaσ^. At R=αR=\alphaR=α the central limit theorem gives P(pnCLT≤u)→u\mathbb P(p^{\mathrm{CLT}}_n\le u)\to uP(pnCLT​≤u)→u, which is the content the paper intends. The hypothesis of positive variance is added because the formula is undefined when σ^n=0\hat\sigma_n=0σ^n​=0. With zero variance, σ^n=0\hat\sigma_n=0σ^n​=0 almost surely; with positive variance, the event σ^n=0\hat\sigma_n=0σ^n​=0 has probability tending to 000. On that event Lean evaluates the quotient as 000.

Preamble
import Mathlib
import Definitions.Def_LearnThenTest_Basic

open MeasureTheory ProbabilityTheory Filter
Formal statement
namespace LearnThenTest

theorem clt_pvalue_asymptotically_valid {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
    [IsProbabilityMeasure P] (L : ℕ → Ω → ℝ) (hmeas : ∀ i, Measurable (L i))
    (hind : iIndepFun L P) (hident : ∀ i, IdentDistrib (L i) (L 0) P P)
    (hL2 : MemLp (L 0) 2 P) (hvar : 0 < variance (L 0) P) (α : ℝ)
    (hnull : α ≤ ∫ ω, L 0 ω ∂P) :
    ∀ u ∈ Set.Icc (0 : ℝ) 1,
      limsup (fun n : ℕ => P {ω | cltPValue α (fun i : Fin n => L i ω) ≤ u}) atTop ≤
        ENNReal.ofReal u := by sorry

end LearnThenTest
Source
Angelopoulos, Bates, Candès, Jordan and Lei, Learn then Test: Calibrating Predictive Algorithms to Achieve Risk Control, arXiv:2110.01052v5 (2022), Appendix B, Proposition B.1, p. 21; proof in Appendix C, p. 22
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Let (Ω,F,P)(\Omega, \mathcal{F}, P)(Ω,F,P) be a probability space. Let L0,L1,L2,⋯:Ω→RL_0, L_1, L_2, \dots : \Omega \to \mathbb{R}L0​,L1​,L2​,⋯:Ω→R be a sequence of real random variables, indexed by the natural numbers starting at 000. Let α∈R\alpha \in \mathbb{R}α∈R be arbitrary. The theorem assumes the following:

  • each LiL_iLi​ is measurable;
  • the family (Li)i≥0(L_i)_{i \ge 0}(Li​)i≥0​ is mutually independent under PPP;
  • every LiL_iLi​ has the same distribution under PPP as L0L_0L0​;
  • L0L_0L0​ is square-integrable, E[L02]<∞\mathbb{E}[L_0^2] < \inftyE[L02​]<∞;
  • the variance is strictly positive, Var⁡(L0)>0\operatorname{Var}(L_0) > 0Var(L0​)>0;
  • the null condition α≤E[L0]\alpha \le \mathbb{E}[L_0]α≤E[L0​] holds, with the inequality non-strict and pointing in this direction.

No boundedness or range condition (such as Li∈[0,1]L_i \in [0,1]Li​∈[0,1]) is imposed on the LiL_iLi​.

For each n∈Nn \in \mathbb{N}n∈N and ω∈Ω\omega \in \Omegaω∈Ω, the statistic uses only the first nnn variables L0(ω),…,Ln−1(ω)L_0(\omega), \dots, L_{n-1}(\omega)L0​(ω),…,Ln−1​(ω). The empirical mean is

R^n=1n∑i=0n−1Li(ω).\hat R_n = \frac{1}{n}\sum_{i=0}^{n-1} L_i(\omega).R^n​=n1​i=0∑n−1​Li​(ω).

The empirical standard deviation is

σ^n=1n−1∑i=0n−1(Li(ω)−R^n)2.\hat\sigma_n = \sqrt{\frac{1}{n-1}\sum_{i=0}^{n-1}\bigl(L_i(\omega) - \hat R_n\bigr)^2}.σ^n​=n−11​i=0∑n−1​(Li​(ω)−R^n​)2​.

The CLT p-value is

pn(ω)=1−Φ ⁣(α−R^nσ^n/n),p_n(\omega) = 1 - \Phi\!\left(\frac{\alpha - \hat R_n}{\hat\sigma_n / \sqrt{n}}\right),pn​(ω)=1−Φ(σ^n​/n​α−R^n​​),

where Φ(x)=Pr⁡(Z≤x)\Phi(x) = \Pr(Z \le x)Φ(x)=Pr(Z≤x) is the distribution function of a standard normal Z∼N(0,1)Z \sim N(0,1)Z∼N(0,1).

These formulas use total-function conventions in degenerate cases: division by zero yields 000, and the square root of a negative number yields 000. This has the following consequences:

  • For n=0n = 0n=0, R^0=0\hat R_0 = 0R^0​=0 and σ^0=0\hat\sigma_0 = 0σ^0​=0.
  • For n=1n = 1n=1, the factor 1/(n−1)1/(n-1)1/(n−1) is 1/0=01/0 = 01/0=0, so σ^1=0\hat\sigma_1 = 0σ^1​=0.
  • For any nnn and ω\omegaω with σ^n=0\hat\sigma_n = 0σ^n​=0, the denominator σ^n/n\hat\sigma_n/\sqrt nσ^n​/n​ is 000. In that case:
    • the argument of Φ\PhiΦ is set to 000;
    • pn(ω)=1−Φ(0)=12p_n(\omega) = 1 - \Phi(0) = \tfrac12pn​(ω)=1−Φ(0)=21​, whatever the value of α−R^n\alpha - \hat R_nα−R^n​.

For n≥2n \ge 2n≥2, the event σ^n=0\hat\sigma_n = 0σ^n​=0 (all L0,…,Ln−1L_0, \dots, L_{n-1}L0​,…,Ln−1​ equal) can have positive probability when the law of L0L_0L0​ has atoms.

The conclusion is that, for every u∈[0,1]u \in [0,1]u∈[0,1],

lim sup⁡n→∞P({ω:pn(ω)≤u})  ≤  u.\limsup_{n \to \infty} P\bigl(\{\omega : p_n(\omega) \le u\}\bigr) \;\le\; u.n→∞limsup​P({ω:pn​(ω)≤u})≤u.

Here the probabilities are taken as values in [0,∞][0, \infty][0,∞]. The limit superior is taken in that extended range as n→∞n \to \inftyn→∞ through the natural numbers. Because it is a limit superior, the values at any finitely many nnn (including the degenerate n=0,1n = 0, 1n=0,1) do not affect it.

The statement is only asymptotic. It gives no bound P(pn≤u)≤uP(p_n \le u) \le uP(pn​≤u)≤u for any particular finite nnn, and no rate of convergence. No measurability of the events {pn≤u}\{p_n \le u\}{pn​≤u} is asserted; PPP is simply evaluated on these sets.

Human review
  • Endorsed by Shuze Chen · Nov 24, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 24, 2026

    Confirmed by the mission captain (proposal self-audit).

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