Documentation

LeanMlir.Proofs.Certificates.Smoothing.MC

The Monte-Carlo tie for randomized smoothing #

smoothing_certified_radius_classifier (Smoothing/Gaussian.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.

This file ties the estimate to the theorem: 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 the shape of Cohen et al.'s CERTIFY procedure, a confidence-qualified radius, under the classifier theorem's hypotheses: C measurable and hp (every class's smoothed probability in (0,1) at every point).

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 N → E | (∑ 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.

theorem Proofs.smoothing_mc_certified {n k : ℕ} {σ : ℝ} (hσ : 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 N → EuclideanSpace ℝ (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 p̂. With probability ≥ 1 − exp(−2Nt²) over the samples, the reported radius is certified: every ‖δ‖ < σ·Φ⁻¹(p̂ − t) keeps y the strict argmax of the smoothed classifier. Hypotheses: C measurable, and hp — every class's smoothed probability lies in (0,1) at every point. 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 the sampling confidence (mc_mean_lower_bound, Hoeffding) all theorems.