Statistical Learning Theory in Lean 4: Empirical Processes from Scratch
Yuanhe Zhang, Jason D. Lee, Fanghui Liu
TL;DR
This work delivers the first end‑to‑end Lean 4 formalization of statistical learning theory anchored in empirical process theory, building a comprehensive toolbox for Gaussian analysis and Dudley’s entropy integral from scratch. It defines and proves a localized empirical‑process framework, enabling sharp rates for least‑squares regression and high‑dimensional l1 regression, with formal machinery such as Gaussian Lipschitz concentration and entropy integration. The results are implemented in a large Lean 4 codebase (~30k lines) through a human‑AI collaboration, demonstrating scalable formal verification and reusable foundations for future ML theory. By making implicit probabilistic and topological assumptions explicit and machine‑checked, the work advances rigorous theoretical analysis for modern ML systems and opens avenues for automated reasoning in statistical learning.
Abstract
We present the first comprehensive Lean 4 formalization of statistical learning theory (SLT) grounded in empirical process theory. Our end-to-end formal infrastructure implement the missing contents in latest Lean 4 Mathlib library, including a complete development of Gaussian Lipschitz concentration, the first formalization of Dudley's entropy integral theorem for sub-Gaussian processes, and an application to least-squares (sparse) regression with a sharp rate. The project was carried out using a human-AI collaborative workflow, in which humans design proof strategies and AI agents execute tactical proof construction, leading to the human-verified Lean 4 toolbox for SLT. Beyond implementation, the formalization process exposes and resolves implicit assumptions and missing details in standard SLT textbooks, enforcing a granular, line-by-line understanding of the theory. This work establishes a reusable formal foundation and opens the door for future developments in machine learning theory. The code is available at https://github.com/YuanheZ/lean-stat-learning-theory
