- 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.
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.
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) provides a mapping from numerals in the object language to their encoded representations, while codeu gives the meta-level Gödel numbers.
- Verifier and Substitution: thmT 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:
- Diagonalisation: A self-referential formula G is constructed via the diagonal lemma such that G↔¬thmT(x)=code(G).
- 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.
- Course-of-Value Recursion: Building thmT 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."
- 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.
- 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 thmT), then it is inconsistent since it also derives 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) and codex, proving their relation only on numerals.
- Two Forms of codeu0: Informal and formal versions of the diagonal formula (codeu1 vs. codeu2) 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: codeu3 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 codeu4 (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.