← All papers
First page of Testing, Credible Compilation, and Verification in the Axon Verified Compiler in Lean and Claude Code

Testing, Credible Compilation, and Verification in the Axon Verified Compiler in Lean and Claude Code

Martin Rinard

cs.PL May 3, 2026 · v3
Builds a verified compiler (Axon) entirely in Lean 4, with code, semantics, and correctness proofs generated by Claude Code.
This paper presents the use of testing, credible compilation/translation validation, verification, and audits in the Axon compiler. Axon comes with fully machine checked proofs that guarantee the correctness of the generated code. All code and proofs were written in Lean by Claude Code, with the correctness proofs eliminating any need to audit or examine any verified code. I present a development process for using these validation techniques, evaluate the use of this process during the development of the compiler, and discuss implications for other development efforts.

Code written by coding agents may not behave as intended, so effective validation techniques are needed. The paper examines how testing, credible compilation, verification, and audits can be combined when an agent develops a verified compiler.

Axon, a compiler for a simple Fortran-inspired language targeting ARM64, was developed in 34 days by Claude Code in Lean 4 under one human supervisor. The AST→TAC→ASM path is machine-checked for refinement, behavior characterization, and totality. Optimization passes use credible compilation: a verified certificate checker validates each transformation. Testing was used to catch common-case bugs before attempting proofs.

The development reached about 38K lines of Lean, roughly 31K of them theorems, including nine optimizations such as register allocation, LICM, and CSE. Certificate generators were delivered much faster than full proofs, which narrowed correctness gaps. Agent time was dominated by proof search. On Livermore kernels, generated code with optimizations was compared against Fortran at several optimization levels.

KindLines of Code
theorem30,997
def5,680
partial def750
Total38,188
Lean declarations by kind