A Lean 4 library for reusable, formalized statistics — 1,368 theorems, checked end to end.
Abstract. statlib builds the foundational layer that statistical and machine-learning formalization needs: stochastic-order asymptotics, uniform integrability, empirical-process tools, high-dimensional concentration, matrix analysis, conformal prediction, and nonparametric approximation on top of Mathlib. Every entry is checked end to end by the Lean compiler — no gaps, no hand-waving.
What's inside
statlib is built around three main boards, each a tree of topic areas formalized against Mathlib, with supporting packages in the full library tree. Today the work centers on these boards:
Statistical foundations
Statlib.StatFoundation The probability and statistics core the rest of the library builds on: stochastic-order asymptotics (big-O/little-o in probability, Slutsky), uniform integrability and integral convergence, conformal prediction, sufficiency and statistical inference, convergence and limit theorems, empirical-process tools, sub-Gaussian and sub-exponential variables, finite-dimensional Gaussian functional inequalities, Lipschitz concentration, and concentration inequalities.
Statistical inference & sufficiency
5 thm · 5 lemA measure-theoretic foundation for sufficient, ancillary, and complete statistics, culminating in the Lehmann-Scheffé and Basu theorems of classical estimation theory.
Convergence & limit theorems
32 thm · 51 lemFormalizes the central limit theorems (IID, Lindeberg-Feller, multivariate), the Lévy continuity and Cramér-Wold tools behind weak convergence, and uniform laws of large numbers including Glivenko-Cantelli.
Stochastic-order asymptotics
82 thm · 4 lemBig-O and little-o in probability, rate bounds, Slutsky-type product theorems, and convergence bridges connecting stochastic orders to classical limit theorems.
Uniform integrability
25 thm · 0 lemUniformly integrable families, Vitali convergence, integral-convergence bridges, and conditions ensuring L¹ convergence from convergence in probability.
Empirical processes
9 thm · 6 lemRademacher complexity, contraction and symmetrization tools, Dudley entropy, bounded-difference controls, and quantitative Glivenko-Cantelli statements for uniform deviation arguments.
Tail behavior of random variables
94 thm · 70 lemConcentration and tail-bound theory for sub-Gaussian and sub-exponential random variables, plus Gaussian functional inequalities culminating in dimension-free Lipschitz concentration.
Concentration inequalities
37 thm · 2 lemTail and moment bounds controlling how sums and functions of independent (or martingale) random variables deviate from their means.
Conformal prediction
13 thm · 0 lemConformal inference foundations: exchangeability, nonconformity scores, conformal quantile regression, and finite-sample coverage guarantees.
Roadmap. Grow shared vocabulary as concepts get reused across areas, broaden the estimation, testing, empirical-process, and asymptotic foundations, and expand stochastic-order and conformal-inference toolchains.
High-dimensional statistics
Statlib.HighDim Statistics in the high-dimensional regime: matrix concentration (Hanson–Wright, matrix Bernstein), Wedin sin-theta perturbation, covariance estimation, L1 quadratic-process analysis, L1 RSE bounds from covariance, high-dimensional geometry, regression, and debiased LASSO inference.
Matrix analysis
70 thm · 101 lemOperator-convexity, trace exponential, Lieb concavity, variational, quantum-relative-entropy, and Wedin sin-theta infrastructure supporting matrix concentration and spectral perturbation.
High-dimensional concentration
38 thm · 110 lemConcentration inequalities for high-dimensional random objects — sub-Gaussian maxima, the matrix Bernstein inequality for sums of independent random matrices, and the Hanson-Wright bound for quadratic forms.
Covariance estimation
7 thm · 24 lemConcentration and unbiasedness guarantees for the sample second-moment (covariance) matrix estimator of high-dimensional sub-Gaussian random vectors.
High-dimensional geometry
11 thm · 53 lemGeometric foundations of high-dimensional statistics: covering numbers, Johnson-Lindenstrauss dimension reduction, isotropic and anisotropic RIP, and restricted eigenvalue transfers.
High-dimensional regression
59 thm · 9 lemOracle inequalities and debiased-inference guarantees for sparse high-dimensional linear models, from restricted-eigenvalue LASSO bounds to asymptotic Wald coverage.
Spectral perturbation
4 thm · 48 lemQuantitative bounds on how a matrix's eigenvalues and eigenvectors move under perturbation, applied to high-dimensional PCA via sample-covariance concentration.
Roadmap. Strengthen the operator-convexity, matrix-concentration, covariance, RIP, spectral-perturbation, debiasing, and regression theorem chains; extend L1-process results to broader design matrix families.
Nonparametric statistics
Statlib.Nonparametric Approximation and risk vocabulary for nonparametric statistics: finite sieves, Holder classes, high-order tensor-product B-spline and wavelet approximation, RKHS and neural-network rates, conformal quantile regression, and oracle interfaces.
Nonparametric approximation
276 thm · 2 lemApproximation-error bounds for finite sieves, Holder balls, splines, wavelets, RKHS balls, and neural-network candidate classes.
Oracle interfaces
1 thm · 0 lemRisk and oracle-comparison interfaces for estimator classes, prediction losses, and candidate families.
Roadmap. Fill in the remaining nonparametric approximation chains while keeping the sieve and risk interfaces reusable across estimators; extend conformal-prediction results to broader nonparametric settings.
Selected results
Wedin sin-theta theorem for singular subspaces
For Ahat = A + E with a separated top-r singular spectrum and small operator-norm perturbation, the left and right singular subspace projectors move by at most a Wedin sin-theta bound.
wedin_sin_theta Debiased LASSO standard Wald interval coverage
An iid-score debiased LASSO theorem: row-approximation error, L1 consistency, studentization, and Gaussian critical-value calibration imply asymptotic standard Wald confidence-interval coverage.
tendsto_measure_debiasedLasso_standardWaldCI_coverage_iidScoreSum_real Holder-smooth ReLU approximation at the -2s/d rate
An explicit fixed-width construction is converted into the architecture-scale ReLU approximation rate (L W^2)^(-2(r+beta)/d) for high-dimensional Holder-smooth functions.
holderSmoothBall_unitCube_LW2_rate_from_fixed_width_M_rate High-order multivariate B-spline Holder rate
A positive-degree tensor-product B-spline system on the high-dimensional unit cube achieves the uniform squared-error sieve rate m^(-2(r+beta)/d) over the trace Holder-smooth ball.
unit_cube_bspline_high_order_holder_smooth_uniform_sieve_approximation_rate Rectangular matrix Bernstein inequality
The matrix Bernstein bound extended to sums of independent centered rectangular p×q random matrices via Hermitian dilation, with variance the max of the two one-sided second-moment norms.
matrix_bernstein_rect Gaussian concentration for Lipschitz functions
An L-Lipschitz function of a vector with independent standard Gaussian coordinates has a dimension-free two-sided Gaussian tail around its mean.
gaussian_lipschitz_concentration Dudley entropy integral
A chaining-style entropy integral control for finite sub-Gaussian processes.
dudley_entropy_integral Built to be reused — and extended
statlib aims to fill a foundation gap: reusable, machine-checked infrastructure for statistics and machine learning, built only on Mathlib. Read how it's designed, or help extend it.