Documentation

LeanMlir.Proofs.Certificates.SmoothingMC

The Monte-Carlo tie for randomized smoothing #

smoothing_certified_radius_classifier (SmoothingGaussian.lean) certifies the radius σ·Φ⁻¹(p) for the TRUE class probability p = ∫ 1[C(x+σz)=y] dγ(z). The *-smooth drivers can only ESTIMATE p from N Gaussian samples — the honest gap flagged since the smoothing theorems landed.

This file closes it: a one-sided Hoeffding bound for [0,1]-valued Monte-Carlo means over the product measure (mc_mean_lower_bound, built on Mathlib's HasSubgaussianMGF machinery), so that with probability ≥ 1 − exp(−2Nt²) over the samples, the true p is at least the empirical p̂ − t — and on that event the reported radius σ·Φ⁻¹(p̂ − t) is genuinely certified (smoothing_mc_certified, composed with the classifier theorem through the quantile's monotonicity). The guarantee has exactly the shape of Cohen et al.'s CERTIFY procedure: a confidence-qualified radius, now end to end a theorem.

theorem Proofs.mc_mean_lower_bound {E : Type u_1} [MeasurableSpace E] (ν : MeasureTheory.Measure E) [MeasureTheory.IsProbabilityMeasure ν] {f : E} (hfm : Measurable f) (hf01 : ∀ (z : E), f z Set.Icc 0 1) (N : ) (hN : 0 < N) {t : } (ht : 0 t) :
1 - Real.exp (-2 * N * t ^ 2) (MeasureTheory.Measure.pi fun (x : Fin N) => ν).real {ω : Fin NE | (∑ i : Fin N, f (ω i)) / N - t (z : E), f z ν}

One-sided Hoeffding for a [0,1]-valued Monte-Carlo mean. With probability ≥ 1 − exp(−2Nt²) over N iid samples from ν, the empirical mean minus t lower-bounds the true mean.

Below 0 the quantile's defining set is empty (Φ > 0 everywhere), so Φ⁻¹ takes the junk value sSup ∅ = 0 — and the radius σ·Φ⁻¹(p̂−t) certifies vacuously.

theorem Proofs.smoothing_mc_certified {n k : } {σ : } ( : 0 < σ) {C : EuclideanSpace (Fin (n + 1))Fin k} (hC : Measurable C) (hp : ∀ (c : Fin k) (x : EuclideanSpace (Fin (n + 1))), (z : EuclideanSpace (Fin (n + 1))), if C (x + σ z) = c then 1 else 0 ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1))) Set.Ioo 0 1) (x : EuclideanSpace (Fin (n + 1))) (y : Fin k) (N : ) (hN : 0 < N) {t : } (ht : 0 t) :
1 - Real.exp (-2 * N * t ^ 2) (MeasureTheory.Measure.pi fun (x : Fin N) => ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1)))).real {ω : Fin NEuclideanSpace (Fin (n + 1)) | ∀ (δ : EuclideanSpace (Fin (n + 1))), δ < σ * stdNormalQuantile ((∑ i : Fin N, if C (x + σ ω i) = y then 1 else 0) / N - t)∀ (j : Fin k), j y (z : EuclideanSpace (Fin (n + 1))), if C (x + δ + σ z) = j then 1 else 0 ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1))) < (z : EuclideanSpace (Fin (n + 1))), if C (x + δ + σ z) = y then 1 else 0 ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1)))}

The Monte-Carlo smoothing certificate. Sample N iid standard Gaussians; report the radius σ·Φ⁻¹(p̂ − t) from the empirical class frequency . With probability ≥ 1 − exp(−2Nt²) over the samples, the reported radius is GENUINELY certified: every ‖δ‖ < σ·Φ⁻¹(p̂ − t) keeps y the strict argmax of the smoothed classifier. This is the guarantee shape of Cohen–Rosenfeld–Kolter's CERTIFY procedure, with the Neyman– Pearson side (smoothing_probit_lipschitz), the radius algebra (smoothing_certified_radius_classifier), and now the sampling confidence (mc_mean_lower_bound, Hoeffding) all theorems.