Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proposition 6: the maximum of the per-risk p-values is valid

Proved
LearnThenTest.max_pvalue_valid

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

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

Fix a parameter λj\lambda_jλj​ and mmm risks R1,…,RmR_1,\dots,R_mR1​,…,Rm​ with levels α1,…,αm\alpha_1,\dots,\alpha_mα1​,…,αm​. For each lll, let pj,lp_{j,l}pj,l​ be a p-value for Hj,l:Rl(λj)>αl\mathcal H_{j,l}:R_l(\lambda_j)>\alpha_lHj,l​:Rl​(λj​)>αl​, valid whenever Hj,l\mathcal H_{j,l}Hj,l​ holds. Define pj=max⁡lpj,lp_j=\max_lp_{j,l}pj​=maxl​pj,l​. If Hj\mathcal H_jHj​ holds, that is, Rl(λj)>αlR_l(\lambda_j)>\alpha_lRl​(λj​)>αl​ for some lll, then

P(pj≤u)≤ufor all u∈[0,1].\mathbb P(p_j\le u)\le u\qquad\text{for all }u\in[0,1].P(pj​≤u)≤ufor all u∈[0,1].

This reduces simultaneous control of several risks to the single-risk procedures above.

Preamble
import Mathlib
import Definitions.Def_LearnThenTest_Basic

open MeasureTheory ProbabilityTheory Filter
Formal statement
namespace LearnThenTest

theorem max_pvalue_valid {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
    [IsProbabilityMeasure P] {m : ℕ} (R α : Fin m → ℝ) (p : Fin m → Ω → ℝ)
    (hp : ∀ l, Measurable (p l)) (hvalid : ∀ l, α l < R l → IsValidPValue P (p l))
    (hnull : ∃ l, α l < R l) :
    IsValidPValue P (fun ω => ⨆ l, p l ω) := 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), Section 2.4, Proposition 6, p. 6; proof in Appendix C, p. 22
Read-back

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

Setting. Let (Ω,F,P)(\Omega, \mathcal{F}, P)(Ω,F,P) be a probability space: PPP is a measure on an arbitrary measurable space Ω\OmegaΩ with P(Ω)=1P(\Omega) = 1P(Ω)=1. Let m∈Nm \in \mathbb{N}m∈N be a number of indices l∈{0,1,…,m−1}l \in \{0, 1, \dots, m-1\}l∈{0,1,…,m−1}. The data are:

  • two families of real numbers RlR_lRl​ and αl\alpha_lαl​, one pair for each index lll;
  • a family of real-valued functions pl:Ω→Rp_l : \Omega \to \mathbb{R}pl​:Ω→R, one for each lll.

The numbers RlR_lRl​ and αl\alpha_lαl​ are plain real constants. They are not tied to PPP or to the plp_lpl​ in any way except through the hypotheses below, where they only decide which indices count as "nulls".

Valid p-value. Throughout, "qqq is a valid p-value under PPP" means: for every u∈[0,1]u \in [0,1]u∈[0,1],

P({ω:q(ω)≤u})≤u.P\bigl(\{\omega : q(\omega) \le u\}\bigr) \le u.P({ω:q(ω)≤u})≤u.

This definition does not require qqq to take values in [0,1][0,1][0,1], nor does it require qqq to be measurable.

Hypotheses.

  1. Every plp_lpl​ is measurable. This applies to all indices lll, not only the null ones.
  2. For every index lll with αl<Rl\alpha_l < R_lαl​<Rl​ (strict inequality), plp_lpl​ is a valid p-value under PPP. Nothing is assumed about the distribution of plp_lpl​ when αl≥Rl\alpha_l \ge R_lαl​≥Rl​.
  3. There exists at least one index lll with αl<Rl\alpha_l < R_lαl​<Rl​. In particular this forces m≥1m \ge 1m≥1, so the index set is nonempty.

No assumption is made about the dependence between the plp_lpl​.

Conclusion. The pointwise maximum

pmax⁡(ω)=sup⁡lpl(ω)=max⁡0≤l≤m−1pl(ω)p_{\max}(\omega) = \sup_{l} p_l(\omega) = \max_{0 \le l \le m-1} p_l(\omega)pmax​(ω)=lsup​pl​(ω)=0≤l≤m−1max​pl​(ω)

is a valid p-value under PPP. That is, for every u∈[0,1]u \in [0,1]u∈[0,1],

P({ω:max⁡lpl(ω)≤u})≤u.P\Bigl(\bigl\{\omega : \max_{l} p_l(\omega) \le u\bigr\}\Bigr) \le u.P({ω:lmax​pl​(ω)≤u})≤u.

Because the index set is finite and, by hypothesis 3, nonempty, the supremum is an attained maximum. The convention that a supremum over an empty family of reals equals 000 never comes into play.

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