
===== PDF PAGE 1 =====
STP: Self-play LLM Theorem Provers with Iterative Conjecturing and Proving


                                                 Kefan Dong 1 Tengyu Ma 1


                         Abstract                                     et al., 2023; Nijkamp et al., 2022). It is also a key criterion
                                                                      for achieving artificial general intelligence (AGI). Auto-
     A fundamental challenge in formal theorem prov-
                                                                      mated theorem proving with formal languages by LLMs
     ing by LLMs is the lack of high-quality training
                                                                      stands at the forefront of reasoning research (Yang et al.,
     data. Although reinforcement learning or expert it-
                                                                      2024a), partly because it allows objective and reliable eval-
     eration partially mitigates this issue by alternating
                                                                      uation through classical verifiers such as Lean (Moura &
     between LLM generating proofs and finetuning
                                                                      Ullrich, 2021) and Isabelle (Nipkow et al., 2002). Moreover,
     them on correctly generated ones, performance
                                                                      it arguably encapsulates the essence of advanced reasoning
     quickly plateaus due to the scarcity of correct
                                                                      tasks while abstracting away the ambiguity of natural lan-
     proofs (sparse rewards). To keep improving the
                                                                      guage, enabling meaningful studies on a relatively smaller
     models with limited data, we draw inspiration
                                                                      scale.
     from mathematicians, who continuously develop
     new results, partly by proposing novel conjectures               However, a fundamental challenge in improving reasoning
     or exercises (which are often variants of known                  performance—whether in natural or formal languages—lies
     results) and attempting to solve them. We de-                    in the lack of high-quality training data. Collecting reason-
     sign the Self-play Theorem Prover (STP) that si-                 ing data requires domain experts, making it expensive to
     multaneously takes on two roles, conjecturer and                 scale. There are only a limited number of advanced math pa-
     prover, each providing training signals to the other.            pers and theorems in existence, orders of magnitude smaller
     The conjecturer is trained iteratively on previously             than other data sources.
     generated conjectures that are barely provable by
                                                                      Reinforcement learning (RL) on datasets without solutions
     the current prover, which incentivizes it to gener-
                                                                      (e.g., datasets with theorem statements or reasoning ques-
     ate increasingly challenging conjectures over time.
                                                                      tions and answers) is a prominent approach for improving
     The prover attempts to prove the conjectures with
                                                                      the reasoning capability, as seen in the recent development
     standard expert iteration. We evaluate STP with
                                                                      of OpenAI o1 (Jaech et al., 2024), DeepSeek-Prover (Xin
     both Lean and Isabelle formal versifiers. With
                                                                      et al., 2024a) and DeepSeek R1 (Guo et al., 2025). Often
     51.3 billion tokens generated during the training
                                                                      referred to as expert iteration (Anthony et al., 2017), it par-
     in Lean, STP proves 28.5% of the statements in
                                                                      tially mitigates the data scarcity issue by alternating between
     the LeanWorkbook dataset, doubling the previous
                                                                      LLMs generating proofs and finetuning them on correctly
     best result of 13.1% achieved through expert itera-
                                                                      generated ones (Kaliszyk et al., 2018; Wu et al., 2021; Al-
     tion. The final model achieves state-of-the-art per-
                                                                      phaProof, 2024; Xin et al., 2024b; Ying et al., 2024).
     formance among whole-proof generation methods
     on miniF2F-test (65.0%), ProofNet-test (23.9%)                   However, as Wu et al. (2024) pointed out, RL or expert itera-
     and PutnamBench (8/644) with pass@3200.                          tion often saturates at a low pass rate because the number of
                                                                      samples required to generate a correct proof for an unproven
                                                                      theorem grows exponentially. As a result, a massive amount
1. Introduction                                                       of computation is wasted on generating incorrect proofs that
The reasoning capability of large language models (LLMs)              provide no training signal to the model. For instance, in the
is critical for various applications, including coding assis-         proof sampling process of Wu et al. (2024), 98.5% of the
tants, question-answering, and agents (Plaat et al., 2024;            compute yields no successful proofs, despite the pass rate
Shinn et al., 2023; Yao et al., 2022; Shao et al., 2024; Li           being only 13.1% on the training dataset, LeanWorkbook
   1
                                                                      (Ying et al., 2024). In other words, after a few rounds of
     Stanford University. Correspondence to: Kefan Dong <kefan-       expert iteration, re-training the model becomes less effective
dong@cs.stanford.edu>, Tengyu Ma <tengyuma@stanford.edu>.
                                                                      due to the limited number of new successful proofs.
Proceedings of the 42 nd International Conference on Machine          In addition, RL’s capability is fundamentally bounded by
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025
by the author(s).                                                     the difficulty level of the theorems in the training dataset—it

                                                                  1


===== PDF PAGE 2 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving




Figure 1: Self-play Theorem Prover (STP). Our model simultaneously takes on two roles — the conjecturer that generates
new, related conjecture given a seed theorem with proof (Step 1), and the prover that attempts to prove the statements in an
existing dataset and the generated conjectures (Step 2). Step 4 selects the correct, approachable, elegant, yet challenging
conjectures to train the conjecturer, and the verifier selects correct proofs in Step 3 to train the prover. The main difference
between STP and expert iteration is the conjecturer role highlighted with a yellow background.


is unlikely, in principle, for a model to learn college-level       1), while the prover attempts to prove conjectures and state-
proof techniques solely by working on high school-level             ments from an existing dataset (Step 2). Then, the verifier
problems or to solve open math problems using RL on                 selects correct proofs (Step 3) to train the prover using stan-
graduate-level problems. Moreover, there are likely not             dard RL and identifies correct, approachable, elegant, yet
enough open problem statements available for RL train-              challenging conjectures to supervise the training of the con-
ing to generalize to other open problems, particularly more         jecturer (Step 4). More concretely, in each iteration, the
advanced ones. In other words, RL or expert iteration al-           conjecturer is trained on previously generated conjectures
gorithms cannot train indefinitely without continuously col-        that: (a) are barely provable by the current prover (i.e., the
lecting more theorem statements or math problems.                   prover’s success probability with respect to its random seed
                                                                    is positive but low), and (b) pass certain elegancy filters.
We need an algorithm that can run and self-improve indefi-
                                                                    This iterative process gradually increases the difficulty of
nitely without more data. To this end, we draw inspiration
                                                                    conjectures and proofs without requiring additional data.
from how mathematicians learn and develop advanced math-
                                                                    Our method can be viewed either as a self-play algorithm
ematics; they refine their understanding and sharpen their
                                                                    between conjectures and provers or as automated curricu-
proof skills by working on synthesized exercises—variants,
                                                                    lum learning (Portelas et al., 2020) with a self-generated
extensions, or combinations of existing theorems. Addi-
                                                                    adaptive curriculum (via conjecturers).
tionally, they frequently propose and publish conjectures,
a process widely regarded as just as important, if not more         We empirically evaluate our method with both Lean (Moura
so, than solving them. In other words, unlike the current           & Ullrich, 2021) and Isabelle (Nipkow et al., 2002). For
training of LLMs, mathematicians engage with far more               the Lean experiments, we aim for the best performance and
exercises and conjectures (referred to collectively as con-         therefore choose DeepSeek-Prover-V1.5-SFT (Xin et al.,
jectures in this paper) than the polished, published results        2024b) as the base model for STP. As shown in Fig. 2, after
found in academic papers and books. Moreover, the con-              a self-play training of roughly 241M generated proofs and
tinuous generation of new conjectures keeps mathematical            3.6M generated conjectures, we successfully prove 28.5% of
fields dynamic and moving forward.                                  the statements in the training dataset LeanWorkbook (Ying
                                                                    et al., 2024), doubling the previous best result of 13.1%
In this paper, we design Self-play Theorem Prover (STP),
                                                                    (Wu et al., 2024) achieved by expert iteration.1 In Fig. 3,
which mimics how mathematicians learn and develop math-
                                                                    we compare the inference-time performance of existing
ematics. It simultaneously assumes two roles—conjecturer
and prover—providing training signals to each other.                   1
                                                                        Based on our reproduction, Deepseek-Prover-V1.5 has a better
                                                                    performance on LeanWorkbook, proving 13.2% statements with
As illustrated in Fig. 1, the conjecturer, given a seed theo-       32 samples per statement, although the original paper does not
rem with proof, proposes a new, related conjecture (Step            report this number.


                                                                2


===== PDF PAGE 3 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving




Figure 2: The cumulative pass rates of STP, expert iteration,
and parallel sampling on LeanWorkbook shows that STP
                                                                    Figure 3: Comparison of pass rates on miniF2F-test (y-axis)
achieves a much better scaling in terms of the performance
                                                                    with different numbers of inference-time samples (x-axis).
vs number of generated proofs. The compute for generating
                                                                    The model trained with STP consistently outperforms the
conjectures and training the conjecturer in STP is negligible
                                                                    Deepseek-Prover-V1.5 series.
because the number of generated proofs during training is
64 times the number of conjectures.
                                                                    2. Additional Related Works
                                                                    We refer the readers to Bibel (2013); Loveland (2016) and
models and the final model trained with STP by taking               the reference therein for classical automated theorem prov-
multiple independent samples on a common benchmark,                 ing. Below, we discuss recent works on modern LLM-based
miniF2F-test (Zheng et al., 2021). Our model significantly          theorem provers in addition to what has been discussed in
outperforms the DeepSeek-Prover-V1.5 models across var-             the intro.
ious sampling budgets. We also achieve state-of-the-art             Autoformalization. A relatively efficient way to create
performance among whole-proof generation methods on                 formal proof data is autoformalization, that is, translating
miniF2F-test (65.0%, pass@3200), ProofNet-test (23.9%,              natural language math statements and/or proofs to formal
pass@3200) (Azerbayev et al., 2023a) and PutnamBench                language (Jiang et al., 2023; Lu et al., 2024). A line of
(8/644, pass@3200) (Tsoukalas et al., 2024), where pass@k           research focuses on generating proofs or reasoning steps
represents the percentage of statements proved with k inde-         in natural language and then formalizing the proofs (Jiang
pendently sampled proofs per statement.                             et al., 2022b; Zheng et al., 2023; Wang et al., 2023). Most
In the Isabelle experiments, we study the scalability of STP        recently, AlphaProof (2024); Xin et al. (2024a;b) autofor-
by starting from a generic math-focused model Llemma-               malize statements and then train with expert iteration / RL to
7b (Azerbayev et al., 2023b) and run STP for more iterations        write proofs, achieving significant improvement over prior
(300M generated proofs in total). We compare the scaling of         works thanks to the large-scale natural language datasets.
STP with expert iteration and parallel sampling, by taking          Formal conjecturing. Prior works also study how to gener-
several model checkpoints during the STP training run and
                                                                    ate new formal statements/conjectures by neural networks
then switching to the baseline methods. The results clearly
                                                                    (Urban & Jakubův, 2020; Einarsdóttir et al., 2024; Johans-
demonstrate that STP achieves a better scaling behavior             son & Smallbone, 2023) or human-written generators (Polu
starting from various checkpoints with different capability         et al., 2022; Trinh & Luong, 2024), and find that the syn-
(see Fig. 4 in Section 4.3). Ablation study also demonstrates       thetic statements are generally useful for training the provers
that the main performance gain stems from the dense train-          (Wang & Deng, 2020; Wu et al., 2020). Synthetic state-
ing signals given by the conjectures. Expert iteration wasted
                                                                    ments and proofs can also be extracted from an incorrect
its compute on generating unsuccessful proofs to challeng-
                                                                    proof trajectory during RL with hindsight experience replay
ing theorems in the training dataset—at a checkpoint where          (HER) (Andrychowicz et al., 2017) to speed up the training
the pass rate is around 11.4% on LeanWorkbook, only 131             process (Aygün et al., 2022; Dong et al., 2024). However,
out of 2.5M generated proofs of the unproved statements             even though the training efficiency is improved, we argue
are correct, resulting in very limited training signals. In         that the final performance is still bounded by difficulty level
contrast, at least 47% of the generated conjectures in STP
                                                                    of the existing dataset because synthetic statements are most
training are successfully proved because the conjecturer is
                                                                    likely easier than the given ones in the dataset.
trained to generate more approachable statements thanks to
the design of its reward (see Fig. 6).                              Self-play and automatic goal generation. The closest re-

                                                                3


===== PDF PAGE 4 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

lated work to this paper is Poesia et al. (2024) which also          and its corresponding proof. We only compute the next to-
designs a self-play training that iterates between conjectur-        ken prediction loss on the proof (which is the expected
ing and theorem proving. The key difference between this             output of the model), while the rest is treated as input. To
paper and Poesia et al. (2024) is that we start with a pre-          build this dataset, we simply extract all the statement-proof
trained model and work on practical formal languages like            pairs from the proof library files and add a system prompt.
Lean and Isabelle with an infinite space of possible proof
steps (which are actions in the RL algorithm), whereas Poe-          Conjecturer SFT dataset. Generally, the conjecturer is to
                                                                     generate a new, related conjecture, given a seed statement
sia et al. (2024) operates in a simplified and constrained
                                                                     with proof that provide the initial ideas. Technically, to fur-
setting with a finite action space and trains from scratch. As
a result, Poesia et al. (2024) rely on constrained decoding to       ther guide the generation of conjecturer, we also provide it
force the validity of generated conjectures, while we solely         a lemma used in the proof of the seed statement, which can
rely on the LLM itself to generate valid conjectures. Techni-        be extracted from the verifier,2 so that the generated conjec-
cally, since our training process is much longer (more than          tures are more likely to be related to the theorem through
                                                                     the lemma. Therefore, the input is a concatenation of the
50 iterations) than Poesia et al. (2024) (5 iterations), we
                                                                     system prompt, a lemma, and a seed statement and its proof,
must carefully design the conjecturing reward to maintain
the diversity and relevance of the generated conjectures (see        separated by special formatting tokens, and the expected
Section 3.2).                                                        output is a conjecture on which we compute training loss.
                                                                     We also allow the model to generate conjectures with a fixed
The idea of generating new tasks by the model is also ex-            trivial lemma. To construct this dataset, we extract (lemma,
plored in other domains such as alignment (Ye et al., 2024),         theorem X, theorem Y) tuples from every proof library file
programming puzzles (Haluptzok et al., 2022; Teodorescu              such that (a) the lemma and two theorems appears in the
et al., 2023; Pourcel et al., 2024b), video games (Zhang             file in this particular order, and (b) the lemma is used in the
et al., 2023; Pourcel et al., 2024a), and classic RL environ-        proof of both theorems. The lemma and theorem X will be
ments (Parker-Holder et al., 2022; Colas et al., 2022). More         part of the inputs, and theorem Y will be the output.
generally, self-play training has demonstrated its potential
to achieve super-human performance on two-player games               3.2. Self-play training
in a fixed environment like Go (Silver et al., 2016).
                                                                     Our self-play training stage of STP is shown in Fig. 1. The
                                                                     main difference compared to expert iteration is the conjec-
3. Method                                                            turer in Steps 1 and 4, highlighted in a yellow background.
On the high level, Self-play Theorem Prover (STP) involves           Generating conjectures and proofs (Steps 1 & 2). The
three training stages: (1) model initialization by supervised        self-play training starts with collecting a list of the conjec-
finetuning, (2) self-play training (visualized in Fig. 1), and       turer’s inputs in the same format as in the conjecture SFT
(3) final re-training. Unless otherwise stated, we use the           dataset (system prompt, lemma, and theorem), but from
term ‘statement’ to refer to the statements in given datasets,       theorem-proof pairs where the theorems are from the given
and ‘conjecture’ the generated conjectures.                          dataset without proofs and proofs are previously generated.
                                                                     We extract a seed lemma from the proof, using the verifier.3
3.1. Model initialization by supervised finetuning                   To prevent the model from only focusing on a few particu-
In this stage, we initialize the model with two roles, con-          lar proof techniques, we de-duplicate the list based on the
jecturer and prover, by finetuning a generic LLM (such as            seed statement and lemma, and randomly drop some inputs
the Llama (Touvron et al., 2023)) on a SFT dataset con-              whose lemma appears excessively. Then, the LLM gener-
structed from existing proof libraries such as Mathlib (math-        ates conjectures from the inputs, and we randomly select a
lib Community, 2020). The proof libraries are organized              subset of the generated conjectures with size no larger than
into files containing human-written formal proofs of known           the number of remaining unproved statements in the given
mathematical theorems, and each file formalizes a relatively         dataset, so that the prover’s compute budget is split equally
self-contained result, such as a chapter of a textbook. Our          between the conjectures and statements. (See the pseudo-
SFT data consists of the following two parts, for finetuning         code and details in Appendix A.2.) For the prover’s inputs,
the prover and conjecturer, respectively. Also see concrete          we combine the generated conjectures and the unproved
examples in Appendix A.1.                                            statements in the existing dataset. Then, we independently
                                                                     sample K proofs per statement/conjecture in Step 2.
Prover SFT dataset. We construct a SFT dataset to teach                 2
the model to write formal proofs in the given format, where               There is no fundamental difference between lemmas and theo-
                                                                     rems in formal proofs — the naming is purely for better exposition.
each example is the concatenation of a system prompt (to in-            3
                                                                          In our implementation, lemmas are extracted together with
struct the model to generate in formal language), a statement,       proof verification in Step 3 by configuring the verifiers accordingly.


                                                                 4


===== PDF PAGE 5 =====
                                   Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Reward assignments (Step 4). The major technical chal-                        the distribution P as the training set for the conjecturer.
lenge of STP is to design the reward function for the con-                    Pseudo-code of this step is in Appendix A.3, and an effi-
jecturer (in other words, construct the conjecturer dataset                   cient implementation is in Appendix A.5.
in Step 4). The ultimate goal is to incentivize conjecturer
                                                                              For the prover dataset, we only select correct generated
to generate diverse, relevant, approachable yet challenging
                                                                              proofs where the empirical pass rate of the corresponding
conjectures to provide enough training signals to the prover.
                                                                              statement/conjecture is below 1/2. (We consider other cor-
In Step 4, we first organize all generated conjectures and                    rect proofs trivial). We de-duplicate the prover dataset by
proofs into a list of examples D = {(ti , pti , li , ci , pci )}ni=1          exact match. Then, the prover is trained on a replay buffer
where ti and pti represents a seed statement and its proof, li                containing the selected proofs from the last three iterations.
is a lemma used in the proof pti , and ci , pci are the generated
                                                                              LLM training (Step 5). We use weighted cross entropy
conjectures and the generated proof. We will filter D as
                                                                              loss computed on the conjectures or proofs (but not the
described below and then use (ti , pti , li ) as the input to the
conjecturer and ci as the output, and pci as the output of the                inputs of the model). For the proof dataset, we weight
prover w.r.t. the input ci .                                                  the examples reciprocally to the number of verified proofs
                                                                              to the corresponding statement/conjecture. We also use a
To decide whether a conjecture c is challenging, we use                       length penalization of the form γ L to reward simpler proofs,
the (empirical) pass rate of the prover estimated by the K                    where γ < 1 is the discount factor and L is the length of
independently generated proofs:                                               the proof. For the experiments with Lean, we additionally
                                                                              reward proofs that has faster verification time by a penaliza-
  P̂ (c) ≜ (#{i : ci = c, pci is correct})/(#{i : ci = c}).                   tion of the form β T , where T is the execution time of the
Then, we select the examples in D where (a) lemma li is                       Lean verifier.4
used in the proof of conjecture pci , and (b) the pass rate of
the conjecture, P̂ (ci ), is between (0, 1/4]:                                3.3. Final re-training
                                                                              To avoid training instability caused by the changing data
 D ← {(ti , pti , li , ci ) | (ti , pti , li , ci , pci ) ∈ D,
                                                                              distribution during self-play, we re-train the final model
              P̂ (ci ) ∈ (0, 1/4], pci is correct, li is used in pci }.       checkpoint from the base model (before the SFT stage) on
                                                                              a combination of the SFT dataset and all the correct proofs
Here we discard the proofs (of the conjecture) pci since they                 generated during the self-play training whose corresponding
are not needed to train the conjecturer, and we remove the                    statement/conjecture has an empirical pass rate no larger
duplicated conjectures (that have multiple proofs).                           than 1/4. For every statement/conjecture, we randomly keep
Then, we apply a heuristic elegancy filter to discourage the                  at most 16 distinct proofs to speedup the training.
model from generating artificially hard conjectures with
complicated goals — we remove conjectures whose mini-                         4. Experiments
mum proof length divided by the length of the conjecture is
in the lowest 20% of remaining examples.                                      This section presents our implementation details of STP, the
                                                                              results of Isabelle and Lean experiments, and the ablation
Finally, we re-weight the selected conjectures to preserve                    studies, followed by examples of generated conjectures.
the diversity of the conjecturer — the reward for conjecturer
cannot only depend on the generated conjectures individ-
                                                                              4.1. Implementation details
ually because otherwise the conjecturer’s optimal policy
may degenerate to a singular distribution, whereas in reality,                Training datasets. Our primary source of statements with-
the given dataset typically has multiple modes because the                    out proofs is the de-duplicated LeanWorkbook (Ying et al.,
statements focus on different topics like algebra, number                     2024), which contains around 89K Lean4 statements (see
theory, and calculus. Therefore, our idea is to push the dis-                 Appendix A.4 for details). For the Isabelle experiments,
tribution of the selected conjectures toward the unproved                     we translate the Lean4 statements to Isabelle using the
statements in the existing dataset to maintain the balance                    DeepSeek V2.5 with few-shot prompting. For the Lean
between multiple modes. To this end, we compute a distribu-                   experiments, we combine LeanWorkbook, miniF2F-valid,
tion P supported on the selected conjectures that minimizes                   and ProofNet-valid as the training dataset for STP.
the Wasserstein distance to the uniform distribution over
unproved theorems, denoted by Q. The matching cost or                         The SFT dataset for the Isabelle experiments is extracted
similarity metric between a conjecture and a statement, used                     4
                                                                                   In our preliminary experiments, we found that without the
for computing the Wasserstein distance between P and Q,                       penalization on verification time, the Lean verifier takes 2x more
is defined as the negative cosine similarity between their                    wall-clock time on CPU than sampling proofs on TPU for our
embeddings (given by the current model). Finally, we use                      cluster setup, which becomes a bottleneck for STP training.


                                                                          5


===== PDF PAGE 6 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

from AFP5 and Isabelle built-in files such as HOL. For the             metric for training progress. Fig. 2 plots the cumulative
Lean experiments, we first sample 32 proofs per statement              pass rate of STP and two major baselines, expert iteration,
in LeanWorkbook since our base model, DeepSeek-Prover-                 and parallel sampling, on the training dataset LeanWork-
V1.5-SFT, is already trained on it, and combine the correct            book (Ying et al., 2024). Expert iteration alternates between
proofs with examples extracted from the proof library Math-            generating proofs to the statements in the given dataset and
lib4 (mathlib Community, 2020) as the SFT dataset.                     finetuning the model on correct proofs. (See discussions
                                                                       and comparison about variants of expert iteration in Ap-
Periodic refreshing. With a limited replay buffer, the model
                                                                       pendix A.6.) Parallel sampling simply generates proofs
may forget some proof skills learned in the SFT stage af-
                                                                       with the given model. Fig. 2 shows that STP achieves signif-
ter many iterations. Therefore, during our STP training,               icantly better scaling than expert iteration, which simulates
we periodically re-train the model from the base model on              the performance of DeepSeek’s model as if it were trained
all previously generated correct proofs, following a pro-              for more iterations.
cedure similar to the final re-training in Section 3.3. After
refreshing, we reset the replay buffer and restart the self-play       Since the formal statements in our training dataset, Lean-
training using the re-trained model checkpoint.                        Workbook, are translated from natural language statements,
                                                                       they are not always provable. In Appendix B.3, we ran-
Verifiers’ setup. To study the scalability of STP with lim-            domly select 20 unproved statements from LeanWorkbook
ited compute, in the Isabelle experiments, we disable the              and manually assess whether (a) the formal statement is an
advanced proof tactics sledgehammer, mason, smt,                       accurate translation of the natural language statement, and
metis, sos, which require huge CPU compute, to allow                   (b) the formal statement itself is correct and provable. We
more training iterations, sacrificing verification strength and        find that 16 out of the 20 statements are translated correctly,
overall performance. We use PISA (Jiang et al., 2021) to               but only 7 statements are provable and the remaining 13
interact with Isabelle, and enforce a 10s timeout for any              statements are unprovable (e.g., due to missing assumptions
proof step and 360s timeout for entire proofs. For Lean, we            in the corresponding natural language statement), suggest-
follow Xin et al. (2024b), which allows all proof tactics, and         ing that the best possible pass rate on LeanWorkbook is far
set a 200s timeout and a 15GB memory limit for each proof.             below 100%.
Hyperparameters. For inference, we cap the number of                   In Table 1, we compare the final re-trained model of STP
generated tokens to 1024, and set the sampling temperature             with prior works on two common benchmarks, miniF2F-test
to 0.7 for Llemma-7b and 1.0 for DeepSeek-Prover, fol-                 and ProofNet-test, which contain formal statements of high-
lowing Dong et al. (2024); Xin et al. (2024b), respectively.           school level and college level math questions, respectively.6
For training, we use batch size 2048 and Adam (Kingma &                Among the whole-proof generation methods, STP signif-
Ba, 2014) with a constant learning rate of 5e-5 in STP, and            icantly outperforms DeepSeek-Prover-V1.5-RL (which is
1e-4 in SFT and final re-training. The discount factors are            continuously trained with RL on top of their SFT model)
γ = exp(−0.001) and β = exp(−0.01)                                     and achieves SoTA performance across various inference-
In each iteration of STP, we sample K = 32 proofs per                  time sample budgets. We also report the performance of
conjecture/statement. For the expert iteration and parallel            the model trained only on LeanWorkbook for 24 iterations,
sampling, we use K = 64. Since we maintain the number of               excluding miniF2F-valid and proofnet-valid, demonstrating
generated conjectures per iteration to be at most the number           that the model trained with STP also generalizes to out-of-
of unproved statements in the given dataset, STP has the               domain theorems.7
same sample budget as the baseline methods per iteration.              Table 1 also compares STP with tree search methods such as
                                                                       InternLM2.5-StepProver (Wu et al., 2024), which use LLMs
4.2. Results with Lean                                                 to generate single proof steps conditioned on the current ver-
For the Lean experiments, we choose DeepSeek-Prover-                   ifier’s proof state and then find a complete proof by best first
V1.5-SFT as our base model, which is trained on proofs                 search or MCTS. The sample budget of these methods are
collected by expert iteration on a combination of public,              not directly comparable with whole-proof generation meth-
such as LeanWorkbook, miniF2F-valid (Zheng et al., 2021),                 6
                                                                            In our experiments, we use the miniF2F statements in
and ProofNet-valid (Azerbayev et al., 2023a), and propri-              https://github.com/yangky11/miniF2F-lean4/
etary datasets. We run 48 iterations of STP and generated              commit/8c83bc4 and the ProofNet statements in https:
3.6M conjectures, 241M proofs, and 51.3B tokens in total.              //github.com/deepseek-ai/DeepSeek-Prover-
                                                                       V1.5/blob/main/datasets/proofnet.jsonl.
We use the cumulative pass rate, defined by the fraction of               7
                                                                            Our base model, DeepSeek-Prover-V1.5-SFT, is trained on
statements proved during the entire training, as the main              miniF2F-valid and ProofNet-valid, though we only run STP on
   5                                                                   LeanWorkbook in this experiment. The penalization on verification
       https://www.isa-afp.org/                                        time is also not included in this experiment.


                                                                   6


===== PDF PAGE 7 =====
                             Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Table 1: Pass rate on miniF2F (Zheng et al., 2021) and ProofNet (Azerbayev et al., 2023a) with different inference-time
sample budgets. Our method, STP, achieves state-of-the-art performance among whole-proof generation methods across
various sample budgets. For reference, we also include tree search methods, even though they are orthogonal to our main
contribution. The sample budgets of tree search methods are not fully comparable to that of the whole proof generation
because they also use the LLM to process the verifier’s internal proof state.

                                                 Sample budget             Sample budget
    Method                                                                                         MiniF2F-test      ProofNet-test
                                                   (#Proofs)                 (#Steps)
    Whole-Proof Generation Methods
    TheoremLlama (Wang et al., 2024)                  128                         -                   33.6%                -
    DSP (Jiang et al., 2022b)                         100                         -                   39.3%                -
    DeepSeek-Prover-V1.5-SFT                          128                         -               50.4% ± 0.4%      15.9% ± 0.6%
     (Xin et al., 2024b)                              3200                        -               53.3% ± 0.5%      21.0% ± 0.9%
    DeepSeek-Prover-V1.5-RL                           128                         -               51.6% ± 0.5%      18.2% ± 0.5%
     (Xin et al., 2024b)                              3200                        -               54.9% ± 0.7%      22.0% ± 0.5%
                                                     25,600                       -               58.4% ± 0.6%          23.7%
                                                    102,400                       -                   60.2%                -
    STP                                               128                       1.1K              57.2% ± 0.6%      18.0% ± 0.7%
      (w/o miniF2F-valid, ProofNet-valid)             3200                      28K                   61.1%             23.1%
    STP                                               128                      1.3K               61.2% ± 0.6%      19.5% ± 0.7%
                                                      3200                      32K               65.0% ± 0.5%      23.9% ± 0.6%
                                                     25,600                    254K                   67.6%             26.9%

    Tree Search Methods8
    ReProver (Yang et al., 2024b)                      -                         -                    26.5%                -
    PACT (Zheng et al., 2021)                          -                8 × 16 × 512 = 66K            29.2%                -
    GPT-f (Polu et al., 2022)                          -               64 × 8 × 512 = 262K            36.6%                -
    HTPS (Lample et al., 2022)                         -                 64 × 5000 = 320K             41.0%                -
    Lean-STaR (Lin et al., 2024)                       -                64 × 1 × 50 = 3.2K            46.3%                -
    DeepSeek-Prover-V1.5-RL + RMaxTS9                3200                        -                55.0% ± 0.7%      21.5% ± 0.8%
     (Xin et al., 2024b)                            25,600                       -                59.6% ± 0.6%          25.3%
                                                    204,800                      -                    63.5%                -
    InternLM2.5-StepProver                             -                4 × 32 × 600 = 77K        58.5% ± 0.9%            -
      (Wu et al., 2024)                                -              16 × 32 × 600 = 307K        62.5% ± 0.5%            -
                                                       -              256 × 32 × 600 = 4.9M           65.9%                -


ods because (a) the number of steps in a generated proof                  As shown in Table 4, on PutnamBench (Tsoukalas et al.,
varies significantly, (b) LLMs in tree search methods need                2024) which consists of undergraduate-level mathematics
to process additional tokens related to the verifier’s proof              competition questions, STP solves 7 out of 644 problems
state, and (c) methods like InternLM2.5-StepProver (Wu                    with 128 samples per problem, and 8 problems with 3200
et al., 2024) require an additional LLM as the value func-                samples per problem, outperforming the best result of 6
tion. Moreover, it’s conceivable that tree search methods                 problems in prior works achieved by Wu et al. (2024).
can also be used with STP, so essentially these are orthog-
onal methods. Nonetheless, we compute the total number                    4.3. Results with Isabelle
of proof steps per statement generated by STP as an proxy
for the total number of LLM output tokens for STP and tree                For Isabelle experiments, we start with the Llemma-
search methods, ignoring the additional compute required                  7b (Azerbayev et al., 2023b), math-focused model, and
by tree search methods to process the verifier’s proof state              run 58 iterations of STP to study its scalability. We take
and query the value function. Results in Table 1 indicate                 several checkpoints during STP training and then switch
that STP also outperforms prior tree search methods with                  to the expert iteration and parallel sampling baselines to
similar (estimated) inference-time budgets.                               study the scalability of the algorithm from checkpoints with
                                                                          various capability. Fig. 4 compares their cumulative pass
    8
      The #Steps for tree search methods is typically calculated by       rates on LeanWorkbook (Isabelle translation), showing that
#Independent runs × #Tactics generated per search step × #Search          STP consistently achieves a better scaling across the training
steps, or #Independent runs × #Search steps.
    9
      DeepSeek-Prover-V1.5-RL + RMaxTS is a tree search method            instead of single proof steps. Therefore, we treat their sample
that uses the LLMs to generate complete proofs during the search          budget as the number of generated proofs instead of steps.


                                                                      7


===== PDF PAGE 8 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Table 2: Comparison of STP with and without final re-
training on miniF2F-test and ProofNet-test.

   Method               Budget      miniF2F      ProofNet
   STP                      1        42.3%         7.7%
    w/ re-training        3200       65.0%        23.9%
                         25600       67.6%        26.9%
   STP                      1        43.2%         8.8%
    w/o re-training       3200       65.1%        22.0%
                         25600       66.0%        23.7%

                                                                       Figure 4: Cumulative pass rate on LeanWorkbook (trans-
                                                                       lated into Isabelle) of STP, expert iteration, and parallel
process. The model also gradually improves on miniF2F                  sampling, started from two checkpoints in STP training.
over the training process, as shown in Fig. 5.                         STP achieves better scaling starting from both checkpoints.
                                                                       For better visualization, the x-axis starts with 50m here and
4.4. Ablation study                                                    we defer the full plot to Fig. 7 in the appendix.

Generated conjectures provide denser training signals.
Fig. 6 shows the histogram of empirical pass rates of the
generated conjectures and the unproved statements in Lean-
Workbook using a checkpoint in the Isabelle experiment.
Only 131 out of 2.5M generated proofs for the 79K un-
proved statements are correct. As a result, finetuning the
model on correct proofs has almost no effect, and thus ex-
pert iteration plateaus. In contrast, generated conjectures by
STP offers higher pass rates and thus more training signals,
leading to better scaling.
Re-training with generated conjectures still helps down-
stream performance. One may hypothesis that the self-
play algorithm and generated conjectures only help improve             Figure 5: The performance of our model on miniF2F grad-
the pass rate on LeanWorkbook. It turns out that in the                ually improves during the training process. Note that our
final re-training stage, it is still beneficial to re-train with       model is not trained on miniF2F valid and we disallow
the generated conjectures in addition to the successfully              advanced tactics such as sos. The checkpoints are taken
proved statements in LeanWorkbook even for performance                 roughly per 68M generated proofs.
on miniF2F-test and ProofNet-test—it leads to about 2-3%
performance gain (for pass@128) than re-training only on
the latter (See Appendx B.1).                                          lemmas in the proofs of LeanWorkbook statements. At a
                                                                       late checkpoint of our experiments, 51.1% of the correct
Final re-training improves the pass@k performance. In                  proofs of generated conjectures share at least one lemma
Table 2, we compare the performance of STP with the fi-                with the proof of the seed statement, which indicates that
nal model checkpoint from self-play training (i.e., without            a substantial portion of generated conjectures are mean-
final re-training) on miniF2F-test and ProofNet-test. Ta-              ingfully related to their seed statement. In Appendix B.4,
ble 2 shows that STP with final re-training achieves a better          we list 30 most frequently shared lemmas. While lem-
scaling (and therefore a better pass@k for large k), while             mas in the field of inequalities and algebra remain dom-
sacrificing the pass@1 performance.                                    inant (e.g., sq_nonneg, Real.sin_sq_add_cos_sq),
                                                                       we also see lemmas related to sequence of products (i.e.,
4.5. Analysis of generated conjectures                                 Finset.prod_range_succ), and number theory (e.g.,
                                                                       Nat.pow_mod, nat_sub_dvd_pow_sub_pow).
We observe that the generated conjectures generally require
similar proof techniques as the original statements — we
                                                                       4.6. Examples of generated conjectures
compute the 20 most frequently used lemmas in the proofs
of generated conjectures, and find that among these 20                 In this section, we list three manually selected examples of
lemmas, 17 also appear among the top 20 most frequent                  the generated conjectures at the last iteration of the Lean

                                                                   8


===== PDF PAGE 9 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving


                                                                      theorem lean_workbook_plus_46203’ (a : R)
                                                                          (ha : 0 < a ∧ a ≤ 1) : Σ’ (i : N), 1
                                                                          / 4 ^ i * a = a / (1 - 1 / 4)
                                                                                                                       √
                                                                      The seed statement is a special case where a =       5/3:
                                                                      theorem lean_workbook_plus_46203 :
                                                                         Σ’ k : N, (1 / 4)^k * (Real.sqrt 5 / 4)
                                                                          = (Real.sqrt 5 / 3)

                                                                      In this case, the conjecture generalizes the given statement
                                                                      by replacing Real.sqrt 5 / 4 with a variable a.
Figure 6: Histogram of empirical pass rates of generated
conjectures and unproved statements in the training dataset           5. Conclusion
at a checkpoint where the cumulative pass rate on Lean-
Workbook (Isabelle translation) is 11.4%. The generated               This paper designs Self-play Theorem Prover (STP) that si-
conjectures are significantly more likely to be proved (i.e.,         multaneously has two roles, conjecturer and prover. By pro-
has a positive pass rate) than the unproved statements in the         viding training signals to each other, STP goes beyond the
dataset, and therefore provide denser training signal. Note           statements in the given dataset and its performance continu-
that the y-axis is in log scale.                                      ously improves. Our final model significantly outperforms
                                                                      Deepseek-Prover-V1.5 series and achieves state-of-the-art
                                                                      performance among whole-proof generation methods on
experiment to demonstrate their quality.                              common formal proof benchmarks. To facilitate future re-
                                                                      search, we release our code, model, and dataset in this url:
Example 1. The generated conjecture says (1 + x)2n ≥                  https://github.com/kfdong/STP.
1 + xn when n ≥ 1 is an integer and x ∈ [0, 1]:
theorem lean_workbook_36081’ (x : R) (hx :                            Impact Statement
    0 ≤ x ∧ x ≤ 1) : ∀ n :N, n ≥ 1 → (1 +
     x)^(2*n) ≥ 1 + x^n                                               This paper presents work whose goal is to advance the field
                               2            2                         of Machine Learning. There are many potential societal
The seed statement says 1 + x ≤ (1 + x) when x ∈ [0, 1]:
                                                                      consequences of our work, none which we feel must be
theorem lean_workbook_36081 (x : R) (hx :                             specifically highlighted here.
    0 ≤ x ∧ x ≤ 1) : 1 + x^2 ≤ (1 + x)^2
                                                                      Acknowledgment
In this case, the conjecture is harder than the original state-
ment but is proved with similar techniques — expanding                The authors would like to thank Yinuo Ren, Zhizhou Ren,
the powers of a binomial and then using the fact that x ≥ 0.          Woosuk Kwon, David Hall, Huajian Xin, Kaiyue Wen, and
                                                                      ICML anonymous reviewers for their helpful discussions.
Example 2. The generated conjecture says (xn −
                                                                      The authors would also like to thank the support from NSF
1) mod (x − 1) ≤ 1 if x, n are integers:
                                                                      RI 2211780, and NSF CIF 2212263, and the Google TPU
theorem lean_workbook_54038’ (x : N) (n : N                           Research Cloud for the computing resources that enabled
    ) (hn : 1 < n) : (x^n - 1) % (x - 1) ≤                            these experiments.
    1

The seed statement says n − 1 divides nk − 1:                         References
theorem lean_workbook_54038 (n : N) (k : N                            AlphaProof. Ai achieves silver-medal standard solving in-
    ) (hn : 2 ≤ n) : n - 1 | n^k - 1                                    ternational mathematical olympiad problems. 2024. URL
                                                                        https://deepmind.google/discover/blog/
In this case, our model generates a variant of the original
                                                                        ai-solves-imo-problems-at-silver-
statement by realizing that b mod a equals zero if a divides
                                                                        medal-level/.
b. This conjecture may help the model connect its proof
technique in algebra and number theory. However, the con-             Andrychowicz, M., Wolski, F., Ray, A., Schneider, J., Fong,
jecture itself is somewhat unusual and the inequality is not            R., Welinder, P., McGrew, B., Tobin, J., Pieter Abbeel, O.,
tight. Therefore it is unlikely to be included in any datasets.         and Zaremba, W. Hindsight experience replay. Advances
                                                                        in neural information processing systems, 30, 2017.
Example 3. The generated conjecture says i≥0 ((1/4)i ·
                                               P
         a
a) = 1−1/4    if 0 < a ≤ 1.                                           Anthony, T., Tian, Z., and Barber, D. Thinking fast and slow

                                                                  9


===== PDF PAGE 10 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

  with deep learning and tree search. Advances in neural             Jiang, A. Q., Welleck, S., Zhou, J. P., Li, W., Liu, J., Jamnik,
  information processing systems, 30, 2017.                             M., Lacroix, T., Wu, Y., and Lample, G. Draft, sketch,
                                                                        and prove: Guiding formal theorem provers with informal
Aygün, E., Anand, A., Orseau, L., Glorot, X., Mcaleer,
                                                                        proofs. arXiv preprint arXiv:2210.12283, 2022b.
  S. M., Firoiu, V., Zhang, L. M., Precup, D., and Mourad,
  S. Proving theorems using incremental learning and hind-           Jiang, A. Q., Li, W., and Jamnik, M. Multilingual mathemat-
  sight experience replay. In International Conference on               ical autoformalization. arXiv preprint arXiv:2311.03755,
  Machine Learning, pp. 1198–1210. PMLR, 2022.                          2023.
Azerbayev, Z., Piotrowski, B., Schoelkopf, H., Ayers, E. W.,
  Radev, D., and Avigad, J. Proofnet: Autoformalizing and            Johansson, M. and Smallbone, N. Exploring mathematical
  formally proving undergraduate-level mathematics. arXiv              conjecturing with large language models. 2023.
  preprint arXiv:2302.12433, 2023a.
                                                                     Kaliszyk, C., Urban, J., Michalewski, H., and Olšák, M.
Azerbayev, Z., Schoelkopf, H., Paster, K., Dos Santos,                 Reinforcement learning of theorem proving. Advances in
  M., McAleer, S., Jiang, A., Deng, J., Biderman, S., and              Neural Information Processing Systems, 31, 2018.
 Welleck, S. Llemma: An open language model for mathe-
  matics. In The 3rd Workshop on Mathematical Reasoning              Kingma, D. P. and Ba, J. Adam: A method for stochastic
  and AI at NeurIPS’23, 2023b.                                         optimization. arXiv preprint arXiv:1412.6980, 2014.

Bibel, W. Automated theorem proving. Springer Science &              Kwon, W., Li, Z., Zhuang, S., Sheng, Y., Zheng, L., Yu,
  Business Media, 2013.                                               C. H., Gonzalez, J., Zhang, H., and Stoica, I. Efficient
Colas, C., Karch, T., Sigaud, O., and Oudeyer, P.-                    memory management for large language model serving
  Y. Autotelic agents with intrinsically motivated goal-              with pagedattention. In Proceedings of the 29th Sym-
  conditioned reinforcement learning: a short survey. Jour-           posium on Operating Systems Principles, pp. 611–626,
  nal of Artificial Intelligence Research, 74:1159–1199,              2023.
  2022.
                                                                     Lample, G., Lacroix, T., Lachaux, M.-A., Rodriguez, A.,
Dong, K., Mahankali, A., and Ma, T. Formal theorem prov-               Hayat, A., Lavril, T., Ebner, G., and Martinet, X. Hyper-
  ing by rewarding llms to decompose proofs hierarchically.            tree proof search for neural theorem proving. Advances in
  arXiv preprint arXiv:2411.01829, 2024.                               neural information processing systems, 35:26337–26349,
                                                                       2022.
Einarsdóttir, S. H., Alhessi, Y., First, E., and Johansson,
  M. On lemma conjecturing using neural, symbolic and                Li, R., Allal, L. B., Zi, Y., Muennighoff, N., Kocetkov, D.,
  neuro-symbolic approaches. 2024.                                     Mou, C., Marone, M., Akiki, C., Li, J., Chim, J., et al.
Guo, D., Yang, D., Zhang, H., Song, J., Zhang, R., Xu, R.,             Starcoder: may the source be with you! arXiv preprint
  Zhu, Q., Ma, S., Wang, P., Bi, X., et al. Deepseek-r1: In-           arXiv:2305.06161, 2023.
  centivizing reasoning capability in llms via reinforcement
                                                                     Lin, H., Sun, Z., Yang, Y., and Welleck, S. Lean-star: Learn-
  learning. arXiv preprint arXiv:2501.12948, 2025.
                                                                       ing to interleave thinking and proving. arXiv preprint
Haluptzok, P., Bowers, M., and Kalai, A. T. Language                   arXiv:2407.10040, 2024.
  models can teach themselves to program better. arXiv
  preprint arXiv:2207.14502, 2022.                                   Loveland, D. W. Automated theorem proving: A logical
                                                                       basis. Elsevier, 2016.
Jaech, A., Kalai, A., Lerer, A., Richardson, A., El-Kishky,
  A., Low, A., Helyar, A., Madry, A., Beutel, A., Car-               Lu, J., Wan, Y., Liu, Z., Huang, Y., Xiong, J., Liu, C., Shen,
  ney, A., et al. Openai o1 system card. arXiv preprint                J., Jin, H., Zhang, J., Wang, H., et al. Process-driven auto-
  arXiv:2412.16720, 2024.                                              formalization in lean 4. arXiv preprint arXiv:2406.01940,
Jiang, A. Q., Li, W., Han, J. M., and Wu, Y. Lisa: Language            2024.
   models of isabelle proofs. In 6th Conference on Artificial
                                                                     mathlib Community, T. The lean mathematical library. In
   Intelligence and Theorem Proving, pp. 378–392, 2021.
                                                                      Proceedings of the 9th ACM SIGPLAN International Con-
Jiang, A. Q., Li, W., Tworkowski, S., Czechowski, K.,                 ference on Certified Programs and Proofs, CPP 2020,
   Odrzygóźdź, T., Miłoś, P., Wu, Y., and Jamnik, M. Thor:         pp. 367–381, New York, NY, USA, 2020. Association
   Wielding hammers to integrate language models and auto-            for Computing Machinery. ISBN 9781450370974. doi:
   mated theorem provers. Advances in Neural Information              10.1145/3372885.3373824. URL https://doi.org/
   Processing Systems, 35:8360–8373, 2022a.                           10.1145/3372885.3373824.

                                                                10


===== PDF PAGE 11 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Moura, L. d. and Ullrich, S. The lean 4 theorem prover                Panneershelvam, V., Lanctot, M., Dieleman, S., Grewe,
 and programming language. In Automated Deduction–                    D., Nham, J., Kalchbrenner, N., Sutskever, I., Lillicrap, T.,
 CADE 28: 28th International Conference on Automated                  Leach, M., Kavukcuoglu, K., Graepel, T., and Hassabis,
 Deduction, Virtual Event, July 12–15, 2021, Proceedings              D. Mastering the game of Go with deep neural networks
 28, pp. 625–635. Springer, 2021.                                     and tree search. Nature, 529(7676):484–503, 2016.

Nijkamp, E., Pang, B., Hayashi, H., Tu, L., Wang, H., Zhou,         Teodorescu, L., Colas, C., Bowers, M., Carta, T., and
  Y., Savarese, S., and Xiong, C. Codegen: An open large              Oudeyer, P.-Y. Codeplay: Autotelic learning through
  language model for code with multi-turn program synthe-             collaborative self-play in programming environments. In
  sis. arXiv preprint arXiv:2203.13474, 2022.                         IMOL 2023-Intrinsically Motivated Open-ended Learn-
                                                                      ing workshop at NeurIPS 2023, 2023.
Nipkow, T., Wenzel, M., and Paulson, L. C. Isabelle/HOL:
  a proof assistant for higher-order logic. Springer, 2002.         Touvron, H., Martin, L., Stone, K., Albert, P., Almahairi,
                                                                      A., Babaei, Y., Bashlykov, N., Batra, S., Bhargava, P.,
Parker-Holder, J., Jiang, M., Dennis, M., Samvelyan, M., Fo-
                                                                      Bhosale, S., et al. Llama 2: Open foundation and fine-
  erster, J., Grefenstette, E., and Rocktäschel, T. Evolving
                                                                      tuned chat models. arXiv preprint arXiv:2307.09288,
  curricula with regret-based environment design. In Inter-
                                                                      2023.
  national Conference on Machine Learning, pp. 17473–
  17498. PMLR, 2022.
                                                                    Trinh, T. and Luong, T. Alphageometry: An olympiad-level
Plaat, A., Wong, A., Verberne, S., Broekens, J., van Stein,           ai system for geometry. Google DeepMind, 17, 2024.
  N., and Back, T. Reasoning with large language models,
                                                                    Tsoukalas, G., Lee, J., Jennings, J., Xin, J., Ding, M., Jen-
  a survey. arXiv preprint arXiv:2407.11511, 2024.
                                                                      nings, M., Thakur, A., and Chaudhuri, S. Putnambench:
Poesia, G., Broman, D., Haber, N., and Goodman, N. D.                 Evaluating neural theorem-provers on the putnam mathe-
  Learning formal mathematics from intrinsic motivation.              matical competition. arXiv preprint arXiv:2407.11214,
  arXiv preprint arXiv:2407.00695, 2024.                              2024.

Polu, S., Han, J. M., Zheng, K., Baksys, M., Babuschkin, I.,        Urban, J. and Jakubův, J. First neural conjecturing datasets
  and Sutskever, I. Formal mathematics statement curricu-             and experiments. In Intelligent Computer Mathematics:
  lum learning. arXiv preprint arXiv:2202.01344, 2022.                13th International Conference, CICM 2020, Bertinoro,
                                                                      Italy, July 26–31, 2020, Proceedings 13, pp. 315–323.
Portelas, R., Colas, C., Weng, L., Hofmann, K., and                   Springer, 2020.
  Oudeyer, P.-Y. Automatic curriculum learning for deep rl:
  A short survey. arXiv preprint arXiv:2003.04664, 2020.            Wang, H., Xin, H., Zheng, C., Li, L., Liu, Z., Cao, Q.,
                                                                     Huang, Y., Xiong, J., Shi, H., Xie, E., et al. Lego-prover:
Pourcel, G., Carta, T., Kovač, G., and Oudeyer, P.-Y. Au-
                                                                     Neural theorem proving with growing libraries. arXiv
  totelic llm-based exploration for goal-conditioned rl. In
                                                                     preprint arXiv:2310.00656, 2023.
  Intrinsically Motivated Open-ended Learning Workshop
  at NeurIPS 2024, 2024a.                                           Wang, M. and Deng, J. Learning to prove theorems by
                                                                     learning to generate theorems. In Proceedings of the
Pourcel, J., Colas, C., Molinaro, G., Oudeyer, P.-Y., and
                                                                     34th International Conference on Neural Information
  Teodorescu, L. Aces: generating diverse programming
                                                                     Processing Systems, pp. 18146–18157, 2020.
  puzzles with autotelic language models and semantic
  descriptors. Neurips, 2024b.
                                                                    Wang, R., Zhang, J., Jia, Y., Pan, R., Diao, S., Pi, R., and
Shao, Z., Wang, P., Zhu, Q., Xu, R., Song, J., Zhang, M.,            Zhang, T. Theoremllama: Transforming general-purpose
  Li, Y., Wu, Y., and Guo, D. Deepseekmath: Pushing                  llms into lean4 experts. arXiv preprint arXiv:2407.03203,
  the limits of mathematical reasoning in open language              2024.
  models. arXiv preprint arXiv:2402.03300, 2024.
                                                                    Wu, M., Norrish, M., Walder, C., and Dezfouli, A. Tac-
Shinn, N., Cassano, F., Labash, B., Gopinath, A.,                    ticzero: Learning to prove theorems from scratch with
  Narasimhan, K., and Yao, S. Reflexion: Language agents             deep reinforcement learning. Advances in Neural Infor-
  with verbal reinforcement learning.(2023). arXiv preprint          mation Processing Systems, 34:9330–9342, 2021.
  cs.AI/2303.11366, 2023.
                                                                    Wu, Y., Jiang, A. Q., Ba, J., and Grosse, R. Int: An inequal-
Silver, D., Huang, A., Maddison, C. J., Guez, A., Sifre, L.,         ity benchmark for evaluating generalization in theorem
  van den Driessche, G., Schrittwieser, J., Antonoglou, I.,          proving. arXiv preprint arXiv:2007.02924, 2020.

                                                               11


===== PDF PAGE 12 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Wu, Z., Huang, S., Zhou, Z., Ying, H., Wang, J., Lin, D., and
 Chen, K. Internlm2. 5-stepprover: Advancing automated
 theorem proving via expert iteration on large-scale lean
 problems. arXiv preprint arXiv:2410.15700, 2024.
Xin, H., Guo, D., Shao, Z., Ren, Z., Zhu, Q., Liu, B., Ruan,
  C., Li, W., and Liang, X. Deepseek-prover: Advancing
  theorem proving in llms through large-scale synthetic
  data. arXiv preprint arXiv:2405.14333, 2024a.
Xin, H., Ren, Z., Song, J., Shao, Z., Zhao, W., Wang, H., Liu,
  B., Zhang, L., Lu, X., Du, Q., et al. Deepseek-prover-v1.5:
  Harnessing proof assistant feedback for reinforcement
  learning and monte-carlo tree search. arXiv preprint
  arXiv:2408.08152, 2024b.
Yang, K., Poesia, G., He, J., Li, W., Lauter, K., Chaudhuri,
  S., and Song, D. Formal mathematical reasoning: A new
  frontier in ai. arXiv preprint arXiv:2412.16075, 2024a.
Yang, K., Swope, A., Gu, A., Chalamala, R., Song, P.,
  Yu, S., Godil, S., Prenger, R. J., and Anandkumar, A.
  Leandojo: Theorem proving with retrieval-augmented
  language models. Advances in Neural Information Pro-
  cessing Systems, 36, 2024b.
Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan,
  K., and Cao, Y. React: Synergizing reasoning and acting
  in language models. arXiv preprint arXiv:2210.03629,
  2022.
Ye, Z., Agarwal, R., Liu, T., Joshi, R., Velury, S., Le, Q. V.,
  Tan, Q., and Liu, Y. Evolving alignment via asymmetric
  self-play. arXiv preprint arXiv:2411.00062, 2024.
Ying, H., Wu, Z., Geng, Y., Wang, J., Lin, D., and Chen,
  K. Lean workbook: A large-scale lean problem set for-
  malized from natural language math problems. arXiv
  preprint arXiv:2406.03847, 2024.

Zhang, J., Lehman, J., Stanley, K., and Clune, J. Omni:
  Open-endedness via models of human notions of interest-
  ingness. arXiv preprint arXiv:2306.01711, 2023.
Zheng, C., Wang, H., Xie, E., Liu, Z., Sun, J., Xin, H.,
  Shen, J., Li, Z., and Li, Y. Lyra: Orchestrating dual
  correction in automated theorem proving. arXiv preprint
  arXiv:2309.15806, 2023.
Zheng, K., Han, J. M., and Polu, S. minif2f: a cross-system
  benchmark for formal olympiad-level mathematics. In
  International Conference on Learning Representations,
  2021.




                                                                  12


===== PDF PAGE 13 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

A. Additional Implementation Details
In this section, we list the missing implementation details.

A.1. Examples of inputs and outputs of our model
Here we present some concrete examples to demonstrate the input and output formats of our model.
Examples of the conjecturer. In the following, we show examples of the conjecturer’s inputs and outputs. Note that
<lemma>,<easy theorem>,<hard theorem>,</hard theorem> are the formatting tokens, and the system prompt
is the first three lines in the input examples.
Input:
Complete the following Lean 4 code:

‘‘‘lean4
<lemma>
lemma sq_nonneg (a : α) : 0 ≤ a ^ 2
<easy theorem>
theorem lean_workbook_9742 (a b c : R) (ha : a ≥ 0) (hb : b ≥ 0) (hc : c ≥ 0) (hab : a +
    b + c = 1) : a^2 + b^2 + c^2 ≤ 1 / 4 + a^3 + b^3 + c^3 := by
nlinarith [sq_nonneg (a - 1 / 2), sq_nonneg (b - 1 / 2), sq_nonneg (c - 1 / 2),
mul_nonneg ha hb, mul_nonneg hb hc, mul_nonneg ha hc, hab]
<hard theorem>
theorem

Output:
lean_workbook_9229 (a b c : R) (ha : 0 < a ∧ 0 < b ∧ 0 < c) (hab : a + b + c = 1) : a^3
    / (a * b) + b^3 / (b * c) + c^3 / (c * a) ≥ 1 - a^2 - b^2 - c^2</hard theorem>
‘‘‘

In the following example, the lemma is replaced by a trivial statement, and the model can generate conjectures without
focusing on any particular direction (see Section 4.1).
Input:
Complete the following Lean 4 code:

‘‘‘lean4
<lemma>
theorem true: True
<easy theorem>
theorem lean_workbook_980 (a b : R) (ha : 0 < a) (hb : 0 < b) (hab : 1/a + 1/b = 1) :
    1/(a + 1) + 2/(2 * b + 1) ≤ 3/4 := by
field_simp [ha.ne’, hb.ne’, ha.ne’, hb.ne’] at hab
field_simp [ha.ne’, hb.ne’, ha.ne’, hb.ne’]
rw [div_le_div_iff (by positivity) (by positivity)]
nlinarith [sq_nonneg (a - b), sq_nonneg (a - 2 * b), sq_nonneg (2 * a - b), hab]
<hard theorem>
theorem

Output:
lean_workbook_982 (a b c : R) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) (hab : a + b + c =
    1) :
a / a ^ 2 + b / b ^ 2 + c / c ^ 2 ≥ 3 / 4 ∧ 1 / (a + b + c) ^ 2 + 1 / (b + c + a) ^ 2 +
    1 / (c + a + b) ^ 2 ≥ 3 / 4</hard theorem>
‘‘‘

Examples of the prover. In the following, we show an example of the prover’s inputs and outputs.
Input:
Complete the following Lean 4 code:

                                                               13


===== PDF PAGE 14 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving


‘‘‘lean4
theorem lean_workbook_52370 (p q : N) (hp : Nat.Prime p) (hq : Nat.Prime q) (hpq: p >= q)
    (hq5 : q >= 5) : 24 | (p^2 - q^2) := by

Output:
have : p^2 % 24 = (p % 24)^2 % 24 := by
rw [Nat.pow_mod]
have : q^2 % 24 = (q % 24)^2 % 24 := by
rw [Nat.pow_mod]
rw [← Nat.mod_add_div p 24, ← Nat.mod_add_div q 24]
ring_nf
norm_num
have : p % 24 = 1 ∨ p % 24 = 5 ∨ p % 24 = 7 ∨ p % 24 = 11 ∨ p % 24 = 13 ∨ p % 24 = 17 ∨
    p % 24 = 19 ∨ p % 24 = 23 := by
have := hp.eq_one_or_self_of_dvd 2
have := hp.eq_one_or_self_of_dvd 3
have := hp.eq_one_or_self_of_dvd 4
have := hp.eq_one_or_self_of_dvd 5
omega
have : q % 24 = 1 ∨ q % 24 = 5 ∨ q % 24 = 7 ∨ q % 24 = 11 ∨ q % 24 = 13 ∨ q % 24 = 17 ∨
    q % 24 = 19 ∨ q % 24 = 23 := by
have := hq.eq_one_or_self_of_dvd 2
have := hq.eq_one_or_self_of_dvd 3
have := hq.eq_one_or_self_of_dvd 4
have := hq.eq_one_or_self_of_dvd 5
omega
rcases this with (h | h | h | h | h | h | h | h) <;> rcases this with (h’ | h’ | h’ | h’ | h’ |
    h’ | h’ | h’) <;>
simp [h, h’, pow_two, Nat.mul_mod, Nat.add_mod, Nat.mod_mod, Nat.mod_self, zero_add,
Nat.zero_mul, Nat.mod_one, Nat.one_mul, Nat.mod_add_mod]
<;> omega
‘‘‘


A.2. Pseudo-code for selecting the conjecturer’s inputs
In the following, we present the pseudo-code for selecting the conjecturing imports. Recall that the input for the conjecturer
consists of a statement, its proof, and a lemma used in the proof (c.f., Section 3.1). In Step 1, we construct the prompts
by taking the correct proofs to statements in the given dataset, and extract the lemmas used in the proof by the formal
verifiers. We also allow the model to propose conjectures without focusing on any particular lemma, which is implemented
by replacing the lemma statement with a fixed trivial statement in the prompt (see Appendix A.1 for concrete examples).
Finally, we de-duplicate the inputs by the (statement, lemma) pair. After generating the conjectures, we randomly select a
subset whose size does not exceed the number of remaining unproved statements in the given dataset, so that the prover’s
sample budget is distributed equally between the conjectures and the statements.
We run two heuristic methods to ensure the diversity of the inputs. First, we make sure that each lemma l appears at most
0.1n times in the inputs because we observe that some lemmas (e.g., sq_nonneg, mul_self_nonneg) are much more
likely to be included. Second, we make sure that every statement-lemma pair only appear at most once in the prompt, even
if there are multiple correct proofs.
Alg. 1 shows the complete pseudo-code for selecting the conjecturer’s inputs.

A.3. Pseudo-code for preparing the conjecturer dataset.
The pseudo-code for preparing the conjecturer dataset is shown in Alg. 2. The motivations and explanations of each step in
Alg. 2 can be found in Section 3.2.

A.4. Pre-processing LeanWorkbook
LeanWorkbook is a dataset that contains statements translated from natural language math statements (a.k.a., auto-
formalization). The original dataset contains 140K (natural language statement, formal statement) pairs.

                                                             14


===== PDF PAGE 15 =====
                            Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Algorithm 1 Prepare inputs for the conjecturer.
 1: Input: a list of statements and proofs L = {(ti , pi )}n
                                                           i=1 .
 2: Initialize prompt list P = [].
 3: for (t, p) ∈ L do
 4:    Parse the proof and get the set of used lemmas S.
 5:    With probability 0.5, add the trivial lemma to S.
 6:    For every lemma l ∈ S, add (t, p, l) to the prompt list P .
 7: end for
          ∈ S do
 8: for l P
 9:    if (t′ ,p′ ,l′ )∈P I [l = l′ ] > 0.1n then
10:       Randomly keep at most 0.1n prompts with lemma l in P .
11:    end if
12: end for
13: De-duplicate P randomly so that every (statement, lemma) pair (t, l) appears at most once.
14: Return: de-duplicated list of prompts P .


Algorithm 2 Prepare the conjecturer dataset.
 1: Input: a list of (seed statement, proof of the seed statement, lemma, generated conjecture, generated proof of the
    conjecture) tuples D = {(ti , pti , li , ci , pci )}i=1,··· ,n , and unproved statements Q = {tj }j=1,··· ,m .
 2: For each conjecture c, compute its empirical pass rate

                                        P̂ (c) ≜ (#{i : ci = c, pci is correct})/(#{i : ci = c}).

 3: Select conjecturing examples that (a) have low but positive pass rates, and (b) the lemma l is used in the proof pc :

                                        D = {(t, pt , l, c) |(t, pt , l, c, pc ) ∈ D, P̂ (c) ∈ (0, 1/4],
                                                                pc is correct, l is used in pc }.

 4: De-duplicate D based on the conjecture c.
 5: Compute the elegancy score

                                                 min{len(pci ) : 1 ≤ i ≤ n, pci is correct, ci = c}
                                       E(c) ≜
                                                                      len(c)

 6: Let κ be the 20%-quantile of E(c) for conjectures in D.
                           e = {(t, pt , l, c) ∈ D | E(c) ≥ κ}.
 7: Apply elegancy filter: D
 8: Find a distribution P supported on the conjectures in De that minimizes the Wasserstein distance W (P, Q) (Alg. 4).
 9: Return: D re-weighted by the density of P .
              e


We de-duplicate the LeanWorkbook dataset by keeping only one formal statements per natural language statement. After
de-duplication, we get 89,221 formal Lean4 statements as our existing dataset w/o proofs for Lean experiments.
For the Isabelle experiments, we translate the Lean4 statements to Isabelle using DeepSeek-V2.5 API with few-shot
examples. The prompt to the model is listed below.
Please translate the following lean statement into Isabelle. Please make sure that
1. All the variables are well-typed.
2. All the functions are correctly translated into the corresponding Isabelle functions.
3. All the symbols are correctly translated into corresponding Isabelle symbols.
4. Please directly output the translation without explanation.

Here are some hints for the translation:
1. In Isabelle, the second operand of the operator ^ should be integer. For real numbers,
    please use powr instead.
2. Please define the types of numerals.

                                                                   15


===== PDF PAGE 16 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

3. ‘Real.logb x y‘ should be translated to ‘log x y‘.
4. ‘Real.sqrt x‘ should be translated to ‘sqrt x‘.
5. Variables with subscripts should be disallowed. For any variable names of form a_b,
    translate it to ab.
6. Please translate superscripts to the corresponding exponential form. For example, x−1
    should be translated to (x powr -1).
7. ‘a | b‘ should be translated to ‘a dvd b‘.
8. ‘x ≡ y [ZMOD p]‘ should be translated to ‘x mod p = y mod p‘.
9. ‘x ∈ zmod p‘ should represent that x is nat and x < p.

## Input:
‘‘‘lean
theorem lean_workbook_50 (a b c : R)
(ha : a ≥ 0 ∧ b ≥ 0 ∧ c ≥ 0)
(hab : a + b + c = 3)
: a^3 + b^3 + c^3 + 216 * (a * b + b * c + c * a) / (24 + a * b + b * c + c * a) ≤ 27                                    :=
     by sorry
‘‘‘

## Output:
‘‘‘Isabelle
theorem lean_workbook_50:
fixes a b c :: real
assumes "a ≥ 0 ∧ b ≥ 0 ∧ c ≥ 0"
assumes "a + b + c = 3"
shows "a^3 + b^3 + c^3 + 216 * (a * b + b * c + c * a) / (24 + a * b + b * c + c * a) ≤
    27"
sorry
‘‘‘

## Input:
‘‘‘lean
{}
‘‘‘

## Output:


A.5. Re-weighting the conjecturing dataset
In this section, we describe the motivations and implementation details of the re-weighting method for the conjecturing
dataset.
Motivation. In our early experiments, we observe that the generated conjectures tend to have mode collapse issue after
several iterations of self-play training. For example, the generated conjectures are mostly about algebraic manipulations even
when the seed statements contain questions about, for example, number theory. This is partly because the LeanWorkbook
dataset contains a significant portion of inequality questions.
Therefore, in addition to the particular conjecturing format where we require that the proof of the conjecture must use the
lemma given in the input, we also re-weight the conjecturing examples at every iteration. Intuitively, if there is a distance
function that can separate statements of different topics, the Wasserstein projection of the conjectures will have a similar
distribution of topics, and therefore alleviates the mode collapsing issue.
Cost function. We compute the cost d(x, y) of matching conjecture x to a statement y by the negative of the cosine
similarity between their embeddings, and the embedding is computed by the last hidden layer of the current model averaged
over the sequence dimension. Since our model is trained to generate proofs of conjectures and statements, we expect that
statements with similar proof techniques tend to have similar embeddings, and therefore smaller cost for the matching.
Algorithm. On the high level, our method computes a re-weighting of the generated conjectures that minimizes its
Wasserstein distance to the unproved statements in the given dataset. Abstractly speaking, let X be the set of generated
conjectures, and Q the set of unproved statements. Let d(x, y) be the distance between a conjecture x and a statement y.



                                                             16


===== PDF PAGE 17 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Then, the optimization problem can be written as

                                                         argmin                     W (P, Q),                             (1)
                                         P :P is a valid distribution, supp(P )⊆X

where W (P, Q) is the Wasserstein distance between P and Q (with little abuse of notation, we use Q to represent the
uniform distribution over the unproved statements). The Wasserstein distance W (P, Q) is defined by the following optimal
transportation problem where µ is a matching between the distribution P and Q:
                                                            X
                                  W (P, Q) = min                          µ(x, y)d(x, y)                              (2)
                                                  µ
                                                          x∈supp(P ),y∈supp(Q)
                                                              X
                                                  s.t.                 µ(x, y) = P (x),                                   (3)
                                                          y∈supp(Q)
                                                              X
                                                                       µ(x, y) = Q(y),                                    (4)
                                                          x∈supp(P )

                                                         µ(x, y) ≥ 0,         ∀x, y.                                      (5)

Combining the equations above, the re-weighting distribution P can be computed by
                                                             X
                                  argmin min                            µ(x, y)d(x, y)                                    (6)
                                  P :supp(P )⊆X   µ
                                                          x∈supp(P ),y∈supp(Q)
                                                              X
                                                  s.t.                 µ(x, y) = P (x),                                   (7)
                                                          y∈supp(Q)
                                                              X
                                                                       µ(x, y) = Q(y),                                    (8)
                                                          x∈supp(P )

                                                          µ(x, y) ≥ 0,        ∀x, y,                                      (9)
                                                          P (x) ≥ 0, ∀x,                                                 (10)
                                                          X
                                                               P (x) = 1,                                                (11)
                                                          x∈X

where the last two constraint ensures that P is a valid distribution. Equivalently, we get the following program,
                                                                X
                                    argmin min                              µ(x, y)d(x, y)                               (12)
                                  P :supp(P )⊆X   µ
                                                          x∈supp(P ),y∈supp(Q)
                                                              X
                                                  s.t.                 µ(x, y) = Q(y),                                   (13)
                                                          x∈supp(P )
                                                                 X
                                                                              µ(x, y) = 1,                               (14)
                                                          x∈X ,y∈supp(Q)

                                                          µ(x, y) ≥ 0, ∀x, y,                                            (15)
                                                                     X
                                                          P (x) =         µ(x, y).                                       (16)
                                                                     y∈supp(Q)

Since Q(y) is given, we can optimize µ(x, y) for every fixed y separately, and then compute the final P (x) using Eq. (16).
As
P a result, the    program above has a closed-form solution µ⋆ (x, y) = Q(y)I [x = argminx′ ∈X d(x′ , y)] and P (x) =
                 ⋆
   y∈supp(Q) µ (x, y). In other words, the optimal matching µ(x, y) for any given y is only supported at the x that minimizes
the distance d(x, y). Therefore, the (theoretical) algorithm that computes the optimal re-weighting is given in Alg. 3. Note
that the last line in Alg. 3 is to make sure that the sum of the weights equals the number of generated conjectures (i.e., the
sum of weights before re-weighting).
Our practical implementation is shown in Alg. 4. In this implementation, we additionally requires that the weighting P for
every conjecture x cannot be too big because otherwise it might cause instability of the LLM training with weighted cross

                                                                  17


===== PDF PAGE 18 =====
                           Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

Algorithm 3 Computing the optimal re-weighting (theory).
 1: Input: generated conjectures X = {x1 , · · · , xn } of size n, unproved statements Q with size m, and a distance function
    d(x, y).
 2: Initialize the optimal re-weighting P = [0, 0, · · · , 0].
 3: for y ∈ Q do
 4:    Compute x⋆ = argminx∈X d(x, y).
 5:    P (x⋆ ) ← P (x⋆ ) + 1/m.
 6: end for
 7: Return: the optimal re-weighting is [P (x1 ) ∗ n, P (x2 ) ∗ n, · · · , P (xn ) ∗ n].



entropy loss. We also allow unproved statements in Q to have different matching weights — an important statement can be
matched to more than one conjecture (see Line 5-6 of Alg. 4). In both the Isabelle and Lean experiments, the statements
from LeanWorkbook have matching weight 1. The statements from miniF2F-valid and ProofNet-valid have matching weight
1 for the first 24 iterations in the Lean experiment, and 128 afterward.

Algorithm 4 Computing the optimal re-weighting.
 1: Input: generated conjectures X = {x1 , · · · , xn } of size n, unproved statements Q with size m, and a distance function
    d(x, y).
 2: Initialize the optimal re-weighting P = [0, 0, · · · , 0].
 3: Initialize the masks M (x) = 1, ∀x ∈ X .
 4: for y ∈ Q do
 5:    Let k be the matching weight of y.
 6:    Let x1 , · · · , xk be the k conjectures with smallest value of d(·, y)M (·).
 7:    for i = 1, · · · , k do
 8:       P (xi ) ← P (xi ) + 1/m.
 9:       if P (xi ) ∗ n > 3 then
10:          M (xi ) ← 0.
11:       end if
12:    end for
13: end for
14: Return: the optimal re-weighting is [P (x1 ) ∗ n, P (x2 ) ∗ n, · · · , P (xn ) ∗ n].



A.6. Implementation details for expert iteration.
In this section, we describe two different implementations of expert iteration and compare their performance.
Vanilla expert iteration. For vanilla expert iteration, we only sample proofs to the unproved statements in the given dataset.
The LLM training dataset consists of all the correct proofs generated in this and previous iterations, and in each iteration, the
model is trained from the base model.
Optimized expert iteration. The most significant issue of vanilla expert iteration is the limited correct proofs generated in
each iteration. As a result, even though the model is re-trained at every iteration, the difference between two models in
consecutive iterations are limited.
Therefore, in our optimized implementation of expert iteration, we generate proofs to all statements in the given dataset,
regardless of whether they are previously proved or not. Then, to construct the LLM training dataset, we randomly choose at
most 16 proofs per statement (so that the model does not overfit to the easy problems with many correct proofs). Note that
this implementation requires slightly more sample budget per iteration. However, since the pass rate on the given dataset is
low (less than 30% even for our best model), this difference is not significant.
In Fig. 7 (Left), we plot the cumulative pass rate of two implementations of expert iteration, STP and parallel sampling. STP
outperforms both implementations of expert iteration, and the optimized implementation of expert iteration is better than the
vanilla implementation.

                                                                18


===== PDF PAGE 19 =====
                          Self-play LLM Theorem Provers with Iterative Conjecturing and Proving




Figure 7: Left: Comparison of pass rates between STP, two implementations of expert iteration, and parallel sampling
methods on LeanWorkbook. Right: Comparison of pass rates between STP and baseline methods on LeanWorkbook
(Isabelle translation). The red crosses shows the points where we refresh the self-play training as described in Section 4.1.




For the figures of Isabelle experiments, we always use the optimizes implementation of expert iteration. For Fig. 2, we use
the vanilla implementation.

A.7. Additional details for interacting with the Isabelle verifier
For the Isabelle experiments, we have an additional filter for the conjectures — if the generated conjecture is equivalent to
the statement in the prompt (tested by solve_direct in Isabelle), we consider it invalid.
We disallow the tactics sledgehammer, mason, smt, metis, sos by invalidating proofs that contain any of these
sub-strings. However, following the implementation of Jiang et al. (2022a), we still use the keyword ‘sledgehammer’ to
replace the following simple tactics


[by auto, by simp, by blast, by fastforce, by force, by eval, by presburger,
by arith, by linarith, by (auto simp: field_simps)].


During proof verification, we try these tactics sequentially to replace the keyword ‘sledgehammer’. If any of the tactics
succeed, we proceed to the remaining proof steps. Otherwise we flag the proof incorrect.

A.8. Additional details for interacting with the Lean4 verifier
During the self-play training, we use the same imports as the miniF2F Lean4 project10 instead importing the entire Mathlib
to optimize the memory efficiency. This is because we do not have access to an additional CPU cluster for proof verification,
and the available CPU memory in TPU-v4 VMs is limited.

A.9. Compute resources
Our experiments are primarily done on TPU-v4 VMs with 32 nodes. Each node contains 4 TPU chips (8 TPU cores), 240
CPU cores, and 400G memory. We use vLLM (Kwon et al., 2023) to generate LLM outputs, and Levanter11 to train the
LLM. In both STP and expert iteration, since the generated proofs are heavily filtered (based on the correctness, elegancy,
trivialness, etc.) when constructing the training dataset, LLM training only takes less than 25% of the wall-clock time for
TPU compute, and generating proofs takes the rest 75%.
  10
       https://github.com/yangky11/miniF2F-lean4/tree/main/MiniF2F
  11
       https://github.com/stanford-crfm/levanter

                                                             19


===== PDF PAGE 20 =====
                            Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

B. Additional Experiment Results
In this section we show the additional experiment results with both Lean and Isabelle formal verifier.

B.1. Additional results with Lean
In Table 4, we compare the performance of our method with prior works on PutnamBench. Note that DSP (Jiang et al.,
2022b) uses Isabelle verifier where PutnamBench only has 640 statements. Our model STP achieves state-of-the-art
performance by solving 8 out of 644 problems.
Table 3 compares the model obtained by final re-training with and without the proofs of generated conjectures, as discussed
in the ablation study section (Section 4.4). The results show that it is still beneficial to re-train with the generated conjectures
in addition to the successfully proved statements in LeanWorkBook even for performance on miniF2F-test and ProofNet-test,
which leads to about 2-3% performance gain (for pass@128).

                                         Table 3: Pass rate on miniF2F and ProofNet.

                            Method                   Sample budget       MiniF2F-test        ProofNet-test
                            STP (w/o conjectures)         128           58.3% ± 0.7%         17.4% ± 0.4%
                            STP                           128           61.2% ± 0.6%         19.5% ± 0.7%


B.2. Additional results with Isabelle
In Fig. 7 (Right), we plot the pass rates of STP and baseline methods on LeanWorkbook starting from iteration 0. The red
crosses shows the points where we refresh the training process as described in Section 4.1. Our models are tested with
PutnamBench (Tsoukalas et al., 2024), commit d49896f.12

                                                Table 4: Results on PutnamBench.

                          Method                                Sample budget (#Proofs / #Steps)         Result
                          Whole-Proof Generation Methods
                          DSP (GPT-4o) (Jiang et al., 2022b)                     10                      4/640
                          STP                                                   128                      7/644
                                                                                3200                     8/644
                          Tree Search Methods
                          InternLM2.5-StepProver-BF+CG                     2 × 32 × 600                  6/644


B.3. Examples of unproved statements in LeanWorkbook
In this section, we list 20 randomly selected statements from LeanWorkbook that are not proved during STP training. The
following table shows the formal statement, the corresponding natural language statement in LeanWorkbook, the correctness
of formalization, and the correctness of the formal statement.

  #      Lean formal statement                       Natural language statement                          Correct          Correct
                                                                                                         formalization?   statement?
  1      theorem lean_workbook_7116                  If a = x2 , b = y 2 , c = z 2 it suffices to show   Yes              No.     The
         (x y z : R) (hx : x + y + z =               that: x+y+z = 3 =⇒ x2 +y 2 +z 2 +3 ≤                                 case x =
          3) : x ^ 2 + y ^ 2 + z ^ 2 +               2( x12 + y12 + z12 )                                                 0 is ill de-
          3 ≤ 2 * (1 / x ^ 2 + 1 / y                                                                                      fined.
         ^ 2 + 1 / z ^ 2) := by




  12
       https://github.com/trishullab/PutnamBench/tree/d49896fdc87a128a70e15a185d8dfca3516dd894

                                                                 20


===== PDF PAGE 21 =====
                   Self-play LLM Theorem Provers with Iterative Conjecturing and Proving


2    theorem                              Prove that if a ≡ b (mod n), then an ≡ bn          Yes                 Yes
     lean_workbook_plus_72390 (a          (mod n2 ).
     b n : N) (h : a ≡ b [ZMOD
     n]) : a^n ≡ b^n [ZMOD n^2] :=
      by
3    theorem lean_workbook_35349          For:         √9                  1
                                                                        ≤ a+b    1
                                                                              + b+c +        Yes (but maybe      No      (e.g.,
                                                 a+b+c+   3(ab+bc+ca)
     (a b c : R) : (9 / (a + b +           1                                                 missing      the    (a, b, c) =
     c + Real.sqrt (3 * (a * b +          c+a                                                implicit      as-   (−0.5, 1, 1).)
     b * c + c * a)))) ≤ (1 / (a +                                                           sumption
      b) + 1 / (b + c) + 1 / (c +                                                            a, b, c > 0)
     a)) := by                                        √            √
4    theorem lean_workbook_8880           Prove
                                           √    that a √b2 + c2 + b c2 + a2 +                Yes                 No
     (a b c : R) : a * Real.sqrt          c a + b ≤ 3 2,
                                              2   2

     (b ^ 2 + c ^ 2) + b *
     Real.sqrt (c ^ 2 + a ^ 2) +
      c * Real.sqrt (a ^ 2 + b ^
     2) ≤ 3 * Real.sqrt 2 := by               √
5    theorem                              Put 3 x = a . The√
                                                           equation is equivalent to         Yes                 No
     lean_workbook_plus_44018              2
                                          a − 2a − (a3 − 4) a3 − 7 − 3a3 + 28 = 0
     (x : R) (hx : 0 < x) (a : R
     ) (ha : a = x^(1/3)) : a^2
     - 2*a - (a^3 - 4)*Real.sqrt
     (a^3 - 7) - 3*a^3 + 28 = 0 :=
      by                                                                     q
                                                                                 a+2b+3c
6    theorem                              If a, b, c > 0 prove or disprove       4a+b+c
                                                                                         +   Yes                 Yes
     lean_workbook_plus_35882             q
                                              3a+b+2c
                                                          q
     (a b c : R) (ha : 0 < a)                  a+4b+c
                                                       + 2a+3b+c
                                                             a+b+4c
                                                                       ≥3
     (hb : 0 < b) (hc : 0 < c)
     : (Real.sqrt ((a + 2 * b +
     3 * c) / (4 * a + b + c)) +
      Real.sqrt ((3 * a + b + 2
     * c) / (a + 4 * b + c)) +
     Real.sqrt ((2 * a + 3 * b +
     c) / (a + b + 4 * c))) ≥ 3 :=
      by
7    theorem lean_workbook_12619          Let x2 +q x + xy + y 2 ≤ 1(x, y ∈ R) . Prove       No (there is a      No
     : ∀ x y : R, (x^2+x+xy+y^2)                                 √                           xy term in Lean.
                                          that − 13 12 (69 + 11 33) ≤ x2 + 2xy ≤
     ≤ 1 → -(1/3)*Real.sqrt                                                                  Should be x * y)
                                            q             √
     ((1/2)*(69+11*Real.sqrt              1    1
                                                 (69 + 11 33)
                                          3    2
     33)) ≤ x^2+2*x*y ∧
     x^2+2*x*y ≤ (1/3)*Real.sqrt
     ((1/2)*(69+11*Real.sqrt 33))
     := by
8    theorem                              Prove that f (f (x) + 1) = f (x) + 1 for all       Yes                 No
     lean_workbook_plus_20629             real x.
     (f : R → R) (x : R) : f (f
     x + 1) = f x + 1 := by                                         n
9    theorem lean_workbook_37208          Prove that: n√nn! < 1 + n1    for every pos-       Yes                 Yes
     (n : N) (hn : 0 < n) : (n :          itive integer n
     R) / (n! : R) ^ (1 / n) <
     (1 + 1 / n)^n := by
10   theorem lean_workbook_10259          Given a, b ∈ N(a ̸= b) so that a+b | a2 +b2        Yes                 Yes
     (a b : N) (hab : a ̸= b) (h          . Let d = gcd(a, b) . Prove that ab + 4 ≤ d4
     : a + b | a^2 + b^2) : a * b +
     4 ≤ (Nat.gcd a b)^4 := by
11   theorem lean_workbook_45322          Let a, b > 0 and (a + a1 )(b + 1b ) = 2 + √32 .    Yes                 Yes
     (a b : R) (ha : 0 < a) (hb           Prove that 1 ≤ a4 + b4 ≤ 4
     : 0 < b) (hab : (a + 1 /
     a) * (b + 1 / b) = 2 + 3 /
     Real.sqrt 2) : 1 ≤ a ^ 4 + b
     ^ 4 ∧ a ^ 4 + b ^ 4 ≤ 4 :=
     by


                                                     21


===== PDF PAGE 22 =====
                  Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

                                                             q
                                                                  48x
12   theorem lean_workbook_28189         prove:               1 + y+z               ≥     Yes (but maybe     No x =
     (x y z : R) : Real.sqrt (1 +            2      2    2
                                         184x −32(y +z )+289x(y+z)+127yz                  missing x ≥ 0)     −1/24, y =
     48 * x / (y + z)) ≥ (184 * x           8(x2 +y 2 +z 2 )+47(yz+zx+xy)                                    z=1
     ^ 2 - 32 * (y ^ 2 + z ^ 2) +
     289 * x * (y + z) + 127 * y *
      z) / (8 * (x ^ 2 + y ^ 2 +
     z ^ 2) + 47 * (y * z + z * x
     + x * y)) := by
13   theorem lean_workbook_31673         Solution without Geometric Formula 71 + 72 +     Yes                Yes
     (x : R) (h0 : Σ’ k : N, (7          7
                                           + 78 · · · = x We divide everything by 2:
                                         4
     / (2^k)) = x) : x = 14 := by        7
                                           +  7
                                                + 78 + 167
                                                           · · · = x2 We substitute the
                                         2    4
                                         original equation in: x − 7 = x2 x2 = 7
                                         Therefore, x = 14 .
14   theorem lean_workbook_4086          Given g(1) = g(1)2 ⇒ g(1) = 1                    No (natural lan-   No
     (g : N → N) (h1 : g 1 = g 1                                                          guage statement
     ^ 2) : g 1 = 1 := by                                                                 is unclear)
15   theorem lean_workbook_6922                              b ≥ 2. Prove that
                                          q a, b ≥ 0qand a + q
                                         Let                                              Yes                Yes
     (a b : R) (ha : 0 ≤ a) (hb              a
                                         a 2+7b         b
                                                 + b 2+7a       1
                                                           + 1+8ab  ≥1
     : 0 ≤ b) (hab : 2 ≤ a + b)
     : a * Real.sqrt (a / (2 + 7 *
      b)) + b * Real.sqrt (b / (2
     + 7 * a)) + Real.sqrt (1 /
     (1 + 8 * a * b)) ≥ 1 := by
16   theorem                             Find all functions f : R → R such that           Yes                No
     lean_workbook_plus_65183            f (x+f (y)) = y+f (x+1), for all x, y ∈ R.
     (f : R → R): (∀ x y, f (x +
      f y) = y + f (x + 1)) ↔ (∀
     x, f x = x + 1) ∨ (∀ x, f x =
      -x + 1) := by
                                                             2 2   2 2   2 2
17   theorem lean_workbook_26304                              c +c a
                                         ⇔ a + b + c ≤ a b +babc                          No (natural lan-   No  (e.g.,
     (a b c : R) : a + b + c ≤                                                            guage statement    abc < 0
     (a^2 * b^2 + b^2 * c^2 + c^2                                                         is unclear)        and
     * a^2) / (a * b * c) := by                                                                              a+b+c >
                                                                                                             0)
18   theorem                             Solve
                                              the following system of equations:         No                 No
     lean_workbook_plus_30866               3
                                         
                                          x  + y+z =1
     (x y z : R) (hx : x^3 + y +           x + y3 + z = 1
     z = 1) (hy : x + y^3 + z =          x + y + z 3 = 1
                                         
     1) (hz : x + y + z^3 = 1) :
     x = y ∧ y = z ∧ z = x := by
19   theorem                             Let A ∈ Mn (C) be so that A · At = On            Yes                No (not true
     lean_workbook_plus_51637            . Prove that A = On . Here, At is the                               for complex
     (A : Matrix (Fin n) (Fin n) C       transpose of A .                                                    matrix)
     ) (h : A * A.transpose = 0)
     : A = 0 := by
                                                                              x
20   theorem                             We also have a nice inequality 1 ≤ √ ·           Yes                No (when
     lean_workbook_plus_58359                                                 yz                             x, y, z =
                                           1       y     1       z      1     √
     (x y z : R) (hx : 0 < x) (hy              +√ ·           +√ ·           ≤ 2.                            ϵ → 0, this
     : 0 < y) (hz : 0 < z) : 1 ≤         x+1       zx y + 1      xy z + 1                                    term goes
                                                    √
     x / (Real.sqrt (y * z)) * (1        With 1 and 2 are the best constant.                                 to 3)
     / (x + 1)) + y / (Real.sqrt
     (z * x)) * (1 / (y + 1)) + z
     / (Real.sqrt (x * y)) * (1
     / (z + 1)) ∧ x / (Real.sqrt
     (y * z)) * (1 / (x + 1)) + y
     / (Real.sqrt (z * x)) * (1
     / (y + 1)) + z / (Real.sqrt
     (x * y)) * (1 / (z + 1)) ≤
     Real.sqrt 2 := by




                                                    22


===== PDF PAGE 23 =====
                         Self-play LLM Theorem Provers with Iterative Conjecturing and Proving

B.4. Most frequent shared lemmas in Lean
In this section, we list 30 most frequently shared lemmas in the Lean experiments.
sq_nonneg, mul_self_nonneg, div_le_div_iff, Real.sq_sqrt, Real.sin_add,
    Real.sin_sq_add_cos_sq, Real.cos_add, pow_two, div_le_iff, Real.cos_sub,
    Real.sin_sub, Real.cos_sq, Real.sin_two_mul, Real.cos_two_mul, pow_mul, div_le_one,
    Real.sqrt_pos, pow_add, Real.tan_eq_sin_div_cos, abs_le, Finset.prod_range_succ’,
    pow_pos, Real.cos_sq_add_sin_sq, Nat.sum_range_choose, Nat.pow_mod, pow_three,
    abs_mul, abs_cases, Real.pi_pos, nat_sub_dvd_pow_sub_pow




                                                           23
