Source-linked AI summary

Lean Workbook: A large-scale Lean problem set formalized from natural language math problems

Huaiyuan Ying, Zijian Wu, Yihan Geng, Zheng Yuan, Dahua Lin, Kai Chen

arXiv:2406.03847v3cs.CL

TL;DR

LLMs have advanced at solving mathematical problems, but theorem proving in formal languages such as Lean remains challenging, in part because formalized training data is scarce. Lean Workbook iteratively generates and filters translations between natural-language math problems and Lean 4 statements. The authors report a 57K-problem dataset with 93.5% accuracy in a random manual sample, and improvements in compile and NLI pass counts and MiniF2F accuracy.

  • Problem

    LLM theorem proving in Lean remains unsatisfactory, and available formalized data is limited or focused on fundamental rather than contest-level problems.

    Source: §1 · p. 1
  • Method

    Lean Workbook uses active learning to translate natural-language problems into Lean statements, filtering with compilation, back-translation and NLI checks, and human revision of flagged samples.

    Source: §1 · pp. 1–2, §4.2 · p. 5
  • Results

    The dataset contains 57K formalized problems with 93.5% accuracy in a random manual sample; human-labeled and filtered data add over 20,000 correct samples on both compile and NLI tests, alongside improved MiniF2F accuracy.

    Source: §1 · p. 2, §5.3 · p. 8
  • Takeaways & Limitations

    The authors release a large formalized problem set and translation pipeline intended to support research on autoformalization and automated theorem proving.

    Source: §1 · p. 2, §6 · p. 9

    The authors note that similar problems are difficult to deduplicate and that a model focused on contest-level problems may not suit formalizing other levels of mathematics.

    Source: Limitations · p. 9

Abstract

from arXiv · show

Large language models have demonstrated impressive capabilities across various natural language processing tasks, especially in solving mathematical problems. However, large language models are not good at math theorem proving using formal languages like Lean. A significant challenge in this area is the scarcity of training data available in these formal languages. To address this issue, we propose a novel pipeline that iteratively generates and filters synthetic data to translate natural language mathematical problems into Lean 4 statements, and vice versa. Our results indicate that the synthetic data pipeline can provide useful training data and improve the performance of LLMs in translating and understanding complex mathematical problems and proofs. Our final dataset contains about 57K formal-informal question pairs along with searched proof from the math contest forum and 21 new IMO questions. We open-source our code at https://github.com/InternLM/InternLM-Math and our data at https://huggingface.co/datasets/InternLM/Lean-Workbook.

1 Introduction

Lean Workbook addresses the scarcity of high-quality formalized contest problems with an iterative autoformalization pipeline and a large Lean problem set. The authors report 57K formalizations with 93.5% accuracy in a random manual sample, plus 21 new IMO statements.

1 Introduction

  • The work targets data sparsity: MiniF2F is limited by the labor required for formalization, while Mathlib emphasizes fundamental rather than contest-level problems.The introduction identifies creating enough high-quality formalized statements as an initial step toward better automatic theorem proving.Source: §1 · p. 1
  • 57K math problems were autoformalized, with 93.5% accuracy in a random manual sample, and the filtering process produced 21 new IMO statements absent from Compfiles.The authors describe the pipeline as translating between natural-language questions and Lean 4 statements, with compiler and NLI checks and human revision of invalid samples.Source: §1 · p. 2
  • The authors present an active-learning pipeline for autoformalizing natural-language questions and open-source a translation model and pipeline for diverse mathematical topics.They also describe an open dataset of 57K formalized problems, 5K with formal solutions, for autoformalization and automated theorem proving.Source: §1 · pp. 1–2
  • The contribution also includes 21 newly formalized IMO questions that have not appeared in Compfiles.The questions are produced through the same filtering process described for the larger dataset.Source: §1 · p. 2

2 Preliminaries

The preliminaries explain Lean 4 and Mathlib as the formal-proving environment, then clarify that this work translates problem statements rather than proving them. Lean statements specify variables, conditions, and conclusions, while proofs are represented with `sorry`.

2 Preliminaries

  • Lean 4 supports formal verification, and a completed proof returns a “No goals” signal; users can also leave a proof incomplete with “sorry.”The paper says its focus is statement translation, so it uses “sorry” for proofs.Source: §2 · p. 2
  • Mathlib is a user-maintained Lean 4 library whose existing theorems and functions can be used when stating and proving results.The paper defaults to Mathlib in the following discussion, as in MiniF2F environments.Source: §2 · p. 2
  • A typical Lean statement lists variables and their types, gives conditions in brackets, and places the conclusion after a colon before `:= by sorry`.The example uses a theorem declaration with assumptions and a set-valued conclusion.Source: §2 · p. 3

3 Related works

Related work covers autoformalization across mathematics levels, alternative approaches to automated theorem proving, and collaborative dataset curation. The authors position their work as large-scale contest-problem formalization using active learning and human evaluation.

3.1 Autoformalization

  • For high-school contest problems, Lean Workbook differs from DeepSeek-prover [31] by using active learning to reduce incorrect formalizations and manually evaluating dataset accuracy.Prior autoformalization spans grade-school, high-school contest, and undergraduate mathematics, using in-context learning or fine-tuned LLMs.Source: §3.1 · p. 3

3.2 Automatic Theorem Proving

  • Theorem-proving approaches either search proof states with best-first or tree search [7] [23] [29], or generate whole proofs from models or human proofs [31] [12, 27].Search can reject invalid tactics through the compiler, but the paper says it does not let the model predict tactics from an overall perspective.Source: §3.2 · p. 3

3.3 Data curation

  • Formal-language datasets draw on runtime information, human annotations, and human interaction, while benchmarks provide high-accuracy formal verification; this work combines expert and LLM contributions to autoformalization data.The cited examples include LeanDojo and CoqGym for extracting runtime information [32? ].Source: §3.3 · p. 3

4 Data construction pipeline

The data-construction pipeline iteratively translates math problems between natural language and Lean, filters candidate formalizations, and uses human corrections to refine later rounds.

4.1 First-round pipeline

  • For round one, MiniF2F and ProofNet supplied paired data; solution questions were rewritten as proof goals, and both translation directions entered training.Source: §4.1 · pp. 3–4
  • The well-defined subset had 6,652 tags; more than three-fourths of samples had algebra-related tags, geometry tags were rare, and number-theory tags were often assigned to inequalities.Source: §4.1 · p. 5

4.2 Data Diagnostic and Iteration pipeline

  • Lean compilation checks statement validity, then back-translation and NLI compare the original question with its formalization’s natural-language rendering.Samples without positive NLI feedback are marked for human revision.Source: §4.2 · p. 5
  • Experts diagnosed samples that failed compilation or NLI, added manual corrections to training, and later switched to random tag-based sampling as patterns became harder to identify.Early iterations added about 30 human-labeled samples each.Source: §4.2 · p. 5
  • After six rounds, sampled-data correct rate almost reached 95%, and iterations added 341 problems to training.Source: §4.2 · p. 6

5 Results

Results evaluate Lean translations with compilation, NLI, and sampled human checks, and report gains from active learning, proof search, and formalization of new IMO problems.

5.1 Evaluation setting

  • Evaluation uses compile pass number, NLI pass number, and sampled human-judged correct translation rate to assess generated statements.NLI pass requires compilation and a back-translation judged equivalent to the original question; human review is sampled by question type.Source: §5.1 · p. 6

5.2 Dataset Statistics and Evaluation Results

  • After six iterations, 205,079 questions pass compilation and 57,231 pass NLI; sampled accuracy exceeds 90% for the three most common tags.For other tags, almost all have at most one wrong translation; Table 1 samples 10 problems for each of the three most common tags and five for others.Source: §5.2 · p. 6, Table 1 · p. 7
  • InternLM-Math-Plus solves 4,898 Lean Workbook problems from 1,024 proof samples per problem, a Pass@1024 of 8.6%.The paper describes these problems as significantly harder than MiniF2F and says the solutions will be open-sourced to support theorem proving.Source: §5.2 · p. 6
  • Manual diagnostics find that iterative examples help correct compilation patterns, but are less effective for contest-problem interpretation errors.Reported examples include integer division type ambiguity and omitted minimality or existence; some errors can be partly fixed by post-processing.Source: §5.2 · p. 6

5.3 Effectiveness and discussion

  • The pipeline and dataset add over 20,000 correct samples for both compile and NLI tests, while MiniF2F accuracy increases with the extended dataset.The comparison covers models across iterations and MiniF2F fine-tuning with and without Lean Workbook.Source: §5.3 · p. 8, Table 3 · p. 8, Table 4 · p. 8

5.4 Formalizing IMO problems

  • The model yields 21 manually evaluated IMO formalizations: 14 algebra, five number theory, and two combinatorics problems.The team translated each problem 100 times, filtered with compile and NLI tests, and manually checked and slightly modified some conclusions.Source: §5.4 · p. 8

6 Conclusion

The paper concludes that its automatic pipeline translates contest-level math problems into Lean statements with high accuracy and releases Lean Workbook to support research.

6 Conclusion

  • The authors conclude that active learning is effective in this data-sparse setting and release Lean Workbook to support work on autoformalization and automatic theorem proving.Source: §6 · p. 9

Limitations

The authors identify dataset duplication and the contest-level focus of active learning as limitations.

Limitations

  • Similar problems are difficult to deduplicate, and contest-focused active learning may not suit formalizing other levels of mathematics.Source: Limitations · p. 9

Checklist

The checklist responses refer readers to the paper’s claims, scope, limitations, and experimental reporting.

Checklist

  • The checklist says the main claims and scope are described and that work limitations are discussed in Section 6.Source: Checklist · p. 12
  • The authors report no apparent negative societal impacts, stating that proving mathematical theorems has none.Source: Checklist · p. 12
  • The checklist reports that code, data, and training details are provided; error bars are marked not applicable because each iteration was fine-tuned once.Source: Checklist · p. 12

A Case study

The case study pairs natural-language problems with Lean statements across common mathematical tags, showing examples from number theory, inequalities, algebra, and analysis.

  • The examples pair natural-language problems with Lean statements across common mathematical tags.Source: A Case study · p. 13
  • A four-variable inequality assumes positive variables with product 1 and gives an upper bound of 4/5.Source: A Case study · p. 13
  • Number-theory examples formalize a prime-divisibility claim and classify integer cubes modulo 9.Source: A Case study · pp. 13–14
  • A trigonometric system is stated in Lean with an equivalent characterization of its solutions using integer multiples of π.Source: A Case study · p. 13
  • A triangle-side inequality is formalized under positivity and triangle-inequality hypotheses.Source: A Case study · p. 13
  • A complex-set example states that containing two specified lines and being closed under addition implies M = C.Source: A Case study · p. 14
  • The case study also includes a normalized sum estimate approaching 1 and the theorem that a continuous image of a compact set is compact.Source: A Case study · pp. 14–15
  • Other examples formalize a real-valued functional equation and a sequence recurrence whose reciprocal terms have partial sums below 2.Source: A Case study · p. 14

B IMO example

The IMO examples show Lean formalizations of problems across algebra, number theory, and combinatorics, including statements from several IMO years.

  • The formalized IMO questions focus on algebra, number theory, and combinatorics.Source: B IMO example · p. 15
  • The IMO 1975 sequence example formalizes infinitely many representations of later sequence terms as positive-integer combinations involving an earlier term.Source: B IMO example · p. 15
  • The IMO 1977 trigonometric example states bounds on two pairs of coefficients when a specified trigonometric expression is nonnegative for all real inputs.Source: B IMO example · p. 15
  • The IMO 1978 number-theory example encodes finding the least-sum positive exponents whose powers of 1978 have matching last three digits.Source: B IMO example · p. 15
  • The IMO 1982 number-theory example states that a positive integer represented by x^3 − 3xy^2 + y^3 has at least three representations, while 2891 has none.Source: B IMO example · p. 16
  • The IMO 1978 combinatorics example encodes a six-country, 1978-member society problem as a same-country sum condition on member numbers.Source: B IMO example · p. 16

C Dataset card

The dataset card describes two dataset splits, the information supplied for each problem, and the project's release and maintenance details.

  • Lean Workbook contains 57,231 problems and Lean Workbook Plus contains 82,893, with natural-language statements, answers, formal statements, and proofs when available.Source: C Dataset card · p. 16
  • The code and data are open-sourced under an Apache 2.0 dataset license, with plans to maintain and improve the dataset.Source: C Dataset card · p. 16
Loading 2406.03847v3…