← All papers
First page of A Formally Verified Library of Mathematical Finance in Lean 4

A Formally Verified Library of Mathematical Finance in Lean 4

Raphael Coelho

q-fin.MF May 31, 2026 · v1
Builds a sorry-free mathematical finance library in Lean 4 on Mathlib and BrownianMotion, covering stochastic calculus and pricing.
We describe a library of mathematical finance built in the Lean 4 proof assistant, on top of Mathlib and the BrownianMotion package. It is broad: more than two hundred sorry-free theorems across eleven areas, from the measure-theoretic foundations of continuous-time stochastic calculus through derivative pricing to applied risk, portfolio, and fixed-income theory, and, to our knowledge, the most comprehensive machine-checked development of mathematical finance to date. Breadth is the setting, not the point. Two things make it more than a catalogue. It reaches into the continuous theory far enough to construct the L2 Itô integral as a bounded linear isometry and to derive, rather than assume, the risk-neutral pricing measure. And it audits its own faithfulness: every result is classified by how its Lean statement relates to the mathematics it claims, and a build-enforced gate pins the axioms each proof actually uses, so a reader can see precisely what has been proved and what has only been proved under added hypotheses. We close with a candid finding: a formal base over classical financial mathematics yields certified unification of known results rather than new financial theory. The contribution is therefore methodological and infrastructural, reusable verified foundations for mathematical finance, together with the faithfulness audit.

Formalized mathematical finance in proof assistants is narrow and incomplete: prior work covers only isolated models (CRR in Isabelle, a single Ito-to-Black-Scholes derivation in Lean 4), and none offers a systematic way to state how faithful a formalization is to the mathematics it claims.

The authors build a broad Lean 4 library of mathematical finance on top of Mathlib and the BrownianMotion package, spanning eleven areas with over 200 sorry-free theorems. The library constructs the continuous L2 Ito integral as a bounded linear isometry, derives the risk-neutral pricing measure via a static Girsanov change of measure rather than assuming it, and proves the binomial-to-Black-Scholes scaling limit. A four-tier faithfulness audit classifies every theorem by how its Lean statement relates to the mathematical claim, backed by a build-enforced axiom gate that pins the exact axioms each proof uses.

The library contains 251 sorry-free theorems across eleven areas, with 204 classified as full formalizations and 28 as reduced-core (holding under added hypotheses). This is the most comprehensive machine-checked development of mathematical finance to date, covering derivative pricing, risk measurement, portfolio theory, and fixed income in a single coherent framework.

this workNagy (2026)Echenim-Peltier (2017)
proverLean 4Lean 4Isabelle/HOL
scope11 areas, 251 theoremsone derivation (Ito to BS)one model (CRR) + completeness
continuous Ito integralconstructedstructurally verified-
risk-neutral measurederived (Girsanov/Esscher)derived (two-state FTAP)assumed
faithfulness audityes (4-tier + axiom gate)--
Comparison with prior formalized-finance work
tiercount
full204
library_wrapper19
reduced_core28
placeholder0
Faithfulness tier breakdown