Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1, proof: P(sup⁡x∣F^a(x)−Fa(x)∣>ϵ)≤δP(\sup_x|\hat F_a(x)-F_a(x)|>\epsilon)\le\deltaP(supx​∣F^a​(x)−Fa​(x)∣>ϵ)≤δ

Proved
OpenCategoryPAC.alien_cdf_uniform_deviation

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

anomaly-detectiondkw-inequalityempirical-cdfopen-category-detectionpac-guarantee

Let μ0,μa\mu_0,\mu_aμ0​,μa​ be probability measures on R\mathbb RR with continuous CDFs F0,FaF_0,F_aF0​,Fa​, let 0<α≤10<\alpha\le10<α≤1, and let μm=(1−α)μ0+αμa\mu_m=(1-\alpha)\mu_0+\alpha\mu_aμm​=(1−α)μ0​+αμa​ with CDF FmF_mFm​. Let S0S_0S0​ consist of nnn i.i.d. draws from μ0\mu_0μ0​ and, independently, SmS_mSm​ of nnn i.i.d. draws from μm\mu_mμm​, and let F^a\hat F_aF^a​ be the estimate of eq. (1). For ϵ>0\epsilon>0ϵ>0 and δ∈(0,1)\delta\in(0,1)δ∈(0,1), if

n>12ln⁡21−1−δ(1ϵ)2(2−αα)2,n>\frac12\ln\frac{2}{1-\sqrt{1-\delta}}\left(\frac1\epsilon\right)^2\left(\frac{2-\alpha}{\alpha}\right)^2,n>21​ln1−1−δ​2​(ϵ1​)2(α2−α​)2,

then

P(sup⁡x∣F^a(x)−Fa(x)∣>ϵ)≤δ.P\Big(\sup_x|\hat F_a(x)-F_a(x)|>\epsilon\Big)\le\delta.P(xsup​∣F^a​(x)−Fa​(x)∣>ϵ)≤δ.

This is the uniform deviation bound established in the proof of Theorem 1 from Massart's form of the Dvoretzky–Kiefer–Wolfowitz inequality (eq. (2)) applied to each sample.

Formalization Note The probability is that of the product law of the two samples, which encodes the independence of S0S_0S0​ and SmS_mSm​ used in the last step of the proof. The bound is stated for the measure of the deviation event itself (an outer measure if the event were not measurable). The paper writes the proof for ϵ∈(0,1−q)\epsilon\in(0,1-q)ϵ∈(0,1−q), but qqq does not enter this bound, so only ϵ>0\epsilon>0ϵ>0 is assumed.

Preamble
import Mathlib
import Definitions.Def_OpenCategoryPAC_Basic

open MeasureTheory ProbabilityTheory Filter Topology
Formal statement
namespace OpenCategoryPAC

theorem alien_cdf_uniform_deviation (μ0 μa μm : Measure ℝ) [IsProbabilityMeasure μ0]
    [IsProbabilityMeasure μa] [IsProbabilityMeasure μm] (α : ℝ) (hα0 : 0 < α) (hα1 : α ≤ 1)
    (hm : μm = mixture α μ0 μa) (hF0 : Continuous (cdf μ0)) (hFa : Continuous (cdf μa))
    (ε δ : ℝ) (hε : 0 < ε) (hδ0 : 0 < δ) (hδ1 : δ < 1) (n : ℕ)
    (hn : sampleSizeBound α ε δ < n) :
    sampleLaw μ0 μm n {s | ε < supDev (alienCDFEst α s.1 s.2) (cdf μa)} ≤ ENNReal.ofReal δ := by sorry

end OpenCategoryPAC
Source
Liu, Garrepalli, Dietterich, Fern and Hendrycks, Open Category Detection with PAC Guarantees, arXiv:1808.00529v1 (ICML 2018), Appendix A (Proof for Theorem 1), p. 8, using eq. (2)
Read-back

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

Let μ0\mu_0μ0​, μa\mu_aμa​ and μm\mu_mμm​ be three probability measures on the real line (Borel sets). Their cumulative distribution functions are F0(t)=μ0((−∞,t])F_0(t) = \mu_0((-\infty, t])F0​(t)=μ0​((−∞,t]), Fa(t)=μa((−∞,t])F_a(t) = \mu_a((-\infty, t])Fa​(t)=μa​((−∞,t]) and Fm(t)=μm((−∞,t])F_m(t) = \mu_m((-\infty, t])Fm​(t)=μm​((−∞,t]). Let α\alphaα be a real number with 0<α≤10 < \alpha \le 10<α≤1, and assume:

  • Mixture hypothesis: μm\mu_mμm​ equals the mixture
μm=(1−α) μ0+α μa.\mu_m = (1-\alpha)\,\mu_0 + \alpha\,\mu_a .μm​=(1−α)μ0​+αμa​.

When α=1\alpha = 1α=1 this says μm=μa\mu_m = \mu_aμm​=μa​.

  • Continuity hypotheses: F0F_0F0​ and FaF_aFa​ are both continuous functions on R\mathbb{R}R. No continuity assumption is stated for FmF_mFm​ separately.

No other relation between μ0\mu_0μ0​ and μa\mu_aμa​ is assumed. In particular there is no ordering of their CDFs and no disjointness of their supports.

Let ε\varepsilonε and δ\deltaδ be real numbers with ε>0\varepsilon > 0ε>0 and 0<δ<10 < \delta < 10<δ<1. Let nnn be a natural number satisfying the strict inequality

12 ln⁡ ⁣(21−1−δ)(1ε)2(2−αα)2  <  n.\frac{1}{2}\,\ln\!\left(\frac{2}{1-\sqrt{1-\delta}}\right)\left(\frac{1}{\varepsilon}\right)^{2}\left(\frac{2-\alpha}{\alpha}\right)^{2} \;<\; n .21​ln(1−1−δ​2​)(ε1​)2(α2−α​)2<n.

For δ∈(0,1)\delta \in (0,1)δ∈(0,1) the left-hand side is strictly positive, so this forces n≥1n \ge 1n≥1.

The samples. Consider a pair of samples (x,y)(x, y)(x,y) with x=(x1,…,xn)∈Rnx = (x_1,\dots,x_n) \in \mathbb{R}^nx=(x1​,…,xn​)∈Rn and y=(y1,…,yn)∈Rny = (y_1,\dots,y_n) \in \mathbb{R}^ny=(y1​,…,yn​)∈Rn. Both samples have the same size nnn. They are drawn from the product law

Pn=μ0⊗n⊗μm⊗n,P_n = \mu_0^{\otimes n} \otimes \mu_m^{\otimes n},Pn​=μ0⊗n​⊗μm⊗n​,

so the xix_ixi​ are i.i.d. with law μ0\mu_0μ0​, the yjy_jyj​ are i.i.d. with law μm\mu_mμm​, and the two samples are independent.

The estimator. The empirical CDFs are

F^x(t)=1n #{i:xi≤t},F^y(t)=1n #{j:yj≤t}.\hat F_x(t) = \frac{1}{n}\,\#\{i : x_i \le t\}, \qquad \hat F_y(t) = \frac{1}{n}\,\#\{j : y_j \le t\}.F^x​(t)=n1​#{i:xi​≤t},F^y​(t)=n1​#{j:yj​≤t}.

The estimated alien CDF is

F^a(t)=F^y(t)−(1−α) F^x(t)α.\hat F_a(t) = \frac{\hat F_y(t) - (1-\alpha)\,\hat F_x(t)}{\alpha}.F^a​(t)=αF^y​(t)−(1−α)F^x​(t)​.

This F^a\hat F_aF^a​ need not lie in [0,1][0,1][0,1] and need not be monotone. It is, however, bounded, as is FaF_aFa​, so the real supremum

D(x,y)=sup⁡t∈R∣F^a(t)−Fa(t)∣D(x,y) = \sup_{t \in \mathbb{R}} \bigl|\hat F_a(t) - F_a(t)\bigr|D(x,y)=t∈Rsup​​F^a​(t)−Fa​(t)​

is a genuine finite supremum.

Conclusion. The theorem asserts that

Pn({(x,y):D(x,y)>ε})  ≤  δ.P_n\Bigl(\bigl\{(x,y) : D(x,y) > \varepsilon\bigr\}\Bigr) \;\le\; \delta .Pn​({(x,y):D(x,y)>ε})≤δ.

That is, the probability that the uniform deviation of F^a\hat F_aF^a​ from the true alien CDF FaF_aFa​ strictly exceeds ε\varepsilonε is at most δ\deltaδ.

The left-hand side is the measure PnP_nPn​ applied directly to this set. The statement does not separately assert that the set is measurable; if it is not, the quantity is PnP_nPn​'s outer measure of the set.

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