Lean Language: Using Code to Verify Mathematical Proofs — The Key for AI to Crack the Riemann Hypothesis?

Lean makes mathematical proofs machine-verifiable; RLVR may let AI search for proofs and spill over into software security.
Adam Marblestone argues that Lean turns mathematical proofs into machine-verifiable code, eliminating the ambiguity of human review and giving reinforcement learning a clear correctness signal. On this basis, RLVR can search for mathematical proofs much as AlphaGo searched for winning paths in Go. On whether AI can mechanically prove the Riemann Hypothesis, Marblestone is cautiously optimistic: technically feasible, but timing unpredictable. He also notes this capability can spill over into formal software verification, mathematically proving code cannot be attacked in specific ways, forming a new cybersecurity paradigm.
Can mathematical proofs be "verified with a single click" like code? In a recent talk, Adam Marblestone gave an affirmative answer: the Lean programming language is transforming how mathematical proofs are produced, and may provide AI with the key signal needed to tackle problems like the Riemann Hypothesis.
Lean: Making Mathematical Proofs Verifiable
The core value of Lean lies in turning pen-and-paper mathematical proofs into code that can be checked by a machine. According to Adam Marblestone, Lean is a verifiable language: "You can basically click verify, and it automatically checks whether the proof is correct. If Lean says it's right, then it's right."

This certainty eliminates the ambiguity of human review in traditional mathematical proofs. More importantly, it provides reinforcement learning (RL) with a clear correctness signal — a proof either passes verification or it doesn't; there is no in-between state.
Lean and Dependent Type Theory
Lean is built on Dependent Type Theory, a framework that treats mathematical propositions as types and proofs as values of those types. In Lean, writing down a theorem and giving a proof is essentially constructing a term belonging to a specific type; the compiler checks whether the type of this term matches the proposition, thereby determining whether the proof is correct. This is in the same lineage as type checking in traditional programming languages, but its expressive power is sufficient to encode almost all of modern mathematics. Lean was initiated by Leonardo de Moura at Microsoft Research in 2013, and its mathematical library mathlib has already gathered hundreds of thousands of theorems, becoming an important infrastructure for formalized mathematics.
RLVR and the Automated Search for Mathematical Proofs
Marblestone believes that applying RLVR (Reinforcement Learning with Verifiable Rewards) to mathematical proofs "will basically work." His logic is straightforward: since AlphaGo can find winning paths in Go through search, a similar approach can be used to search for mathematical proofs.

The key here is the verifiable signal provided by Lean. The outcome of a Go game is unambiguous, and the correctness of a mathematical proof can likewise be automatically determined by Lean. Both have the clear reward mechanism required for reinforcement learning, enabling AI systems to gradually approach the correct proof path through trial and error and search.
RLVR and the Sparse Reward Problem
RLVR (Reinforcement Learning with Verifiable Rewards) refers to a setting where the reward signal comes from automatically verifiable outcomes rather than human preferences or hand-designed reward functions. In the mathematical proof setting, Lean's verifier is the source of reward: a proof passes and the reward is 1, otherwise it's 0. This reward is sparse and binary, similar to Go where only the final win/loss matters. Reinforcement learning algorithms (such as policy gradients or Monte Carlo tree search combined with value networks) need to perform credit assignment under such sparse signals, attributing the final success or failure to each step in the proof search process. AlphaGo's success shows that when the environment's rules are clear and simulatable, the combination of search and learning can overcome the difficulty of sparse rewards; the formalization of mathematical proofs happens to provide a similar closed environment.
The Riemann Hypothesis: Possible but Not Inevitable
When asked whether this means AI will eventually mechanically prove the Riemann Hypothesis, Marblestone remained cautiously optimistic. He said "maybe, I'm not sure," and noted that no one can fully predict this, just as no one could accurately predict when Go would be conquered.

The analogy is worth pondering: Go was long regarded as a bastion of human intuition, but the arrival of AlphaGo changed the situation. Whether the automated search for mathematical proofs will achieve a breakthrough at some point is likewise hard to predict. But Marblestone believes that the existence of a verifiable signal makes this path at least technically feasible.
The Current State of Formalizing the Riemann Hypothesis
The Riemann Hypothesis is the proposition that all non-trivial zeros of the Riemann zeta function have real part 1/2, and is one of the Millennium Prize Problems offered by the Clay Mathematics Institute. Formalizing the Riemann Hypothesis in Lean is itself a massive undertaking: it requires formalizing complex analysis, the analytic continuation of the zeta function, the prime-counting function, and related mathematics. Currently mathlib already includes some foundations of complex analysis and analytic number theory, but it is still some distance from a complete statement of the Riemann Hypothesis. Even if the statement were formalized, automatically searching for a proof would be far more difficult than Go — Go's state space is large but its rules are simple, whereas the search space of mathematical proofs lacks a simple heuristic evaluation function and requires creating new mathematical concepts rather than combining moves under fixed rules.
From Mathematical Proofs to Secure Software
Breakthroughs in mathematical proofs also have direct practical value. Marblestone points out that Lean and the same proof methods can be used for formally verified software — "you can write mathematical proofs about software, showing that this code not only passes these unit tests, but that I can mathematically prove there is no way to hack it in these ways."

This means the cybersecurity field may see an entirely new defense paradigm. Traditional security relies on testing and patching, whereas formal verification mathematically guarantees that specific properties of code cannot be violated. Marblestone believes that if you can prove the Riemann Hypothesis, you can likewise prove extremely complex properties about extremely complex software, and then have LLMs synthesize provably correct software.
The Practice and Challenges of Formal Verification
Formal verification is not an entirely new concept — projects such as the seL4 microkernel and the CompCert compiler have demonstrated its feasibility, but these projects consumed a great deal of expert manpower. What's different about the Lean route is that it uses LLMs to automatically synthesize proofs, thereby lowering the cost of verification. However, formally modeling software behavior itself requires precise specifications, and the correctness of the specifications themselves is hard to guarantee automatically; moreover, real software depends on operating systems, hardware, and network environments, and formal models must make assumptions about these boundaries. The vision Marblestone describes of "having LLMs synthesize provably correct software" still faces the challenge of the gap between specification and implementation, but the verifiable signal provided by Lean at least makes automation of this process possible.
Three Core Judgments
Taken together, Marblestone's views can be distilled into three levels: Lean provides a machine-verifiable standard for mathematical proofs; RLVR makes AI proof search a viable technical route; and breakthroughs in mathematical proof capability will spill over into formal software verification and cybersecurity. The endpoint of this path is not yet known, but the direction is clear.
(This article is based on Adam Marblestone's talk on YouTube.)
One-line Summary
Lean makes mathematical proofs machine-verifiable; RLVR may enable AI to search for proofs and spill over into software security.
Paragraph Summary
Adam Marblestone argues that the Lean programming language turns mathematical proofs into code that can be automatically verified by machines, eliminating the ambiguity of human review and providing reinforcement learning with a clear correctness signal. On this basis, RLVR (Reinforcement Learning with Verifiable Rewards) can search for mathematical proofs much as AlphaGo searched for winning paths in Go. As for whether AI can mechanically prove the Riemann Hypothesis, Marblestone is cautiously optimistic, believing it technically feasible but hard to predict in timing. He also notes that this capability can spill over into formal software verification, mathematically proving that code cannot be attacked in specific ways, thereby forming a new cybersecurity paradigm.
Related articles

All-Attention Transformer: Architectural Innovation or Hype?
Exploring the All-Attention Transformer concept proposed on Hacker News, analyzing its potential advantages, technical challenges, and community reaction to assess whether this architectural innovation deserves attention.

D20 Bench: Testing LLM Dungeon Master Skills with Code-Based Scoring
D20 Bench is an LLM benchmark on Hacker News that uses code-based scoring to test how well models follow D&D 5E rules as Dungeon Masters. We analyze its design, strengths, and limits.

Brazil Sends Google the Bill: Fake AI Doctors on YouTube Trigger Regulatory Storm
Brazil demands Google bear financial responsibility for fake AI doctor content on YouTube. This regulatory innovation could trigger global chain reactions. The article analyzes the background, impact on platform business models, and new trends in AI medical content governance.