A Formally Verified Library of Mathematical Finance in Lean 4

summary

The gist

A Formally Verified Library of Mathematical Finance in Lean 4 describes a comprehensive machine-checked development of mathematical finance that yields certified unification of known results rather…

In short

This library provides a machine-checked foundation for mathematical finance using Lean 4. It rigorously verifies over three hundred theorems across eleven domains, including stochastic calculus and pricing models like Black-Scholes. The core contribution is a faithfulness audit system that ensures every result is provably correct based on its underlying axioms, offering verified tools for quantitative modeling.

Key concepts

Faithfulness-Audit Methodology
This is a classification system used to rate theorems based on how closely their formal Lean statement matches the actual mathematical claim. It uses four tiers (full to placeholder) to explicitly show the gap between what is proven and what assumptions are made, ensuring transparency in verification.
Continuous Itô Integral
The library constructs this integral as a bounded linear isometry on L2([0, T]). This means it provides a concrete, rigorously defined mathematical object for stochastic calculus that AI systems can use with verified structural guarantees instead of relying on sketched or assumed calculus definitions.
Static Girsanov Change of Measure
Instead of assuming the risk-neutral measure, the library derives it directly from physical laws using formal constructions like an Esscher density. This ensures pricing hypotheses are derived from foundational principles rather than being arbitrarily assumed in the model.

Terminology used across episodes

This episode discusses

The paper

A Formally Verified Library of Mathematical Finance in Lean 4 · Read on arXiv

Transcript

Introduction to the show: ident: Quantitative Finance. The day in quantitative finance: models of markets, risk and prices.

Ruth: We're looking at the paper: "A Formally Verified Library of Mathematical Finance in Lean 4".

Warren: Here's the gist of the paper. A Formally Verified Library of Mathematical Finance in Lean 4 describes a comprehensive machine-checked development of mathematical finance that yields certified unification of known results rather than new financial theory.

Ruth: Scope and Breadth The library spans eleven areas, providing more than three hundred sorry-free theorems across various domains in mathematics and finance.

Warren: This breadth includes continuous-time stochastic calculus foundations, no-arbitrage pricing foundations, Black–Scholes pricing (call and put formulas), the binomial model, futures, fixed income theory, portfolio theory, risk measures (coherence and CVaR), actuarial mathematics, and DeFi.

Ruth: The development is built upon Mathlib and the BrownianMotion package.

Title and authors: Ruth: So we're looking at this paper, "A Formally Verified Library of Mathematical Finance in Lean four" and the authors are Raphael Coelho <ref:2606.01356#pg1,A Formally Verified Library of Mathematical Finance in Lean 4>. It’s pretty ambitious to build an entire library of mathematical finance this way.

Warren: Am I missing something? It sounds like they aren't just writing a textbook or a collection of formulas; they're trying to create something machine-checked. That’s a big undertaking, especially when you think about the complexity of financial math.

Iris: I think the key word here is "verified." When you say verified, it means there's a formal proof that every single theorem in this library is absolutely solid, not just assumed or sketched out somewhere.

Ruth: Exactly. It’s about creating a system where the results are certified. They're taking established financial math and putting it into Lean four on top of Mathlib and the BrownianMotion package, to make it machine-checkable <ref:2606.01356#pg1,on top of Mathlib and the BrownianMotion package>.

Warren: So instead of just having some models that work, they want to prove *why* they work from a very rigorous foundation. That suggests a huge effort in structuring the underlying math itself.

Iris: Right. And what’s interesting is their goal isn't necessarily to invent new financial theory, but rather to achieve this certified unification of known results across eleven different areas of finance and math.

Ruth: That's the core idea, isn't it? They’re not trying to discover a new pricing model from scratch; they’re using this formal system to show that all these existing models fit together in one coherent, verified framework.

Warren: It shifts the focus from just getting a result that works on paper to proving that the underlying structure is sound under certain conditions. That’s a different kind of assurance for us as traders or model builders.

The paper's summary: Ruth: So, what does this library actually cover? It spans eleven areas, from the continuous-time stochastic calculus foundations all the way down to things like fixed income and even some DeFi applications. It’s quite a broad scope.

Warren: Eleven areas is a lot. I always worry that when you try to cover everything, you end up missing something important in practice. Is this truly comprehensive?

Iris: The paper states they have more than three hundred sorry-free theorems across all those domains, which they claim makes it one of the most comprehensive machine-checked developments of mathematical finance available right now.

Ruth: That number is impressive, but I want to know what that means for us. It means we can trust the foundational pieces of pricing theory—like no-arbitrage pricing foundations and Black–Scholes pricing formulas—because they've been checked extensively.

Warren: Trusting the foundation is good, but how do these theorems translate into actual trading strategies? Are we talking about something that lets an AI build a model on this base without needing to constantly re-verify every step?

Iris: That’s where the methodology comes in. They use a faithfulness-audit methodology where every theorem is classified by how closely its Lean statement matches the actual mathematical claim, using tiers like full, library wrapper, reduced core, and placeholder.

Ruth: That auditing process is crucial. It doesn't just give you a result; it tells you exactly how much faith to put in that result based on the level of proof verification they achieved.

Warren: So if I'm looking at a theorem that’s only in the "placeholder" tier, what does that tell me about its reliability? Is it just theoretical exploration, or is it something I can rely on for my risk calculations?

Iris: It means you know precisely where the gap is. The build-enforced gate called AxiomAudit pins the exact print axioms used for load-bearing theorems to ensure everything is sorry-free. This makes the difference between "we proved X" and "we proved a weaker X under added hypotheses" very explicit and checkable.

The paper's improvements: Ruth: Beyond just compiling the library, the paper highlights some really deep constructions they’ve done that go further than what earlier work usually assumes. They’ve built foundational objects that other researchers only sketch or assume exist.

Warren: Can you give me an example of one of these deep constructions? I mean, in finance, we often start with assumptions about the process itself, like assuming a certain type of diffusion.

Iris: One major construction is them building the continuous Itô integral as a bounded linear isometry on L two from zero to T. That means they are not just using an existing definition; they are constructing it and proving it behaves perfectly in terms of norms for stochastic processes.

Ruth: So, instead of taking the Itô integral as a given tool, they’ve built the tool itself and verified its properties rigorously. That’s a significant step up in foundational rigor.

Warren: That sounds like something that would give us more control over the noise term in our simulations. If you know exactly how bounded that integral is, it helps with understanding the errors when we try to price things continuously.

Iris: They also derived the risk-neutral measure directly from a static Girsanov change of measure instead of just assuming it exists. This process turns what was once a hypothesis into a proven theorem, specifically BSCallHyp. exists of physical >

Ruth: That’s significant for model building because it means the pricing hypothesis—that you can switch to the risk-neutral measure—is derived from physical laws and mathematical constructions, not just an assumption about market behavior.

Warren: If we can derive that measure this way, it strengthens the connection between theoretical finance and actual market dynamics. It makes the link more direct than just picking a Girsanov density that looks right for our specific asset class.

Conclusion: Ruth: So, to wrap things up on "A Formally Verified Library of Mathematical Finance in Lean four" the main point is that this work provides reusable verified foundations for mathematical finance <ref:2606.01356#pg1,A Formally Verified Library of Mathematical Finance in Lean 4>. It’s about creating a verified infrastructure we can build complex quantitative models on.

Warren: I see it as building a highly reliable toolkit where the results are certified, and the process itself is auditable by an AI system before any deployment. That infrastructure is what matters most for running real strategies at scale.

Iris: I think the most important part is that this library certifies when two independently built modules denote the same mathematics, like checking if different methods for calculating Markowitz portfolio variance are actually equivalent. It provides a benchmark of mathematical equivalence between different approaches >

Ruth: Exactly. It’s about providing certified unification across the field, showing that when we follow these formal rules, we arrive at the same verified truths. It’s less about finding a new financial theory and more about proving the consistency of existing knowledge >

Warren: For me, it means less time spent debugging foundational assumptions and more time building actual trading logic on top of a proven mathematical bedrock. That efficiency is key for anyone running a large quantitative system >

Iris: I just want to say that this work is most faithful where the mathematics is classical and elementary, but the partial cores are sitting at the continuous-time frontier, which tells us exactly where we are standing in this formalization effort >

Ruth: It’s a huge project, fifty-two thousand lines of code, reproducible via a pinned Docker image. It sets a very high bar for how we should be thinking about verifying complex quantitative systems moving forward >

Warren: Yeah, it's heavy lifting on the math side, but the promise is that once you have this verified library in place, the path to deploying models built on it becomes much more structured and trustworthy >

More episodes

← Home