Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1, p. 5 — UCB calibration: with probability ≥ 1 − δ the selected λ̂ has R(λ̂) ≤ α

Proved
RiskControl.UCB.theorem_1

by mikedeng1 · Oct 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

distribution-freep2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1prediction-setsrisk-controlupper-confidence-bound

Theorem 1 (Validity of UCB calibration). Let PPP be a probability distribution on X×Y\mathcal X \times \mathcal YX×Y and let D=((X1,Y1),…,(Xn,Yn))D = ((X_1, Y_1), \dots, (X_n, Y_n))D=((X1​,Y1​),…,(Xn​,Yn​)) be an i.i.d. sample from PPP. Let Λ⊆R∪{±∞}\Lambda \subseteq \mathbb R \cup \{\pm\infty\}Λ⊆R∪{±∞} be closed and let {Tλ}\{\mathcal T_\lambda\}{Tλ​}, Tλ:X→2Z\mathcal T_\lambda : \mathcal X \to 2^{\mathcal Z}Tλ​:X→2Z, be nested on Λ\LambdaΛ:

λ1<λ2  ⟹  Tλ1(x)⊆Tλ2(x).(1)\lambda_1 < \lambda_2 \implies \mathcal T_{\lambda_1}(x) \subseteq \mathcal T_{\lambda_2}(x). \tag{1}λ1​<λ2​⟹Tλ1​​(x)⊆Tλ2​​(x).(1)

Let L(y,S)≥0L(y, S) \ge 0L(y,S)≥0 be a loss with

S⊆S′  ⟹  L(y,S)≥L(y,S′),(2)S \subseteq S' \implies L(y, S) \ge L(y, S'), \tag{2}S⊆S′⟹L(y,S)≥L(y,S′),(2)

such that L(Y,Tλ(X))L(Y, \mathcal T_\lambda(X))L(Y,Tλ​(X)) is integrable for each λ∈Λ\lambda \in \Lambdaλ∈Λ, and write R(λ)=E[L(Y,Tλ(X))]R(\lambda) = \mathbb E[L(Y, \mathcal T_\lambda(X))]R(λ)=E[L(Y,Tλ​(X))]. Assume that R(λmax⁡)=0R(\lambda_{\max}) = 0R(λmax​)=0 for some λmax⁡∈Λ\lambda_{\max} \in \Lambdaλmax​∈Λ and that RRR is continuous on Λ\LambdaΛ. Let R^+(λ)=R^+(D,λ)\widehat R^+(\lambda) = \widehat R^+(D, \lambda)R+(λ)=R+(D,λ) be a function of the sample satisfying, for every λ∈Λ\lambda \in \Lambdaλ∈Λ,

Pn(R(λ)≤R^+(λ))≥1−δ,(3)P^n\big(R(\lambda) \le \widehat R^+(\lambda)\big) \ge 1 - \delta, \tag{3}Pn(R(λ)≤R+(λ))≥1−δ,(3)

and let λ^=inf⁡{λ∈Λ:R^+(λ′)<α ∀λ′∈Λ, λ′≥λ}\hat\lambda = \inf\{\lambda \in \Lambda : \widehat R^+(\lambda') < \alpha \ \forall \lambda' \in \Lambda,\ \lambda' \ge \lambda\}λ^=inf{λ∈Λ:R+(λ′)<α ∀λ′∈Λ, λ′≥λ} as in (4). Then

Pn(R(Tλ^)≤α)≥1−δ,P^n\big(R(\mathcal T_{\hat\lambda}) \le \alpha\big) \ge 1 - \delta,Pn(R(Tλ^​)≤α)≥1−δ,

that is, Tλ^\mathcal T_{\hat\lambda}Tλ^​ is an (α,δ)(\alpha, \delta)(α,δ)-risk-controlling prediction set.

This is the paper's main guarantee: a confidence bound that holds for each fixed λ\lambdaλ separately suffices for the data-dependent choice λ^\hat\lambdaλ^, with no uniform convergence, because the risk is monotone in λ\lambdaλ.

Formalization Note The conclusion is written as a failure bound: the PnP^nPn-outer measure of the event "the set in (4) is nonempty and R(λ^)>αR(\hat\lambda) > \alphaR(λ^)>α" is at most δ\deltaδ; for a measurable event this is the page's statement, and no measurability of R^+\widehat R^+R+ or λ^\hat\lambdaλ^ is assumed. When the set in (4) is empty, the page's λ^=inf⁡∅=+∞\hat\lambda = \inf\emptyset = +\inftyλ^=inf∅=+∞ need not lie in Λ\LambdaΛ and R(Tλ^)R(\mathcal T_{\hat\lambda})R(Tλ^​) is undefined; that event is excluded (the safe output there is Tλmax⁡\mathcal T_{\lambda_{\max}}Tλmax​​, of risk 000). The space of predictions is 2Z2^{\mathcal Z}2Z; Λ\LambdaΛ is a closed subset of the extended reals and RRR is continuous in its subspace topology. The integrability of the loss, the nonnegativity of LLL, the closedness of Λ\LambdaΛ and the point λmax⁡\lambda_{\max}λmax​ are the standing assumptions of §2.1 (p. 4). The i.i.d. sample is the product measure PnP^nPn. The monotonicity of RRR is not assumed; it follows from (1) and (2). No range is placed on α\alphaα or δ\deltaδ, as on the page.

Preamble
import Mathlib
import Definitions.Def_RiskControl_UCB_Setting

open MeasureTheory
Formal statement
namespace RiskControl.UCB

/-- Theorem 1 (Validity of UCB calibration), arXiv:2101.02703v3, p. 5, in the setting of §2.1:
an i.i.d. calibration sample `D = ((X₁, Y₁), …, (Xₙ, Yₙ))` from `P`, a closed `Λ ⊆ ℝ ∪ {±∞}`,
nested set predictors (1), a nonnegative loss with (2), integrable losses, some `λ_max ∈ Λ`
with `R(λ_max) = 0`, a continuous risk, and a pointwise UCB (3). Then
`P(R(𝒯_λ̂) > α) ≤ δ` on the event that the calibration set of (4) is nonempty. -/
theorem theorem_1 {𝒳 𝒴 𝒵 : Type*} [MeasurableSpace 𝒳] [MeasurableSpace 𝒴]
    (P : Measure (𝒳 × 𝒴)) [IsProbabilityMeasure P] (n : ℕ)
    (Λ : Set EReal) (hΛ : IsClosed Λ)
    (T : EReal → 𝒳 → Set 𝒵)
    (hnest : ∀ l₁ ∈ Λ, ∀ l₂ ∈ Λ, l₁ < l₂ → ∀ x, T l₁ x ⊆ T l₂ x)
    (L : 𝒴 → Set 𝒵 → ℝ) (hL0 : ∀ y S, 0 ≤ L y S)
    (hLmono : ∀ y S S', S ⊆ S' → L y S' ≤ L y S)
    (hint : ∀ l ∈ Λ, Integrable (fun p : 𝒳 × 𝒴 => L p.2 (T l p.1)) P)
    (hmax : ∃ lmax ∈ Λ, risk P L T lmax = 0)
    (hcont : ContinuousOn (risk P L T) Λ)
    (Rhat : (Fin n → 𝒳 × 𝒴) → EReal → ℝ) (α δ : ℝ)
    (hucb : ∀ l ∈ Λ,
      (Measure.pi fun _ : Fin n => P) {D | Rhat D l < risk P L T l} ≤ ENNReal.ofReal δ) :
    (Measure.pi fun _ : Fin n => P)
        {D | (calSet Λ (Rhat D) α).Nonempty ∧ α < risk P L T (lambdaHat Λ (Rhat D) α)}
      ≤ ENNReal.ofReal δ := by sorry

end RiskControl.UCB
Source
Bates, Angelopoulos, Lei, Malik & Jordan, arXiv:2101.02703v3, Theorem 1, p. 5, in the setting of §2.1–2.2, p. 4, (1)–(4); proof p. 26 (via Theorem A.1)
Human review
  • Endorsed by Shuze Chen · Oct 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 8, 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