Documentation

LeanMlir.Proofs.Certificates.SmoothingNetSemantics

Net semantics for the smoothing chain — the classifier becomes a NET #

The smoothing chain up through smoothing_cp_certified_solved quantifies over an ABSTRACT measurable classifier C with an interiority hypothesis hp : ∀ c x, p_c(x) ∈ (0,1) — the last informality flagged in the scorecard headers. This file closes it:

All results are propext / Classical.choice / Quot.sound-clean.

theorem Proofs.argmaxNet_nonempty {E : Type u_1} {k : } (f : EFin (k + 1)) (x : E) :
{c : Fin (k + 1) | ∀ (j : Fin (k + 1)), f x j f x c}.Nonempty

Some logit is maximal: the maximizer set argmaxNet takes the least of is nonempty.

noncomputable def Proofs.argmaxNet {E : Type u_1} {k : } (f : EFin (k + 1)) (x : E) :
Fin (k + 1)

The argmax classifier of a logit map, LOWEST index winning ties: the least index among the maximizers. Total and deterministic — the tie-break never matters at strict-argmax points.

Equations
Instances For
    theorem Proofs.argmaxNet_isMax {E : Type u_1} {k : } (f : EFin (k + 1)) (x : E) (j : Fin (k + 1)) :
    f x j f x (argmaxNet f x)
    theorem Proofs.argmaxNet_eq_of_strict {E : Type u_1} {k : } {f : EFin (k + 1)} {x : E} {c : Fin (k + 1)} (h : ∀ (j : Fin (k + 1)), j cf x j < f x c) :
    argmaxNet f x = c

    At a STRICT argmax the tie-break is irrelevant: argmaxNet returns it.

    theorem Proofs.measurable_argmaxNet {E : Type u_1} [MeasurableSpace E] {k : } {f : EFin (k + 1)} (hf : ∀ (j : Fin (k + 1)), Measurable fun (x : E) => f x j) :

    Fibers of argmaxNet from logit measurability: argmaxNet f x = c iff c maximizes at x and no smaller index does.

    theorem Proofs.isOpen_strictRegion {E : Type u_1} [TopologicalSpace E] {k : } {f : EFin (k + 1)} (hf : ∀ (j : Fin (k + 1)), Continuous fun (x : E) => f x j) (c : Fin (k + 1)) :
    IsOpen {x : E | ∀ (j : Fin (k + 1)), j cf x j < f x c}

    N(0,1) charges every nonempty open set (the pdf is everywhere positive) — packaged as the Mathlib IsOpenPosMeasure class.

    The standard Gaussian on a finite-dimensional inner-product space charges every nonempty open set: it is the pushforward of the pi-Gaussian (open-pos by pi.isOpenPosMeasure) under the surjective continuous basis sum.

    theorem Proofs.argmaxNet_smoothProb_mem_Ioo {n k : } {σ : } ( : 0 < σ) {f : EuclideanSpace (Fin (n + 1))Fin (k + 2)} (hf : ∀ (j : Fin (k + 2)), Continuous fun (x : EuclideanSpace (Fin (n + 1))) => f x j) (w : Fin (k + 2)EuclideanSpace (Fin (n + 1))) (hw : ∀ (c j : Fin (k + 2)), j cf (w c) j < f (w c) c) (c : Fin (k + 1 + 1)) (x : EuclideanSpace (Fin (n + 1))) :

    hp interiority from per-class witnesses. If every class has a point where it is the STRICT argmax of the continuous logits, then under Gaussian smoothing EVERY class probability at EVERY point is in (0,1): exactly the hp hypothesis of the smoothing chain. Needs ≥ 2 classes (Fin (k+2)) — with one class p ≡ 1.

    theorem Proofs.smoothing_cp_certified_net {n k : } {σ : } ( : 0 < σ) {f : EuclideanSpace (Fin (n + 1))Fin (k + 2)} (hf : ∀ (j : Fin (k + 2)), Continuous fun (x : EuclideanSpace (Fin (n + 1))) => f x j) (w : Fin (k + 2)EuclideanSpace (Fin (n + 1))) (hw : ∀ (c j : Fin (k + 2)), j cf (w c) j < f (w c) c) (x : EuclideanSpace (Fin (n + 1))) (y : Fin (k + 2)) {N k₀ : } (hk₀ : k₀ N) {α q₀ : } ( : 0 α) (hα1 : α < 1) (hq₀ : q₀ Set.Ioo 0 1) (htail : binomTail N k₀ q₀ α) :
    1 - α (MeasureTheory.Measure.pi fun (x : Fin N) => ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1)))).real {ω : Fin NEuclideanSpace (Fin (n + 1)) | (∑ i : Fin N, if argmaxNet f (x + σ ω i) = y then 1 else 0) = k₀∀ (δ : EuclideanSpace (Fin (n + 1))), δ < σ * stdNormalQuantile q₀∀ (j : Fin (k + 2)), j y (z : EuclideanSpace (Fin (n + 1))), if argmaxNet f (x + δ + σ z) = j then 1 else 0 ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1))) < (z : EuclideanSpace (Fin (n + 1))), if argmaxNet f (x + δ + σ z) = y then 1 else 0 ProbabilityTheory.stdGaussian (EuclideanSpace (Fin (n + 1)))}

    The net-semantics capstone. smoothing_cp_certified_solved with the classifier INSTANTIATED as the argmax of a concrete continuous logit map: measurability and hp interiority are DISCHARGED (from continuity and per-class strict-argmax witnesses). With probability ≥ 1 − α over the N Gaussian samples: if the vote count for class y comes out k₀ (where binomTail N k₀ q₀ ≤ α is one kernel check), every perturbation ‖δ‖ < σ·Φ⁻¹(q₀) leaves y the strict argmax of the SMOOTHED net.

    Each logit of the trained pooled-MNIST MLP is continuous: the coordinate formula ∑ k, W2ⱼₖ·max(∑ l, W1ₖₗ·xₗ, 0) is definitional.