← 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 · v1
Axon, a verified optimizing compiler with fully machine-checked correctness proofs, was written entirely in Lean 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.

Writing verified compilers is labor-intensive. The question is whether an AI coding agent (Claude Code) can produce a fully machine-checked compiler in Lean, and what development process makes this feasible.

The Axon compiler is written entirely in Lean by Claude Code, combining testing, credible compilation (translation validation), and full formal verification. The development process layers these validation techniques so that machine-checked correctness proofs eliminate the need to audit verified code. The compiler includes 9 optimizations (constant propagation, dead-code elimination, CSE, LICM, register allocation, etc.) developed over 34 days.

Figure 2. Code growth by project day.

The final codebase is 38,188 lines of Lean, of which 30,997 are theorem statements. Code was produced over 34 project days with all optimizations formally verified. On Livermore loops benchmarks, the optimized Axon output (Axon-O) reaches roughly 19-20ms per kernel, comparable to Fortran -O1/-O2.

KindLines of Code
theorem30,997
def5,680
partial def750
inductive529
structure166
Total38,188
Axon code breakdown by kind