This is really cool, and I love your ask of the labs.
I think if Astra or Claude found an exploit to derive anything in Lean, RL would quickly propagate that exploit to be used on any hard problem the models couldn't otherwise solve and the labs would see the models apparently proving everything, no? The LLMs in the lab's RL gyms may already be desperately searching for exploits in Lean, because that's what we've been training them to do. The good part of Goodhart.
Edit I missed that Terry Tao said the same thing as my comment in the screenshot of the quote from Leo de Moura
My understanding (for various reasons including this tweet from an ex-OpenAI post-training engineer) is that OpenAI has been creating and checking proofs purely in natural language, and then Lean-formalizing them as an optional second step, only after they believe that they have a complete and correct natural-language proof.
I think it’s unlikely but not completely impossible that we could be in a situation where the Lean-formalization step always “works”, even for broken proofs, but where nobody at OpenAI has yet noticed that there’s something fishy going on with their Lean-formalization workflow.
where nobody at OpenAI has yet noticed
I don’t have good guesses either way, but I always remember being surprised that for DeepSeek’s ProverV2 even a small model was able to exploit a technique that held up to enough scrutiny to make it into v1 of their paper:
v1:

v2:

This is really fun to interpret now, since it is now very possible that for the NS proof, that the natural language proof does not match the formal proof. And apparently no human nor OAI researchers were able to comprehend that proof and find the mistake.
Right, the exploit would surely propagate.
Maybe a good comparison is Hugging Face. There, an exploit was found, and it propagated through the message board and soon all of the agents who were stuck could use the exploit. Somehow this capabilities increase was not enough to trigger an internal audit, so I don't know!
Yes, this was also my intuition, which is why I've always assumed that worries about bugs in the Lean kernel are overblown.
Is it possible that some Lean bugs are only exploitable on certain problems? Or would pretty much every useful bug allow you to prove that True = False? It may not be obvious if the AI were to find the former kind of bug.
To protect against an exploit that the AI discovers sometimes but hasn't yet fully propagated, you could offer it extra reward for proving that True = False.
There are two kinds of bugs: one where Lean refuses to accept a true proof, or one where it accepts a false proof. The first is annoying but harmless. In the case of the second, there's some proposition P for which you can prove both P and not-P. And by a standard logical gyration, you can prove anything at all, true, false or indifferent, from (P and not P). It's called the principle of explosion, or ex falso quodlibet. So no, you can't hope to survive a small bug where only a few false things can be proven.
You're assuming every proposition is true or false. There's some that can neither be proven nor disproven, like Euclid's fifth postulate or the Axiom of Choice. Or if you're using ZFC, the existence of a set that's bigger than natural numbers and smaller than real numbers. If it proves one of those, there's no contradiction, but it implies the axiom system it's working with is more powerful than it really is.
Edit: Looking at this again, I don't think you assumed that? I don't know why I wrote this comment.
It's also conceivable that Lean is unsound, but it's hidden behind a large activation energy and there's been signal to learn from. The AI could find the unsoundness if it were looking, but all past thoughts on Lean exploits have been a waste of time and the AI's been reinforced out of ever doing that. In order to get thoughts about unsoundness, you'd have to direct the AI to think in that direction.
The hugging face attack shows that you don't need to direct AI at finding a bug in the Lean kernel. Translating the hugging face attack to this scenario: You just need to give it a math problem it believes is more difficult then finding a lean kernel exploit. And since it is now public knowledge that lean has had kernel soundness bugs in the past, any pretrained model might see this as a possibility of passing their task.
Frontier labs' NDAs are virtually airtight; even if they found those FLT-level verifications were actually relying on bugs, they have the option to slow-walk the disclosure and wait until IPOs.
Labs gain a lot from announcing breakthroughs. Do they gain as much from quickly disclosing later corrections?
Curated. In recent days, some strong words have been applied to the OpenAI math results (90 of 500 top problems), things like "biggest day ever in mathematics" or similar. I am not sufficiently knowledgeable about math to judge; however the claim "verified by Lean" felt like it at least said, whether or not these results were a big deal, they were trustworthy in a sense.
This post casts real doubt on that. I did not realize that Lean was much less than completely watertight. The fact that models could be exploiting the issues (as they are so good at) is a reason for further questioning.
So now I am very interested to have humans work through the novel proofs and figure out what fraction hold up to scrutiny? It'll be pretty scandalous if it turns out actually a good chunk of the results were exploits of the Lean kernel.
I guess to the mathematicians this is good news. Still work to be done!
Thank you, Milo, for raising this to everyone's attention. Kudos!
Question from someone who doesn't deeply understand type theory but thinks Lean is really cool; if I'm expecting to write proofs that are pretty vanilla mathematics, can I avoid this issue entirely by doing something like running the verifier with a flag like `--without-nested-inductive-types`?
Would a proof that Lean4 - nested inductives is consistent with respect to ZFC + any large cardinal axiom help bound the problem? Or a characterisation of what you get by taking nested inductives out of the picture / where it becomes more incomplete than you would ordinarily like?
I'm mostly wondering if there would be value in establishing bounds on how bad things are. If it is "just" nested inductives that feels different to "nested inductives and a bunch of other things we can't even establish with nested inductives in the frame".
I'm not offering, I'm just curious. I already burn my marginal token usage on other things.
I also find it very unfortunate Lean4 became a sort of standard when its foundational state is so poor. I do find it hopeful that we migrated from Lean3 to Lean4, so we probably still can migrate to something else. I note that this is very specific to Lean3/Lean4 and other systems have considerably better foundational state. For example, I consider 2006 proof of HOL Towards self-verification of HOL Light basically adequate for its foundational state (its large cardinal axiom is very modest).
I agree. Lean5 maybe will be built around something like one of the type-theory-in-type-theories that are getting built with QIITs... concrete efficiency for these massive searchers seems important more than metaprogrammatic ergonomics. semirelated (for building upon hol-reflection) https://github.com/emberian/svenvs tries to do some explicitly self-verified self-improving confinement...
I've been sticking my head in the sand partly because it is so painful to watch these other communities slowly do the meaning-making that has already been done about these tools and their trustworthiness. I should probably find some group to join at this point though :) maybe what @simeon_c is up to and mentioned earlier. I'm not really sure. since I was last ircposting as cmr many things have changed :)
I don't see this intuition pump much, but it makes it easier for me to think about self-verifying type theories when I think about type theories as just functions Term x Type -> Bool. From here partially applied, Types can be thought of as predicates on terms Term -> Bool. In that context, type theories are families of such predicates and validating just means writing those type as predicates in the form of a Term and defining other types (predicates) that say certain things about those terms.
I think the possible consistency questions are a minor part of the problem. The real core problem is having to continually transfer/keep-in-sync the mathematical model of how Lean's type theory should work with how the type-checking kernel actually works in C++ and how the elaborator turns statements into underlying logic. While the elaborator is a more minor participant, as it ~can't convince the kernel of a false statement, the elaborator can have bugs that obscure whether something was truly proved or whether the elaborator turned it into a simpler statement.
So, how do you avoid needing to continually keep the mathematical model and the language itself in sync? The most direct way is to formalize C++, and prove that the Lean kernel implements the type theory (up to fuel bounds and whatnot) & that the elaborator has no/limited routes to obfuscating. This can work, but also good luck formalizing C++. Feasible especially with AI agents but the amount of dark corners that the agents may skip over and thus introduce more space for weird bugs is quite large. We shouldn't aim for that, even though we will have such a formalization eventually, as we want a trusted core language and minimizing that is useful.
The alternative way, and which I prefer, is transforming Lean into a proper programming language. Why are we implementing simple sorting functions twice between the C++ implementation and the formal model, much less implementing complex kernel procedures that need to be painfully correct and importantly efficient for the scale that mathematics and software operates at? The first challenge with that transformation is bootstrapping, but that's feasible to work around. Lean in its current state can bootstrap as it can run code and prove it correct up to their basic model, Rocq can produce executable code, and so on. There is still fundamental trust issues here, but you can plausibly sidestep over-trusting the odd details of Lean's foundations. Multiple implementations that produce a basic typechecker that is then used to produce a better more fundamentally type-checked kernel is one method. The second issue is really just that Lean is not a very good language for actually programming, especially efficiently. If we want secure code beyond just Lean and mathematics, then we'll want a language that actually has a high quality model of the hardware, and lets one talk about low-level operations and how they relate to the code you wrote. We should have a language that big software projects such as OpenSSL/Chromium/Linux/etc can (eventually) be rewritten into with the ability to prove the correctness of code, rather than slowly iterating on issues by throwing tons of compute at finding hidden bugs like Glasswing and such.
I've been thinking if what we want is secure but efficient code, then maybe what we want is Lean code that outputs Rust code, or whatever.
Back in grad school I did some programming in domain-specific languages embedded in Haskell. It was pretty cool, I'd create the program as an object in Haskell, then it would output C code implementing the program.
Of course there was no verification here. But I guess in Lean, we could prove some kind of guarantee about the generated Rust code? Like, prove a property about the program object in Lean, and prove (with a model of some fragment of Rust) that the code generator is faithful.
I think it'd be better to have a Lean-like language directly output assembly for its functions. A type theory with ability to intensionally reflect on code (ex: DeLaM) would make this easier, but isn't essential. Then you don't need to prove translation to C or Rust is correct and that the translation from C/Rust to assembly is correct. You just prove that the translation from Lean-like to assembly is correct.
With proofs, we "just" need to develop a model of the underlying machine and the assembly that is accurate.
Then build a compiler that requires proofs about equivalent behavior between the abstract function and the compiled function (on the model of the machine). Which can be heavily modularized and automated to not showup in front users that often, but also AI makes extra boilerplate less problematic.
There's challenges here.
Like ensuring the model of the architecture is accurate, but that's something any compiler has to do even if not to the formal level.
Or how to compile more mathematical logic into efficient code. Nat is slow relative to using a proper native u64, and in many cases you can just use the smaller bitwidth. Nontrivial to infer.
Or issues around Lean not being designed to compute for a lot of more mathematical parts of mathlib. Like Polynomials, I believe.
But none of this is infeasible, it "just" requires lots of engineering work. And ideally the compiler is in the same language, so then you can prove useful correctness properties directly.
That is, imo, we shouldn't try to use the languages of old because that translation to them still requires trusting them more than we need to. I have a project I've contemplated for some years now but it is unfortunately a lot of work even with modern coding agents.
Yes this is theoretically possible - Lean4 might be consistent, but not provable with respect to any standard axiomatic system. However, at this point mathematicians have a pretty solid intuition for what statements are/aren't provable, and intuition strongly suggests that if we're clever we'll be able to find a proof for Lean4.
mathematicians have a pretty solid intuition for what statements are/aren't provable
Do you mean provable or decidable? And what makes you say that?
(The reason for my question is that:
Really awesome post. Just some questions below because the 2% you gave is rather low and my personal estimate would easily be off by an order of magnitude (closer to 20%). So the questions below are meant to see where that difference is coming from.
"I am 2% certain that we will soon be putting huge amounts of trust into Lean4 certificates produced by misaligned AIs."
Can I ask you more precisely where your 2% is coming from? I.e. can you give some separate odds for the two closely related statements?
1) We will soon be putting huge amounts of trust into Lean4 certificates.
2) We will soon be using misaligned AI's to generate lean certificates.
I'm also curious what is meant by misaligned AI in this post, i.e. how severely misaligned does it have to be? I.e. in the context of the post there are two reasonable interpretations
a) The AI is happy to exploit a kernel bug and use it to claim it found a proof of mathematical theorem.
b) The AI is misaligned in such a way that it actually is likely to lead to an existential catastrophe when it is allowed to recursively self improve?
Or did you have something in mind somewhere between a and b? As this chance severely depends on how misaligned one would require the ai to be.
I think interpretation a) is reasonable since the post is about lean4. While interpretation b) is reasonable since you speak about pivotal act.
Also regarding the lean certificates, will it be lean certificates of just mathematical theorems that the math community cares about. Or will it be lean certificates of statements that are relevant for alignment research?
Dear Maarten,
Interpretation (b) is what I meant.
The full claim is "I am 2% certain that we will soon be putting huge amounts of trust into Lean4 certificates produced by misaligned AIs, and that the human work we do as a community thinking about and fixing Lean4 in the next 24 months would fall under Less Wrong's classification of a pivotal act."
The fact that we'll be putting huge amounts of trust into Lean4 certificates produced by misaligned AIs is like ~99% (or by many definitions is already happening). The part that brings the estimate down to 2% is the second part about the pivotal act.
Pivotal act is a guarded definition on Less Wrong, and I take that very seriously. It refers to "actions that will make a large positive difference a billion years later". Billions is huge! Such a distant future require significant discounting for uncertainty. That's where 2% comes in.
My level of confidence depends strongly on a proof-by-proof basis. There's been a slew of Lean4-validated proofs lately, without a standardized level of rigor. I put it at ~40% chance that one of the recent high-visibility Lean4-formalized proofs ends up needing to be retracted, but what dominates that estimate is statement mistranslation, not soundness issues.
By "statement mistranslation", do you mean that in some steps of some proofs, the proof should be proving statement A, but proved a similar statement B instead?
I asked this because LLMs usually modify my statements to generate a proof. Though I am not sure if this also happen inside those lean-formalized proofs.
Yeah, for instance https://arxiv.org/abs/2610.08144. I liked the discussion in Section 4
The slippage is between the English statement of the proposition to be proven, and the Lean form of the proposition. You could leave out a clause when translating into Lean, or ask about the normal regular case when you meant to ask about the regular normal case. Since most propositions are pretty short, it's a relatively hard error to make. Once it's written in Lean, you can rely on the claimed proof being an actual proof (modulo sea monsters).
Godel's Incompleteness Theorem says that a sufficiently expressive theory will never be able to prove its own consistency. What you can do is prove one theory's consistency using another theory. It's perfectly fine to have a proof of Lean4's consistency within ZFC + large cardinals.
Maybe what you have in mind is something like: "How is it possible that con-leche can claim to give a proof of its own consistency"? The trick is that you start with "con-leche + strong set theory assumptions" and you conclude "con-leche is consistent". What you do NOT get is a proof of "con-leche + strong set theory assumptions is consistent". You use the stronger theory to prove the consistency of the weaker theory.
Since Astra is flagging your requests as "cybersecurity"; maybe you could apply for OpenAI's cybersecurity program, Project Daybreak? It seems to be GPT 5.6 Sol, and not Astra, but could perhaps be helpful.
Good points. This makes me think things like Lean4 might just be the wrong sort of target language for AI-math. One of the design constraints Lean4 was built under is to make stuff easy (or at least easier) for human authors to prove things in. But given how things have changed, the primary design consideration for AI-piloted proof languages ought to be to make sure we can trust arbitrarily long outputs without having to comb through them. OP has cast significant doubt on this for Lean4 specifically.
Given also that modern LLMs are now good enough to straight-up read and write compiled assembly code (given what various claims video game modders have made), I wonder if the right move for getting trustworthy mathematical results out of modern LLMs would instead be to implement the simplest verifier we can get away with and target that instead. The most extreme version of this would be to make a verifier for First Order Logic and the ZFC axioms (plus optionally large cardinal axioms) and just use that as the AI's compilation target. If it's just a clean implementation of FOL+ZFC itself, then there really shouldn't be any room for Sea Monsters to hide.
Of course, if we do only that, we leave the poor human mathematicians with a way bigger headache around verifying that the thing being proved is in fact the thing they want to prove. However, I imagine we could get around this by implementing a separate human-readable-definition-to-FOL+ZFC compiler (Caveat: there might still be some limits about what the theorem can actually say; maybe we can't express the sort of theorem that lives way up in type-theory-land. But if it's just a statement about the integers, or real numbers, or groups, etc. this looks doable.) This would let humans express complex math at all without drowning in pages upon pages of quantifiers.
Now granted, the definition compiler would be a more complex piece of software that can understand types and could in fact be subject to bugs just like Lean4. However, I think this would still be a substantially improved situation because said definition compiler wouldn't end up targeted by adversarial AI optimization. In this vision, human mathematicians would write down want they want to prove, compile it down to FOL+ZFC with the definition compiler and only then hand it over to the AI and demand a raw FOL+ZFC proof. Bugs in the definition-compiler would only bite us if the human mathematician chances into triggering one (while in the current situation all of Lean4 is an AI attack surface).
Caveats: There are a few ways I could imagine this trick failing. First, maybe proofs expressible in Lean4 could actually cost exponentially many tokens to say in raw FOL+ZFC (this worry makes sense if we think of the types acting as something like macros). But, it's not immediately obvious that those costs are irreducible, that the AIs wouldn't be able to find clever shortcuts through FOL+ZFC itself which don't correspond to the sorts of exponential bloat one might get when compiling something like Lean4 naively. Second, it's plausible that Lean4 ends up being an easier language for the AI to think in than raw FOL+ZFC. The assembly language results in coding are mild evidence against this. It also presumes the AI couldn't be coaxed into creating and using its own internal compiler that would compile something "easier for it to think in" into FOL+ZFC. (If either of these obstacles prove substantial the right move may then be to back off a bit and climb a little higher up the abstraction hierarchy, but only go as far as needed to make the system workable.)
We already have theorem provers in the HOL family — they assume even less than ZFC.
But a lower-level language means elaborated statements are harder to read and compare to the originals: you'll never prove a false theorem, but did you prove the right one?
I apologize for the rush, I didn't addresses your whole post. But there's quite a bit of existing debate between different theorem provers and I'm not sure I can summarize this all. "How well can we express abstract algebra in Isabelle (the most mature HOL prover)" is part of that debate and related to one of your questions.
For those who are unfamiliar, the recently launched Palomar Registry project addresses a number of current Lean weaknesses. It reduces the chance of formalization gaps and proofs exploiting Lean kernel vulnerabilities, making it more reliable than Lean alone. It does not address one of the major points Milo raises though, which is the open question of whether Lean's underlying type theory is fundamentally consistent with ZFC (+large cardinal axioms).
Appreciate the post Milo!
I'm building a company, that I co-founded with @davidad, where we're building formal verification infra for the cyber-physical universe at large. Among others, we're building a Lean for the real-world that aims to bypass these issues by having solid theoretical foundations, that are then translated in a logic ; as a desiderata, we're also building it such that it scales to MB/GB-scale proofs, which will be required for proofs about real-world complex systems. We have made strong progress, which we will talk about more publicly in the coming months, once what we have built is mature enough for a broader community to build on it.
Although the article mentions practical reasons that the Lean software might be unstable, it still has strong theoretical foundations, in a sense. Dependent type theory has been used by many theorem provers up until now (Agda, Rocq, Nuprl, and now Lean), and this fact is based on trust of this theory. Just letting you know that finding an alternative is not trivial.
From what I understand, proof theory and dependent type theory are tied together through the Curry-Howard correspondence (isomorphism).
One of the nested inductive types described in one of the papers linked above is the RoseTree type. Its constructors are:
leaf : A -> (RoseTree A)
node: (List (RoseTree A)) -> (RoseTree A)
with type parameter A: Type. So an interesting question is: Is there a way to define this type without resorting to nesting? I think the answer is yes.
The thoughts: Let's consider a simpler case: Instead of a list of arbitrary length, we'll just ask for a pair of subtrees. The resulting definition with nesting:
leaf : A -> (BinaryTree A)
node: (Pair (BinaryTree A) (BinaryTree A)) -> (BinaryTree A)
To get rid of the nesting, we just have to observe that to have a pair, we just need to be able to extract the first element of the pair, and also the second element of the pair. Here are the non-nested versions of the constructors (leaf was already non-nested, so it's unchanged):
leaf: A -> (BinaryTree A)
node: (Bit -> (BinaryTree A)) -> (BinaryTree A)
where Bit is, as expected, a type with two values: zero and one. This new version asks for a function that maps a Bit to a subtree. Since bit has two possible values, to define such a function we must provide two subtrees. There is little difference between asking for that kind of function, and asking for a proper Pair. Similarly, for rose trees, we could write:
leaf: A -> (RoseTree A)
node: n:Nat -> ((FiniteSet n) -> (RoseTree A)) -> (RoseTree A)
where FiniteSet is a type with a natural number parameter n, with exactly n elements. Now the node constructor asks for a length n and a function from (FiniteSet n) to rose trees (which is like asking for a list of n subtrees). So given that n is arbitrary, this constructor is a good substitute for its previous version, which asked for a list that could have arbitrary length.
Given that Pair is basically the same as And, can we figure out a trick for Or also? Yup. We basically just replace the n:Nat field above with a b:Bit field. Then to ask for (Or P Q), we ask for a field of type (if b P Q), where if is an if/else expression (represented with the ternary ... ? ... : ... operator in some programming languages). So: ... b: Bit -> (if b P Q) -> ...
The first comment from Milo about how "the Lean kernel always catches mistakes" is the sort of think you'd ding a first-year CS student for. Nobody has ever written perfect software, and nobody ever will. There are two obvious sources of problems with proving the correctness of any bit of software:
The discussion in this thread about whether or not the system can be proven to be consistent is the second of these types of errors. However, I find the claim that "because no RL-trained system has broken our software therefore it is unbreakable" to be equally dubious.
Thanks Milo this is so interesting.
What is this "comparator" thing that takes all the runtime? The comparator is an extra tool which is useful for making sure that malicious code in the proof body does not mess up the theorem statement during the elaboration+compilation process. This is something you have to worry about even if you trust the kernel completely. As you can see, it takes a long time to run.
This reminds me of LLVM tools like UBSan which compile code from unsafe languages like C++ with extra checks to find (some) bugs that would otherwise be somewhat invisible.
In practice though, what kind of malicious code does the comparator protect against? Is it a kind of sandboxing system that makes sure the proof body doesn't, like, have side-effects and overwrite arbitrary files with its own data? Or is it more subtle than that?
Assuming that Lean4 is consistent, then a proof should exist and we should be able to find it.
I am confused.
Given something like Gödel’s incompleteness theorems, I would have expected: “Even assuming that Lean4 is consistent, a proof may not exist”, and, given standard undecidability theorems: “and even if it did, we may not be able to find it.”
What am I missing?
Like discussed in other comments, you can prove consistency in a stronger theory — and in program verification, we can tweak the program so that the correctness proof is easier.
Like discussed in other comments
Yes, I saw that afterwards. Sorry about that, and thanks for your answer.
you can prove consistency in a stronger theory
I get that. But:
in program verification, we can tweak the program so that the correctness proof is easier
I do not see what you mean here. Would you have an example?
Critical and foundational proofs should probably get certificates from multiple proof assistants then, right?
I am only familiar with proof assistants in passing, but, if having a single certificate from one proof assistant still leaves doubt about a proof's validity wouldn't a decent strategy be having multiple certificates from multiple proof assistants? If we have a well supported ecosystem of diverse proof assistants and they all agree that the proof is true, then we could be pretty confident that the proof does not exploit some vulnerability. We wouldn't expect a diverse set of proof assistants to all carry the same exploitable bug.
Of course, this doesn't exclude the possibility of a model creating a proof that manages to string together exploits for each proof assistant. But, it does seem a lot less likely than getting a valid certificate for a invalid proof from a single proof assistant.
"Comparator's own scripts/fake-landrun.sh is used = no sandbox, which is how the recorded run was made; the sandbox guards against an untrusted solution, which is moot when you built the tree yourself."
This approach from Anthropic undermines the verification problem exists, even in mathematics. Thank you for highlighting it. Knowing how these models error in the code they write (and their logic errors more generally), my expectation is that there will be many of these structural flaws - subtle reward hacks - in the maths results from the frontier labs.
The labs themselves will be fine with that I expect. The community will tell them what the errors are and they will train on that. On the surface they will be making progress on mathematics. But their maths-expert LLMs are themselves showing their misalignment through flaws like the above. The more post-training compute the labs put into such already-misaligned LLMs, the more misaligned they will become. So it seems likely that the community's corrections will come too late to mitigate the harm that the bad proofs in the maths LLMs are baking into themselves.
This article is primarily about the use of formal verification for critical safety infrastructure (such as the type described by this taskforce: https://sl5.org/), not about formal verification in pure math.
Thank you for pointing that out. I failed to express my point clearly. However, I argue that such strictness isn't essential in real-world software development. CVEs are constantly discovered in Linux, yet no one suggests abandoning it. As you said, we need to be developers rather than mathematicians—which makes focusing on absolute perfection even more difficult.
Lots of the discussion around Lean certificates and trust centers around general philosophical ideas of how much humans should trust formal certificates. It's important to remember, though, that Lean4 is not an ideal formal certificate machine: Lean4 is a software in its infancy and has issues. There are reasonable reasons to specifically not trust Lean4.
If we're going to be putting our society's trust in Lean4, I think that it's good to have an open critical discussion of how warranted that trust is.
Epistemic status: Most of this work is a factual description about aspects of Lean4 and set theory. I am 85% sure that at most two of these factual descriptions are incorrect. I am 90% sure that, in the current version of Lean4 on Github, there exists a proof of the statement "True=False" that would be accepted in such a way that the Lean community would call it a bug in need of patching (either by messing with the elaborator, compiler, kernel, or some other part of the Lean). I am 2% certain that we will soon be putting huge amounts of trust into Lean4 certificates produced by misaligned AIs, and that the human work we do as a community thinking about and fixing Lean4 in the next 24 months would fall under Less Wrong's classification of a pivotal act.
The current status of things
Here's a quote from a last April be Leo de Moura, the creator of Lean.
Here's another post by Leo de Moura, three months later:
Following this incident, the Lean FRO found seven more bugs in the kernel. The new opinion of Leo de Moura: "[False statements being accepted by Lean] is going to keep happening. AIs are really good at exploiting soundness bugs in the kernels".
What was the Lean community's reaction to "soundness bug #14576"? There's a nice thread about it on a Lean developer's forum here.
Uh oh! Not only do we expect bugs, but there are possibilities of "sea monsters". This article is a bit about the bugs, a bit about the sea monsters, and a bit about the unsafe ways that Lean4 is currently being used (e.g. the un-sandboxed comparator used in Anthropic's formalization of Fermat's Last Theorem) .
What does it mean for Lean4 to be consistent?
Lean4 lets you write mathematical statements and proofs using the bare low-level primitive notions of mathematics, and checks that the proofs are valid using the fundamental axioms. Which axioms? The most standard mathematical axioms are the "Zermelo-Fraenkel plus Choice" axioms (ZFC). These axioms have been vetted by armies of nerds and we're really quite certain that they are consistent. Lean4 is not based on ZFC. It is based on a special home-brew version of dependent type theory, which was designed by picking and choosing features of various modern type theories, with the governing design principle that it should be fast at compile time.
How do we know that Lean4's type theory is consistent? Ideally we would construct some totally convincing proof that if ZFC (or some standard strengthening of of it via large cardinal axioms) is consistent, then Lean4 is consistent. However, we currently don't know how to do this.
As of writing, there is no publicly available proof that Lean4 is consistent with respect to ZFC + any large cardinal axiom.
When I originally learned that Lean4 had no known consistency proof, I thought this was some sort of bug or technicality. Surely we understand why Lean4 is supposed to be consistent, we just haven't bothered writing out the details? My current read of the situation is that this is not the case. Lean4 is not known to consistent, we don't know why it should be consistent, and there are real obstructions to all known proof strategies for showing that Lean4 is consistent.
Smart people make fundamentally inconsistent type theories all the time
Lean4 is a "dependent type theory". Dependent type theory as a foundation for mathematics was pioneered in 1971 by Martin-Löf. A year after Martin-Löf came out with his type theory, Girard found a contradiction in Martin-Löf's theory. In his revised paper, Martin-Löf concluded that one of the axioms “had to be abandoned” and describes the necessary change as “so drastic” that the theory lost substantial expressive strength. Oops! Constructing good dependent type theories is hard.
Outside the world of dependent type theory there are other famous examples of mathematicians trying to come up with new foundations of mathematics and making deep, subtle, fundamental mistakes: Church's 1932 proposed foundations for mathematics using lambda calculus (which was shown to be inconsistent by Kleene and Rosser), and Quine's 1940 proposed reworking of ZFC (which was shown to be inconsistent by Rosser).
The status of Lean4's consistency proof
Coming up with consistent foundations for math is tricky business. The ingredients that make Lean4 fast at compile time are the same ingredients that give it access to an unusually strong amount of recursion. For instance, a common proof strategy for showing that dependent type theories are consistent with respect to ZFC + large cardinals is to use the so called "normalization" property. It was proved in 2019 by Abel and Coquand that this normalization property fails for type theories like Lean's, which in some precise sense means that Lean4's type theory is wild/poorly behaved.
There was a proof of Lean3's consistency proposed in 2019 by Mario Carneiro. This proof works by embedding the primitive notions of Lean3 into the primitive notions of set theory (sets, functions between them), and then showing that the axioms of Lean3 correspond to true statements about sets. Proving that type theories are consistent with respect to ZFC + large cardinals via embedding into set theory is standard business. Unfortunately it came out in 2024 that there was a flaw in his proof strategy (oops!) and that the correct proof would require a new approach. Even if the Lean3 embedding gets fixed, Lean4 adds new features which require non-trivial extensions of that embedding.
I recently asked my GPT-6 Astra to find an embedding of Lean4 into set theory. It spent ~25h and several thousand dollars on the task, and it did not succeed. It kept trying new embeddings and tricks, but every time it found counterexamples using the strong recursive power of Lean4. So it seems to me like finding this set theory embedding is a genuinely non-trivial task, and we don't have a high-level picture of why Lean4 should be consistent.
Untamed recursion is bug-prone
One of the main things which makes Lean4 logically complex are its "nested inductive types", a sort of declaration where you can define a type in terms of a higher-order property of its own type. Nested inductive types are a new research area, but our understanding is still in its infancy (we've had some good progress in 2026, here and here). Preliminary evidence suggests they might be pretty wild. Here's a quote from the former of those two papers:
The conclusion from the literature, in my view, is that even if Lean4's type theory is consistent at a high level, the nature of nested inductive types makes Lean4's recursion wild. That behavior could be so wild that it is fundamentally incompatible with logic (i.e. is inconsistent), but even assuming that's not the case, it could easily be wild enough to cause bugs.
This is what Chris Bailey was referring to as the "sea monsters" from before - aspects of nested inductive types which are consistent, but wild and ill-behaved and cause bugs. It's impossible to do a systematic search for this bugs currently, because we don't know at a high level what we're looking for. There's no spec to track because nobody knows how Lean4's type theory is supposed to behave.
"But doesn't con-leche give a proof?"
There was recently a project announced called con-leche, which claims to give a formally-verified Lean4 kernel written in Lean4. This is the second attempt at such a project, the first of which is called lean4lean and is still under development.
The con-leche experiment is nice (it's good to have more kernels!), but doesn't solve the "sea monster" questions, and it doesn't rule out bugs in the official kernel.[1]
Using Lean4 safely
Here is the breakdown of the compute cost associated to running Anthropic's Lean4 certificate of Fermat's Last Theorem:
What is this "comparator" thing that takes all the runtime? The comparator is an extra tool which is useful for making sure that malicious code in the proof body does not mess up the theorem statement during the elaboration+compilation process. This is something you have to worry about even if you trust the kernel completely. As you can see, it takes a long time to run.
Soon, we expect that the world's critical software infrastructure will be formally verified. This is a huge project, which is quite expensive. The difference between running basic Lean4 and running Lean4 + comparator could be the difference between "expensive but doable" and prohibitive.
The broader point is that there are choices you make when you use Lean4. If you wanted, you could run your code in con-leche and nanoda. You could use the comparator. You could sandbox your cached .olean files. None of these are the default behavior of Lean4; these are choices you have to opt into as a developer. The right choice surely depends on the application, and your level of trust in both in Lean4 and agent swarms.
How much do we trust the agents?
There's an aspect of Anthropic's FLT certificate I find worrying. When running the comparator, they decided to explicitly disable the sandbox that separates the untrusted proof code from the trusted statement. In their codebase, when justifying their decision, they make the following comment:
It seems like Anthropic decided that the agent swarm that wrote the FLT proof is trusted, and that guarding against malicious code (even when it is easy to do) is "moot". Do we as a community think this is okay? FLT was a landmark formalization. I can easily imagine somebody pointing to the FLT certificate and saying "of course you should trust my certificate, it passed the level of rigor that FLT did". I think we should set higher standards.[2]
Where do we go from here?
All of the issues I talked about seem temporary or fixable. Assuming that Lean4 is consistent, then a proof should exist and we should be able to find it. We should be able to use that understanding of Lean4's foundations to run a systematic bug-search through the Lean4 kernel. We should be able to change the default "maximum trust" behavior of Lean4 to involve significant sandboxing, with formally-proven specs showing that untrusted proofs aren't able to tamper with trusted theorem statements. We should, we should, we should.
Even though Lean4 is open source, not everybody can participate in this journey. Fixing Lean4's safety issues counts as a cybersecurity task, and as such (in my experience), Astra will refrain from answering questions. Astra is happy to try to prove that Lean4 is consistent, but when I've asked it to take seriously the possibility that Lean4 is not consistent it shuts down the chat as cybersecurity. When I ran Anthropic's FLT certificate on my computer, I asked Astra to take a critical look at the logs to make sure there was no funny business and it classified the chat as cybersecurity.
We're entering a world where frontier labs are major decision-makers in cybersecurity. This essay is in part a letter for them: please take Lean4's correctness seriously.
Lean4 is in its infancy. There are still significant hurdles between where we are now and where it needs to be before we can confidently expect it to hold the weight of the world's critical infrastructure against cyberattacks by sophistical, lazy, reward-hacking AI agents.
On a more personal note, related to the con-leche experiment: I hope we don't end up in a future where the most trusted software in the world ends up being in a situation where we are told to trust it because of an AI-generated certificate, especially one that has room for loopholes. Certificates are not replacements for understanding.
I ran the comparator with the sandbox on the FLT certificate and it checked out. Kevin Buzzard also independently checked the FLT certificate and ran various due-diligence checks. The real community verification of the FLT certificate was at a higher standard than Anthropic's repo.