Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Convexified Neyman-Pearson classification: surrogates, errors, NP classifier, chance constrained programs

Definition
NeymanPearsonClassification_Basic

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

binary-classificationchance-constrained-optimizationconvex-surrogateempirical-processesneyman-pearson

Objects of Rigollet and Tong (2011), Sections 2-6.

  1. Convex surrogate (Definition 2.1). A function φ:[−1,1]→R+\varphi:[-1,1]\to\mathbb{R}_+φ:[−1,1]→R+​ that is non-decreasing, continuous and convex with φ(0)=1\varphi(0)=1φ(0)=1.
  2. Base classifiers and their convex hull (Section 2.1). Measurable functions h1,…,hM:X→[−1,1]h_1,\dots,h_M:\mathcal X\to[-1,1]h1​,…,hM​:X→[−1,1]. For λ\lambdaλ in the flat simplex Λ={λ∈RM:λj≥0, ∑jλj=1}\Lambda=\{\lambda\in\mathbb{R}^M:\lambda_j\ge0,\ \sum_j\lambda_j=1\}Λ={λ∈RM:λj​≥0, ∑j​λj​=1}, hλ=∑jλjhj\mathsf h_\lambda=\sum_j\lambda_jh_jhλ​=∑j​λj​hj​, and Hconv={hλ:λ∈Λ}\mathcal H^{\mathrm{conv}}=\{\mathsf h_\lambda:\lambda\in\Lambda\}Hconv={hλ​:λ∈Λ}.
  3. Errors (Section 2.2). Let P−P^-P− and P+P^+P+ be the laws of XXX given Y=−1Y=-1Y=−1 and Y=1Y=1Y=1. The type I error is R−(h)=P−(h(X)≥0)R^-(h)=P^-(h(X)\ge0)R−(h)=P−(h(X)≥0) and the type II error is R+(h)=P+(h(X)≤0)R^+(h)=P^+(h(X)\le0)R+(h)=P+(h(X)≤0). The φ\varphiφ-type I and II errors are Rφ−(h)=∫φ(h) dP−R^-_\varphi(h)=\int\varphi(h)\,dP^-Rφ−​(h)=∫φ(h)dP− and Rφ+(h)=∫φ(−h) dP+R^+_\varphi(h)=\int\varphi(-h)\,dP^+Rφ+​(h)=∫φ(−h)dP+.
  4. Empirical errors (Sections 3.1-3.2). For a sample X1−,…,Xn−−X^-_1,\dots,X^-_{n^-}X1−​,…,Xn−−​ the empirical type I error is R^−(h)=1n−∑i1(h(Xi−)≥0)\hat R^-(h)=\frac1{n^-}\sum_i\mathbf 1(h(X^-_i)\ge0)R^−(h)=n−1​∑i​1(h(Xi−​)≥0). The empirical φ\varphiφ-errors are R^φ−(h)=1n−∑iφ(h(Xi−))\hat R^-_\varphi(h)=\frac1{n^-}\sum_i\varphi(h(X^-_i))R^φ−​(h)=n−1​∑i​φ(h(Xi−​)) and R^φ+(h)=1n+∑iφ(−h(Xi+))\hat R^+_\varphi(h)=\frac1{n^+}\sum_i\varphi(-h(X^+_i))R^φ+​(h)=n+1​∑i​φ(−h(Xi+​)).
  5. Constraint sets. Hφ,a={h∈Hconv:Rφ−(h)≤a}\mathcal H^{\varphi,a}=\{h\in\mathcal H^{\mathrm{conv}}:R^-_\varphi(h)\le a\}Hφ,a={h∈Hconv:Rφ−​(h)≤a} and Hn−φ,a={h∈Hconv:R^φ−(h)≤a}\mathcal H^{\varphi,a}_{n^-}=\{h\in\mathcal H^{\mathrm{conv}}:\hat R^-_\varphi(h)\le a\}Hn−φ,a​={h∈Hconv:R^φ−​(h)≤a}. The optimal value is γ(a)=inf⁡h∈Hφ,aRφ+(h)\gamma(a)=\inf_{h\in\mathcal H^{\varphi,a}}R^+_\varphi(h)γ(a)=infh∈Hφ,a​Rφ+​(h), written min⁡h∈Hφ,aRφ+(h)\min_{h\in\mathcal H^{\varphi,a}}R^+_\varphi(h)minh∈Hφ,a​Rφ+​(h) in the paper.
  6. Convexified NP classifier (eq. 3.4). h~τ\tilde h^\tauh~τ is any solution of min⁡{R^φ+(h):h∈Hconv, R^φ−(h)≤α−τ/n−}\min\{\hat R^+_\varphi(h):h\in\mathcal H^{\mathrm{conv}},\ \hat R^-_\varphi(h)\le\alpha-\tau/\sqrt{n^-}\}min{R^φ+​(h):h∈Hconv, R^φ−​(h)≤α−τ/n−​}.
  7. Constants (Section 4). κ=42 Llog⁡(2M/δ)\kappa=4\sqrt2\,L\sqrt{\log(2M/\delta)}κ=42​Llog(2M/δ)​. εˉ\bar\varepsilonεˉ is the smallest ε\varepsilonε with Hφ,εα≠∅\mathcal H^{\varphi,\varepsilon\alpha}\ne\emptysetHφ,εα=∅, and n0=⌈(4κ/((1−εˉ)α))2⌉n_0=\lceil(4\kappa/((1-\bar\varepsilon)\alpha))^2\rceiln0​=⌈(4κ/((1−εˉ)α))2⌉ (eq. 4.3).
  8. Label split (Section 4.3). For labels Y1,…,YnY_1,\dots,Y_nY1​,…,Yn​, the index sets {i:Yi=−1}\{i:Y_i=-1\}{i:Yi​=−1} and {i:Yi=1}\{i:Y_i=1\}{i:Yi​=1} have sizes N−N^-N− and N+N^+N+.
  9. Binomial tail (Section 6.6). P(N≥t)=∑t≤j≤n(nj)qj(1−q)n−jP(N\ge t)=\sum_{t\le j\le n}\binom nj q^j(1-q)^{n-j}P(N≥t)=∑t≤j≤n​(jn​)qj(1−q)n−j for N∼Bin(n,q)N\sim\mathrm{Bin}(n,q)N∼Bin(n,q).
  10. Chance constrained programs (Section 5). With F(λ,ξ)=∑jλjgj(ξ)F(\lambda,\xi)=\sum_j\lambda_jg_j(\xi)F(λ,ξ)=∑j​λj​gj​(ξ) and gj:Ξ→[−1,1]g_j:\Xi\to[-1,1]gj​:Ξ→[−1,1]: λ\lambdaλ is feasible for (5.1) if λ∈Λ\lambda\in\Lambdaλ∈Λ and P{F(λ,ξ)≤0}≥1−αP\{F(\lambda,\xi)\le0\}\ge1-\alphaP{F(λ,ξ)≤0}≥1−α. λ~\tilde\lambdaλ~ solves min⁡λ∈Λf(λ)\min_{\lambda\in\Lambda}f(\lambda)minλ∈Λ​f(λ) subject to ∑i=1nφ(F(λ,ξi))≤nα−κn\sum_{i=1}^n\varphi(F(\lambda,\xi_i))\le n\alpha-\kappa\sqrt n∑i=1n​φ(F(λ,ξi​))≤nα−κn​. fφ∗=inf⁡{f(λ):λ∈Λ, Eφ(F(λ,ξ))≤α}f^*_\varphi=\inf\{f(\lambda):\lambda\in\Lambda,\ E\varphi(F(\lambda,\xi))\le\alpha\}fφ∗​=inf{f(λ):λ∈Λ, Eφ(F(λ,ξ))≤α} is the optimal value of (5.7).

Formalization Note The covariate space X⊂Rd\mathcal X\subset\mathbb{R}^dX⊂Rd is taken to be Rd\mathbb{R}^dRd (EuclideanSpace ℝ (Fin d)). Classifiers on a measurable X\mathcal XX extend by 000, and laws on X\mathcal XX are laws on Rd\mathbb{R}^dRd carried by X\mathcal XX. A surrogate is a function R→R\mathbb{R}\to\mathbb{R}R→R whose properties are required only on [−1,1][-1,1][−1,1], the only arguments ever used. Infima are real infima (inf⁡∅=0\inf\emptyset=0inf∅=0 in Lean). Every statement that uses γ(a)\gamma(a)γ(a), εˉ\bar\varepsilonεˉ or fφ∗f^*_\varphifφ∗​ assumes or proves that the set involved is nonempty. An empirical average over an empty sample is 000 in Lean. Theorems 4.1 and 4.2 assume nonempty samples; Corollary 4.1 guards the empty case explicitly in part 1, while part 2 includes it, where it is covered by the stated failure probability.

Definition code
import Mathlib

/-!
Rigollet and Tong, *Neyman-Pearson classification, convexity and stochastic constraints*,
arXiv:1102.5750v1 (2011): convex surrogates (Definition 2.1), the convex hull of base classifiers
(Section 2.1), type I/II errors and their convexified versions (Section 2.2), empirical errors and
the convexified NP classifier (Sections 3.1-3.2, eq. (3.4)), the constants of Section 4
(`κ`, `ε̄`, `n₀` of eq. (4.3)), the label-split samples of Section 4.3, the binomial tails of
Section 6.6 and the chance constrained programs (5.1), (5.7) of Section 5.
-/

open MeasureTheory

noncomputable section

namespace NeymanPearsonClassification

/-- Definition 2.1 (p. 2): `φ : [-1,1] → ℝ₊` is a convex surrogate if it is non-negative,
non-decreasing, continuous and convex on `[-1,1]` and `φ(0) = 1`. Values of `φ` outside
`[-1,1]` are never used. -/
def IsConvexSurrogate (φ : ℝ → ℝ) : Prop :=
  (∀ x ∈ Set.Icc (-1 : ℝ) 1, 0 ≤ φ x) ∧ MonotoneOn φ (Set.Icc (-1) 1) ∧
    ContinuousOn φ (Set.Icc (-1) 1) ∧ ConvexOn ℝ (Set.Icc (-1) 1) φ ∧ φ 0 = 1

/-- Section 2.1 (p. 3): base classifiers `h₁, …, h_M : 𝒳 → [-1,1]` (measurable, the standing
convention). The same structure serves the functions `g_j : Ξ → [-1,1]` of Section 5 (p. 11). -/
def IsBaseFamily {X : Type*} [MeasurableSpace X] {M : ℕ} (h : Fin M → X → ℝ) : Prop :=
  ∀ j, Measurable (h j) ∧ ∀ x, h j x ∈ Set.Icc (-1 : ℝ) 1

/-- Section 2.1 (p. 3): the convex combination `h_λ = ∑_j λ_j h_j`; in Section 5 (p. 11) this is
`F(λ, ξ) = ∑_j λ_j g_j(ξ)`. -/
def convComb {X : Type*} {M : ℕ} (h : Fin M → X → ℝ) (lam : Fin M → ℝ) : X → ℝ :=
  fun x => ∑ j, lam j * h j x

/-- Section 2.1 (p. 3): `H^conv = {h_λ : λ ∈ Λ}`, with `Λ` the flat simplex of `ℝ^M`. -/
def HConv {X : Type*} {M : ℕ} (h : Fin M → X → ℝ) : Set (X → ℝ) :=
  convComb h '' stdSimplex ℝ (Fin M)

/-- Section 2.2 (p. 3): type I error `R⁻(h) = P⁻(h(X) ≥ 0)`, `P⁻` the law of `X` given `Y = -1`. -/
def typeI {X : Type*} [MeasurableSpace X] (Pm : Measure X) (f : X → ℝ) : ℝ :=
  (Pm {x | 0 ≤ f x}).toReal

/-- Section 2.2 (p. 3): type II error `R⁺(h) = P⁺(h(X) ≤ 0)`, `P⁺` the law of `X` given `Y = 1`. -/
def typeII {X : Type*} [MeasurableSpace X] (Pp : Measure X) (f : X → ℝ) : ℝ :=
  (Pp {x | f x ≤ 0}).toReal

/-- Section 2.2 (p. 4): `φ`-type I error `R⁻_φ(h) = E[φ(-Y h(X)) | Y = -1] = ∫ φ(h) dP⁻`. -/
def phiTypeI {X : Type*} [MeasurableSpace X] (Pm : Measure X) (φ : ℝ → ℝ) (f : X → ℝ) : ℝ :=
  ∫ x, φ (f x) ∂Pm

/-- Section 2.2 (p. 4): `φ`-type II error `R⁺_φ(h) = E[φ(-Y h(X)) | Y = 1] = ∫ φ(-h) dP⁺`. -/
def phiTypeII {X : Type*} [MeasurableSpace X] (Pp : Measure X) (φ : ℝ → ℝ) (f : X → ℝ) : ℝ :=
  ∫ x, φ (-f x) ∂Pp

open Classical in
/-- Section 3.1 (p. 5): empirical type I error `R̂⁻(h) = (1/n⁻) ∑_i 1(h(X⁻_i) ≥ 0)` of the
sample points `x i`, `i ∈ s`. -/
def empTypeI {ι X : Type*} (s : Finset ι) (x : ι → X) (f : X → ℝ) : ℝ :=
  ((s.filter fun i => 0 ≤ f (x i)).card : ℝ) / s.card

/-- Section 3.2 (p. 7): empirical `φ`-type I error `R̂⁻_φ(h) = (1/n⁻) ∑_i φ(h(X⁻_i))` of the sample
points `x i`, `i ∈ s`. -/
def empPhiTypeI {ι X : Type*} (φ : ℝ → ℝ) (s : Finset ι) (x : ι → X) (f : X → ℝ) : ℝ :=
  (∑ i ∈ s, φ (f (x i))) / s.card

/-- Section 3.2 (p. 7): empirical `φ`-type II error `R̂⁺_φ(h) = (1/n⁺) ∑_i φ(-h(X⁺_i))` of the
sample points `x i`, `i ∈ s`. -/
def empPhiTypeII {ι X : Type*} (φ : ℝ → ℝ) (s : Finset ι) (x : ι → X) (f : X → ℝ) : ℝ :=
  (∑ i ∈ s, φ (-f (x i))) / s.card

/-- Section 3.2 (p. 7): `H^{φ,a} = {h ∈ H^conv : R⁻_φ(h) ≤ a}`. -/
def Hphi {X : Type*} [MeasurableSpace X] {M : ℕ} (h : Fin M → X → ℝ) (Pm : Measure X)
    (φ : ℝ → ℝ) (a : ℝ) : Set (X → ℝ) :=
  {f | f ∈ HConv h ∧ phiTypeI Pm φ f ≤ a}

/-- Section 3.2 (p. 7): `H^{φ,a}_{n⁻} = {h ∈ H^conv : R̂⁻_φ(h) ≤ a}`. -/
def HphiEmp {ι X : Type*} {M : ℕ} (h : Fin M → X → ℝ) (φ : ℝ → ℝ) (s : Finset ι) (x : ι → X)
    (a : ℝ) : Set (X → ℝ) :=
  {f | f ∈ HConv h ∧ empPhiTypeI φ s x f ≤ a}

/-- Section 4.2 (p. 8) and Lemma 6.2 (p. 16): `γ(a) = inf_{h ∈ H^{φ,a}} R⁺_φ(h)`, written
`min_{h ∈ H^{φ,a}} R⁺_φ(h)` in the paper. Statements use it only where `H^{φ,a} ≠ ∅`. -/
def minPhiTypeII {X : Type*} [MeasurableSpace X] {M : ℕ} (h : Fin M → X → ℝ)
    (Pm Pp : Measure X) (φ : ℝ → ℝ) (a : ℝ) : ℝ :=
  sInf (phiTypeII Pp φ '' Hphi h Pm φ a)

/-- Eq. (3.4) (p. 7): `f` is a convexified NP classifier `h̃^τ`, i.e. a solution of
`min { R̂⁺_φ(h) : h ∈ H^conv, R̂⁻_φ(h) ≤ α - τ/√n⁻ }`, where the class `-1` sample is
`(xm i)_{i ∈ sm}` (`n⁻ = |sm|`) and the class `+1` sample is `(xp i)_{i ∈ sp}`. -/
def IsNPClassifier {ι ι' X : Type*} {M : ℕ} (h : Fin M → X → ℝ) (φ : ℝ → ℝ) (α τ : ℝ)
    (sm : Finset ι) (xm : ι → X) (sp : Finset ι') (xp : ι' → X) (f : X → ℝ) : Prop :=
  f ∈ HphiEmp h φ sm xm (α - τ / Real.sqrt sm.card) ∧
    ∀ g ∈ HphiEmp h φ sm xm (α - τ / Real.sqrt sm.card),
      empPhiTypeII φ sp xp f ≤ empPhiTypeII φ sp xp g

/-- Theorem 4.1 (p. 8) and Theorem 5.1 (p. 12): `κ = 4√2 L √(log(2M/δ))`. -/
def kappa (L : ℝ) (M : ℕ) (δ : ℝ) : ℝ :=
  4 * Real.sqrt 2 * L * Real.sqrt (Real.log (2 * M / δ))

/-- Section 4.2 (p. 9): `ε̄`, the smallest `ε` such that `H^{φ, εα} ≠ ∅` (defined under
Assumption 1). -/
def epsBar {X : Type*} [MeasurableSpace X] {M : ℕ} (h : Fin M → X → ℝ) (Pm : Measure X)
    (φ : ℝ → ℝ) (α : ℝ) : ℝ :=
  sInf {ε : ℝ | (Hphi h Pm φ (ε * α)).Nonempty}

/-- Eq. (4.3) (p. 9): `n₀`, the smallest integer with `n₀ ≥ (4κ / ((1 - ε̄)α))²`. -/
def nZero (κ εbar α : ℝ) : ℕ :=
  ⌈(4 * κ / ((1 - εbar) * α)) ^ 2⌉₊

open Classical in
/-- Section 4.3 (p. 10): the indices `i` with label `Y_i = c`; for `c = -1` its cardinality is
`N⁻ = card{Y_i : Y_i = -1}`, for `c = 1` it is `N⁺`. -/
def labelIdx {n : ℕ} (y : Fin n → ℝ) (c : ℝ) : Finset (Fin n) :=
  Finset.univ.filter fun i => y i = c

open Classical in
/-- Section 6.6 (pp. 19-20): `P(N ≥ t)` for `N` binomial with parameters `n` and `q`,
`∑_{j ≤ n, j ≥ t} C(n,j) q^j (1-q)^(n-j)`. -/
def binomTail (n : ℕ) (q t : ℝ) : ℝ :=
  ∑ j ∈ (Finset.range (n + 1)).filter (fun j : ℕ => t ≤ (j : ℝ)),
    (n.choose j : ℝ) * q ^ j * (1 - q) ^ (n - j)

/-- Eq. (5.1) (p. 11): `λ` is feasible for the chance constrained program, i.e. `λ ∈ Λ` and
`P{F(λ, ξ) ≤ 0} ≥ 1 - α`, with `F(λ, ξ) = ∑_j λ_j g_j(ξ)` and `ξ ∼ Pxi`. -/
def IsChanceFeasible {Xi : Type*} [MeasurableSpace Xi] {M : ℕ} (g : Fin M → Xi → ℝ)
    (Pxi : Measure Xi) (α : ℝ) (lam : Fin M → ℝ) : Prop :=
  lam ∈ stdSimplex ℝ (Fin M) ∧ ENNReal.ofReal (1 - α) ≤ Pxi {x | convComb g lam x ≤ 0}

/-- Section 5 (p. 12): `λ̃` solves the sampled convexified program
`min_{λ ∈ Λ} f(λ)` s.t. `∑_{i=1}^n φ(F(λ, ξ_i)) ≤ nα - κ√n`. -/
def IsScenarioSolution {Xi : Type*} {M n : ℕ} (g : Fin M → Xi → ℝ) (φ : ℝ → ℝ)
    (f : (Fin M → ℝ) → ℝ) (α κ : ℝ) (xs : Fin n → Xi) (lam : Fin M → ℝ) : Prop :=
  lam ∈ stdSimplex ℝ (Fin M) ∧
    ∑ i, φ (convComb g lam (xs i)) ≤ n * α - κ * Real.sqrt n ∧
    ∀ l ∈ stdSimplex ℝ (Fin M), ∑ i, φ (convComb g l (xs i)) ≤ n * α - κ * Real.sqrt n →
      f lam ≤ f l

/-- Eq. (5.7) (p. 12): `f*_φ`, the optimal value of `min_{λ ∈ Λ} f(λ)` s.t.
`E[φ(F(λ, ξ))] ≤ α` (an infimum; used only where the constraint is feasible). -/
def ccpOptValue {Xi : Type*} [MeasurableSpace Xi] {M : ℕ} (g : Fin M → Xi → ℝ)
    (Pxi : Measure Xi) (φ : ℝ → ℝ) (f : (Fin M → ℝ) → ℝ) (α : ℝ) : ℝ :=
  sInf (f '' {l | l ∈ stdSimplex ℝ (Fin M) ∧ phiTypeI Pxi φ (convComb g l) ≤ α})

end NeymanPearsonClassification
Source
Rigollet and Tong, Neyman-Pearson classification, convexity and stochastic constraints, arXiv:1102.5750v1 (2011), Definition 2.1 (p. 2), Sections 2.1-2.2 (pp. 3-4), 3.1-3.2 and eq. (3.4) (pp. 5-7), 4.1-4.3 with Assumption 1 and eq. (4.3) (pp. 8-10), Section 5 eqs. (5.1), (5.7) (pp. 11-12), Section 6.6 (pp. 19-20)
Read-back

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

Convex surrogate (IsConvexSurrogate\mathrm{IsConvexSurrogate}IsConvexSurrogate). For a function φ:R→R\varphi:\mathbb{R}\to\mathbb{R}φ:R→R, "φ\varphiφ is a convex surrogate" means all five of the following hold:

  • φ(x)≥0\varphi(x)\ge 0φ(x)≥0 for every x∈[−1,1]x\in[-1,1]x∈[−1,1];
  • φ\varphiφ is non-decreasing on [−1,1][-1,1][−1,1], i.e. x≤yx\le yx≤y in [−1,1][-1,1][−1,1] implies φ(x)≤φ(y)\varphi(x)\le\varphi(y)φ(x)≤φ(y);
  • φ\varphiφ is continuous on [−1,1][-1,1][−1,1];
  • φ\varphiφ is convex on [−1,1][-1,1][−1,1];
  • φ(0)=1\varphi(0)=1φ(0)=1.

Nothing is required of φ\varphiφ outside [−1,1][-1,1][−1,1]. It may be negative, decreasing, discontinuous or non-convex there.

Base family (IsBaseFamily\mathrm{IsBaseFamily}IsBaseFamily). Let X\mathcal{X}X be a measurable space and M∈NM\in\mathbb{N}M∈N. A family h0,…,hM−1:X→Rh_0,\dots,h_{M-1}:\mathcal{X}\to\mathbb{R}h0​,…,hM−1​:X→R is a base family if, for every index jjj:

  • hjh_jhj​ is measurable, with the Borel σ\sigmaσ-algebra on R\mathbb{R}R;
  • hj(x)∈[−1,1]h_j(x)\in[-1,1]hj​(x)∈[−1,1] for all x∈Xx\in\mathcal{X}x∈X.

When M=0M=0M=0 the family is empty and the condition holds vacuously.

Linear combination (convComb\mathrm{convComb}convComb). For functions h0,…,hM−1:X→Rh_0,\dots,h_{M-1}:\mathcal{X}\to\mathbb{R}h0​,…,hM−1​:X→R and an arbitrary vector λ∈RM\lambda\in\mathbb{R}^Mλ∈RM, define

hλ(x)=∑j=0M−1λj hj(x).h_\lambda(x)=\sum_{j=0}^{M-1}\lambda_j\,h_j(x).hλ​(x)=j=0∑M−1​λj​hj​(x).

No sign or sum constraint is placed on λ\lambdaλ here. For M=0M=0M=0, hλh_\lambdahλ​ is the zero function.

Convex hull class (HConv\mathrm{HConv}HConv). Let Λ={λ∈RM:λj≥0 ∀j, ∑jλj=1}\Lambda=\{\lambda\in\mathbb{R}^M:\lambda_j\ge 0\ \forall j,\ \sum_j\lambda_j=1\}Λ={λ∈RM:λj​≥0 ∀j, ∑j​λj​=1} be the standard simplex. Define

Hconv={hλ:λ∈Λ}.H^{\mathrm{conv}}=\{h_\lambda:\lambda\in\Lambda\}.Hconv={hλ​:λ∈Λ}.

The hjh_jhj​ are not required to be a base family. For M=0M=0M=0 the simplex is empty, so Hconv=∅H^{\mathrm{conv}}=\varnothingHconv=∅.

Type I error (typeI\mathrm{typeI}typeI). For an arbitrary measure P−P^-P− on X\mathcal{X}X (not required to be a probability measure) and any f:X→Rf:\mathcal{X}\to\mathbb{R}f:X→R, define

R−(f)=P−{x:f(x)≥0},R^-(f)=P^-\{x: f(x)\ge 0\},R−(f)=P−{x:f(x)≥0},

converted to a real number. If this measure is +∞+\infty+∞, the value is 000. If fff is not measurable, the set is measured by the outer measure. Points with f(x)=0f(x)=0f(x)=0 count as errors.

Type II error (typeII\mathrm{typeII}typeII). For an arbitrary measure P+P^+P+ on X\mathcal{X}X and any fff, define

R+(f)=P+{x:f(x)≤0},R^+(f)=P^+\{x: f(x)\le 0\},R+(f)=P+{x:f(x)≤0},

as a real number, with the same conventions as above. Here too f(x)=0f(x)=0f(x)=0 counts as an error, so the boundary {f=0}\{f=0\}{f=0} is counted in both R−R^-R− and R+R^+R+.

φ\varphiφ-type I error (phiTypeI\mathrm{phiTypeI}phiTypeI). For any measure P−P^-P−, any φ:R→R\varphi:\mathbb{R}\to\mathbb{R}φ:R→R and any fff, define

Rφ−(f)=∫φ(f(x)) dP−(x).R^-_\varphi(f)=\int \varphi(f(x))\,dP^-(x).Rφ−​(f)=∫φ(f(x))dP−(x).

This is a Bochner integral: if x↦φ(f(x))x\mapsto\varphi(f(x))x↦φ(f(x)) is not integrable, the value is defined to be 000. The function φ\varphiφ is evaluated at f(x)f(x)f(x) even when f(x)∉[−1,1]f(x)\notin[-1,1]f(x)∈/[−1,1].

φ\varphiφ-type II error (phiTypeII\mathrm{phiTypeII}phiTypeII). Define

Rφ+(f)=∫φ(−f(x)) dP+(x),R^+_\varphi(f)=\int \varphi(-f(x))\,dP^+(x),Rφ+​(f)=∫φ(−f(x))dP+(x),

with the same convention that a non-integrable integrand gives the value 000.

Empirical type I error (empTypeI\mathrm{empTypeI}empTypeI). Take an index set of any type, a finite set sss of indices, sample points xi∈Xx_i\in\mathcal{X}xi​∈X and any fff. Define

R^−(f)=#{i∈s:f(xi)≥0}∣s∣.\hat R^-(f)=\frac{\#\{i\in s: f(x_i)\ge 0\}}{|s|}.R^−(f)=∣s∣#{i∈s:f(xi​)≥0}​.

If s=∅s=\varnothings=∅, the value is 0/0=00/0=00/0=0.

Empirical φ\varphiφ-type I error (empPhiTypeI\mathrm{empPhiTypeI}empPhiTypeI). Define

R^φ−(f)=1∣s∣∑i∈sφ(f(xi)).\hat R^-_\varphi(f)=\frac{1}{|s|}\sum_{i\in s}\varphi(f(x_i)).R^φ−​(f)=∣s∣1​i∈s∑​φ(f(xi​)).

The value is 000 if s=∅s=\varnothings=∅.

Empirical φ\varphiφ-type II error (empPhiTypeII\mathrm{empPhiTypeII}empPhiTypeII). Define

R^φ+(f)=1∣s∣∑i∈sφ(−f(xi)).\hat R^+_\varphi(f)=\frac{1}{|s|}\sum_{i\in s}\varphi(-f(x_i)).R^φ+​(f)=∣s∣1​i∈s∑​φ(−f(xi​)).

The value is 000 if s=∅s=\varnothings=∅.

Constrained class (Hphi\mathrm{Hphi}Hphi). For a family hhh, a measure P−P^-P−, a function φ\varphiφ and any real aaa, define

Hφ,a={f∈Hconv:Rφ−(f)≤a},H^{\varphi,a}=\{f\in H^{\mathrm{conv}}: R^-_\varphi(f)\le a\},Hφ,a={f∈Hconv:Rφ−​(f)≤a},

using the integral convention above. No assumption is made on φ\varphiφ or hhh.

Empirical constrained class (HphiEmp\mathrm{HphiEmp}HphiEmp). For a finite index set sss, sample points (xi)(x_i)(xi​) and a real aaa, define

Hsφ,a={f∈Hconv:R^φ−(f)≤a}.H^{\varphi,a}_{s}=\{f\in H^{\mathrm{conv}}:\hat R^-_\varphi(f)\le a\}.Hsφ,a​={f∈Hconv:R^φ−​(f)≤a}.

If s=∅s=\varnothings=∅, the constraint becomes 0≤a0\le a0≤a, so the class is all of HconvH^{\mathrm{conv}}Hconv when a≥0a\ge 0a≥0 and empty when a<0a<0a<0.

Optimal φ\varphiφ-type II value (minPhiTypeII\mathrm{minPhiTypeII}minPhiTypeII). For measures P−P^-P− and P+P^+P+, a function φ\varphiφ and a real aaa, define

γ(a)=inf⁡{Rφ+(f):f∈Hφ,a}.\gamma(a)=\inf\{R^+_\varphi(f): f\in H^{\varphi,a}\}.γ(a)=inf{Rφ+​(f):f∈Hφ,a}.

This is a real infimum, not necessarily attained. By convention it equals 000 if Hφ,aH^{\varphi,a}Hφ,a is empty, or if the set of values is unbounded below.

NP classifier (IsNPClassifier\mathrm{IsNPClassifier}IsNPClassifier). The inputs are:

  • a family hhh, a function φ\varphiφ and reals α,τ\alpha,\tauα,τ;
  • a "class −1-1−1" sample (xi−)i∈s−(x^-_i)_{i\in s^-}(xi−​)i∈s−​, with s−s^-s− a finite index set of any type;
  • a "class +1+1+1" sample (xi+)i∈s+(x^+_i)_{i\in s^+}(xi+​)i∈s+​, with s+s^+s+ a finite index set of a possibly different type;
  • a function f:X→Rf:\mathcal{X}\to\mathbb{R}f:X→R.

Set the threshold

c=α−τ∣s−∣.c=\alpha-\frac{\tau}{\sqrt{|s^-|}}.c=α−∣s−∣​τ​.

When s−=∅s^-=\varnothings−=∅, the convention τ/0=0\tau/0=0τ/0=0 gives c=αc=\alphac=α. Then fff is an NP classifier if both of the following hold:

  • f∈Hs−φ,cf\in H^{\varphi,c}_{s^-}f∈Hs−φ,c​, that is, f∈Hconvf\in H^{\mathrm{conv}}f∈Hconv and R^φ−(f)≤c\hat R^-_\varphi(f)\le cR^φ−​(f)≤c on the class −1-1−1 sample;
  • R^φ+(f)≤R^φ+(g)\hat R^+_\varphi(f)\le\hat R^+_\varphi(g)R^φ+​(f)≤R^φ+​(g) on the class +1+1+1 sample for every g∈Hs−φ,cg\in H^{\varphi,c}_{s^-}g∈Hs−φ,c​.

Some edge cases:

  • If s+=∅s^+=\varnothings+=∅, every empirical type II value is 000, so every feasible fff qualifies.
  • If s−=∅s^-=\varnothings−=∅, feasibility reduces to f∈Hconvf\in H^{\mathrm{conv}}f∈Hconv and 0≤α0\le\alpha0≤α.
  • No convex surrogate or base family assumption is made.

Constant κ\kappaκ (kappa\mathrm{kappa}kappa). For reals L,δL,\deltaL,δ and M∈NM\in\mathbb{N}M∈N, define

κ=42 L log⁡(2M/δ).\kappa=4\sqrt{2}\,L\,\sqrt{\log(2M/\delta)}.κ=42​Llog(2M/δ)​.

The real-number conventions produce these cases:

  • log⁡\loglog means log⁡∣⋅∣\log|\cdot|log∣⋅∣, with log⁡0=0\log 0=0log0=0.
  • ⋅\sqrt{\cdot}⋅​ of a negative number is 000.
  • 2M/δ=02M/\delta=02M/δ=0 when δ=0\delta=0δ=0.

Consequently, κ=0\kappa=0κ=0 whenever M=0M=0M=0, or δ=0\delta=0δ=0, or ∣2M/δ∣≤1|2M/\delta|\le 1∣2M/δ∣≤1. In particular this includes every δ≥2M>0\delta\ge 2M>0δ≥2M>0. The constant LLL may be any real number, including a negative one.

Constant εˉ\bar\varepsilonεˉ (epsBar\mathrm{epsBar}epsBar). For a family hhh, a measure P−P^-P−, a function φ\varphiφ and a real α\alphaα, define

εˉ=inf⁡{ε∈R:Hφ,εα≠∅}.\bar\varepsilon=\inf\{\varepsilon\in\mathbb{R}: H^{\varphi,\varepsilon\alpha}\neq\varnothing\}.εˉ=inf{ε∈R:Hφ,εα=∅}.

This is a real infimum, not necessarily attained, and it is 000 if the set is empty or unbounded below. In particular:

  • εˉ=0\bar\varepsilon=0εˉ=0 whenever α≤0\alpha\le 0α≤0.
  • εˉ=0\bar\varepsilon=0εˉ=0 whenever Hconv=∅H^{\mathrm{conv}}=\varnothingHconv=∅.

Sample-size threshold (nZero\mathrm{nZero}nZero). For arbitrary reals κ,εˉ,α\kappa,\bar\varepsilon,\alphaκ,εˉ,α, define

n0=⌈(4κ(1−εˉ)α)2⌉∈N.n_0=\left\lceil\left(\frac{4\kappa}{(1-\bar\varepsilon)\alpha}\right)^2\right\rceil\in\mathbb{N}.n0​=⌈((1−εˉ)α4κ​)2⌉∈N.

If (1−εˉ)α=0(1-\bar\varepsilon)\alpha=0(1−εˉ)α=0, division by zero yields 000, so n0=0n_0=0n0​=0. The inputs are free reals and are not tied to the definitions above.

Label index set (labelIdx\mathrm{labelIdx}labelIdx). For n∈Nn\in\mathbb{N}n∈N, real labels y0,…,yn−1y_0,\dots,y_{n-1}y0​,…,yn−1​ and any real ccc, define

{i∈{0,…,n−1}:yi=c}.\{i\in\{0,\dots,n-1\}: y_i=c\}.{i∈{0,…,n−1}:yi​=c}.

The labels are arbitrary reals; they are not restricted to ±1\pm 1±1.

Binomial tail (binomTail\mathrm{binomTail}binomTail). For n∈Nn\in\mathbb{N}n∈N and arbitrary reals q,tq,tq,t, define

∑0≤j≤nj≥t(nj)qj(1−q)n−j,\sum_{\substack{0\le j\le n\\ j\ge t}}\binom{n}{j}q^j(1-q)^{n-j},0≤j≤nj≥t​∑​(jn​)qj(1−q)n−j,

with 00=10^0=100=1. The parameter qqq is not restricted to [0,1][0,1][0,1]. The extreme cases are:

  • If t≤0t\le 0t≤0, the sum equals 111.
  • If t>nt>nt>n, the sum equals 000.

Chance-constraint feasibility (IsChanceFeasible\mathrm{IsChanceFeasible}IsChanceFeasible). Let Ξ\XiΞ be a measurable space, g0,…,gM−1:Ξ→Rg_0,\dots,g_{M-1}:\Xi\to\mathbb{R}g0​,…,gM−1​:Ξ→R be arbitrary functions, PξP_\xiPξ​ be an arbitrary measure (not necessarily a probability measure), and α\alphaα be real. A vector λ\lambdaλ is feasible if both of the following hold:

  • λ∈Λ\lambda\in\Lambdaλ∈Λ;
  • the measure of the region where the combination is non-positive satisfies
Pξ{ξ:∑jλjgj(ξ)≤0} ≥ max⁡(1−α, 0),P_\xi\Big\{\xi:\sum_j\lambda_j g_j(\xi)\le 0\Big\}\ \ge\ \max(1-\alpha,\,0),Pξ​{ξ:j∑​λj​gj​(ξ)≤0} ≥ max(1−α,0),

compared in [0,∞][0,\infty][0,∞].

When α≥1\alpha\ge 1α≥1, the second condition is automatic, so feasibility reduces to λ∈Λ\lambda\in\Lambdaλ∈Λ.

Scenario solution (IsScenarioSolution\mathrm{IsScenarioSolution}IsScenarioSolution). The inputs are:

  • functions gj:Ξ→Rg_j:\Xi\to\mathbb{R}gj​:Ξ→R and a function φ\varphiφ;
  • an arbitrary objective F0:RM→RF_0:\mathbb{R}^M\to\mathbb{R}F0​:RM→R, with no continuity or convexity assumed;
  • reals α,κ\alpha,\kappaα,κ;
  • sample points ξ0,…,ξn−1\xi_0,\dots,\xi_{n-1}ξ0​,…,ξn−1​.

A vector λ\lambdaλ is a scenario solution if all three of the following hold:

  • λ∈Λ\lambda\in\Lambdaλ∈Λ;
  • it satisfies the sampled constraint
∑i=0n−1φ(∑jλjgj(ξi))≤nα−κn;\sum_{i=0}^{n-1}\varphi\Big(\sum_j\lambda_j g_j(\xi_i)\Big)\le n\alpha-\kappa\sqrt{n};i=0∑n−1​φ(j∑​λj​gj​(ξi​))≤nα−κn​;
  • F0(λ)≤F0(l)F_0(\lambda)\le F_0(l)F0​(λ)≤F0​(l) for every l∈Λl\in\Lambdal∈Λ that satisfies the same constraint.

When n=0n=0n=0, the constraint reads 0≤00\le 00≤0 and always holds. In that case λ\lambdaλ is simply a minimizer of F0F_0F0​ over all of Λ\LambdaΛ.

Optimal value of the convexified program (ccpOptValue\mathrm{ccpOptValue}ccpOptValue). For a measure PξP_\xiPξ​, a function φ\varphiφ, an objective F0F_0F0​ and a real α\alphaα, define

fφ∗=inf⁡{F0(l):l∈Λ, ∫φ(∑jljgj(ξ)) dPξ(ξ)≤α}.f^*_\varphi=\inf\Big\{F_0(l): l\in\Lambda,\ \int\varphi\Big(\sum_j l_j g_j(\xi)\Big)\,dP_\xi(\xi)\le\alpha\Big\}.fφ∗​=inf{F0​(l):l∈Λ, ∫φ(j∑​lj​gj​(ξ))dPξ​(ξ)≤α}.

The integral is 000 when its integrand is not integrable. The infimum is a real infimum, not necessarily attained, and it is 000 if the feasible set is empty or the values are unbounded below.

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