Lean Census: A Distributional Analysis of AI-Generated Lean Code
Organizations: Project Numina · University of Naples Federico II
Abstract
We compare two human-written and four AI-generated Lean libraries with Mathlib through the distributions of simple statistics of their code. For each library we measure inline claims in proofs, proof length, how often each declaration is used, and design choices such as instances and private declarations, and we read each against the variation among Mathlib's own areas. The AI-generated libraries have more inline claims per theorem, longer proofs, fewer instances, and more private declarations than the human-written ones. We release the code for the analysis as a package, lean-census, at https://github.com/project-numina/lean-census.
Figures & tables
| Library | Written by | Lines (k) | Declarations | Revision | Lean | Mathlib |
| Mathlib | human | 2,358 | 254,173 | 56a00585 | 4.35.0 | – |
| CSLib | human | 49 | 4,776 | f8acdb37 | 4.36.0-rc2 | 887bb849 |
| PhysLib | human | 207 | 13,915 | 25465e80 | 4.35.0 | 56a00585 |
| FormalFrontier | AI | 713 | 38,365 | 44 libraries | 4.34.0-rc2 | 83abb3e7 |
| Tau Ceti | AI | 6,500 | 366,101 | 7550358f | 4.36.0-rc2 | 1b1ccf4b |
| CSLib Frontier | AI | 1,836 | 109,786 | 593563c5 | 4.36.0-rc2 | 69552756 |
| Inline claims | Theorems | Text | Explicit | |||
| Library | per theorem | with a claim | used once | Instances | Private | arguments |
| Mathlib | 0.21 | 10% | 31% | 10.7% | 1.1% | 23% |
| Mathlib areas | 0.03–0.52 | 2–23% | 2.2–27.4% | 0.0–6.9% | 7–37% | |
| CSLib | 0.31 | 15% | 36% | 6.2% | 4.1% | 24% |
| PhysLib | 0.64 | 21% | 43% | 5.4% | 3.4% | 31% |
| FormalFrontier | 0.81 | 25% | 37% | 2.7% | 17.2% | 54% |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Library | Signature | Proof | Reuse | Compression |
|---|---|---|---|---|
| CSLib | 1.65 | 1.91 | 1.43 | 1.47 |
| PhysLib | 1.69 | 1.53 | 1.16 | 1.46 |
| FormalFrontier | 1.48 | 2.92 | 1.37 | 1.21 |
| Tau Ceti | 0.79 | 2.94 | 1.31 | 1.44 |
| CSLib Frontier | 1.67 | 3.01 | 1.19 | 0.62 |
| Atlas | 1.75 | 3.22 | 1.65 | 0.68 |
Code Generation Evaluation
Code generation evaluation measures whether AI-produced programs are correct, reliable, secure, efficient, and faithful to their specifications.
See all 233 papers