← All papers
First page of From Lecture Notes to Lean: Formalizing a Textbook on Probability Theory

From Lecture Notes to Lean: Formalizing a Textbook on Probability Theory

Shuo Deng, Kenneth W. Shum

cs.LO Jul 29, 2026 · v1
Formalizes a fourteen-chapter measure-theoretic probability textbook in Lean, building bridge lemmas connecting textbook statements to Mathlib's general measure-theory interfaces via an agentic workflow.
As large language models become increasingly capable of generating mathematical arguments, mathematics is likely to face not a scarcity of proofs but an abundance of plausible ones. In such an environment, verification, exposition, and incorporation into reusable mathematical infrastructure become central tasks. We report on an ongoing Lean formalization of "Measure-Theoretic Probability: With Applications to Statistics, Finance, and Engineering", a fourteen-chapter upper-level undergraduate textbook covering topics from Riemann–Stieltjes integration to martingales and limit theorems. The project produces a machine-checked companion to the textbook and contributes reusable infrastructure for future formalizations involving probability theory. A Lean formalization provides computer-checked statements and proofs, makes hypotheses explicit, and allows readers to inspect the precise logical content of textbook results. A central challenge is to bridge textbook-facing statements with Mathlib's more general measure-theoretic interfaces. We reuse Mathlib results when possible and introduce reviewable interface lemmas when the textbook formulation and library abstraction differ. The project illustrates how formalized textbooks can support teaching, clarify mathematical assumptions, and help build the formal foundations needed for reliable AI-assisted mathematics.

As AI generates abundant plausible proofs, verification and reusable mathematical infrastructure become central. There is a need to expand the formal corpus of probability theory available to human formalizers and AI agents.

An ongoing Lean formalization of the textbook 'Measure-Theoretic Probability' covers all fourteen chapters, including definitions, theorems, examples, and problems. Mathlib results are reused directly when interfaces match; otherwise reviewable interface (bridge) lemmas connect textbook-facing statements to Mathlib's more general abstractions like the Bochner integral. The work was carried out with an agentic AI-assisted workflow inspired by APOLLO, separating source, mathematical, and process artifacts, followed by build checks and human source-fidelity review.

The target textbook contains 81 definitions, 127 theorems, 107 examples, and 134 problems, with examples and problems not yet complete. Representative cases include bridging the strong law of large numbers (mutual vs pairwise independence) to Mathlib's strong_law_ae, and aligning textbook Lebesgue-integral definitions with Mathlib's lintegral and monotone convergence theorem.