Papers
Topics
Authors
Recent
Search
2000 character limit reached

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

Published 1 Jun 2026 in cs.LO | (2606.01898v1)

Abstract: We report an experiment in autoformalisation of Gödel's second incompleteness theorem in Agda using Claude. The theorem is formalised for Church's Basic Recursive Arithmetic (BRA), following the proof outline given in Guard's 1963 lecture notes. The entire Agda development, comprising approximately 50,000 lines and containing no postulates, was produced through interaction with Claude; the author did not write any Agda code. Beyond the formalisation itself, the project provides a case study of the strengths and limitations of current LLMs in mathematics. An initial autonomous attempt based on a theorem of Rose failed because the theorem is false; the resulting formal development produced by Claude established a statement superficially resembling Gödel's theorem but mathematically unrelated to it. This failure was traced to an insufficient specification of the internal provability predicate, illustrating how an LLM may reason correctly from an incorrect formal specification. The final development follows Guard's proof and required the reconstruction of several implicit mathematical arguments, including the role of the internal numeral-encoding operation and the interaction between substitution and numeral closure. The resulting formalisation clarifies a number of details left implicit in the original presentation and provides a fully machine-checked proof of Gödel's second incompleteness theorem for BRA.

Authors (1)

Summary

  • The paper provides a complete, postulate-free autoformalisation of Gödel’s Second Incompleteness Theorem within the minimal framework of Binary Recursive Arithmetic.
  • The methodology employs Agda for proof verification and collaboration with Claude’s LLM, demonstrating automated proof generation and rigorous specification debugging.
  • The work resolves historical ambiguities by clarifying notation and substitution in BRA, establishing a scalable template for future minimal formal systems.

Autoformalisation of Gödel's Second Incompleteness Theorem in Binary Recursive Arithmetic

Overview

The paper "Auto formalisation of Gödel's Second Incompleteness Theorem in Binary Recursive Arithmetic" (2606.01898) presents a comprehensive experiment in autoformalisation centered around Gödel's Second Incompleteness Theorem (GII) for Church's Basic Recursive Arithmetic (BRA). Employing the Agda proof assistant and collaborating with the Claude LLM, the author documents not only a complete, postulate-free formalisation but also the challenges and limits of using LLMs in mathematical formal proofs. The formalisation strictly adheres to Guard's 1963 lecture notes on BRA and remains faithful to Church and Shoenfield’s logical architecture, whilst offering clarifications on a number of historically ambiguous or underspecified points.

Motivation and Context

The formalisation addresses a notable gap in formal, machine-checked proofs of GII at the level of primitive recursive arithmetic. Previous efforts, such as Paulson's Isabelle work, approach GII over hereditary finite sets or with significant logical extensions but not over the minimal syntax of BRA. The experiment also functions as a critical case study in the state of LLM capabilities in mathematical reasoning and proof generation. Notably, the entire Agda development (~50,000 LOC, zero postulates) was produced via interaction with Claude, with the human handling meta-level orchestration and specification corrections.

LLM Interaction and Specification Failures

A critical observation emerged from an initial, fully autonomous attempt to formalise GII using Rose’s 1961 theorem, which is known to be false. Claude’s formalisation yielded a superficially similar but mathematically irrelevant result, highlighting the risk of trusting LLM-claimed proofs in underspecified contexts. The root cause was traced to an insufficiently rigorous specification of the internal provability predicate used to define BRA’s theorems. The LLM, proceeding from an erroneous formal input, soundly reasoned to an incorrect formal output—a scenario emphasizing that verification must be strictly separated from derivation and that meta-level checking of LLM-produced results is essential. This echoes broader concerns about specification validation in automated theorem proving with LLMs.

Formal System and Encoding

BRA, in Church’s and Guard’s formulation, restricts the function symbols to a minimal set enabling the encoding of pairing, projection, and course-of-value recursion directly. The paper encodes all the axioms and inference rules explicitly:

  • Syntax: Terms are constructed from constants, variables, unary, and binary function applications. Formulas are built using atomic equations, negations, and implications.
  • Axiomatic Base: 14 axiom schemes and 3 inference rules (modus ponens, substitution, induction), each explicitly constructed in Agda.
  • Numeral Encoding: The internal functor num(x)num(x) provides a mapping from numerals in the object language to their encoded representations, while codeucode{u} gives the meta-level Gödel numbers.
  • Verifier and Substitution: thmTthmT acts as the internal, representable derivability predicate, built through nontrivial course-of-value recursion expressible in BRA. Substitution is handled by nested single-variable substitutions, the correctness of which depends on an explicit numeral-inertness lemma proven by internal induction.

Proof Strategy for Gödel’s Second Incompleteness

The construction mirrors Guard’s staged decomposition:

  1. Diagonalisation: A self-referential formula GG is constructed via the diagonal lemma such that G¬thmT(x)=code(G)G \leftrightarrow \neg thmT(x) = code(G).
  2. Internal Reasoning: The proof internalises meta-level arguments (the deduction theorem, hypotheses tracking) via mechanisms such as the Carneiro lift for conditional (Hilbert-style) reasoning, as Agda's context-free derivability prevents using external or meta-level deduction directly.
  3. Course-of-Value Recursion: Building thmTthmT required representing general recursion inside BRA, entailing a complex history-as-value encoding and stability lemmas to ensure computations do not depend on surplus "fuel."
  4. Numeral Inertness: The multi-variable substitution problem is avoided by internal induction showing that numerals (and their codes) are closed terms—substitution acts as the identity on them, allowing the full development to eliminate tens of thousands of lines required by direct simultaneous substitution primitives.
  5. Meta-Level Implication: The main theorem is presented as a meta-level implication: if BRA can derive the formula expressing its own consistency (via the internal thmTthmT), then it is inconsistent since it also derives O=s(O)O = s(O). Importantly, this result is not itself an object-theoretic formula within BRA but a meta-theorem about derivability.

Clarified Subtleties and Corrections to Guard

The autoformalisation exposes and resolves several implicit or incorrect details in Guard’s original notes:

  • Notation Distinctions: Guard’s underline notation ambiguously refers to both internal terms and meta-level codes; the formalisation rigorously separates num(x)num(x) and codexcode{x}, proving their relation only on numerals.
  • Two Forms of codeucode{u}0: Informal and formal versions of the diagonal formula (codeucode{u}1 vs. codeucode{u}2) differ in subtle ways, connected only by internal equations, not by syntactic identity.
  • Predicate-Leibniz Principle: The formal version introduces explicit substitution principles for carrying equivalences through arbitrary formulas, a technique missing in the original text.
  • Side Conditions: All use of substitution rules required explicit closedness witnesses.
  • Carneiro-Lift: The ability to thread meta-level hypotheses through Hilbert-style derivations via structural combinators is concrete and essential at several steps, contrasting with Guard’s more informal handling.
  • Validating-Decoder Invariant: codeucode{u}3 must return truth on non-derivation inputs to ensure global closure, an invariant made explicit and proven in the Agda implementation.
  • Removal of Multi-Variable Substitution: By proving the numeral-inertness lemma, the formalisation eliminates the need for simultaneous substitution machinery, achieving considerable architectural simplification.

Implications and Prospects

Practically, this experiment demonstrates that LLMs, when guided with precise specifications and monitored meta-levelly, can contribute significantly to large-scale, mechanically-verified formalisation in foundational mathematics. The development method transforms the process into one of interactive specification debugging rather than direct construction. Theoretically, the work resolves ambiguities in historic presentations and points toward scalable methodologies for encoding more complex results (e.g., Chaitin’s version via Kolmogorov complexity is cited as a potential follow-up).

The structural innovations (e.g., course-of-value recursion encoding, explicit use of numeral inertness) provide ready templates for future efforts in minimal arithmetical frameworks and other logics. The insights into specification checking and the division between computation and derivability within formalisation are broadly relevant as LLMs are increasingly employed in mechanised mathematics.

Open questions remain concerning fragments such as codeucode{u}4 (variable-free, induction-less BRA) and the corresponding potential for internal proofs of consistency, as well as the comparative proof-theoretic strengths of simultaneous vs. nested single-variable substitution.

Conclusion

The formalisation provides the first completely machine-checked, postulate-free proof of Gödel's Second Incompleteness Theorem for Binary Recursive Arithmetic, bridging several gaps and ambiguities in prior treatments. Additionally, it offers a detailed assessment of the strengths and weaknesses of current LLMs for mathematical autoformalisation, especially underscoring the importance of rigorous specification and independent verification. This work stands as a technical reference for automated theorem proving, the foundations of arithmetic, and the emerging interaction between human mathematicians and LLMs in formal mathematics.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 2 tweets with 27 likes about this paper.