Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lebesgue densities, Gaussian PDFs, and weak convergence

Definition
DKFAsymptotics_Densities

by burkh4rt · Sep 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

gaussiankalman-filterprobabilitystatistics

States are real vectors of finite dimension and covariances are real square matrices. The multivariate Gaussian density is the standard determinant-and-quadratic-form expression. Probability density validity requires almost-everywhere nonnegativity, integrability and integral one. A Gaussian PDF additionally has an almost-everywhere representation with a positive-definite covariance. The density measure is obtained from Lebesgue measure by its nonnegative density. The L1L^1L1 norm and distance are extended nonnegative integrals. Weak convergence is expressed by convergence of integrals of every bounded continuous real function over these density measures. The definitions themselves are total; their probability and Gaussian interpretations use the explicit validity predicates in the theorem hypotheses.

Definition code
import Mathlib.Analysis.Matrix.PosDef
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse
import Mathlib.MeasureTheory.Measure.ProbabilityMeasure
import Mathlib.MeasureTheory.Measure.WithDensity
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic
import Mathlib.MeasureTheory.Integral.Bochner.Basic
import Mathlib.MeasureTheory.Constructions.Pi
import Mathlib.Analysis.SpecialFunctions.Gaussian.GaussianIntegral
import Mathlib.Data.PNat.Basic

noncomputable section
open MeasureTheory Filter Matrix
open scoped Topology ENNReal

namespace DKFAsymptotics

abbrev State (d : ℕ) := Fin d → ℝ
abbrev Covariance (d : ℕ) := Matrix (Fin d) (Fin d) ℝ
abbrev Density (d : ℕ) := State d → ℝ

variable {d : ℕ}

def gaussianPDF (m : State d) (C : Covariance d) (z : State d) : ℝ :=
  (Real.sqrt ((2 * Real.pi) ^ d * C.det))⁻¹ *
    Real.exp (-((z - m) ⬝ᵥ (C⁻¹ *ᵥ (z - m))) / 2)

def IsPDF (f : Density d) : Prop :=
  (∀ᵐ z ∂volume, 0 ≤ f z) ∧ Integrable f volume ∧ (∫ z, f z ∂volume) = 1

def IsGaussianPDF (f : Density d) : Prop :=
  IsPDF f ∧ ∃ (m : State d) (C : Covariance d), C.PosDef ∧
    f =ᵐ[volume] gaussianPDF m C

def densityMeasure (f : Density d) : Measure (State d) :=
  volume.withDensity (fun z => ENNReal.ofReal (f z))

def l1Norm (f : Density d) : ℝ≥0∞ :=
  ∫⁻ z, ENNReal.ofReal |f z| ∂volume

def l1Distance (f g : Density d) : ℝ≥0∞ := l1Norm (f - g)

def Weakly (f : ℕ+ → Density d) (P : Measure (State d)) : Prop :=
  ∀ g : BoundedContinuousFunction (State d) ℝ,
    Tendsto (fun n => ∫ z, g z ∂densityMeasure (f n)) atTop (𝓝 (∫ z, g z ∂P))

end DKFAsymptotics
Source
M. C. Burkhart, D. M. Brandman, B. Franco, L. R. Hochberg and M. T. Harrison, The Discriminative Kalman Filter for Bayesian Filtering with Nonlinear and Nongaussian Observation Models, Neural Computation 32(5), 969–1017 (2020), doi:10.1162/neco_a_01275; https://burkh4rt.github.io/pubs/Burkhart-et-al-2020-Neural-Comput.pdf; Appendix B, p. 1003; Gaussian notation in Section 2, p. 972.
Read-back

What the Lean code literally says, in plain math · GPT-6 (Codex independent sub-agent)

Independent mathematical read-back: density declarations

DKFAsymptotics.State

For each natural number d≥0d\geq 0d≥0, the state space is the set of all functions from {0,…,d−1}\{0,\ldots,d-1\}{0,…,d−1} to R\mathbb RR, identified with Rd\mathbb R^dRd. No coordinates or vectors are excluded. For d=0d=0d=0 this is a singleton, whose sole element is the empty vector.

DKFAsymptotics.Covariance

For each natural number d≥0d\geq 0d≥0, the covariance type is the set of all real d×dd\times dd×d matrices, with row and column indices in {0,…,d−1}\{0,\ldots,d-1\}{0,…,d−1}. Membership in this type imposes no symmetry, definiteness, or invertibility condition. For d=0d=0d=0 it contains the unique empty matrix, whose determinant is 111.

DKFAsymptotics.Density

For each natural number d≥0d\geq 0d≥0, a density is any function f:Rd→Rf:\mathbb R^d\to\mathbb Rf:Rd→R, where Rd\mathbb R^dRd means the space of real vectors indexed by {0,…,d−1}\{0,\ldots,d-1\}{0,…,d−1}. There is no requirement of measurability, nonnegativity, integrability, or normalization. For d=0d=0d=0, such a function is specified by a single real value on the empty vector.

DKFAsymptotics.gaussianPDF

For each natural number d≥0d\geq 0d≥0, every vector m∈Rdm\in\mathbb R^dm∈Rd, every real d×dd\times dd×d matrix CCC, and every z∈Rdz\in\mathbb R^dz∈Rd, this definition assigns the real number ((2π)ddet⁡C)−1exp⁡ ⁣(−12∑i=0d−1(zi−mi)∑j=0d−1(C−1)ij(zj−mj))\bigl(\sqrt{(2\pi)^d\det C}\bigr)^{-1}\exp\!\left(-\frac12\sum_{i=0}^{d-1}(z_i-m_i)\sum_{j=0}^{d-1}(C^{-1})_{ij}(z_j-m_j)\right)((2π)ddetC​)−1exp(−21​∑i=0d−1​(zi​−mi​)∑j=0d−1​(C−1)ij​(zj​−mj​)). Matrix inversion is the usual inverse when CCC is invertible and is the zero matrix when CCC is singular; the real square root of a nonpositive number is 000, and the reciprocal of 000 is 000. No symmetry or positive definiteness of CCC is assumed. In particular, when det⁡C≤0\det C\leq0detC≤0, the defined function of zzz is identically 000. For d=0d=0d=0, the determinant and zeroth power in the prefactor are both 111, both sums are empty, and the function takes the value 111 at the unique state. The declaration itself imposes no condition that this function integrate to 111.

DKFAsymptotics.IsPDF

For each natural number d≥0d\geq0d≥0 and every function f:Rd→Rf:\mathbb R^d\to\mathbb Rf:Rd→R, this predicate holds exactly when all three conditions hold: f(z)≥0f(z)\geq0f(z)≥0 for almost every zzz with respect to the product of ddd real Lebesgue measures, fff is Bochner integrable with respect to that measure, and ∫Rdf(z) dz=1\int_{\mathbb R^d}f(z)\,dz=1∫Rd​f(z)dz=1. For a real-valued function, the integrability requirement includes almost-everywhere strong measurability and finiteness of the integral of its absolute value. Nonnegativity is required only almost everywhere; negative values on a null set are permitted. For d=0d=0d=0, the product measure is unit mass on the empty vector, so this predicate holds exactly when the value there is 111.

DKFAsymptotics.IsGaussianPDF

For each natural number d≥0d\geq0d≥0 and every function f:Rd→Rf:\mathbb R^d\to\mathbb Rf:Rd→R, this predicate holds exactly when fff is nonnegative almost everywhere, is Bochner integrable, and has integral 111 with respect to product Lebesgue measure, and there exist a vector m∈Rdm\in\mathbb R^dm∈Rd and a real symmetric matrix CCC such that xTCx>0x^{\mathsf T}Cx>0xTCx>0 for every nonzero vector x∈Rdx\in\mathbb R^dx∈Rd and f(z)=((2π)ddet⁡C)−1exp⁡ ⁣(−12∑i=0d−1(zi−mi)∑j=0d−1(C−1)ij(zj−mj))f(z)=\bigl(\sqrt{(2\pi)^d\det C}\bigr)^{-1}\exp\!\left(-\frac12\sum_{i=0}^{d-1}(z_i-m_i)\sum_{j=0}^{d-1}(C^{-1})_{ij}(z_j-m_j)\right)f(z)=((2π)ddetC​)−1exp(−21​∑i=0d−1​(zi​−mi​)∑j=0d−1​(C−1)ij​(zj​−mj​)) for product-Lebesgue-almost every zzz. Here C−1C^{-1}C−1 is the matrix inverse, with the total convention that it is zero for a singular matrix; real square roots of nonpositive numbers and the reciprocal of zero are also zero. The witnesses mmm and CCC are existentially quantified, without a uniqueness requirement. Equality with the displayed function need not hold at every point. The quantifier on xxx is over all nonzero vectors; in dimension zero it has no instances, the empty matrix satisfies the symmetry and positivity condition, the product measure is unit point mass, and the predicate holds exactly when fff takes the value 111 on the sole state.

DKFAsymptotics.densityMeasure

For each natural number d≥0d\geq0d≥0 and every function f:Rd→Rf:\mathbb R^d\to\mathbb Rf:Rd→R, this definition gives the measure μf\mu_fμf​ on the standard measurable space of Rd\mathbb R^dRd whose value on each measurable set AAA is μf(A)=∫A−max⁡{f(z),0} dz\mu_f(A)=\int_A^-\max\{f(z),0\}\,dzμf​(A)=∫A−​max{f(z),0}dz, with the nonnegative real integrand included in [0,+∞][0,+\infty][0,+∞] and dzdzdz denoting product Lebesgue measure. The symbol ∫−\int^-∫− is the lower Lebesgue integral, defined for any nonnegative function as the supremum of the integrals of measurable simple functions lying pointwise below it. No measurability or integrability assumption on fff is present, and the resulting measure need not be finite or have total mass 111. Negative values of fff contribute zero. For d=0d=0d=0, the result is point mass of weight max⁡{f(∗),0}\max\{f(*),0\}max{f(∗),0} on the unique empty vector ∗*∗.

DKFAsymptotics.l1Norm

For each natural number d≥0d\geq0d≥0 and every function f:Rd→Rf:\mathbb R^d\to\mathbb Rf:Rd→R, this definition assigns the extended nonnegative number ∫Rd−∣f(z)∣ dz∈[0,+∞]\int_{\mathbb R^d}^-|f(z)|\,dz\in[0,+\infty]∫Rd−​∣f(z)∣dz∈[0,+∞], where dzdzdz is product Lebesgue measure and the absolute value is regarded as an extended nonnegative real. The lower integral is the supremum of integrals of measurable nonnegative simple functions bounded pointwise by ∣f∣|f|∣f∣. The definition assumes neither measurability nor integrability, so the value may be +∞+\infty+∞ and applies even to nonmeasurable functions. For d=0d=0d=0, product measure is unit mass at the empty vector ∗*∗ and the value is ∣f(∗)∣|f(*)|∣f(∗)∣.

DKFAsymptotics.l1Distance

For each natural number d≥0d\geq0d≥0 and every pair of functions f,g:Rd→Rf,g:\mathbb R^d\to\mathbb Rf,g:Rd→R, this definition assigns ∫Rd−∣f(z)−g(z)∣ dz∈[0,+∞]\int_{\mathbb R^d}^-|f(z)-g(z)|\,dz\in[0,+\infty]∫Rd−​∣f(z)−g(z)∣dz∈[0,+∞], with subtraction taken pointwise and dzdzdz denoting product Lebesgue measure. The lower integral is the supremum of integrals of measurable nonnegative simple functions bounded pointwise by the displayed absolute difference. No measurability, integrability, nonnegativity, or normalization of either function is required, and the value can be +∞+\infty+∞. The functions are actual functions, rather than equivalence classes under almost-everywhere equality; in particular, functions differing only on a null set have distance zero. For d=0d=0d=0, the value is ∣f(∗)−g(∗)∣|f(*)-g(*)|∣f(∗)−g(∗)∣ on the unique state ∗*∗.

DKFAsymptotics.Weakly

For each natural number d≥0d\geq0d≥0, every sequence (fn)n∈{1,2,3,…}(f_n)_{n\in\{1,2,3,\ldots\}}(fn​)n∈{1,2,3,…}​ of arbitrary functions fn:Rd→Rf_n:\mathbb R^d\to\mathbb Rfn​:Rd→R, and every measure PPP on the standard measurable space of Rd\mathbb R^dRd, this predicate says that, for every bounded continuous real-valued function ggg on Rd\mathbb R^dRd, the real numbers ∫Rdg(z) dμfn(z)\int_{\mathbb R^d}g(z)\,d\mu_{f_n}(z)∫Rd​g(z)dμfn​​(z) converge as n→+∞n\to+\inftyn→+∞ through positive integers to ∫Rdg(z) dP(z)\int_{\mathbb R^d}g(z)\,dP(z)∫Rd​g(z)dP(z). Here, for each measurable set AAA, μfn(A)=∫A−max⁡{fn(z),0} dz\mu_{f_n}(A)=\int_A^-\max\{f_n(z),0\}\,dzμfn​​(A)=∫A−​max{fn​(z),0}dz, where dzdzdz is product Lebesgue measure and the lower integral is the supremum of integrals of measurable nonnegative simple functions below the integrand. More explicitly, for each such ggg and each real ε>0\varepsilon>0ε>0, there is a positive integer NNN such that the absolute difference between these two real integrals is less than ε\varepsilonε for every positive integer n≥Nn\geq Nn≥N; NNN may depend on ggg and ε\varepsilonε. There is no index 000, and there are no measurability, integrability, nonnegativity, or probability-density hypotheses on the fnf_nfn​, nor any finiteness, probability, or sigma-finiteness hypothesis on PPP. Both integrals of ggg are total Bochner integrals: any of them is defined to be 000 if ggg is not integrable for its respective measure, despite ggg being bounded and continuous. In dimension zero the state space is a singleton {∗}\{*\}{∗}, and this predicate is equivalent to convergence of max⁡{fn(∗),0}\max\{f_n(*),0\}max{fn​(∗),0} to the real mass P({∗})P(\{*\})P({∗}) when that mass is finite, and to 000 when that mass is infinite.

Human review
  • Endorsed by Shuze Chen · Sep 16, 2026

  • Endorsed by burkh4rt · Sep 16, 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