MathlibLemma: Folklore Lemma Generation and Benchmark for Formal Mathematics
Xinyu Liu, Zixuan Xie, Amir Moeini, Claire Chen, Shuze Daniel Liu, Yu Meng, Aidong Zhang, Shangtong Zhang
TL;DR
This work introduces MathlibLemma, the first LLM-driven multi-agent system designed to proactively discover and formalize folklore lemmas missing from Mathlib, thereby closing the last-mile gap in formal mathematics. The framework decomposes the task into four stages—Discovery, Judge, Formalizer, and Prover—producing a verified library and a large-scale benchmark of $4{,}028$ Lean statements, of which $1{,}812$ have been formally proven. A rigorous human audit finds $78{\%}$ of sampled residuals provable, demonstrating a strong alignment with mathematical truth and exposing model limitations in deep structural reasoning. The study also reports substantial practical impact, with several generated lemmas upstreamed into Mathlib, highlighting the practicality of AI-assisted, self-evolving formal ecosystems.
Abstract
While the ecosystem of Lean and Mathlib has enjoyed celebrated success in formal mathematical reasoning with the help of large language models (LLMs), the absence of many folklore lemmas in Mathlib remains a persistent barrier that limits Lean's usability as an everyday tool for mathematicians like LaTeX or Maple. To address this, we introduce MathlibLemma, the first LLM-based multi-agent system to automate the discovery and formalization of mathematical folklore lemmas. This framework constitutes our primary contribution, proactively mining the missing connective tissue of mathematics. Its efficacy is demonstrated by the production of a verified library of folklore lemmas, a subset of which has already been formally merged into the latest build of Mathlib, thereby validating the system's real-world utility and alignment with expert standards. Leveraging this pipeline, we further construct the MathlibLemma benchmark, a suite of 4,028 type-checked Lean statements spanning a broad range of mathematical domains. By transforming the role of LLMs from passive consumers to active contributors, this work establishes a constructive methodology for the self-evolution of formal mathematical libraries.
