Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem A.1 (as proved): asymptotic risk control for non-monotone losses

Proved
ConformalRiskControl.monotonized_asymptotic_risk_control

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

conformal-predictiondistribution-free-inferenceexchangeabilityrisk-controluncertainty-quantification

Let Λ⊂R\Lambda\subset\mathbb{R}Λ⊂R be nonempty and compact with λmax⁡=max⁡Λ\lambda_{\max}=\max\Lambdaλmax​=maxΛ, and let α<B\alpha<Bα<B. Let L1,L2,…L_1,L_2,\dotsL1​,L2​,… be i.i.d. random functions on Λ\LambdaΛ with right-continuous, possibly non-monotone, realisations. Assume that almost surely, for every iii:

  1. LiL_iLi​ is bounded below by a fixed constant;
  2. sup⁡λLi(λ)≤B\sup_\lambda L_i(\lambda)\le Bsupλ​Li​(λ)≤B;
  3. Li(λmax⁡)≤αL_i(\lambda_{\max})\le\alphaLi​(λmax​)≤α.

Let R^n↑(λ)=sup⁡t≥λR^n(t)\hat R_n^{\uparrow}(\lambda)=\sup_{t\ge\lambda}\hat R_n(t)R^n↑​(λ)=supt≥λ​R^n​(t) and λ^n↑=inf⁡{λ:R^n↑(λ)≤α}\hat\lambda_n^{\uparrow}=\inf\{\lambda:\hat R_n^{\uparrow}(\lambda)\le\alpha\}λ^n↑​=inf{λ:R^n↑​(λ)≤α}. Then

lim sup⁡n→∞E[Ln+1(λ^n↑)]≤α.\limsup_{n\to\infty}\mathbb{E}\big[L_{n+1}(\hat\lambda_n^{\uparrow})\big]\le\alpha.n→∞limsup​E[Ln+1​(λ^n↑​)]≤α.

Formalization Note The paper writes lim⁡\limlim, but its proof bounds lim sup⁡\limsuplimsup by Fatou's lemma and does not show that the limit exists, so the statement is made for lim sup⁡\limsuplimsup. Indices start at 000: λ^n↑\hat\lambda_n^{\uparrow}λ^n↑​ uses L0,…,Ln−1L_0,\dots,L_{n-1}L0​,…,Ln−1​ and is tested on LnL_nLn​.

Preamble
import Mathlib
import Definitions.Def_ConformalRiskControl_Basic

open MeasureTheory ProbabilityTheory Filter
Formal statement
namespace ConformalRiskControl

theorem monotonized_asymptotic_risk_control {Ω : Type*} [MeasurableSpace Ω]
    (P : Measure Ω) [IsProbabilityMeasure P] (Λ : Set ℝ) (hΛ : IsCompact Λ)
    (hΛne : Λ.Nonempty) (B α : ℝ) (hαB : α < B) (L : ℕ → Ω → ℝ → ℝ) (hiid : IsIID P Λ L)
    (hrc : ∀ i ω, IsRightContOn Λ (L i ω)) (lo : ℝ) (hlo : ∀ᵐ ω ∂P, ∀ i, ∀ x ∈ Λ, lo ≤ L i ω x)
    (h5 : ∀ᵐ ω ∂P, ∀ i, LossBounds Λ B α (L i ω)) :
    limsup (fun n : ℕ => upperExp P B (fun ω => L n ω (lhatPlus Λ α (fun i : Fin n => L i ω))))
      atTop ≤ (α : EReal) := by sorry

end ConformalRiskControl
Source
Angelopoulos, Bates, Fisch, Lei and Schuster, Conformal Risk Control, arXiv:2208.02814v4, Appendix A, Theorem A.1, p. 15; proof in Appendix B, p. 17
Read-back

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

Let (Ω,F)(\Omega,\mathcal F)(Ω,F) be a measurable space with a probability measure PPP. Fix:

  • a set Λ⊆R\Lambda\subseteq\mathbb RΛ⊆R that is compact and nonempty, with λmax⁡:=sup⁡Λ\lambda_{\max}:=\sup\Lambdaλmax​:=supΛ;
  • real numbers BBB and α\alphaα with α<B\alpha<Bα<B (strict);
  • a sequence of random functions L0,L1,L2,…L_0,L_1,L_2,\dotsL0​,L1​,L2​,…, indexed by i∈Ni\in\mathbb Ni∈N starting at 000, where Li(ω,x)∈RL_i(\omega,x)\in\mathbb RLi​(ω,x)∈R is defined for every ω∈Ω\omega\in\Omegaω∈Ω and every x∈Rx\in\mathbb Rx∈R (not only x∈Λx\in\Lambdax∈Λ);
  • a real number lo\mathrm{lo}lo.

Hypotheses.

  1. i.i.d. For every iii and every x∈Λx\in\Lambdax∈Λ, the map ω↦Li(ω,x)\omega\mapsto L_i(\omega,x)ω↦Li​(ω,x) is measurable. The random elements ω↦(Li(ω,x))x∈Λ\omega\mapsto (L_i(\omega,x))_{x\in\Lambda}ω↦(Li​(ω,x))x∈Λ​ of RΛ\mathbb R^\LambdaRΛ, with the product σ\sigmaσ-algebra, are mutually independent under PPP (every finite subfamily is independent). For all i,ji,ji,j they have the same distribution on RΛ\mathbb R^\LambdaRΛ.
  2. Right-continuity, for every sample. For every iii and every ω\omegaω (not merely almost surely), x↦Li(ω,x)x\mapsto L_i(\omega,x)x↦Li​(ω,x) is right-continuous on Λ\LambdaΛ. That is, at each x∈Λx\in\Lambdax∈Λ it is continuous relative to Λ∩[x,∞)\Lambda\cap[x,\infty)Λ∩[x,∞). No monotonicity in xxx is assumed.
  3. Uniform lower bound. For PPP-almost every ω\omegaω, lo≤Li(ω,x)\mathrm{lo}\le L_i(\omega,x)lo≤Li​(ω,x) for all iii and all x∈Λx\in\Lambdax∈Λ.
  4. Bounds (eq. 5). For PPP-almost every ω\omegaω, for all iii:
    • Li(ω,x)≤BL_i(\omega,x)\le BLi​(ω,x)≤B for all x∈Λx\in\Lambdax∈Λ, and
    • Li(ω,λmax⁡)≤αL_i(\omega,\lambda_{\max})\le\alphaLi​(ω,λmax​)≤α.

The parameter. For n∈Nn\in\mathbb Nn∈N and ω∈Ω\omega\in\Omegaω∈Ω, the calibration losses are L0,…,Ln−1L_0,\dots,L_{n-1}L0​,…,Ln−1​ and the test loss is LnL_nLn​. Define the empirical risk

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

When n=0n=0n=0 this is the empty sum divided by 000, which by convention is 000.

Define its monotonization

R^n+(ω,x)=sup⁡{R^n(ω,t):t∈Λ, t≥x}.\hat R_n^+(\omega,x)=\sup\{\hat R_n(\omega,t): t\in\Lambda,\ t\ge x\}.R^n+​(ω,x)=sup{R^n​(ω,t):t∈Λ, t≥x}.

This is a real supremum, with the convention that it equals 000 if the index set is empty or the values are unbounded above.

Let

Sn(ω)={x∈Λ:R^n+(ω,x)≤α}.S_n(\omega)=\{x\in\Lambda:\hat R_n^+(\omega,x)\le\alpha\}.Sn​(ω)={x∈Λ:R^n+​(ω,x)≤α}.

Then

λ^n+(ω)={inf⁡Sn(ω)if Sn(ω)≠∅,λmax⁡otherwise.\hat\lambda^+_n(\omega)=\begin{cases}\inf S_n(\omega)&\text{if }S_n(\omega)\neq\emptyset,\\ \lambda_{\max}&\text{otherwise.}\end{cases}λ^n+​(ω)={infSn​(ω)λmax​​if Sn​(ω)=∅,otherwise.​

The threshold is α\alphaα itself; there is no B/(n+1)B/(n+1)B/(n+1) correction. No measurability of ω↦λ^n+(ω)\omega\mapsto\hat\lambda_n^+(\omega)ω↦λ^n+​(ω) is assumed or asserted.

The expectation used. For a function X:Ω→RX:\Omega\to\mathbb RX:Ω→R, set

EB[X]:=B−∫Ω(B−X(ω))+ dP(ω)∈[−∞,B].\mathbb E^{B}[X]:=B-\int_\Omega (B-X(\omega))^+\,dP(\omega)\in[-\infty,B].EB[X]:=B−∫Ω​(B−X(ω))+dP(ω)∈[−∞,B].

Here the integral is a lower Lebesgue integral in [0,∞][0,\infty][0,∞], defined even for non-measurable XXX. When X≤BX\le BX≤B almost surely and XXX is measurable, this equals the ordinary expectation E[X]\mathbb E[X]E[X], which may be −∞-\infty−∞.

Conclusion. In the extended reals,

lim sup⁡n→∞ EB ⁣[ Ln(ω,λ^n+(ω))] ≤ α.\limsup_{n\to\infty}\ \mathbb E^{B}\!\left[\,L_n\big(\omega,\hat\lambda^+_n(\omega)\big)\right]\ \le\ \alpha .n→∞limsup​ EB[Ln​(ω,λ^n+​(ω))] ≤ α.

That is, the expected test loss at the monotonized parameter built from the first nnn samples has limit superior at most α\alphaα as n→∞n\to\inftyn→∞. Nothing is claimed for any individual finite nnn, including the degenerate case n=0n=0n=0.

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

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 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