← All papers
First page of Lean Census: A Distributional Analysis of AI-Generated Lean Code

Lean Census: A Distributional Analysis of AI-Generated Lean Code

Justin Asher, Pietro Pellegrino

cs.LG Nov 21, 2026 · v1 cs.AI cs.LO cs.SE
Measures code statistics of human-written and AI-generated Lean libraries against Mathlib, and releases a Lean analysis package, lean-census.
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.

AI systems now produce Lean libraries with millions of lines and little human review. Existing audits rely mostly on expert or LLM judgment and do not compare library-wide distributions against human-written code.

Six libraries are compared with Mathlib: two human-written (CSLib, PhysLib) and four AI-generated (FormalFrontier, Tau Ceti, CSLib Frontier, Atlas). For each, distributions are computed for inline claims (have/suffices) per theorem, proof length, declaration reuse, instances, private declarations, and explicit arguments. Each is read against the variation across Mathlib's 26 top-level areas.

Every AI-generated library falls outside the human-written range on inline claims, proof length, instances, private declarations, and explicit arguments. AI-generated proofs have 0.81–3.22 inline claims per theorem versus 0.21–0.64 for human-written ones, and median proof length is 22–49 tokens versus 10–17. Mathlib's Archive matches the AI libraries on proof structure but not on design choices, suggesting purpose explains part of the proof-structure gap.

LibraryInline claims/theoremInstancesPrivate
Mathlib0.2110.7%1.1%
PhysLib (human)0.645.4%3.4%
Tau Ceti (AI)0.893.2%14.0%
Atlas (AI)3.221.2%37.1%
Summary statistics per library (selected columns)