Why is it all in the kernel?

Hacker News Top News

Summary

Lawrence Paulson discusses a bogus refutation of the Collatz conjecture caused by a bug in the Lean kernel, reflecting on proof objects and soundness in proof assistants.

No content available
Original Article
View Cached Full Text

Cached at: 08/05/26, 07:51 AM

# Why is it all in the kernel? Source: [https://lawrencecpaulson.github.io/2026/07/30/Collatz.html](https://lawrencecpaulson.github.io/2026/07/30/Collatz.html) 30 Jul 2026 \[[`general`](https://lawrencecpaulson.github.io/tag/general)[`Lean`](https://lawrencecpaulson.github.io/tag/Lean)[`Isabelle`](https://lawrencecpaulson.github.io/tag/Isabelle)[`HOL system`](https://lawrencecpaulson.github.io/tag/HOL_system)[`philosophy`](https://lawrencecpaulson.github.io/tag/philosophy)[`memories`](https://lawrencecpaulson.github.io/tag/memories)\]Sensational news\! The[Collatz conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture)has just been refuted\. Ramana Kumar has proved its negation\. The proof has been checked in Lean and double‑checked using the independent Nanoda type checker\. Unfortunately, the proof is wrong\. It exploited a bug in the Lean kernel\. Somehow, Nanoda didn’t detect the error either\. Now I am not writing to gloat about this\. Soundness bugs have been[discovered in Isabelle](https://lawrencecpaulson.github.io/2026/01/15/Broken_proofs.html), among many other proof assistants; for all I know, a new and monstrous bug will be discovered tomorrow\. Nevertheless, there are some lessons here, so let’s go\! ### The Collatz conjecture This famous conjecture has been around for nearly a century, attracting the attention of serious mathematicians and cranks alike\. It concerns the following procedure\. Start with a number N\. Now repeat this step: if N is even then divide it by two; if odd, set N to 3N\+1\. Collatz conjectured that this procedure is guaranteed to reach 1 no matter what value of N we start with\. Extensive testing has failed to find a single counterexample\. Recent work shows language models to be quite good at[finding counterexamples to conjectures](https://theconversation.com/hello-there-the-jacobian-conjecture-is-false-thanx-why-a-tiny-social-media-post-has-mathematicians-rethinking-ai-283883), so why not Collatz? Resolving it really would cause a sensation\. ### The dead weight of proof objects As we have known for half a century,[proof objects are unnecessary](https://lawrencecpaulson.github.io/2022/01/05/LCF.html)\. Robin Milner designed the ML language for the specific purpose of supporting proof assistants\. Through the notion of an*abstract type*, the proof kernel could be made secure from the rest of the program\. The rules of inference, confined to the abstract type, would be an API for creating theorems\. Nevertheless, much of our community has doubled down on storing proof objects\. In particular, they noted that a proof object was a*certificate*that could be[checked independently](https://leodemoura.github.io/blog/2026-3-16-who-watches-the-provers/)\. But I am not aware of a single instance where an independent proof checker detected a soundness error that had passed through the kernel of a proof assistant\. For Collatz, as we have seen, Nanoda was also fooled\. When we consider the memory burden that proof objects represent, this is analogous to driving everywhere pulling a spare car on a trailer behind you in case of a breakdown\. And your car does break down, but lo and behold, the spare car doesn’t work either\. And the exact reason your car broke down was the burden of pulling the spare car\. Because it is only the proof calculi that have proof objects that seemingly need to put everything into the kernel\. ### Theft versus honest toil For most of the 20th century, logicians assumed the fewest axioms they could, from them deriving the rest of mathematics\. Possibly they were worried about Russell’s and other paradoxes; possibly they were just parsimonious\. This point of view was perhaps best put by Russell himself: > The method of ‘postulating’ what we want has many advantages; they are the same as the advantages of theft over honest toil\. Let us leave them to others and proceed with our honest toil\. \([Russell](https://plato.stanford.edu/entries/logical-construction/), 1919\) So it’s notable that – so rumor has it – the bug in Lean was caused by nested inductive types in the kernel\. A number of soundness bugs in Rocq were caused by pattern matching involving recursive functions in the kernel\. I’m not precisely sure why dependent type theories are not expressive enough to express things like recursion from a more basic calculus\. The reason is probably technical\. But let’s be clear: in set theory and in simple type theory, you have to assume very little\. Set theory gives you a few principles for introducing sets: unions, separation, pairing, replacement\. Simple type theory gives you a little bit of logic and a bit of λ\-calculus, which gives you a typed set theory where the sets are Boolean\-valued functions\. Then, with honest toil, you can obtain inductive definitions, records, recursive data structures and recursive functions in quite general settings, including pattern matching and partial functions\. You can perform numerical calculations using symbolic binary arithmetic\. Because all these things are defined in terms of the primitive axioms, rather than being postulated, they lie outside the kernel and cannot lead to contradictions\. Back in the 1980s, when I was working with Martin‑Löf type theory, a question arose about expressing recursive functions\. The theory only recognized forms of primitive recursion\. But the theory also admitted higher types, giving the possibility of more powerful forms of recursion\. Having learned mathematics in the tradition of honest toil, I worked \(and it really was laborious\) to define a[system of combinators](https://doi.org/10.1016/S0747-7171(86)80002-5)within Martin‑Löf type theory that could express a vast space of terminating recursive functions\. But I hadn’t understood how this game was played\. The correct answer to the question was to*extend*MLTT with a general notion of recursion, and I must admit, it could be done simply and elegantly\. I’m not sure anyone ever understood what I did\. Years later, I saw the paper cited with the comment, “Paulson extended MLTT with recursion”: they couldn’t imagine someone*obtaining*recursion through honest toil\. ### What does the honest toil look like? I can see why the implementers of a proof assistant take the option of theft, because the honest toil really is like breaking rocks\. The easiest of the many objectives is[recursive data structures](https://rdcu.be/fwTU2)\. An inductive definition can be transformed into a monotone operator on sets\. The least fixed point gives you an inductive definition, and if you prefer a co\-inductive definition, you take the greatest fixed point\. In Isabelle, we seldom bother to link these constructions to types, but[recursive data types](https://rdcu.be/fwT1b)are an important special case, now handled in a general and sophisticated way through*bounded natural functors*\. The construction of*recursive functions*from first principles is particularly tedious\. You begin with a[well‑founded relation](https://en.wikipedia.org/wiki/Well-founded_relation)and prove the existence of the desired recursive function by well‑founded induction\. The work I did on recursion in MLTT was somewhat helpful in this, so it was not entirely wasted\. Isabelle/HOL[now supports](https://rdcu.be/fwT25)recursive function definitions in great generality, including pattern matching and termination checking\. And all of these things lie safely outside the kernel\. There’s an irony that proof objects are sometimes touted as leading to greater soundness guarantees\. The opposite is clearly true\. If soundness is your main concern, you should go for HOL Light or HOL4\.[1](https://lawrencecpaulson.github.io/2026/07/30/Collatz.html#fn:1)Isabelle has had more bugs than those, but few, and definitely far fewer than certain other systems\.

Similar Articles

Postmortem for Lean Kernel Soundness Bug #14576

Lobsters Hottest

A postmortem of a soundness bug in the Lean kernel that was exploited to produce a 'disproof' of the Collatz conjecture, with the fix and analysis of why independent checkers also initially missed it.

Lean now ships with verified kernels

Hacker News Top

Lean v4.35.0 now ships with multiple verified kernels, including con-leche (the first Lean-written kernel with a formal consistency proof, implemented by Claude) and its Rust-refined counterpart con-ron, plus a new `lake check` command for rechecking developments externally. The move follows AI-discovered kernel soundness bugs and aims to eliminate implementation-level unsoundness without performance penalties.

Scaling Lean Theorem Proving for Real-World Code Verification

Hugging Face Daily Papers

The paper presents EasyProver, a Lean proving system using recursive agents and asynchronous search that near-saturates PutnamBench and IMO benchmarks with an off-the-shelf frontier model, plus Aegis, a pipeline converting competitive programming into harder real-world Rust-to-Lean verification tasks for benchmarking and RL.

How Stable Are LLM-Generated Proofs Under Program Refactoring? A Stress Test for Verifiable Code Generation

arXiv cs.AI

This paper introduces RefactorProof, a stress test that derives 458 Lean-certified refactoring variants from VERINA tasks to measure whether LLM-generated proofs remain valid under behavior-preserving program changes. It finds substantial brittleness across reference proofs and specialized provers (DeepSeek-Prover-V2, Goedel-Prover-V2), while noting that most broken proofs can be repaired with small edits.