AI agents produce 613,000-line Lean formalization of CPython, find 418 bugs
A project using Opus 5.5 has generated 613,318 lines of Lean code that mirror CPython's internals function-by-function, testing each rewrite against real Python before attempting formal proofs. A second AI agent independently verifies each proof before it counts as accepted, and 4,071 functions have passed this check so far, yielding 18,898 theorems and lemmas across 1,539 files.
GoKawiil's interpretation of the reporting above, not reported fact.
The effort suggests AI agents can now assist with large-scale formal verification of widely used software, a task traditionally considered too labor-intensive for most production codebases. The 418 bug reports generated, including about 55 the project says can crash the interpreter or corrupt memory, indicate formal methods paired with AI could surface real defects in mature, heavily-used systems like CPython that power most Python execution worldwide.
- 613,318 lines of Lean have been written to mirror CPython's source, covering 1,539 files and 18,898 theorems
- 4,071 functions have passed a two-agent verification process where one agent writes the proof and another checks it
- The work has surfaced 418 bug reports in CPython, with roughly 55 described as capable of crashing the interpreter or corrupting memory
Source: broyojo.com, 2026-11-10
Published there as: “Formalizing CPython”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.