Mathlib.Probability.Gaussian­Mean­Embedding

Gaussian-kernel mean embeddings on bounded real supports: an explicit Hilbert feature map, coordinatewise Bochner integration, weighted-moment determination, and strict separation of measures with unequal second moments.

Gaussian­Mean­Embedding 12 core · 16 supporting This module gives an explicit real Hilbert-space feature map for the Gaussian kernel and proves that its Bochner mean embedding distinguishes finite measures with a common bounded real support. ★ measure_eq_of_meanEmbedding_eq_of_boundedSupport

Gaussian mean embeddings on bounded real supports

This module gives an explicit real Hilbert-space feature map for the Gaussian kernel and proves that its Bochner mean embedding distinguishes finite measures with a common bounded real support. It exposes coordinate integration, Gaussian-weighted moment recovery, equality of measures and second moments, and the resulting strict norm separation.

def gaussianKernel reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The Gaussian kernel at two real inputs a and b is exp(−(a − b)²), the exponential of their negative squared difference.

Definition (Lean source)
a b :
ℝ
gaussianKernel a b :
ℝ
exp (-(a - b) ^ 2)
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianKernel · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:30
structure UnitNormGaussianFeatureMap reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a real Hilbert space, a unit-norm Gaussian feature map consists of an input-to-vector assignment, a unit-norm certificate, and a Gaussian inner-product identity.

Definition (Lean source)
feature :
ℝ → H
norm_eq_one :
∀ r, ‖feature r‖ = 1
inner_eq_kernel :
∀ a b, ⟪feature a, feature b⟫_ℝ = gaussianKernel a b
Causalean.Mathlib.Probability.GaussianMeanEmbedding.UnitNormGaussianFeatureMap · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:35
def gaussianFeatureNormalization reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The Gaussian feature normalization at a natural-number coordinate m is the square-root factor √(2^m / m!).

Definition (Lean source)
m :
ℕ
gaussianFeatureNormalization m :
ℝ
sqrt ((2 : ℝ) ^ m / m.factorial)
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianFeatureNormalization · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:44
def gaussianFeatureCoefficient reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The explicit Gaussian feature coefficient of a real input r at a natural-number coordinate m is the normalized exponentially weighted monomial √(2^m / m!)·exp(−r²)·r^m.

Definition (Lean source)
r :
ℝ
m :
ℕ
gaussianFeatureCoefficient r m :
ℝ
gaussianFeatureNormalization m * exp (-r ^ 2) * r ^ m
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianFeatureCoefficient · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:56
abbrev GaussianHilbert reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The Gaussian Hilbert space is the space ℓ² of square-summable real sequences indexed by the natural numbers, a complete real inner-product space.

Definition (Lean source)
GaussianHilbert :
AddSubgroup (PreLp fun x => ℝ)
lp (fun _ : ℕ => ℝ) 2
Causalean.Mathlib.Probability.GaussianMeanEmbedding.GaussianHilbert · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:83
def gaussianFeature reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a real input, the explicit Gaussian feature vector is its square-summable coefficient sequence given by the preceding coefficients and their square-summability certificate.

Definition (Lean source)
r :
ℝ
gaussianFeature r :
⟨gaussianFeatureCoefficient r, gaussianFeature_memℓp r⟩
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianFeature · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:87 · uses GaussianHilbert
def gaussianFeatureMap reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The explicit unit-norm Gaussian feature realization is given by the weighted monomial feature vector, its unit norm, and its Gaussian inner-product identity.

Definition (Lean source)
clause 1
feature := gaussianFeature
clause 2
norm_eq_one := gaussianFeature_norm
clause 3
inner_eq_kernel := gaussianFeature_inner
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianFeatureMap · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:129 · uses GaussianHilbert , UnitNormGaussianFeatureMap
def meanEmbedding reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a complete real Hilbert-space Gaussian feature realization and a real measure, its Gaussian mean embedding is given by the Bochner integral of the feature map.

Definition (Lean source)
meanEmbedding U μ :
H
∫ r, U.feature r ∂μ
Causalean.Mathlib.Probability.GaussianMeanEmbedding.meanEmbedding · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:185 · uses UnitNormGaussianFeatureMap
def gaussianCoordinate reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a natural-number coordinate, the continuous Gaussian coordinate evaluation is given by evaluation in the real square-summable sequence space.

Definition (Lean source)
m :
ℕ
gaussianCoordinate m :
GaussianHilbert →L[ℝ] ℝ
lp.evalCLM ℝ (fun _ : ℕ => ℝ) 2 m
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianCoordinate · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:192 · uses GaussianHilbert
def gaussianWeight reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

The Gaussian weight at a real input r is exp(−r²).

Definition (Lean source)
r :
ℝ
gaussianWeight r :
ℝ
exp (-r ^ 2)
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianWeight · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:216
def gaussianWeightedMonomial reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a natural-number degree and a real input, the Gaussian-weighted monomial is the Gaussian weight times that raw monomial.

Definition (Lean source)
m :
ℕ
r :
ℝ
gaussianWeightedMonomial m r :
ℝ
gaussianWeight r * r ^ m
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussianWeightedMonomial · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:219
theorem measure_eq_of_meanEmbedding_eq_of_boundedSupport reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given two finite real measures, a nonnegative common support radius, their concentration on that closed interval, and equal explicit Gaussian mean embeddings, the measures are equal.

Formal statement
B :
ℝ
hB :
0 ≤ B
hμ :
μ (Icc (-B) B)ᶜ = 0
hν :
ν (Icc (-B) B)ᶜ = 0
μ = ν
Proof (Lean source)
theorem measure_eq_of_meanEmbedding_eq_of_boundedSupport (μ ν : Measure ℝ) [IsFiniteMeasure μ] [IsFiniteMeasure ν] (B : ℝ) (hB : 0 ≤ B) (hμ : μ (Icc (-B) B)ᶜ = 0) (hν : ν (Icc (-B) B)ᶜ = 0) (hemb : meanEmbedding gaussianFeatureMap μ = meanEmbedding gaussianFeatureMap ν) : μ = ν := by apply measure_eq_of_gaussianWeightedMoments_eq μ ν B hB hμ hν exact gaussianWeightedMoments_eq_of_meanEmbedding_eq μ ν hemb
Causalean.Mathlib.Probability.GaussianMeanEmbedding.measure_eq_of_meanEmbedding_eq_of_boundedSupport · Causalean/Mathlib/Probability/GaussianMeanEmbedding.lean:465 · uses GaussianHilbert , gaussianFeatureMap , meanEmbedding
16 supporting declarations (lemmas, instances)
Coordinates 2 core · 4 supporting This module turns norm control of the explicit Gaussian mean embedding into simultaneous control of finitely many Gaussian-weighted monomial moments. ★ abs_sum_gaussianWeightedMoment_sub_le

Quantitative Gaussian-feature coordinate bounds

This module turns norm control of the explicit Gaussian mean embedding into simultaneous control of finitely many Gaussian-weighted monomial moments. It also supplies the normalization-adjusted finite coefficient bound used for second-moment recovery.

theorem abs_sum_gaussianWeightedMoment_sub_le reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given two finite real measures, a finite index set, a degree assigned to each index, and real coefficients, the associated finite weighted-moment sum is bounded by the embedding distance times the sum of absolute normalization-adjusted coefficients.

Formal statement
ι :
Type*
s :
degree :
ι → ℕ
coefficient :
ι → ℝ
|∑ i ∈ s, coefficient i * ((∫ r, gaussianWeightedMonomial (degree i) r ∂μ) - ∫ r, gaussianWeightedMonomial (degree i) r ∂ν)|
≤ (∑ i ∈ s, |coefficient i| / gaussianFeatureNormalization (degree i)) * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖
Proof (Lean source)
theorem abs_sum_gaussianWeightedMoment_sub_le (μ ν : Measure ℝ) [IsFiniteMeasure μ] [IsFiniteMeasure ν] {ι : Type*} (s : Finset ι) (degree : ι → ℕ) (coefficient : ι → ℝ) : |∑ i ∈ s, coefficient i * ((∫ r, gaussianWeightedMonomial (degree i) r ∂μ) - ∫ r, gaussianWeightedMonomial (degree i) r ∂ν)| ≤ (∑ i ∈ s, |coefficient i| / gaussianFeatureNormalization (degree i)) * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ := by calc |∑ i ∈ s, coefficient i * ((∫ r, gaussianWeightedMonomial (degree i) r ∂μ) - ∫ r, gaussianWeightedMonomial (degree i) r ∂ν)| ≤ ∑ i ∈ s, |coefficient i * ((∫ r, gaussianWeightedMonomial (degree i) r ∂μ) - ∫ r, gaussianWeightedMonomial (degree i) r ∂ν)| := Finset.abs_sum_le_sum_abs _ _ _ = ∑ i ∈ s, |coefficient i| * |(∫ r, gaussianWeightedMonomial (degree i) r ∂μ) - ∫ r, gaussianWeightedMonomial (degree i) r ∂ν| := by simp only [abs_mul] _ ≤ ∑ i ∈ s, (|coefficient i| / gaussianFeatureNormalization (degree i)) * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ := by apply Finset.sum_le_sum intro i hi simpa only [div_eq_mul_inv, mul_assoc, mul_comm] using mul_le_mul_of_nonneg_left (abs_gaussianWeightedMoment_sub_le μ ν (degree i)) (abs_nonneg (coefficient i)) _ = (∑ i ∈ s, |coefficient i| / gaussianFeatureNormalization (degree i)) * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ := by rw [Finset.sum_mul]
def secondMomentRecoveryCoefficient reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a truncation order, the second-moment recovery coefficient is the sum over k from 0 to N of the reciprocal factorial 1/k! divided by the Gaussian feature normalization at coordinate 2k + 2.

Definition (Lean source)
N :
ℕ
secondMomentRecoveryCoefficient N :
ℝ
∑ k ∈ range (N + 1), (1 / (k.factorial : ℝ)) / gaussianFeatureNormalization (2 * k + 2)
Causalean.Mathlib.Probability.GaussianMeanEmbedding.secondMomentRecoveryCoefficient · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Coordinates.lean:100
4 supporting declarations (lemmas, instances)
Taylor 2 core · 5 supporting This module defines the polynomial truncation of r² exp(r²), proves its degree, and bounds its factorial-series remainder uniformly on the interval from zero to five. ★ abs_secondMoment_exp_sub_taylor_oneHundred_le

Certified finite Taylor approximation for Gaussian moment recovery

This module defines the polynomial truncation of r² exp(r²), proves its degree, and bounds its factorial-series remainder uniformly on the interval from zero to five.

def secondMomentTaylorPolynomial reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a truncation order, the second-moment Taylor polynomial is the sum of the first N + 1 terms of the r² exp(r²) power series.

Definition (Lean source)
N :
ℕ
secondMomentTaylorPolynomial N :
ℝ[X]
∑ k ∈ range (N + 1), Polynomial.monomial (2 * k + 2) (1 / (k.factorial : ℝ))
Causalean.Mathlib.Probability.GaussianMeanEmbedding.secondMomentTaylorPolynomial · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:22
theorem abs_secondMoment_exp_sub_taylor_oneHundred_le reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given a real point in the interval from zero to five, the order-100 (degree-202) Taylor polynomial differs from r² exp(r²) by at most 25 · (25¹⁰¹ / 101!) · (102 / 77).

Formal statement
r :
ℝ
hr :
r ∈ Icc (0 : ℝ) 5
|r ^ 2 * exp (r ^ 2) - (secondMomentTaylorPolynomial 100).eval r|
≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77)
Proof (Lean source)
theorem abs_secondMoment_exp_sub_taylor_oneHundred_le {r : ℝ} (hr : r ∈ Icc (0 : ℝ) 5) : |r ^ 2 * exp (r ^ 2) - (secondMomentTaylorPolynomial 100).eval r| ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) := by have hr0 : 0 ≤ r := hr.1 have hr5 : r ≤ 5 := hr.2 have hx0 : 0 ≤ r ^ 2 := sq_nonneg r have hx25 : r ^ 2 ≤ 25 := by nlinarith rw [secondMomentTaylorPolynomial_eval] have hsum : ∑ k ∈ range 101, r ^ (2 * k + 2) / (k.factorial : ℝ) = r ^ 2 * ∑ k ∈ range 101, (r ^ 2) ^ k / (k.factorial : ℝ) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro k _ rw [show 2 * k + 2 = 2 + 2 * k by omega, pow_add, pow_mul] ring rw [hsum, ← mul_sub, abs_mul, abs_of_nonneg hx0, abs_of_nonneg (sub_nonneg.mpr (Real.sum_le_exp_of_nonneg hx0 101))] have htail := exp_series_tail_le_geometric 100 (r ^ 2) hx0 (by norm_num linarith) have htail' : exp (r ^ 2) - ∑ k ∈ range 101, (r ^ 2) ^ k / (k.factorial : ℝ) ≤ (r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / (102 - r ^ 2)) := by norm_num only [Nat.reduceAdd, Nat.cast_ofNat, Nat.cast_add] at htail exact htail calc r ^ 2 * (exp (r ^ 2) - ∑ k ∈ range 101, (r ^ 2) ^ k / (k.factorial : ℝ)) ≤ r ^ 2 * ((r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / (102 - r ^ 2))) := mul_le_mul_of_nonneg_left htail' hx0 _ ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) := by have hratio : (102 : ℝ) / (102 - r ^ 2) ≤ 102 / 77 := by exact div_le_div_of_nonneg_left (by norm_num) (by norm_num) (by nlinarith) have hpow : (r ^ 2) ^ 101 ≤ (25 : ℝ) ^ 101 := by exact pow_le_pow_left₀ hx0 hx25 101 have hdiv : (r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) ≤ 25 ^ 101 / ((101 : ℕ).factorial : ℝ) := div_le_div_of_nonneg_right hpow (by positivity) have hfacpos : (0 : ℝ) < ((101 : ℕ).factorial : ℝ) := by exact_mod_cast Nat.factorial_pos 101 have hdiv0 : 0 ≤ (r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) := div_nonneg (pow_nonneg hx0 101) hfacpos.le have hdiv25 : 0 ≤ (25 : ℝ) ^ 101 / ((101 : ℕ).factorial : ℝ) := div_nonneg (pow_nonneg (by norm_num) 101) hfacpos.le have hratio0 : 0 ≤ (102 : ℝ) / (102 - r ^ 2) := div_nonneg (by norm_num) (by nlinarith) calc r ^ 2 * ((r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / (102 - r ^ 2))) ≤ 25 * ((r ^ 2) ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / (102 - r ^ 2))) := mul_le_mul_of_nonneg_right hx25 (mul_nonneg hdiv0 hratio0) _ ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / (102 - r ^ 2))) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hdiv hratio0) (by norm_num) _ ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ) * (102 / 77)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hratio hdiv25) (by norm_num) _ = 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) := by ring
Causalean.Mathlib.Probability.GaussianMeanEmbedding.abs_secondMoment_exp_sub_taylor_oneHundred_le · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:145 · uses secondMomentTaylorPolynomial
5 supporting declarations (lemmas, instances)
  • secondMomentTaylorPolynomial_eval theorem — Given a truncation order and a real argument, evaluating the second-moment Taylor polynomial yields its finite sum of even powers with reciprocal-factorial coefficients.
    N :
    ℕ
    r :
    ℝ
    = ∑ k ∈ range (N + 1), r ^ (2 * k + 2) / (k.factorial : ℝ)
    Proof (Lean source)
    theorem secondMomentTaylorPolynomial_eval (N : ℕ) (r : ℝ) : (secondMomentTaylorPolynomial N).eval r = ∑ k ∈ range (N + 1), r ^ (2 * k + 2) / (k.factorial : ℝ) := by rw [secondMomentTaylorPolynomial, Polynomial.eval_finsetSum] apply Finset.sum_congr rfl intro k _ rw [Polynomial.eval_monomial] ring
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.secondMomentTaylorPolynomial_eval · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:28
  • secondMomentTaylorPolynomial_natDegree_oneHundred theorem — The truncation through index one hundred has polynomial degree exactly 202.
    Proof (Lean source)
    theorem secondMomentTaylorPolynomial_natDegree_oneHundred : (secondMomentTaylorPolynomial 100).natDegree = 202 := by apply Polynomial.natDegree_eq_of_le_of_coeff_ne_zero · apply Polynomial.natDegree_sum_le_of_forall_le intro k hk rw [Polynomial.natDegree_monomial] split_ifs · omega · have hk' : k < 101 := Finset.mem_range.mp hk omega · set_option maxRecDepth 10000 in rw [secondMomentTaylorPolynomial] rw [Polynomial.finsetSum_coeff] simp only [Polynomial.coeff_monomial] rw [Finset.sum_eq_single 100] · norm_num · intro b hb hne split_ifs with h · omega · rfl · simp
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.secondMomentTaylorPolynomial_natDegree_oneHundred · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:40
  • exp_series_tail_le_geometric theorem — Given a truncation order, a nonnegative real argument, and the condition that the next denominator exceeds that argument, the exponential-series tail after the truncation is bounded by its first omitted term times the displayed geometric factor.
    N :
    ℕ
    x :
    ℝ
    hx :
    0 ≤ x
    hden :
    x < N + 2
    exp x - ∑ k ∈ range (N + 1), x ^ k / (k.factorial : ℝ)
    ≤ (x ^ (N + 1) / ((N + 1).factorial : ℝ)) * ((N + 2 : ℝ) / ((N + 2 : ℝ) - x))
    Proof (Lean source)
    theorem exp_series_tail_le_geometric (N : ℕ) (x : ℝ) (hx : 0 ≤ x) (hden : x < N + 2) : exp x - ∑ k ∈ range (N + 1), x ^ k / (k.factorial : ℝ) ≤ (x ^ (N + 1) / ((N + 1).factorial : ℝ)) * ((N + 2 : ℝ) / ((N + 2 : ℝ) - x)) := by let f : ℕ → ℝ := fun k => x ^ k / (k.factorial : ℝ) have hf : Summable f := by simpa [f] using NormedSpace.expSeries_div_summable x have hsplit := hf.sum_add_tsum_nat_add (N + 1) have hexp : exp x = ∑' k, f k := by rw [Real.exp_eq_exp_ℝ] simpa [f] using (NormedSpace.expSeries_div_hasSum_exp x).tsum_eq.symm have htail : exp x - ∑ k ∈ range (N + 1), x ^ k / (k.factorial : ℝ) = ∑' j : ℕ, f (j + (N + 1)) := by rw [hexp] change (∑' k, f k) - ∑ k ∈ range (N + 1), f k = _ linarith rw [htail] let a : ℝ := x ^ (N + 1) / ((N + 1).factorial : ℝ) let q : ℝ := x / (N + 2 : ℝ) have hq : |q| < 1 := by rw [abs_of_nonneg (div_nonneg hx (by positivity))] exact (div_lt_one (by positivity)).2 hden have hfshift : Summable (fun j : ℕ => f (j + (N + 1))) := by exact hf.comp_injective (fun _ _ h => Nat.add_right_cancel h) have hg : Summable (fun j : ℕ => a * q ^ j) := (summable_geometric_of_norm_lt_one (by simpa [Real.norm_eq_abs] using hq)).mul_left a calc (∑' j : ℕ, f (j + (N + 1))) ≤ ∑' j : ℕ, a * q ^ j := by apply Summable.tsum_le_tsum _ hfshift hg intro j dsimp [f, a, q] have hfac : ((N + 1).factorial : ℝ) * (N + 2 : ℝ) ^ j ≤ ((N + 1 + j).factorial : ℝ) := by exact_mod_cast factorial_mul_pow_le_factorial_add N j have hpos : 0 < ((N + 1).factorial : ℝ) * (N + 2 : ℝ) ^ j := by positivity have hnum : 0 ≤ x ^ (N + 1 + j) := by positivity rw [show j + (N + 1) = N + 1 + j by omega] calc x ^ (N + 1 + j) / ((N + 1 + j).factorial : ℝ) ≤ x ^ (N + 1 + j) / (((N + 1).factorial : ℝ) * (N + 2 : ℝ) ^ j) := div_le_div_of_nonneg_left hnum hpos hfac _ = (x ^ (N + 1) / ((N + 1).factorial : ℝ)) * (x / (N + 2 : ℝ)) ^ j := by rw [div_pow, pow_add] field_simp _ = a * (1 - q)⁻¹ := by rw [tsum_mul_left, tsum_geometric_of_abs_lt_one hq] _ = (x ^ (N + 1) / ((N + 1).factorial : ℝ)) * ((N + 2 : ℝ) / ((N + 2 : ℝ) - x)) := by dsimp [a, q] have hn : (N + 2 : ℝ) ≠ 0 := by positivity have hd : (N + 2 : ℝ) - x ≠ 0 := ne_of_gt (sub_pos.mpr hden) field_simp
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.exp_series_tail_le_geometric · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:81
  • abs_sq_sub_gaussianWeightedTaylor_oneHundred_le theorem — Given a real point in the interval from zero to five, multiplying the degree-202 approximation by the reciprocal Gaussian weight approximates the raw square within the same certified error.
    r :
    ℝ
    hr :
    r ∈ Icc (0 : ℝ) 5
    |r ^ 2 - exp (-r ^ 2) * (secondMomentTaylorPolynomial 100).eval r|
    ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77)
    Proof (Lean source)
    theorem abs_sq_sub_gaussianWeightedTaylor_oneHundred_le {r : ℝ} (hr : r ∈ Icc (0 : ℝ) 5) : |r ^ 2 - exp (-r ^ 2) * (secondMomentTaylorPolynomial 100).eval r| ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) := by have hx0 : 0 ≤ r ^ 2 := sq_nonneg r have hprev := abs_secondMoment_exp_sub_taylor_oneHundred_le hr have hexp : exp (-r ^ 2) * exp (r ^ 2) = 1 := by rw [← Real.exp_add] simp have hid : r ^ 2 - exp (-r ^ 2) * (secondMomentTaylorPolynomial 100).eval r = exp (-r ^ 2) * (r ^ 2 * exp (r ^ 2) - (secondMomentTaylorPolynomial 100).eval r) := by calc r ^ 2 - exp (-r ^ 2) * (secondMomentTaylorPolynomial 100).eval r = (exp (-r ^ 2) * exp (r ^ 2)) * r ^ 2 - exp (-r ^ 2) * (secondMomentTaylorPolynomial 100).eval r := by rw [hexp]; ring _ = _ := by ring rw [hid, abs_mul, abs_of_pos (Real.exp_pos _)] calc exp (-r ^ 2) * |r ^ 2 * exp (r ^ 2) - (secondMomentTaylorPolynomial 100).eval r| ≤ 1 * |r ^ 2 * exp (r ^ 2) - (secondMomentTaylorPolynomial 100).eval r| := mul_le_mul_of_nonneg_right (Real.exp_le_one_iff.mpr (by linarith)) (abs_nonneg _) _ ≤ 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) := by simpa using hprev
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.abs_sq_sub_gaussianWeightedTaylor_oneHundred_le · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:220
  • two_taylorRemainder_oneHundred_le theorem — Twice the uniform degree-202 approximation error is at most the exact rational remainder 10⁻¹⁵.
    2 * (25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77)) ≤ (1 / 10 ^ 15 : ℝ)
    Proof (Lean source)
    theorem two_taylorRemainder_oneHundred_le : 2 * (25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77)) ≤ (1 / 10 ^ 15 : ℝ) := by norm_num [factorial]
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.two_taylorRemainder_oneHundred_le · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Taylor.lean:258
Stability 1 core · 2 supporting This module combines finite coordinate control with a uniform Taylor approximation remainder. ★ gaussian_meanEmbedding_secondMoment_stability_Icc_zero_five

Quantitative second-moment stability from Gaussian mean embeddings

This module combines finite coordinate control with a uniform Taylor approximation remainder. It exports the probability-law bound on the interval from zero to five and its explicit lower bound for Gaussian embedding distance.

theorem gaussian_meanEmbedding_secondMoment_stability_Icc_zero_five reviewed
Causalean.Mathlib.Probability.GaussianMeanEmbedding

Given two probability measures concentrated on the interval from zero to five, their raw second-moment difference is at most 5151 times the distance between their explicit Gaussian mean embeddings plus the exact rational remainder 10⁻¹⁵.

Formal statement
hμ :
μ (Icc (0 : ℝ) 5)ᶜ = 0
hν :
ν (Icc (0 : ℝ) 5)ᶜ = 0
|(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν|
≤ 5151 * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖
+ (1 / 10 ^ 15 : ℝ)
Proof (Lean source)
theorem gaussian_meanEmbedding_secondMoment_stability_Icc_zero_five (μ ν : Measure ℝ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hμ : μ (Icc (0 : ℝ) 5)ᶜ = 0) (hν : ν (Icc (0 : ℝ) 5)ᶜ = 0) : |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| ≤ 5151 * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + (1 / 10 ^ 15 : ℝ) := by let ε : ℝ := 25 * (25 ^ 101 / ((101 : ℕ).factorial : ℝ)) * (102 / 77) have hbound := secondMoment_sub_le_of_taylor_error (R := 5) (N := 100) (ε := ε) μ ν hμ hν (by intro r hr dsimp [ε] simpa only [gaussianWeight] using abs_sq_sub_gaussianWeightedTaylor_oneHundred_le hr) calc |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| ≤ secondMomentRecoveryCoefficient 100 * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + 2 * ε := hbound _ ≤ 5151 * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + (1 / 10 ^ 15 : ℝ) := add_le_add (mul_le_mul_of_nonneg_right secondMomentRecoveryCoefficient_oneHundred_le (norm_nonneg _)) (by dsimp [ε] exact two_taylorRemainder_oneHundred_le)
Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussian_meanEmbedding_secondMoment_stability_Icc_zero_five · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Stability.lean:146 · uses GaussianHilbert , gaussianFeatureMap , meanEmbedding
2 supporting declarations (lemmas, instances)
  • secondMoment_sub_le_of_taylor_error theorem — Given two probability measures, a support radius and an approximation error, a Taylor truncation order, their concentration on the interval from zero to that radius, and a uniform approximation of the raw square by the weighted Taylor polynomial, their raw second-moment difference is bounded by the recovery coefficient times their Gaussian embedding distance plus twice the approximation error.
    R ε :
    ℝ
    N :
    ℕ
    hμ :
    μ (Icc (0 : ℝ) R)ᶜ = 0
    hν :
    ν (Icc (0 : ℝ) R)ᶜ = 0
    happrox :
    ∀ r ∈ Icc (0 : ℝ) R,
    |r ^ 2 - gaussianWeight r * (secondMomentTaylorPolynomial N).eval r| ≤ ε
    |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν|
    + 2 * ε
    Proof (Lean source)
    theorem secondMoment_sub_le_of_taylor_error (μ ν : Measure ℝ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (R ε : ℝ) (N : ℕ) (hμ : μ (Icc (0 : ℝ) R)ᶜ = 0) (hν : ν (Icc (0 : ℝ) R)ᶜ = 0) (happrox : ∀ r ∈ Icc (0 : ℝ) R, |r ^ 2 - gaussianWeight r * (secondMomentTaylorPolynomial N).eval r| ≤ ε) : |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| ≤ secondMomentRecoveryCoefficient N * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + 2 * ε := by let S : Set ℝ := Icc 0 R let q : ℝ → ℝ := fun r => gaussianWeight r * (secondMomentTaylorPolynomial N).eval r have hμS : ∀ᵐ r ∂μ, r ∈ S := by rw [ae_iff] exact hμ have hνS : ∀ᵐ r ∂ν, r ∈ S := by rw [ae_iff] exact hν have hμrestrict : μ.restrict S = μ := Measure.restrict_eq_self_of_ae_mem hμS have hνrestrict : ν.restrict S = ν := Measure.restrict_eq_self_of_ae_mem hνS have hsquare_cont : Continuous (fun r : ℝ => r ^ 2) := by fun_prop have hq_cont : Continuous q := by dsimp [q] unfold gaussianWeight fun_prop have hsquareμ : Integrable (fun r : ℝ => r ^ 2) μ := by have h := hsquare_cont.integrableOn_Icc (a := (0 : ℝ)) (b := R) (μ := μ) change Integrable (fun r : ℝ => r ^ 2) (μ.restrict S) at h rwa [hμrestrict] at h have hsquareν : Integrable (fun r : ℝ => r ^ 2) ν := by have h := hsquare_cont.integrableOn_Icc (a := (0 : ℝ)) (b := R) (μ := ν) change Integrable (fun r : ℝ => r ^ 2) (ν.restrict S) at h rwa [hνrestrict] at h have hqμ : Integrable q μ := by have h := hq_cont.integrableOn_Icc (a := (0 : ℝ)) (b := R) (μ := μ) change Integrable q (μ.restrict S) at h rwa [hμrestrict] at h have hqν : Integrable q ν := by have h := hq_cont.integrableOn_Icc (a := (0 : ℝ)) (b := R) (μ := ν) change Integrable q (ν.restrict S) at h rwa [hνrestrict] at h have herrorμ : |(∫ r, r ^ 2 ∂μ) - ∫ r, q r ∂μ| ≤ ε := by have hbound : ∀ᵐ r ∂μ, ‖r ^ 2 - q r‖ ≤ ε := hμS.mono fun r hr => by simpa only [S, q, Real.norm_eq_abs] using happrox r hr rw [← integral_sub hsquareμ hqμ, ← Real.norm_eq_abs] simpa using norm_integral_le_of_norm_le_const hbound have herrorν : |(∫ r, r ^ 2 ∂ν) - ∫ r, q r ∂ν| ≤ ε := by have hbound : ∀ᵐ r ∂ν, ‖r ^ 2 - q r‖ ≤ ε := hνS.mono fun r hr => by simpa only [S, q, Real.norm_eq_abs] using happrox r hr rw [← integral_sub hsquareν hqν, ← Real.norm_eq_abs] simpa using norm_integral_le_of_norm_le_const hbound have hq_integral (m : Measure ℝ) [IsFiniteMeasure m] : (∫ r, q r ∂m) = ∑ k ∈ range (N + 1), (1 / (k.factorial : ℝ)) * ∫ r, gaussianWeightedMonomial (2 * k + 2) r ∂m := by simp only [q, secondMomentTaylorPolynomial_eval, Finset.mul_sum] rw [integral_finset_sum] · apply Finset.sum_congr rfl intro k hk have hfun : (fun r : ℝ => gaussianWeight r * (r ^ (2 * k + 2) / (k.factorial : ℝ))) = fun r => (1 / (k.factorial : ℝ)) * gaussianWeightedMonomial (2 * k + 2) r := by funext r simp only [gaussianWeightedMonomial] ring rw [hfun, integral_const_mul] · intro k hk rw [show (fun r : ℝ => gaussianWeight r * (r ^ (2 * k + 2) / (k.factorial : ℝ))) = fun r => (1 / (k.factorial : ℝ)) * gaussianWeightedMonomial (2 * k + 2) r by funext r simp only [gaussianWeightedMonomial] ring] exact (integrable_gaussianWeightedMonomial m (2 * k + 2)).const_mul _ have hmiddle : |(∫ r, q r ∂μ) - ∫ r, q r ∂ν| ≤ secondMomentRecoveryCoefficient N * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ := by rw [hq_integral μ, hq_integral ν, ← Finset.sum_sub_distrib] simpa only [mul_sub] using abs_secondMomentWeightedSum_sub_le μ ν N calc |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| ≤ |(∫ r, r ^ 2 ∂μ) - ∫ r, q r ∂μ| + |(∫ r, q r ∂μ) - ∫ r, q r ∂ν| + |(∫ r, q r ∂ν) - ∫ r, r ^ 2 ∂ν| := by calc _ ≤ |(∫ r, r ^ 2 ∂μ) - ∫ r, q r ∂μ| + |(∫ r, q r ∂μ) - ∫ r, r ^ 2 ∂ν| := abs_sub_le _ _ _ _ ≤ _ := by have htri : |(∫ r, q r ∂μ) - ∫ r, r ^ 2 ∂ν| ≤ |(∫ r, q r ∂μ) - ∫ r, q r ∂ν| + |(∫ r, q r ∂ν) - ∫ r, r ^ 2 ∂ν| := abs_sub_le _ _ _ linarith _ ≤ ε + secondMomentRecoveryCoefficient N * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + ε := by gcongr simpa only [abs_sub_comm] using herrorν _ = secondMomentRecoveryCoefficient N * ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ + 2 * ε := by ring
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.secondMoment_sub_le_of_taylor_error · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Stability.lean:21
  • gaussian_meanEmbedding_norm_lowerBound_of_secondMoment_gap theorem — Given two probability measures concentrated on the interval from zero to five and a certified second-moment gap exceeding 10⁻¹⁵, their Gaussian mean-embedding distance is at least the positive quantity obtained by subtracting that remainder and dividing by 5151.
    hμ :
    μ (Icc (0 : ℝ) 5)ᶜ = 0
    hν :
    ν (Icc (0 : ℝ) 5)ᶜ = 0
    hgap :
    (1 / 10 ^ 15 : ℝ) < |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν|
    conclusion 1
    0 < (|(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| - (1 / 10 ^ 15 : ℝ)) / 5151
    conclusion 2
    (|(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| - (1 / 10 ^ 15 : ℝ)) / 5151
    ≤ ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖
    Proof (Lean source)
    theorem gaussian_meanEmbedding_norm_lowerBound_of_secondMoment_gap (μ ν : Measure ℝ) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] (hμ : μ (Icc (0 : ℝ) 5)ᶜ = 0) (hν : ν (Icc (0 : ℝ) 5)ᶜ = 0) (hgap : (1 / 10 ^ 15 : ℝ) < |(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν|) : 0 < (|(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| - (1 / 10 ^ 15 : ℝ)) / 5151 ∧ (|(∫ r, r ^ 2 ∂μ) - ∫ r, r ^ 2 ∂ν| - (1 / 10 ^ 15 : ℝ)) / 5151 ≤ ‖meanEmbedding gaussianFeatureMap μ - meanEmbedding gaussianFeatureMap ν‖ := by have hbound := gaussian_meanEmbedding_secondMoment_stability_Icc_zero_five μ ν hμ hν constructor · positivity · nlinarith
    Causalean.Mathlib.Probability.GaussianMeanEmbedding.gaussian_meanEmbedding_norm_lowerBound_of_secondMoment_gap · Causalean/Mathlib/Probability/GaussianMeanEmbedding/Stability.lean:181