Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1: type-I error of Fisher's combination test

Open
ConformalOutlierTesting.fisher_type_one_error

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

conformal-inferencefalse-discovery-ratemultiple-testingoutlier-detectionprds

Let the scores be continuously distributed with law μ\muμ, and assume the global null: the mmm test scores and the nnn calibration scores are all i.i.d. with law μ\muμ. Let m=⌊γn⌋m=\lfloor\gamma n\rfloorm=⌊γn⌋ with γ∈(0,∞)\gamma\in(0,\infty)γ∈(0,∞), and let α∈(0,1)\alpha\in(0,1)α∈(0,1). As n→∞n\to\inftyn→∞:

  1. The type-I error of Fisher's combination test applied to the marginal conformal p-values satisfies
P[−2∑i=1mlog⁡u^(marg)(X2n+i)≥χ2(2m;1−α)]→Φˉ(z1−α1+γ).\mathbb P\Big[-2\sum_{i=1}^m\log\hat u^{(\mathrm{marg})}(X_{2n+i})\ge\chi^2(2m;1-\alpha)\Big]\to\bar\Phi\Big(\frac{z_{1-\alpha}}{\sqrt{1+\gamma}}\Big).P[−2i=1∑m​logu^(marg)(X2n+i​)≥χ2(2m;1−α)]→Φˉ(1+γ​z1−α​​).
  1. The conditional type-I error given the calibration data converges in distribution:
P[−2∑i=1mlog⁡u^(marg)(X2n+i)≥χ2(2m;1−α) ∣ D]→dΦˉ(z1−α+γ W),W∼N(0,1).\mathbb P\Big[-2\sum_{i=1}^m\log\hat u^{(\mathrm{marg})}(X_{2n+i})\ge\chi^2(2m;1-\alpha)\,\Big|\,\mathcal D\Big]\xrightarrow{d}\bar\Phi(z_{1-\alpha}+\sqrt\gamma\,W),\qquad W\sim N(0,1).P[−2i=1∑m​logu^(marg)(X2n+i​)≥χ2(2m;1−α)​D]d​Φˉ(z1−α​+γ​W),W∼N(0,1).

Since γ>0\gamma>0γ>0, the limiting type-I error exceeds α\alphaα whenever α<1/2\alpha<1/2α<1/2. So the dependence induced by the shared calibration set invalidates Fisher's test.

Formalization Note The level is restricted to α∈(0,1)\alpha\in(0,1)α∈(0,1), which is implicit in the paper. Convergence in distribution is stated as convergence of Ef(⋅)\mathbb E f(\cdot)Ef(⋅) for every bounded continuous fff. Because the test scores are independent of D\mathcal DD, the conditional probability is written as the probability over the test scores with the calibration scores held fixed.

Preamble
import Mathlib
import Definitions.Def_ConformalOutlierTesting_Basic

open MeasureTheory ProbabilityTheory Filter Topology Set BoundedContinuousFunction
Formal statement
namespace ConformalOutlierTesting

theorem fisher_type_one_error (μ : Measure ℝ) [IsProbabilityMeasure μ] [NullSingletonClass μ]
    (γ : ℝ) (hγ : 0 < γ) (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) :
    Tendsto (fun n : ℕ =>
        ((scoreLaw (n := n) μ (fun _ : Fin ⌊γ * (n : ℝ)⌋₊ => μ))
          {ω | quantile (chiSqLaw (2 * ⌊γ * (n : ℝ)⌋₊)) (1 - α) ≤ fisherStat ω.1 ω.2}).toReal)
      atTop (𝓝 (normSurv (quantile stdNormal (1 - α) / Real.sqrt (1 + γ)))) ∧
    ∀ f : ℝ →ᵇ ℝ,
      Tendsto (fun n : ℕ =>
          ∫ s, f (condFisherRejProb μ ⌊γ * (n : ℝ)⌋₊ α s) ∂(Measure.pi fun _ : Fin n => μ))
        atTop (𝓝 (∫ w, f (normSurv (quantile stdNormal (1 - α) + Real.sqrt γ * w)) ∂stdNormal)) := by sorry

end ConformalOutlierTesting
Source
Bates, Candès, Lei, Romano and Sesia, Testing for Outliers with Conformal p-values, arXiv:2104.08279v3 (2022), Section 2.1, Theorem 1, eq. (5), p. 6; proof in Appendix A.2 (Theorem 6 with ξ = 1), pp. 33-38
Read-back

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

Let μ\muμ be a probability measure on R\mathbb{R}R with no atoms: μ({x})=0\mu(\{x\}) = 0μ({x})=0 for every x∈Rx \in \mathbb{R}x∈R. Let γ>0\gamma > 0γ>0 and α∈(0,1)\alpha \in (0,1)α∈(0,1) be real numbers (strict inequalities: 0<γ0 < \gamma0<γ, 0<α<10 < \alpha < 10<α<1). For each n∈Nn \in \mathbb{N}n∈N, set

mn=⌊γn⌋∈N.m_n = \lfloor \gamma n \rfloor \in \mathbb{N}.mn​=⌊γn⌋∈N.

Because γ>0\gamma > 0γ>0, mn≥1m_n \ge 1mn​≥1 for all sufficiently large nnn, but mn=0m_n = 0mn​=0 is allowed for small nnn, including n=0n = 0n=0.

Objects used in the statement.

  • Conformal p-value. For calibration scores s=(s1,…,sn)∈Rns = (s_1,\dots,s_n) \in \mathbb{R}^ns=(s1​,…,sn​)∈Rn and x∈Rx \in \mathbb{R}x∈R,
u^s(x)=1+#{i:si≤x}n+1.\hat u_s(x) = \frac{1 + \#\{i : s_i \le x\}}{n+1}.u^s​(x)=n+11+#{i:si​≤x}​.

This always lies in [1n+1,1][\tfrac{1}{n+1}, 1][n+11​,1], so its logarithm is a genuine real number.

  • Fisher statistic. For test scores t=(t1,…,tm)∈Rmt = (t_1,\dots,t_m) \in \mathbb{R}^mt=(t1​,…,tm​)∈Rm,
F(s,t)=−2∑j=1mlog⁡u^s(tj).F(s,t) = -2\sum_{j=1}^{m} \log \hat u_s(t_j).F(s,t)=−2j=1∑m​logu^s​(tj​).

It equals 000 when m=0m = 0m=0.

  • Chi-square quantile. χk2\chi^2_kχk2​ denotes the Gamma law with shape k/2k/2k/2 and rate 1/21/21/2 (Lebesgue measure weighted by the Gamma density). For a measure ν\nuν on R\mathbb{R}R with cumulative distribution function FνF_\nuFν​, the qqq-quantile is
Qν(q)=inf⁡{x:Fν(x)≥q}.Q_\nu(q) = \inf\{x : F_\nu(x) \ge q\}.Qν​(q)=inf{x:Fν​(x)≥q}.

Write cn=Qχ2mn2(1−α)c_n = Q_{\chi^2_{2m_n}}(1-\alpha)cn​=Qχ2mn​2​​(1−α).

  • When mn=0m_n = 0mn​=0 the "law" χ02\chi^2_0χ02​ is Gamma with shape 000, which is a degenerate object (not the point mass at 000). cnc_ncn​ is then whatever the definitions produce.
  • This affects only finitely many nnn.
  • Normal quantities. Φ\PhiΦ is the cumulative distribution function of N(0,1)N(0,1)N(0,1), and Φˉ(x)=1−Φ(x)\bar\Phi(x) = 1 - \Phi(x)Φˉ(x)=1−Φ(x). The normal quantile is
z1−α=inf⁡{x:Φ(x)≥1−α}.z_{1-\alpha} = \inf\{x : \Phi(x) \ge 1-\alpha\}.z1−α​=inf{x:Φ(x)≥1−α}.

Claim (a): unconditional rejection probability. Let S1,…,SnS_1,\dots,S_nS1​,…,Sn​ and T1,…,TmnT_1,\dots,T_{m_n}T1​,…,Tmn​​ be independent, all with law μ\muμ. In other words, the joint law is the product μ⊗n⊗μ⊗mn\mu^{\otimes n} \otimes \mu^{\otimes m_n}μ⊗n⊗μ⊗mn​ on Rn×Rmn\mathbb{R}^n \times \mathbb{R}^{m_n}Rn×Rmn​. Then, as n→∞n \to \inftyn→∞,

Pr⁡[ cn≤F(S,T) ]  ⟶  Φˉ ⁣(z1−α1+γ).\Pr\big[\, c_n \le F(S, T) \,\big] \;\longrightarrow\; \bar\Phi\!\left(\frac{z_{1-\alpha}}{\sqrt{1+\gamma}}\right).Pr[cn​≤F(S,T)]⟶Φˉ(1+γ​z1−α​​).

Claim (b): conditional rejection probability. For calibration scores s∈Rns \in \mathbb{R}^ns∈Rn, define the conditional rejection probability

Cn(s)=μ⊗mn({t∈Rmn:cn≤F(s,t)}),C_n(s) = \mu^{\otimes m_n}\big(\{t \in \mathbb{R}^{m_n} : c_n \le F(s,t)\}\big),Cn​(s)=μ⊗mn​({t∈Rmn​:cn​≤F(s,t)}),

where the test scores t1,…,tmnt_1,\dots,t_{m_n}t1​,…,tmn​​ are i.i.d. μ\muμ. The claim is that for every bounded continuous function f:R→Rf : \mathbb{R} \to \mathbb{R}f:R→R, as n→∞n \to \inftyn→∞,

∫Rnf(Cn(s)) dμ⊗n(s)  ⟶  ∫Rf ⁣(Φˉ(z1−α+γ w)) dN(0,1)(w).\int_{\mathbb{R}^n} f\big(C_n(s)\big)\, d\mu^{\otimes n}(s) \;\longrightarrow\; \int_{\mathbb{R}} f\!\big(\bar\Phi(z_{1-\alpha} + \sqrt{\gamma}\, w)\big)\, d N(0,1)(w).∫Rn​f(Cn​(s))dμ⊗n(s)⟶∫R​f(Φˉ(z1−α​+γ​w))dN(0,1)(w).

That is, the law of Cn(S)C_n(S)Cn​(S) under S∼μ⊗nS \sim \mu^{\otimes n}S∼μ⊗n converges weakly to the law of Φˉ(z1−α+γ W)\bar\Phi(z_{1-\alpha} + \sqrt{\gamma}\, W)Φˉ(z1−α​+γ​W) with W∼N(0,1)W \sim N(0,1)W∼N(0,1). One caveat: under the formal conventions, the left-hand integral is set to 000 if s↦f(Cn(s))s \mapsto f(C_n(s))s↦f(Cn​(s)) fails to be measurable. The statement does not itself assert that CnC_nCn​ is measurable.

The theorem asserts the conjunction of (a) and (b). Both claims are limits as n→∞n \to \inftyn→∞ only. They say nothing about any fixed finite nnn, and no rate of convergence is stated.

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