Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 8, p. 13 — for λ < 0, T_λ(x) = {z : E[ℓ(Y; z) | X = x] ≥ −λ} has E|T_λ(X)| ≤ E|T′(X)| whenever R(T′) ≤ R(T_λ)

Proved
RiskControl.Optimal.theorem_8

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

distribution-freeoptimalityp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1prediction-setsrisk-control

Theorem 8 (Optimality of set predictors, generalized form). Let (X,Y)(X, Y)(X,Y) have law PPP on X×Y\mathcal X \times \mathcal YX×Y, with marginal PXP_XPX​ and a regular conditional distribution κ(x)\kappa(x)κ(x) of YYY given X=xX = xX=x. Let μ\muμ be a finite measure on a measurable space Z\mathcal ZZ and ℓ:Y×Z→[0,∞)\ell : \mathcal Y \times \mathcal Z \to [0, \infty)ℓ:Y×Z→[0,∞) measurable; ℓ(y,z)\ell(y, z)ℓ(y,z) is the cost of not including zzz in the prediction set when the true response is yyy. The loss of a set S⊆Z\mathcal S \subseteq \mathcal ZS⊆Z is

L(y;S)=∫z∈Scℓ(y,z) dμ(z),L(y; \mathcal S) = \int_{z \in \mathcal S^c} \ell(y, z)\, d\mu(z),L(y;S)=∫z∈Sc​ℓ(y,z)dμ(z),

and the risk of a set-valued predictor T:X→2Z\mathcal T : \mathcal X \to 2^{\mathcal Z}T:X→2Z is R(T)=E[L(Y;T(X))]R(\mathcal T) = \mathbb E[L(Y; \mathcal T(X))]R(T)=E[L(Y;T(X))]. For λ<0\lambda < 0λ<0 let

Tλ(x)={z:E[ℓ(Y;z)∣X=x]≥−λ}.(11)\mathcal T_\lambda(x) = \{z : \mathbb E[\ell(Y; z) \mid X = x] \ge -\lambda\}. \tag{11}Tλ​(x)={z:E[ℓ(Y;z)∣X=x]≥−λ}.(11)

If T′\mathcal T'T′ is any set-valued predictor (with measurable graph) such that R(T′)≤R(Tλ)R(\mathcal T') \le R(\mathcal T_\lambda)R(T′)≤R(Tλ​), then

E[∣Tλ(X)∣]≤E[∣T′(X)∣],\mathbb E\big[|\mathcal T_\lambda(X)|\big] \le \mathbb E\big[|\mathcal T'(X)|\big],E[∣Tλ​(X)∣]≤E[∣T′(X)∣],

where ∣S∣=μ(S)|\mathcal S| = \mu(\mathcal S)∣S∣=μ(S).

The threshold sets (11) are thus the smallest on average among all set-valued predictors that are at least as accurate, for every loss of this integral form; Theorem 7 of the paper is the special case of a weighted miscoverage loss on a discrete label space.

Formalization Note The paper states the theorem for λ∈Λ⊂(−∞,0]\lambda \in \Lambda \subset (-\infty, 0]λ∈Λ⊂(−∞,0]; it is false at λ=0\lambda = 0λ=0 (take ℓ≡0\ell \equiv 0ℓ≡0 and μ(Z)>0\mu(\mathcal Z) > 0μ(Z)>0: then T0(x)=Z\mathcal T_0(x) = \mathcal ZT0​(x)=Z and T′≡∅\mathcal T' \equiv \emptysetT′≡∅ both have risk 000, but E∣T′(X)∣=0<μ(Z)=E∣T0(X)∣\mathbb E|\mathcal T'(X)| = 0 < \mu(\mathcal Z) = \mathbb E|\mathcal T_0(X)|E∣T′(X)∣=0<μ(Z)=E∣T0​(X)∣), and its proof divides by −λ-\lambda−λ; the statement is posed for λ<0\lambda < 0λ<0. The set size ∣⋅∣|\cdot|∣⋅∣ is the measure μ\muμ of the loss, as the proof (p. 27) uses; p. 13 describes ∣⋅∣|\cdot|∣⋅∣ as Lebesgue or counting measure in the context of Theorem 7. The conditional expectation E[ℓ(Y;z)∣X=x]\mathbb E[\ell(Y; z) \mid X = x]E[ℓ(Y;z)∣X=x] is ∫ℓ(y,z) dκ(x)(y)\int \ell(y, z)\, d\kappa(x)(y)∫ℓ(y,z)dκ(x)(y) for a Markov kernel κ\kappaκ with P=PX⊗κP = P_X \otimes \kappaP=PX​⊗κ; such a kernel exists, for instance, whenever Y\mathcal YY is standard Borel. The predictor T′\mathcal T'T′ is required to have a measurable graph {(x,z):z∈T′(x)}\{(x, z) : z \in \mathcal T'(x)\}{(x,z):z∈T′(x)}, so that its risk and expected size are integrals of measurable functions; the page leaves this implicit. All integrals are lower Lebesgue integrals in [0,∞][0, \infty][0,∞], so no integrability assumption is made.

Preamble
import Mathlib
import Definitions.Def_RiskControl_Optimal_Setting

open MeasureTheory ProbabilityTheory
open scoped ENNReal NNReal
Formal statement
namespace RiskControl.Optimal

/-- Theorem 8 (Optimality of set predictors, generalized form), arXiv:2101.02703v3, p. 13, proof
p. 27. Let the loss be `L(y; 𝒮) = ∫_{z ∈ 𝒮ᶜ} ℓ(y, z) dμ(z)` for a nonnegative measurable `ℓ` and a
finite measure `μ`, let `κ` be a regular conditional distribution of `Y` given `X`
(`P.fst ⊗ₘ κ = P`), let `λ < 0` (the page allows `λ ≤ 0`; the claim fails at `λ = 0`), and let
`𝒯_λ(x) = {z : 𝔼[ℓ(Y; z) | X = x] ≥ −λ}` be (11). For every set-valued predictor `𝒯′` with a
measurable graph and `R(𝒯′) ≤ R(𝒯_λ)`, `𝔼[|𝒯_λ(X)|] ≤ 𝔼[|𝒯′(X)|]`, sizes measured by `μ`. -/
theorem theorem_8 {𝒳 𝒴 𝒵 : Type*} [MeasurableSpace 𝒳] [MeasurableSpace 𝒴]
    [MeasurableSpace 𝒵]
    (P : Measure (𝒳 × 𝒴)) [IsProbabilityMeasure P]
    (μ : Measure 𝒵) [IsFiniteMeasure μ]
    (ℓ : 𝒴 → 𝒵 → ℝ≥0) (hℓ : Measurable (Function.uncurry ℓ))
    (κ : Kernel 𝒳 𝒴) [IsMarkovKernel κ] (hκ : P.fst ⊗ₘ κ = P)
    (lam : ℝ) (hlam : lam < 0)
    (T' : 𝒳 → Set 𝒵) (hT' : MeasurableSet {q : 𝒳 × 𝒵 | q.2 ∈ T' q.1})
    (hR : risk P μ ℓ T' ≤ risk P μ ℓ (thresholdSet κ ℓ lam)) :
    expSize P μ (thresholdSet κ ℓ lam) ≤ expSize P μ T' := by sorry

end RiskControl.Optimal
Source
Bates, Angelopoulos, Lei, Malik & Jordan, arXiv:2101.02703v3, Theorem 8, p. 13 (setting of §4.3 and (11), p. 13; risk R(𝒯), §2.1, p. 4); proof p. 27
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