← Latest papers
💻 computer science

Auto formalisation of Goedel's Second Incompleteness Theorem in Binary Recursive Arithmetic

This paper reports an experiment where an author used the AI model Claude to autoformalize Gödel's second incompleteness theorem in Agda for Church's Basic Recursive Arithmetic, resulting in a 50,000-line, postulate-free machine-checked proof that also serves as a case study on the model's ability to reconstruct implicit mathematical arguments and its tendency to produce mathematically incorrect results when given insufficient specifications.

Original authors: Thierry Coquand

Published 2026-06-02
📖 5 min read🧠 Deep dive

Original authors: Thierry Coquand

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to build a perfect, self-checking robot that can verify its own math homework. This robot, which we'll call BRA, is very smart but follows extremely strict, simple rules. It can add, subtract, and check if things are equal, but it doesn't have a "common sense" module.

The paper you are reading is a report on an experiment where a human researcher (Thierry Coquand) teamed up with an AI (Claude) to teach this robot a very famous, very difficult lesson: Gödel's Second Incompleteness Theorem.

Here is the story of that experiment, broken down into simple parts.

1. The Goal: Can the Robot Prove It's Safe?

Gödel's Second Theorem is a bit like a "liar's paradox" for math systems. It says: "If a system is consistent (it never proves false things), it cannot prove that it is consistent."

In other words, if our robot BRA is actually doing math correctly, it will never be able to write down a proof saying, "I am a good robot." If it could prove that, it would actually be broken. The goal of this project was to build a digital version of this proof inside a computer program called Agda, using the AI to write the code.

2. The First Attempt: The "Fake" Success

The team started by asking the AI to read an old paper by a mathematician named Rose and try to prove the theorem based on that.

  • What happened: The AI worked hard for days and produced a "proof." It looked impressive!
  • The Problem: The AI had been tricked. The old paper it was reading contained a mistake (a false theorem). The AI followed the instructions perfectly, but because the starting point was wrong, the result was a "proof" of something that looked like Gödel's theorem but was actually nonsense.
  • The Lesson: This showed that AI is great at following logic, but if you give it a bad map, it will happily drive you to the wrong destination. You can't just trust the AI to tell you what to prove; you have to know the destination yourself.

3. The Real Attempt: Fixing the Map

After the failure, the team switched to a different, more reliable set of notes by a mathematician named R. Guard. These notes were like a treasure map with some missing pieces and typos.

  • The Challenge: Guard's notes were written in 1963. They were precise but left out many tiny, obvious details that a human mathematician would fill in automatically. For example, Guard assumed the reader knew how to handle "numerals" (numbers like 1, 2, 3) inside the robot's brain.
  • The AI's Role: The human researcher didn't write a single line of code. Instead, they acted as a "translator" or "architect." They told the AI: "Here is the missing piece. Here is the rule. Now, write the code."
  • The Result: The AI successfully wrote 50,000 lines of code from scratch. It built the entire robot, the proof, and the verification system without any human typing the code. The final result was a machine-checked proof that the robot BRA cannot prove its own safety.

4. The Hidden Tricks (The "Secret Sauce")

The paper highlights several clever tricks the AI had to learn to make this work, which were hidden in the old notes:

  • The "Nested Box" Problem: The robot needed to check its own history. Imagine trying to read a book while simultaneously writing the book. The AI had to build a special "history tape" inside the robot's brain. It turned out the robot's basic tools weren't built for this, so the AI had to invent a complex "Russian nesting doll" structure to make the robot remember its past steps.
  • The "Closed Box" Rule: The robot has to treat numbers (like 5) as "closed boxes" that can't be changed by substitution. The old notes assumed this was obvious. The AI had to be explicitly told to prove that "5 is a closed box" before it could proceed.
  • The "Hypothetical" Shortcut: The robot works in a very rigid way (Hilbert-style logic) where it can't easily say "If X is true, then Y." The AI used a clever trick (called the "Carneiro lift") to wrap every statement in a "If..." wrapper, allowing the robot to simulate complex reasoning without breaking its own rules.

5. Why This Matters

This isn't just about proving a math theorem. It's a test drive for the future of how humans and AI work together.

  • The Human is the Architect: The human provided the vision, the correct map, and the ability to spot when the AI was going off the rails (like in the first failed attempt).
  • The AI is the Mason: The AI did the heavy lifting, laying every single brick of the 50,000-line proof.
  • The Discovery: The process revealed that the old math notes were actually "sloppy" in places. By forcing the AI to write code that must be perfect, the team found hidden assumptions and typos in the original 1963 text that had been overlooked for decades.

Summary

Think of this project as a team building a self-driving car. The human driver knew the destination (Gödel's Theorem) and the rules of the road. The AI was the engine builder who assembled the car.

  • At first, the AI tried to build the car based on a broken blueprint and built a vehicle that looked like a car but wouldn't drive.
  • Then, they switched to a better blueprint. The AI built a perfect, functioning car.
  • Along the way, they realized the blueprint had some missing instructions, so they had to invent new parts to make the car work.

The result is a fully verified, machine-checked proof that a specific mathematical system cannot prove its own consistency, achieved entirely through a collaboration where the human guided the AI, and the AI did the writing.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →