Manuscript Offprint
arXiv:2609.11319Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Most of mathematical knowledge has been communicated through so-called informal use of mathematics and natural language. With large language models (LLMs) being highly adept in using natural language, they achieve strong performance, yet not perfect, in informal mathematical reasoning. Restraining LLMs to informal reasoning misses out on the opportunity to use the discrete verification abilities that machines offer through machine-checkable proofs. In this paper, we bridge the gap between informal and formal reasoning by integrating Lean signals into the informal reasoning process. We introduce MAGENTA, a training-free agentic pipeline that, given only a natural-language problem, produces an answer, expresses it as a Lean 4 statement, and constructs a machine-checked proof. A statement judge verifies whether the formalisation preserves the original problem, while an error-attribution judge routes failed attempts either to mathematical re-derivation or local Lean repair. MAGENTA achieves 100% accuracy across all evaluated olympiad benchmarks, including AIME 2025, AIME 2026, and HMMT February 2026. When paired with the open-weight K2-HORIZON-7B reasoner, it solves all six IMO 2026 problems. Our analysis shows that statement adjudication is essential for preventing false certificates and that feedback-guided correction outperforms independent resampling on difficult problems.
1 INTRODUCTION
LLMs have become increasingly capable mathematical problem solvers (OpenAI, 2026; Anthropic, 2026; Qwen Team, 2026), solving International Mathematical Olympiad (IMO) problems (Huang & Yang, 2025) and beginning to contribute to mathematical research (Chen & Jiang, 2026; Jiang et al., 2026). Much of this progress relies on chain-of-thought (CoT) reasoning (Wei et al., 2022) and test-time scaling (Muennighoff et al., 2025), where models generate long reasoning traces. Yet longer reasoning does not make correctness easier to guarantee: such traces routinely contain errors and dead ends (Leang et al., 2025a; Lyu et al., 2023). LLM judges (Li et al., 2026) and process reward models (Guan et al., 2025; Zhang et al., 2025c) provide useful supervision over such traces, but ultimately remain learned proxies for correctness: they reproduce the failure modes of the models they evaluate and score plausible-but-incorrect reasoning (Yosef et al., 2026; Guan et al., 2025).
Interactive theorem provers and proof assistants such as Lean 4 (Moura & Ullrich, 2021), Isabelle (Paulson, 1994) and Rocq (Coquand & Huet, 1988) offer a different form of supervision: once a theorem is stated, a proof accepted by them provides a certificate of correctness. Systems built on this foundation have reached gold-medal level at the IMO (Chen et al., 2025) and solve 99.2% of miniF2F (Zheng et al., 2022) and 70.0% of PutnamBench (Tsoukalas et al., 2024; Varambally et al., 2026). However, the models used are closed-source, or require parameter counts and search budgets beyond ordinary reach (Chen et al., 2025; Wang et al., 2026). In addition, the results stated above largely address proof search after formalisation. Such benchmarks provide the system with a human-written formal statement and evaluate whether it can prove that statement (Lin et al., 2026; Xin et al., 2024). They therefore assume away a central part of mathematical problem solving: determining precisely what the natural-language problem asks to prove. Extending formal verification to natural-language mathematics consequently requires more than stronger proof search.

Figure 1: Overview of MAGENTA. The pipeline maps a natural-language problem to an informal solution and candidate answer, a faithfully adjudicated Lean 4 statement, and a machine-checked proof. The illustrated example is taken from AIME 2026, where the initial reasoning incorrectly derives instead of the correct expression . Rejected formal statements are resampled, while failed proof attempts are classified as either LEAN or MATH errors. LEAN errors trigger local proof regeneration, whereas MATH errors, such as the versus mistake shown here, are returned to the reasoner for mathematical re-derivation using verification feedback.
To address these issues, we introduce MAGENTA, an end-to-end agentic pipeline, as shown in Figure 1. Given a natural-language problem, MAGENTA produces a reasoning chain and candidate answer, converts them into a Lean 4 statement, and constructs a machine-checked proof. MAGENTA separates these tasks across four roles: A reasoner derives an informal solution and commits to a candidate answer; a formaliser converts the problem and that answer into a Lean 4 statement; a statement judge explicitly checks whether that statement preserves the semantics of the original question and answer, rejecting omitted hypotheses, altered constants, and trivialising assumptions; and a prover uses the informal reasoning as a proof plan. The Lean kernel can certify only that a proof establishes the generated formal statement; it cannot determine whether that statement faithfully represents the original natural-language problem. This semantic gap is therefore the central reliability risk in our setting, and the statement judge mitigates it by checking their alignment before proof generation. In addition, MAGENTA, in contrast to previous work, treats each certification failure as an attribution problem, introducing an error judge that labels it SYNTAX or MATH and reroutes the pipeline based on that.
MAGENTA verifies every problem on AIME 2025, AIME 2026, and HMMT February 2026 with four different reasoners, which indicates that these benchmarks are saturated under our evaluation setting. Paired with K2-HORIZON-7B, MAGENTA solves all six IMO 2026 problems, surpassing frontier closed models (OpenAI, 2026) and reasoners over two orders of magnitude larger (Team, 2026). To our knowledge, this is the smallest reported reasoner to solve all six problems. Since perfect scores may raise concerns of contamination, we further test whether the results can be explained by one-shot recall: many problems reach a verified solution only after verification-guided self-correction, and we additionally re-evaluate the pipeline on answer-preserving paraphrases. Standalone reasoners degrade under such perturbations (Mirzadeh et al., 2025; Leang et al., 2025a), whereas MAGENTA remains robust. In summary, our contributions are as follows:
• We introduce MAGENTA, a training-free agentic pipeline that bridges informal mathematical reasoning and formal verification, jointly producing an answer, a Lean 4 formalisation of the problem and answer, and a machine-checked proof through verification-guided self-correction.
• We further evaluate robustness to paraphrasing, characterise how verified performance scales with formalisation and proof-repair budgets, and ablate the two mechanisms that distinguish MAGENTA from a simple retry loop.
2.1 COMPONENTS
MAGENTA contains five components, each implemented by a prompted language model except for the deterministic verifier. To describe them, we first define the spaces over which they operate.
Let and denote, respectively, the spaces of natural-language mathematics problems, informal reasoning chains, candidate answers, Lean 4 theorem statements and Lean 4 proof scripts. Let and denote the space of Lean diagnostics produced when a proof fails verification and when a statement fails to elaborate, respectively. Let denote the absence of diagnostics, as occurs on the first iteration before any call to the Lean verifier. Let denote the space of all correction feedback signals that get generated in case of a mathematical mistake, where denotes the absence of feedback. Given a set , we denote by the set of distributions over , and by a sample from a distribution .
Reasoner . The reasoner maps a problem and a mathematical-correction signal to a distribution over pairs , where is an informal reasoning chain and is a candidate answer. We write for a sample from the reasoner model obtained by inserting and into its prompt and extracting and from the generated output. On the initial attempt, ; a non-empty arises only after the error judge returns MATH, indicating that the previous reasoning chain contains a mathematical error.
Formaliser . The formaliser maps a problem and candidate answer to a distribution over the space of Lean 4 theorem statements. We write for a sample from the formaliser model obtained by inserting and into its prompt and extracting the generated Lean statement. Conditioning on makes the statement assert the proposed answer rather than pose an open-ended existential goal. The resulting statement remains a candidate until it passes both Lean elaboration and semantic adjudication.
Prover . The prover maps a problem , an informal chain , an accepted formal statement and an optional diagnostic to a proof script to a distribution over the space of Lean 4 proof scripts. We write , for a sample from the prover model obtained by inserting and into its prompt. On the first attempt , after a SYNTAX error the next attempt receives the latest diagnostic while and remain fixed.
Verifier V. The verifier is the deterministic Lean 4 checking environment augmented with SafeVerify, a certification wrapper that rejects a submission whenever the declared theorem differs from the accepted statement or the script uses a forbidden construct such as sorry, admit, a new axiom or nativedecide (Appendix B.2). The verifier consists of two deterministic checks: the statement verifier and the proof verifier , where denotes a successful check. The verifier checks that a generated statement is closed and elaborates in Lean, which is a well-formedness check and does not establish that the statement is true or faithful to the problem. The verifier checks that is a complete, policy-compliant Lean proof of the unchanged statement ; otherwise, the verifier returns a diagnostic .
Judge J. A single language model, prompted in two distinct ways, implements two distinct judging functions. The statement judge maps a problem , candidate answer , and Lean 4 statement to a distribution over acceptance decisions. Acceptance denotes that the Lean 4 statement faithfully represents the original problem and candidate answer. The error judge , maps the complete context of a failed proof attempt to a distribution over error labels. We write , where indicates that the mathematical reasoning should be revised, while indicates that the error lies in the formal implementation. Thus, determines whether the generated statement faithfully represents the intended claim, whereas determines which component should be revised after proof verification fails.
2.2 THE MAGENTA PROCEDURE
MAGENTA is an iterative verification-guided refinement procedure in which Lean 4 feedback is used to identify and correct errors in the reasoner's proposed solution. Verification failures are attributed either to the mathematical reasoning or to its formal implementation, allowing the pipeline to revise only the component responsible for the failure. Below we describe each step of the procedure, while the pseudocode can be found in Appendix A.2.
Step 1: Reasoning & Answer Generation (Reasoner R). Let be a user-defined upper bound on the number of calls to the reasoner, and let index these calls. At iteration , the reasoner samples , where . For , the reasoner is invoked only after the error judge classifies the previous failed proof attempt as MATH; in this case, is constructed from the failed attempt and the corresponding verifier diagnostic. Thus, each MATH error triggers a new reasoning chain and candidate answer, while statement resampling and proof repair leave the current pair unchanged. The procedure terminates if a proof is verified or if the budget of reasoner calls is exhausted.
Step 2.a: Formal Statement Generation (Formaliser F). Let M be a user-defined upper bound on the number of statement samples drawn for a fixed candidate answer, and let index these samples. At sample m, the formaliser draws , whose hypotheses encode the conditions of q and the final answer provided by .
Step 2.b: Formal Statement Verification (Statement Verifier ). Each candidate statement is first submitted to the Lean 4 verifier. If , the statement is discarded and the formaliser is resampled. Otherwise, proceeds to statement adjudication. This verification step is restarted for every new reasoning pair and repeated within the same reasoning iteration until a statement passes verification, while remains fixed.
Step 2.c: Formal Statement Adjudication (Statement Judge ). Given a candidate statement such that , the statement judge samples . The judge is tasked to accept only if it faithfully represents the original problem and assert the candidate answer . If , the candidate is discarded and control returns to step 2, where the formaliser is resampled under the same statement budget . If , the candidate is accepted, denoted , and passed to the prover. A failure at either step 2.1 or step 2.2 does not trigger a new call to the reasoner; hence, statement resampling leaves the current reasoning pair unchanged. The statement judge therefore determines what the pipeline attempts to prove, and is the component that connects Lean's guarantee about the accepted formal statement to the corresponding claim about the original problem ; §2.3 discusses the resulting guarantee in detail.
Step 3: Formal Proof Generation (Prover P). Let be a user-defined upper bound on the number of proof attempts for an accepted statement, and let index these attempts. At attempt , the prover samples , where and the informal solution acts as a proof plan.
Step 4.a: Proof Verification (Proof Verifier ). Each candidate proof is submitted to the proof verifier . If , then the Lean 4 verifier has accepted the proof, and the pipeline terminates and returns . The associated informal solution and candidate answer are retained as the final reasoning chain and answer. Otherwise, , i.e., the verifier has returned an error, which gets passed to the error judge.
Step 4.b: Error attribution (Error Judge ). Each candidate proof that failed the verifier check is submitted together with its corresponding error trace to the error judge , which returns . If then the algorithm loops back to step 3 a new candidate proof is sampled from the prover. Thus, each SYNTAX error triggers a repair of the proof script alone, while and remain fixed. If the informal solution is deemed false or insufficient, and the pipeline builds from the failed attempt and returns to step 1. Only a MATH label may revise the reasoning and answer.
2.3 ROLE OF THE JUDGE AND SCOPE OF THE GUARANTEE
Why is statement adjudication necessary? Lean verifies a proof only relative to the generated statement: entails that is a valid proof of , but this does not imply that faithfully represents the original problem and answer . We refer to this as the autoformalisation gap, which is due to the nature of LLMs and use of natural language. The statement judge prevents these false certificates, working under the assumption that it is an easier task to confirm alignment between formal and informal statements compared to the generation of the formal statement. As this semantic check is performed by a learned judge rather than the Lean kernel, the final output is a soft certificate: formally sound with respect to s, but only as relevant to q as the generated statement is faithful. Further ablation study of Statement Judge can be referred to §4.3.
Why is error attribution necessary? When proof verification fails, identifies where Lean failed. However, the same rejection may arise because the informal mathematics is false or insufficient, or because a correct argument has been implemented incorrectly in Lean. These cases require varying actions: the former requires a new mathematical derivation, or the latter requires proof repair at fixed mathematical content. The error judge supplies this decision: , where . The resulting label determines the correction path:
A SYNTAX label preserves and uses the diagnostic to repair the Lean proof, whereas a MATH label constructs and returns control to the reasoner. Without , the closed-loop pipeline is underdetermined: a failed verification provides no basis for choosing between proof repair and mathematical re-derivation.
A mistake-bound perspective Given a question , let be the possible answers (correct or not) that an LLM could provide for it. We might ask the question, in terms of the mistake-bound model of learning (Cesa-Bianchi & Lugosi, 2006), what is the maximal number of “mistakes” (verifier returning 0), our pipeline, or an improved one, would make before we find a verified answer? If the LLM does not loop in its answer (and the verifier provides a significant feedback), and the context length is limited (hence, the answer too), then this “dimension” of (over all questions, see also the Littlestone dimension in online learning; Littlestone 1987) is finite.
A simple result speaks about this dimension in terms of the feedback loop removing a fraction of potential (mistaken) answers left at each step shows that . For example, if at each point we remove half of the possible answers from the LLM prediction based on our verifier feedback, then . Given the complexity of LLM inference, it is difficult to point and prove an exact value of or , but we believe the mistake-bound model is a promising learning model to analyse such pipelines and we leave it for future work to estimate in our case on a larger set of answers and questions. We provide further empirical analysis of the number of mistakes our pipeline makes in §3.2.
3 EXPERIMENTS
3.1 EXPERIMENTAL SETUP
Models. We vary R across both open-weight and proprietary families: K2-Horizon-7B and 375B, Qwen3.8-27B and GPT-5.6-Sol (Codex). All other components are held fixed unless stated otherwise: Goedel-Formaliser-32B as F, DeepSeek-V4-Flash for both judge roles, and Leanstral-1.5 as the prover P. This provides an entirely open weight pipeline. §4.1 substitutes GPT-5.6-Sol for F and for P. Proofs are checked with Lean v4.29.1 and MATHLIB under SafeVerify; decoding settings and the budgets T, M, K are provided in Appendix B.2.
Datasets. We evaluate on AIME 2025, AIME 2026 and HMMT February 2026: natural-language competition problems with a numerical answer and no accompanying formal statement. We additionally evaluate our smallest reasoner K2-HORIZON-7B with MAGENTA on IMO 2026 problems.
Baselines. We compare against state-of-the-art baselines: Claude Opus 5, Gemini 3.7 Flash, and Kimi K3. We let each baseline only generate one answer (i.e., pass@1 rate).
3.2 EXPERIMENTAL RESULTS
MAGENTA is robust to model choice. As shown in Table 1, MAGENTA's performance is not tied to a particular base model used as reasoner. The average gain across the three tasks over the corresponding standalone reasoner ranges from 8.6 points for Qwen3.8-27B to 25.8 points for K2-HORIZON-7B. In order to show that generalist closed models can be used instead of specialised open source models as formaliser and prover, we replace both of them with GPT-5.6-Sol (Codex). This once again yields the perfect scores shown in Table 1. Consistency across reasoner, formaliser and prover configurations suggests the gains arise from the verification-guided pipeline rather than from any single model; §4.1 analyses what these configurations cost.
We note the term “mistake” is referring to lack of verifiability, not correctness, due to the autoformalisation gap that remains unpreventable with current techniques
Table 1: Accuracy (%) on competition-level mathematics benchmarks, covering 93 problems in total. Light-grey rows denote results obtained with MAGENTA. Green values in parentheses report absolute improvements over the corresponding base reasoner in percentage points.
| Model | AIME 2025 | AIME 2026 | HMMT Feb. 2026 | Overall |
|---|---|---|---|---|
| Claude Opus 5 | 100.00 | 100.00 | 96.97 | 98.92 |
| Gemini 3.7 Flash | 100.00 | 100.00 | 90.91 | 96.77 |
| Kimi K3 | 93.33 | 90.00 | 78.79 | 87.10 |
| K2-Horizon-7B | 83.33 | 80.00 | 60.61 | 74.19 |
| + MAGENTA | 100.00 (↑ 16.67) | 100.00 (↑ 20.00) | 100.00 (↑ 39.39) | 100.00 (↑ 25.81) |
| K2-Horizon-375B | 93.33 | 90.00 | 72.73 | 84.95 |
| + MAGENTA | 100.00 (↑ 6.67) | 100.00 (↑ 10.00) | 100.00 (↑ 27.27) | 100.00 (↑ 15.05) |
| Qwen3.8-27B | 100.00 | 86.67 | 87.88 | 91.40 |
| + MAGENTA | 100.00 (↑ 0.00) | 100.00 (↑ 13.33) | 100.00 (↑ 12.12) | 100.00 (↑ 8.60) |
| GPT-5.6-Sol (Codex) | 90.00 | 86.67 | 78.79 | 84.95 |
| + MAGENTA | 100.00 (↑ 10.00) | 100.00 (↑ 13.33) | 100.00 (↑ 21.21) | 100.00 (↑ 15.05) |
K2-HORIZON-7B+MAGENTA solves all IMO 2026 problems. Coupled with MAGENTA, K2-HORIZON-7B solves all six IMO 2026 problems. To our knowledge, this is the smallest reported reasoner to score perfectly on this task. Unlike answer-only benchmarks, IMO solutions are inherently multi-step: they require answering a sequence of intermediate subproblems, whose results are then composed to obtain the final answer. Despite perfect final answer accuracy and formal verification we observe a residual gap between the informal explanation and the formal statement and proof. We therefore append a final alignment judge, instantiated with K2-HORIZON-375B, which returns incomplete_proof when the two do not support the same conclusion (Appendix F); its feedback yields substantially more complete reasoning chains in our qualitative analysis. Formal correctness is thus attainable with a compact reasoner, whereas a fully aligned, communicable informal derivation remains a separate challenge.
Verification-guided correction trades test-time computation for model scale. Most reasoners do not solve every problem first time, but their verified solve rates rise consistently across correction rounds. On AIME 2026, K2-HORIZON-7B needs an average of 5 correction rounds to reach a verified solution against 2 for K2-HORIZON-375B. Both ultimately attain perfect accuracy, but the larger reasoner gets there with fewer feedback cycles while the 7B model closes the gap by spending additional verification-guided computation. On the more complex IMO 2026, K2-HORIZON-7B needs an average of 5.7 rounds, with per-problem trajectories in Figure 2. These averages count only revisions triggered by mathematical errors; compiler-level errors require further repair iterations (§4.1).

Figure 2: Self-corrections required by K2-HORIZON-7B+MAGENTA on IMO 2026.
4 ANALYSIS
4.1 SCALING ANALYSIS
We analyse how test-time computation is distributed across the two stages of MAGENTA. We first examine how the choice of formaliser affects the number of samples required to obtain an accepted statement, and then compare the cost of different proof backends.
4.1.1 FORMAL STATEMENT GENERATION
The formaliser governs how quickly the pipeline reaches a faithful, provable statement. CODEX succeeds on its first call for approximately 66% of AIME 2026 problems against 42% for Goedel, and covers the benchmark within 6 calls rather than approximately 120 (Figure 3); at a six-call budget Goedel covers only about 68%. The distributions differ in shape, not merely location:
CODEX is compact, and indeed represents a very small number of calls, whereas the Goedel curve spans two orders of magnitude and any practical truncates it. Truncation is not a correctness failure—adjudication rejects unfaithful statements before proof effort is spent—but an exhausted statement budget forfeits the problem, thus a long formalisation tail converts directly into lost coverage.
4.1.2 FORMAL PROOF GENERATION
Both prover backends verify 100% of AIME 2026, thus accuracy by itself cannot separate them. Reporting accuracy as a function of a budget rather than at a single operating point is standard practice in agent evaluation (Kapoor et al., 2025) and in the test-time-scaling literature (Muennighoff et al., 2025; Snell et al., 2025). To make claims about self-repair meaningful, we report the cumulative pass rate:
where measures measures the number of tokens necessary to produce the proof, indicates whether the proposed resolution of q passes independent verification, and represents the tokens budget. A single cost axis is not well defined across backends: LEANSTRAL runs as a multi-turn agent, thus one invocation can hide hundreds of compiler queries, while a CODEX CLI call reports one call regardless of what it does internally. We therefore count a cost as external when a failure survives the prover's own repair attempts and returns to the error judge, and internal when incurred inside a single invocation. External costs are defined identically for both backends; internal costs are observable only for LEANSTRAL (Figure 4), and are paid on local hardware rather than billed per request.

Figure 3: Cumulative pass rate against formal-statement generation calls on AIME 2026.

Figure 4: Internal LEANSTRAL agent calls on the winning trajectory. This measure has no CODEX counterpart, as its CLI does not expose per-invocation turns.
Measured externally, LEANSTRAL reaches the shared ceiling more cheaply: it solves 42% of problems with no failed external verification round against 17% for CODEX (Figure 5b), reaches full coverage on approximately reasoner tokens versus (Figure 5c), and produces verified proofs roughly half as long, against tokens (Figure 5d).
This efficiency is bought with computation inside LEANSTRAL's agentic loop: its winning trajectories consume approximately internal calls at median coverage and up to at full coverage (Figure 4), and once these are counted the ordering reverses (Figure 5a). The claim is therefore not that the open-weight prover is cheaper outright, but that at equal verified accuracy it moves cost from metered rounds into local computation one controls. Since CODEX performs an unknown amount of internal work, its external measurements is only a lower-bound on its true compute. Attribution matters mainly in the remaining tail: an external failure reaches the router on 58% of problems with LEANSTRAL against 83% with CODEX.
4.2 ROBUSTNESS TO ANSWER-PRESERVING PARAPHRASE
To control for possible data leakage, we use DeepSeek-V4-Flash to paraphrase every AIME 2026 problem while preserving its quantities, hypotheses, goal and reference answer, check each paraphrase before use using CODEX, and measure the robustness gap between original and paraphrased accuracy. Prior work (Mirzadeh et al., 2025) shows that standalone reasoners are sensitive to such answer-preserving changes, and Table 2
Table 2: Accuracy (%) on original and paraphrased AIME 2026. is the % decrease.
| Model | Original | Paraphrased | Δ |
|---|---|---|---|
| K2-Horizon-375B | 90.0 | 86.7 | -3.3 |
| + MAGENTA | 100.0 | 100.0 | 0.0 |
| K2-Horizon-7B | 80.0 | 70.0 | -10.0 |
| + MAGENTA | 100.0 | 100.0 | 0.0 |

(a) Total recorded calls
(b) Failed external Lean verification rounds

(c) Reasoner (K2-HORIZON-7B) tokens
(d) Final verified Lean-code length
Figure 5: Cumulative pass rate against four cost measures on AIME 2026 (Equation 2). Both backends reach , so the curves separate on budget, not on ceiling. Panels (b)-(d) are external measures, defined identically for both backends, and LEANSTRAL is left-shifted on each.
reproduces this: paraphrasing costs K2-HORIZON-375B 3.3 points and K2-HORIZON-7B 10.0 points, whereas both retain with MAGENTA (). Perturbing the numerical quantities, so that the reference answer itself changes, would be the stronger test; we therefore read this as necessary rather than sufficient evidence against contamination.
4.3 ABLATION STUDY
We ablate the two mechanisms that distinguish MAGENTA from a generic retry loop: the statement judge , which decides what is proved, and the error judge , which decides how a failed attempt is retried. Both rerun the same harness with one component disabled, and the rest as in §3.1.
Statement adjudication. A certificate is meaningful only when the proved statement preserves the original problem, so we separate two outcomes. Let Ver be the fraction of problems for which the pipeline returns a verified proof and VerCor the fraction for which it does so and the certified answer matches the reference. The false certification rate FCR = 1 - VerCor/Ver is then the fraction of returned certificates whose answer is nonetheless wrong. Since the verifier V is sound, FCR > 0 is possible only through an unfaithful formalisation, which makes it a direct measurement of the residual gap identified in §2.3. We disable by accepting the first elaborated statement unconditionally. Table 3 reports the result.
Table 3: Effect of statement adjudication with Goedel formaliser on AIME 2026.
| Setting | Ver ↑ | VerCor ↑ | FCR ↓ |
|---|---|---|---|
| With | 63.3% | 63.3% | 0.0% |
| Without | 36.7% | 20.0% | 45.5% |
Without the judge Ver falls from to even though every first-sampled formalisation is now accepted. The judge, therefore, acts as an additional filter on the formal statement beyond semantically aligning it with the informal one. The effect on correctness is larger still: VerCor falls 43.3 points to and FCR rises to , so nearly half the surviving certificates prove something other than the problem asked, but not necessarily contradictory (Appendix E.1).
Resampling versus diagnostic-conditioned self-correction. We next replace diagnostic-conditioned self-correction with independent resampling, which discards compiler feedback and draws a fresh proof each attempt. This baseline is stronger than it may appear: for a problem with single-shot success probability , after parallelisable attempts of using as a sound selector, the probability is increased to . On AIME 2026 resampling with K2-HORIZON-7B solves 29/30 (96.7%) against 30/30 for self-correction; in the single failure the initial answer is wrong, so the statement is unprovable and further proof samples cannot recover it.
The gap widens on IMO 2026, where, despite 8–16 independent generations per problem, resampling verifies only 1/6 (16.7%) while self-correction verifies all six, so p is effectively zero under our budget for most IMO problems. Conditioning on a diagnostic moves probability mass onto proofs the unconditioned distribution does not reach. The benefit in error attribution (MATH versus SYNTAX) is routing the next attempt to the right component based on the previous attempt.
5 RELATED WORK
LLMs for Mathematical Reasoning. LLMs have achieved strong performance in competition mathematics through CoT reasoning (Wei et al., 2022) and test-time scaling (Albalak et al., 2025; Shao et al., 2024; Zhang et al., 2025b). As plausible reasoning traces may still lead to incorrect solution, prior work applies LLM judges (Yosef et al., 2026), process reward models (Liu et al., 2024), and related scoring or selection methods (Ospanov et al., 2026; Leang et al., 2026a). These signals remain learned proxies that may share the models' failure modes (Leang et al., 2026a; 2025a). MAGENTA instead uses Lean as a deterministic verifier of the generated formal proof.
Theorem Proving and Autoformalisation. LLM-based theorem proving has advanced rapidly, with specialised proving models such as Pythagoras-Prover (Leang et al., 2026b), Goedel-Prover (Lin et al., 2026), and others (Ma et al., 2026; Wang et al., 2026), together with agentic closed-source models (Liu et al., 2026; Xu et al., 2026), have rapidly advanced LLM theorem proving, albeit often through substantial test-time scaling (Varambally et al., 2026; Klingner et al., 2026; Chen et al., 2025; Lin et al., 2026). However, current benchmarking assume an accurate formal statement as the input. Producing faithful formal statements remains challenging: an incorrect formalisation may admit a valid proof without certifying the original problem (Cornish et al., 2026).
Formal–Informal Distillation. Previous work has explored connections between informal reasoning and formal proof (Varambally et al., 2026; Quan et al., 2025), but often relying solely on closed-source models, and underperforms state-of-the-art mathematical reasoners (Liu et al., 2025; Zhou et al., 2024; Yao et al., 2025; Zhang et al., 2025a). Carefully curated formal–informal pipelines can improve reliability (Sazonova et al., 2026), while Theorem Prover as a Judge uses GPT-4o and formal verification to validate informal traces during synthetic-data generation (Leang et al., 2025b). Tsoukalas et al. (2026), on the other hand, applies formal-informal distillation on solving mathematical research problems, but rely heavily on closed-source models with large parameter scale. Often, current methods assume that a formal goal is already available (Yao et al., 2025; Varambally et al., 2026; Bourigault et al., 2026). These systems use formal verification as a selection or certification signal, rather than for error attribution.
6 CONCLUSION
We introduced MAGENTA, a training-free agentic pipeline that couples informal mathematical reasoning with formal verification. Given only a natural-language problem, it produces a reasoning chain and candidate answer, formalises them as a Lean 4 statement, and generates a checked proof, with a statement judge deciding whether the formalisation preserves the original problem and an error judge routing failed attempts to re-derivation or local repair. MAGENTA verifies every problem on AIME 2025, AIME 2026 and HMMT February 2026 with four reasoners, and with K2-HORIZON-7B solves all six IMO 2026 problems. Our ablation experimental results show that adjudication is what keeps a certificate meaningful and that diagnostic-conditioned correction reaches proofs independent resampling does not. Because the pipeline writes the statement it proves, verification guarantees correctness only relative to the generated formalisation, not unconditionally with respect to the original problem. Closing that gap is a question of better autoformalisation rather than better proof search, which we regard as the main remaining obstacle to Lean-guided natural language reasoning.
REFERENCES
Alon Albalak, Duy Phung, Nathan Lile, Rafael Rafailov, Kanishk Gandhi, Louis Castricato, Anikait Singh, Chase Blagden, Violet Xiang, Dakota Mahan, and Nick Haber. Big-math: A large-scale, high-quality math dataset for reinforcement learning in language models, 2025. URL https://arxiv.org/abs/2502.17387.
Anthropic. System Card: Claude Opus 4.6. https://anthropic.com/claude-opus-4-6-system-card, 2026.
Pauline Bourigault, Xiaotong Ji, Matthieu Zimmer, Rasul Tutunov, and Haitham Bou Ammar. Risk-controlled lean-as-judge for natural-language mathematical reasoning, 2026. URL https://arxiv.org/abs/2605.28365.
Nicolo Cesa-Bianchi and Gabor Lugosi. Prediction, Learning, and Games. Cambridge University Press, 2006.
Jiangjie Chen, Wenxiang Chen, Jiacheng Du, Jinyi Hu, Zhicheng Jiang, Allan Jie, Xiaoran Jin, Xing Jin, Chenggang Li, Wenlei Shi, et al. Seed-prover 1.5: Mastering undergraduate-level theorem proving via learning from experience. arXiv preprint arXiv:2512.17260, 2025.
Xiaoyang Chen and Xiang Jiang. Moonshine: An autonomous mathematical research agent centered on conjecture generation, 2026. URL https://arxiv.org/abs/2606.10806.
Thierry Coquand and Gérard Huet. The Calculus of Constructions. Information and Computation, 76(2–3):95–120, 1988. URL https://doi.org/10.1016/0890-5401(88)90005-3.
Rob Cornish, Iacopo Ghinassi, Po-Hung Yeh, Shuqi Liu, Qiyuan Xu, Haoxuan Yin, Dominik Wagner, Wenda Li, Yee Whye Teh, and Luke Ong. Faithformbench: Benchmarking faithfulness of mathematical chain-of-thought autoformalisation. arXiv preprint arXiv:2608.10916, 2026.
Xinyu Guan, Li Lyna Zhang, Yifei Liu, Ning Shang, Youran Sun, Yi Zhu, Fan Yang, and Mao Yang. rStar-math: Small LLMs can master math reasoning with self-evolved deep thinking. In Aarti Singh, Maryam Fazel, Daniel Hsu, Simon Lacoste-Julien, Felix Berkenkamp, Tegan Maharaj, Kiri Wagstaff, and Jerry Zhu (eds.), Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 20640–20661. PMLR, 13–19 Jul 2025. URL https://proceedings.mlr.press/v267/guan25f.html.
Yichen Huang and Lin F. Yang. Winning gold at imo 2025 with a model-agnostic verification-and-refinement pipeline, 2025. URL https://arxiv.org/abs/2507.15855.
Eric Jiang, Xiao Liang, Yikai Zhang, Yingjia Wan, Mengting Li, Haikang Deng, Alexander K. Taylor, Justin Baker, Rushil Raghavan, Junyi Zhang, Ying Nian Wu, Andrea L. Bertozzi, Kai-Wei Chang, Raghu Meka, Matthew Sottile, Nanyun Peng, Amit Sahai, Terence Tao, and Wei Wang. From solvers to research: Large language model-driven formal mathematics at the research frontier, 2026. URL https://arxiv.org/abs/2607.07779.
Sayash Kapoor, Benedikt Stroebl, Zachary S Siegel, Nitya Nadgir, and Arvind Narayanan. AI agents that matter. Transactions on Machine Learning Research, 2025. ISSN 2835-8856. URL https://openreview.net/forum?id=Zy4uFzMviZ.
Tyson Klingner, Drew Bladek, Escher Crawford, Bohao Chen, Ariel Fu, Kaira Nair, Jarod Alper, Giovanni Inchiostro, and Vasily Ilin. Evaluation of LLMs for mathematical formalization in Lean, 2026. URL https://arxiv.org/abs/2606.05632.
Joshua Ong Jun Leang, Aryo Pradipta Gema, and Shay B Cohen. CoMAT: Chain of Mathematically Annotated Thought Improves Mathematical Reasoning. In Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, and Violet Peng (eds.), Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pp. 20245–20274, Suzhou, China, November 2025a. Association for Computational Linguistics. ISBN 979-8-89176-332-6. doi: 10.18653/v1/2025.emnlp-main.1024. URL https://aclanthology.org/2025.emnlp-main.1024/.
Joshua Ong Jun Leang, Giwon Hong, Wenda Li, and Shay B Cohen. Theorem Prover as a Judge for Synthetic Data Generation. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 29941–29977, Vienna, Austria, July 2025b. Association for Computational Linguistics. ISBN 979-8-89176-251-0. doi: 10.18653/v1/2025.acl-long.1448. URL https://aclanthology.org/2025.acl-long.1448/.
Joshua Ong Jun Leang, Zheng Zhao, Aryo Pradipta Gema, Sohee Yang, Wai-Chung Kwan, Xuanli He, Wenda Li, Pasquale Minervini, Eleonora Giunchiglia, and Shay B Cohen. PiCSAR: Probabilistic confidence selection and ranking for reasoning chains. In Maria Liakata, Viviane P. Moreira, Jiajun Zhang, and David Jurgens (eds.), Findings of the Association for Computational Linguistics: ACL 2026, pp. 31511–31544, San Diego, California, United States, July 2026a. Association for Computational Linguistics. ISBN 979-8-89176-395-1. doi: 10.18653/v1/2026.findings-acl.1577. URL https://aclanthology.org/2026.findings-acl.1577/.
Joshua Ong Jun Leang, Zheng Zhao, Mihaela Cătălina Stoian, Qiyuan Xu, Haonan Li, Wenda Li, Shay B. Cohen, and Eleonora Giunchiglia. Pythagoras-prover: Advancing efficient formal proving via augmented lean formalisation, 2026b. URL https://arxiv.org/abs/2606.12594.
Zhuochun Li, Yong Zhang, Ming Li, Yuelyu Ji, Yiming Zeng, Ning Cheng, Yun Zhu, Yanmeng Wang, Shaojun Wang, Jing Xiao, and Daqing He. Rethinking LLM-as-a-judge: Representation-as-a-judge with small language models via semantic capacity asymmetry. In The Fourteenth International Conference on Learning Representations, 2026. URL https://openreview.net/forum?id=VAISvCsrvG.
Yong Lin, Shange Tang, Bohan Lyu, Ziran Yang, Jui-Hui Chung, Haoyu Zhao, Lai Jiang, Yihan Geng, Jiawei Ge, Jingruo Sun, Jiayun Wu, Jiri Gesi, Ximing Lu, David Acuna, Kaiyu Yang, Hongzhou Lin, Yejin Choi, Danqi Chen, Sanjeev Arora, and Chi Jin. Goedel-Prover-V2: Scaling Formal Theorem Proving with Scaffolded Data Synthesis and Self-Correction. In The Fourteenth International Conference on Learning Representations, 2026. URL https://openreview.net/forum?id=j4C0nALrgK.
Nick Littlestone. Learning quickly when irrelevant attributes abound: A new linear-threshold algorithm. In 28th Annual Symposium on Foundations of Computer Science (sfcs 1987), pp. 68–77, 1987. doi: 10.1109/SFCS.1987.37.
Chengwu Liu, Ye Yuan, Yichun Yin, Yan Xu, Xin Xu, Zaoyu Chen, Yasheng Wang, Lifeng Shang, Qun Liu, and Ming Zhang. Safe: Enhancing mathematical reasoning in large language models via retrospective step-aware formal verification. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 12171–12186, Vienna, Austria, July 2025. Association for Computational Linguistics. ISBN 979-8-89176-251-0. doi: 10.18653/v1/2025.acl-long.594. URL https://aclanthology.org/2025.acl-long.594/.
Chris Yuhao Liu, Liang Zeng, Jiacai Liu, Rui Yan, Jujie He, Chaojie Wang, Shuicheng Yan, Yang Liu, and Yahui Zhou. Skywork-reward: Bag of tricks for reward modeling in LLMs, 2024. URL https://arxiv.org/abs/2410.18451.
Junqi Liu, Zihao Zhou, Zekai Zhu, Marco Dos Santos, Weikun He, jiawei liu, Yunzhou Xie, Junqiao Zhao, Qiufeng Wang, Lihong Zhi, Jia LI, and Wenda Li. Numina-lean-agent: An open and general agentic reasoning system for formal mathematics. In Forty-third International Conference on Machine Learning, 2026. URL https://openreview.net/forum?id=0bTEd4LpQr.
Qing Lyu, Shreya Havaldar, Adam Stein, Li Zhang, Delip Rao, Eric Wong, Marianna Apidianaki, and Chris Callison-Burch. Faithful Chain-of-Thought Reasoning. In Jong C. Park, Yuki Arase, Baotian Hu, Wei Lu, Derry Wijaya, Ayu Purwarianti, and Adila Alfa Krisnadhi (eds.), Proceedings of the 13th International Joint Conference on Natural Language Processing and the 3rd Conference of the Asia-Pacific Chapter of the Association for Computational
Linguistics (Volume 1: Long Papers), pp. 305–329, Nusa Dua, Bali, November 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.ijcnlp-main.20. URL https://aclanthology.org/2023.ijcnlp-main.20/.
David Ma, Kaijing Ma, Shawn Guo, Yunfeng Shi, Enduo Zhao, Jiajun Shi, Zhaoxiang Zhang, Gavin Cheung, Jiaheng Liu, and Zili Wang. OProver: A unified framework for agentic formal theorem proving, 2026. URL https://arxiv.org/abs/2605.17283.
Iman Mirzadeh, Keivan Alizadeh, Hooman Shahrokhi, Oncel Tuzel, Samy Bengio, and Mehrdad Farajtabar. GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models. In The Thirteenth International Conference on Learning Representations, ICLR 2025, Singapore, April 24-28, 2025. OpenReview.net, 2025. URL https://openreview.net/forum?id=AjXkRZIvjB.
Leonardo de Moura and Sebastian Ullrich. The lean 4 theorem prover and programming language. In Automated Deduction – CADE 28: 28th International Conference on Automated Deduction, Virtual Event, July 12–15, 2021, Proceedings, pp. 625–635, Berlin, Heidelberg, 2021. Springer-Verlag. ISBN 978-3-030-79875-8. doi: 10.1007/978-3-030-79876-5_37. URL https://doi.org/10.1007/978-3-030-79876-5_37.
Niklas Muennighoff, Zitong Yang, Weijia Shi, Xiang Lisa Li, Li Fei-Fei, Hannaneh Hajishirzi, Luke Zettlemoyer, Percy Liang, Emmanuel Candès, and Tatsunori Hashimoto. s1: Simple test-time scaling. In Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, and Violet Peng (eds.), Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pp. 20275–20321, Suzhou, China, November 2025. Association for Computational Linguistics. ISBN 979-8-89176-332-6. doi: 10.18653/v1/2025.emnlp-main.1025. URL https://aclanthology.org/2025.emnlp-main.1025/.
OpenAI. OpenAI GPT-5 System Card, 2026. URL https://arxiv.org/abs/2601.03267.
Azim Ospanov, Zijin Feng, Jiacheng Sun, Haoli Bai, SHEN XIN, and Farzan Farnia. HERMES: Towards efficient and verifiable mathematical reasoning in LLMs. In Forty-third International Conference on Machine Learning, 2026. URL https://openreview.net/forum?id=w7BZcUc0fJ.
Lawrence C. Paulson. Isabelle - A Generic Theorem Prover (with a contribution by T. Nipkow), volume 828 of Lecture Notes in Computer Science. Springer, 1994. ISBN 3-540-58244-4. doi:10.1007/BFB0030541. URL https://doi.org/10.1007/BFb0030541.
Xin Quan, Marco Valentino, Louise A. Dennis, and Andre Freitas. Faithful and robust LLM-driven theorem proving for NLI explanations. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 17734–17755, Vienna, Austria, July 2025. Association for Computational Linguistics. ISBN 979-8-89176-251-0. doi: 10.18653/v1/2025.acl-long.867. URL https://aclanthology.org/2025.acl-long.867/.
Qwen Team. Qwen3.6-27B: Flagship-Level Coding in a 27B Dense Model, April 2026. URL https://qwen.ai/blog?id=qwen3.6-27b.
Subham Sekhar Sahoo, Marianne Arriola, Yair Schiff, Aaron Gokaslan, Edgar Marroquin, Justin T Chiu, Alexander Rush, and Volodymyr Kuleshov. Simple and Effective Masked Diffusion Language Models. In A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang (eds.), Advances in Neural Information Processing Systems, volume 37, pp. 130136–130184. Curran Associates, Inc., 2024. doi: 10.52202/079017-4135. URL https://proceedings.neurips.cc/paper_files/paper/2024/file/eb0b13cc515724ab8015bc978fdde0ad-Paper-Conference.pdf.
Varvara Sazonova, Dmitri Shmelkin, Stanislav Kikot, and Vasily Motolygin. Pipeline for verifying LLM-generated mathematical solutions, 2026. URL https://arxiv.org/abs/2602.20770.
Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, and Daya Guo. DeepSeekMath: Pushing the limits of mathematical reasoning in open language models, 2024. URL https://arxiv.org/abs/2402.03300.
Charlie Victor Snell, Jaehoon Lee, Kelvin Xu, and Aviral Kumar. Scaling LLM test-time compute optimally can be more effective than scaling parameters for reasoning. In The Thirteenth International Conference on Learning Representations, 2025. URL https://openreview.net/forum?id=4FWAwZtd2n.
Kimi Team. Kimi K3: open frontier intelligence, 2026. URL https://arxiv.org/abs/2607.24653.
George Tsoukalas, Jasper Lee, John Jennings, Jimmy Xin, Michelle Ding, Michael Jennings, Amitayush Thakur, and Swarat Chaudhuri. PutnamBench: Evaluating Neural Theorem-Provers on the Putnam Mathematical Competition. In A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang (eds.), Advances in Neural Information Processing Systems, volume 37, pp. 11545–11569. Curran Associates, Inc., 2024. doi: 10.52202/079017-0368. URL https://proceedings.neurips.cc/paper_files/paper/2024/file/1582eaf9e0cf349e1e5a6ee453100aal-Paper-Datasets_and_Benchmarks_Track.pdf.
George Tsoukalas, Anton Kovsharov, Sergey Shirobokov, Anja Surina, Moritz Firsching, Gergely Bérczi, Francisco JR Ruiz, Arun Suggala, Adam Zsolt Wagner, Eric Wieser, et al. Advancing mathematics research with ai-driven formal proof search. arXiv preprint arXiv:2605.22763, 2026.
Sumanth Varambally, Thomas Voice, Yanchao Sun, Zhifeng Chen, Rose Yu, and Ke Ye. Hilbert: Recursively building formal proofs with informal reasoning. In The Fourteenth International Conference on Learning Representations, 2026. URL https://openreview.net/forum?id=GN8OdkTo3B.
Jianing Wang, Jianfei Zhang, Qi Guo, Linsen Guo, Rumei Li, Chao Zhang, Chong Peng, Cunguang Wang, Dengchang Zhao, Jiarong Shi, Jingang Wang, et al. Longcat-flash-prover: Advancing native formal reasoning via agentic tool-integrated reinforcement learning, 2026. URL https://arxiv.org/abs/2603.21065.
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed Chi, Quoc V Le, and Denny Zhou. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, pp. 24824–24837. Curran Associates, Inc., 2022. URL https://proceedings.neurips.cc/paper_files/paper/2022/file/9d5609613524ecf4f15af0f7b31abca4-Paper-Conference.pdf.
Huajian Xin, Daya Guo, Zhihong Shao, Zhizhou Ren, Qihao Zhu, Bo Liu, Chong Ruan, Wenda Li, and Xiaodan Liang. DeepSeek-Prover: Advancing Theorem Proving in LLMs through Large-Scale Synthetic Data, 2024. URL https://arxiv.org/abs/2405.14333.
Qiyuan Xu, Joshua Ong Jun Leang, Renxi Wang, Wenda Li, Haonan Li, Luke Ong, and Conrad Watt. AoA: Theorem proving agent over abstract syntax tree of redesigned language, 2026. URL https://arxiv.org/abs/2607.16372.
Jiarui Yao, Ruida Wang, and Tong Zhang. FANS: Formal answer selection for LLM natural language math reasoning using Lean4. In Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, and Violet Peng (eds.), Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pp. 3181–3200, Suzhou, China, November 2025. Association for Computational Linguistics. ISBN 979-8-89176-332-6. doi: 10.18653/v1/2025.emnlp-main.158. URL https://aclanthology.org/2025.emnlp-main.158/.
Erez Yosef, Oron Anschel, Shunit Haviv Hakimi, Asaf Gendler, Adam Botach, Nimrod Berman, and Igor Kviatkovsky. Rethinking math reasoning evaluation: A robust LLM-as-a-judge framework beyond symbolic rigidity, 2026. URL https://arxiv.org/abs/2604.22597.
Lan Zhang, Marco Valentino, and Andre Freitas. Autoformalization in the wild: Assessing LLMs on real-world mathematical definitions. In Christos Christodoulopoulos, Tanmoy Chakraborty, Carolyn Rose, and Violet Peng (eds.), Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pp. 1720–1738, Suzhou, China, November 2025a. Association for Computational Linguistics. ISBN 979-8-89176-332-6. doi: 10.18653/v1/2025.emnlp-main.90. URL https://aclanthology.org/2025.emnlp-main.90/.
Qiyuan Zhang, Fuyuan Lyu, Zexu Sun, Lei Wang, Weixu Zhang, Wenyue Hua, Haolun Wu, Zhihan Guo, Yufei Wang, Niklas Muennighoff, Irwin King, Xue Liu, and Chen Ma. A survey on test-time scaling in large language models: What, how, where, and how well?, 2025b. URL https://arxiv.org/abs/2503.24235.
Zhenru Zhang, Chujie Zheng, Yangzhen Wu, Beichen Zhang, Runji Lin, Bowen Yu, Dayiheng Liu, Jingren Zhou, and Junyang Lin. The lessons of developing process reward models in mathematical reasoning. In Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar (eds.), Findings of the Association for Computational Linguistics: ACL 2025, pp. 10495–10516, Vienna, Austria, July 2025c. Association for Computational Linguistics. ISBN 979-8-89176-256-5. doi: 10.18653/v1/2025.findings-acl.547. URL https://aclanthology.org/2025.findings-acl.547/.
Kunhao Zheng, Jesse Michael Han, and Stanislas Polu. MiniF2F: a cross-system benchmark for formal Olympiad-level mathematics. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=9ZPegFuFTFv.
Jin Peng Zhou, Charles Staats, Wenda Li, Christian Szegedy, Kilian Q. Weinberger, and Yuhuai Wu. Don't trust: Verify – grounding LLM quantitative reasoning with autoformalization. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024. URL https://openreview.net/forum?id=V5tdi14ple.
A ALGORITHM
A.1 NOTATION SUMMARY
Table 4 summarises the notation used throughout the description and analysis of MAGENTA.
Table 4: Summary of the principal notation used in MAGENTA.
| Symbol | Domain or type | Description |
|---|---|---|
| Problems and generated artefacts | ||
| Natural-language mathematics problems, and an individual problem. | ||
| Candidate answers, and the answer proposed by the reasoner at round . | ||
| Reference answer, used only for evaluation and never shown to the pipeline; and the answer finally returned. | ||
| Informal reasoning chains, and the chain generated at round . | ||
| Lean 4 theorem statements, and a generated statement. | ||
| Lean 4 proof scripts, and a candidate proof. | ||
| Diagnostic space | Statement-elaboration diagnostics returned by . | |
| Proof-verification diagnostics returned by , and the diagnostic from a failed attempt. | ||
| Mathematical-correction feedback built from a failed attempt, . Constructed only when returns MATH. | ||
| Empty signal | Absence of feedback: on the first reasoning round, on the first proof attempt. | |
| Pipeline components | ||
| Reasoner: produces an informal chain and candidate answer. | ||
| Formaliser: renders the problem and candidate answer as a Lean 4 statement. | ||
| Prover: generates or repairs a Lean 4 proof script. | ||
| Statement checker: elaborates in Lean (well-formedness only). | ||
| Proof checker: Lean kernel plus SafeVerify on the unchanged statement. | ||
| Statement judge and its verdict; accepts the formalisation. | ||
| Error judge and its label, routing a failed attempt to re-derivation or to local Lean repair. | ||
| Success verdict | A check passed: elaboration for , kernel and SafeVerify acceptance for . | |
| Budgets and evaluation | ||
| Maximum reasoner attempts, formalisation samples per candidate answer, and proof attempts per accepted statement. | ||
| Set of problems | The evaluation benchmark. | |
| Indicator that terminated with an adjudicated statement and a kernel-accepted proof. | ||
| A per-problem cost measure and a budget on it, used in Equation 2. | ||
A.2 FULL DETAILS
Algorithm 1 specifies the complete inference procedure using the notation of §2.1. The budgets T, M and K bound reasoner attempts, formal-statement samples for a fixed answer, and proof attempts for an accepted statement, respectively. The procedure returns the verified reasoning chain, answer, statement and proof , or UNCERTIFIED if an applicable budget is exhausted. Per problem it issues at most T reasoner calls, TM formaliser and statement-judge calls, and TK prover, verifier and error-judge calls, so adjudication is cheap relative to proof search whenever , which is the regime we operate in and the reason adjudication precedes proving.
Algorithm 1: MAGENTA inference.
Require: problem q; components R, F, P, , , , ; budgets T, M, K Ensure: verified output , or UNCERTIFIED
1: ▷ reasoner feedback state
2: for do
3: ▷ Phase 1: natural-language reasoning
4: ▷ no accepted statement yet
5: for do ▷ Steps 1–2: formalise and adjudicate
6:
7:
8: if then continue ▷ resample an ill-formed statement
9:
10: if then ; ; break
11: if then return UNCERTIFIED
12:
13:
14: for do ▷ Step 3: prove and verify
15:
16:
17: if then return ▷ Step 5: verified output
18: ▷ Step 4: error attribution
19: if
20: ; ; break ▷ construct feedback in
21: ▷ SYNTAX: repair the proof in place
22: if then return UNCERTIFIED
23: return UNCERTIFIED ▷ reasoner budget exhausted
Algorithms 2–4 decompose the same procedure into its controller, statement-search and proof-search routines. Statement search resamples whenever rejects an ill-formed statement or rejects an unfaithful one; neither failure changes or returns control to . Once a statement is accepted it remains fixed throughout proof search. A SYNTAX label returns the verifier diagnostic to for local proof repair, whereas only a MATH label constructs feedback in and invokes again.
Algorithm 2: End-to-end controller for MAGENTA.
Require: problem q; components R, F, P, , , , ; budgets T, M, K Ensure: verified output , or UNCERTIFIED 1: 2: for do 3: 4: 5: if 6: 7: if 8: if 9: ; continue 10: if 11: return UNCERTIFIED
▷ mathematical-revision loop ▷ construct feedback in ▷ reasoner budget exhausted
Algorithm 3: Faithful formal-statement search.
Require: problem q; candidate answer a; formaliser F; statement verifier ; statement judge ; budget M Ensure: (ACCEPTED, s) or (REJECTED, ) 1: for do 2: 3: 4: if then continue 5: 6: 7: if then return (ACCEPTED, ) 8: return (REJECTED, )
▷ generate a closed answer-carrying Lean signature ▷ elaborate the statement in Lean ▷ resample from F ▷ check the problem structure and the proposed answer
Algorithm 4: Syntax-guided proof repair and error attribution.
Require: problem q; chain c; answer a; immutable statement s; prover P; proof verifier ; error judge ; budget K Ensure: status in {CERTIFIED, MATH-ERROR, REPAIR-EXHAUSTED}, proof, diagnostic 1: ; ; 2: for do 3: 4: 5: 6: if then return (CERTIFIED, ) 7: 8: 9: if 10: return (MATH-ERROR, ) 11: 12: return (REPAIR-EXHAUSTED, )
▷ preserve q, c, s; repair only the Lean body ▷ Lean and SafeVerify checking ▷ route to the reasoner ▷ SYNTAX: condition the next local repair
For IMO 2026, a final completeness judge is applied only after Algorithm 4 returns CERTIFIED. It compares with and returns incomplete_proof when the formal certificate omits or misaligns a substantive part of the informal solution. This is an additional acceptance filter; it does not replace Lean or alter the feedback routing above.
B IMPLEMENTATION DETAILS FOR MAGENTA
B.1 PROMPT TEMPLATES
The templates below are reproduced verbatim from the experimental harness.
K2 informal-reasoner prompt
You are an expert mathematical problem solver. Solve the problem carefully and show enough reasoning to make the solution understandable. End with the final answer in the exact form \boxed{answer}. Do not put anything after the boxed answer.
{original_problem}
K2 mathematical self-correction prompt
Solve the original mathematics problem again and produce a complete corrected mathematical solution.
A downstream formal-verification audit classified the previous mathematical reasoning as defective.
Use the latest Lean code and exact verifier diagnostic below only as evidence locating the mathematical defect.
Do not focus on Lean syntax or tactics. Re-derive the mathematics, correct the answer if necessary, and provide a self-contained solution.
End with one clear final answer in \boxed{...}.
Closed-loop K3 regeneration cycle: {cycle}
Original problem:
{original_problem}
Previous K3 mathematical solution:
{previous_k3_mathematical_solution}
Immutable Lean target generated from that solution:
{immutable_lean_target}
Latest Lean proof attempt:
{latest_lean_proof_attempt}
Exact Lean/SafeVerify diagnostic:
{lean_or_safeverify_diagnostic}
Goedel formaliser prompt
Please autoformalize the following natural language problem statement in Lean 4.
The natural language statement is:
{informal_statement_content}
Think before you provide the lean statement.
DeepSeek statement-alignment judge prompt
Judge whether the candidate Lean 4 theorem statement faithfully formalizes the supplied question together with the generator's proposed final answer.
This is a statement-alignment judgment only. Do not write a proof and do not repair or rewrite the statement.
Do not independently solve the problem, recompute the answer, correct the generator's mathematics, or prefer your own conclusion. A mathematically wrong proposed answer must still be judged right when the Lean statement faithfully encodes that answer and the original task structure.
The original question controls domains, hypotheses, quantifiers, constraints, and the requested quantity.
The proposed answer controls the concrete claimed result. Do not silently replace it with a different answer.
Return verdict right only when the candidate preserves both sources without missing assumptions, extra assumptions, weakened conclusions, strengthened conclusions, hard-coded loopholes, or a changed answer.
Return verdict wrong otherwise and precisely describe the mismatch.
Return only one strict JSON object with exactly these string fields: verdict, rationale, mismatch_details. verdict must be right or wrong. mismatch_details must be empty when right and nonempty when wrong.
Exact appended question passed to the formalizer:
{answer_appended_question}
Original natural-language question:
{original_question}
Generator's proposed final answer:
{proposed_answer}
Candidate Lean 4 theorem statement:
{candidate_lean4_theorem_statement}
Leanstral proof-generation prompt
Produce a complete Lean 4 proof of the supplied theorem signature.
-
This is a formal translation and verification task, not an independent mathematics attempt.
-
Copy the theorem signature verbatim and do not weaken, strengthen, rename, or otherwise alter it.
-
Formalize the supplied K2 solution's reasoning and claimed conclusion without correcting, replacing, or bypassing its mathematics. Add only Lean-specific bookkeeping needed to express the same steps.
-
Do not substitute an independent proof strategy merely because it proves the statement. Do not use 'native_decide' or another exhaustive computation unless the supplied solution itself explicitly used that strategy.
-
If the supplied mathematics is false or insufficient, do not invent assumptions or silently repair it.
-
Use the available Lean compiler and lean-lsp-mcp tools to inspect errors and iteratively repair only the Lean implementation.
-
Edit 'Main.lean' in the current working directory. It must import Mathlib and must not use 'sorry', 'admit', axioms, unsafe declarations, fabricated assumptions, or the conclusion as a hypothesis.
-
Before editing the final code, provide a detailed Lean-oriented proof plan covering the main steps, intermediate lemmas, and tactics.
Original informal problem (authoritative for task structure):
{original_question}
Answer-appended question supplied to K2 (the answer is parsed from the K2 solution, not from ground truth):
{answer_appended_question}
Supplied K2 final mathematical solution (content after the private thinking marker; authoritative for the reasoning and claimed conclusion):
{k2_final_mathematical_solution}
Lean 4 theorem signature that must be preserved verbatim:
{immutable_lean4_theorem_signature}
Current 'Main.lean':
...lean4
{current_Main_lean}
...
DeepSeek error-classification prompt
Classify the root cause of this failed Lean 4 proof attempt.
This is a routing-only classification task. Do not repair the Lean code, do not suggest ↔ tactics, and do not provide feedback for the prover.
Return math_error only when the supplied K3 mathematical reasoning or claimed answer is ↔ itself false or insufficient, and the verifier evidence materially exposes that ↔ mathematical defect.
Return code_error for syntax, elaboration, typing, tactic, missing-lemma, namespace, ↔ coercion, timeout, forbidden-token, changed-target, SafeVerify protocol, or ↔ incomplete-proof failures that could be fixed while preserving the same mathematics.
A difficult or currently unsolved proof is code_error. SafeVerify rejection caused by ↔ changing the theorem is code_error.
When evidence is ambiguous, return code_error. Do not independently replace the proposed ↔ answer.
Return only one strict JSON object with exactly these string fields: classification, ↔ rationale, evidence.
classification must be code_error or math_error. Keep rationale and evidence concise.
Original problem:
{original_question}
K3 proposed answer:
{k3_proposed_answer}
K3 mathematical solution:
{k3_mathematical_solution}
Immutable Lean theorem target:
{immutable_lean_theorem_target}
Latest Lean candidate:
{latest_lean_candidate}
Verifier stage:
{verifier_stage}
Exact Lean/SafeVerify diagnostic:
{exact_lean_or_safeverify_diagnostic}
B.2 HYPERPARAMETER SETTINGS
-
Budgets. For all the experiments, we use reasoner attempts, formal-statement samples per candidate answer and proof attempts per accepted statement. For computational efficiency, the ablations of §4.3, run the pipeline in batched mode with a batch size 32.
-
Reasoner. We use temperature 0.6, top_p = 0.95, a maximum output length of 64,000 tokens (128,000 for IMO 2026), and thinking=auto. The random seed is 42 for the main evaluation. The reasoner is served with a 524,288-token context window. During self-correction, incomplete responses are resampled if they reach the token limit without emitting the post-thinking marker (this counts toward the budget ). In practice, this never occurred in our experiments.
-
Goedel formaliser. We use temperature 0.9, top_k = 20, top_p = 0.95, a maximum output length of 16,384 tokens, and seed 42. The model is served with a 40,960-token context window. Each extracted theorem statement is checked in Lean with a temporary sorry proof.
-
DeepSeek statement-alignment judge. We use temperature 1.0, top_p = 1.0, a maximum output length of 32,000 tokens, and reasoning effort max. Only statements that have already passed Lean elaboration are submitted to this judge. The model is served with a 65,536-token context window, tensor parallelism 8, pipeline parallelism 1, GPU-memory utilisation 0.90, FP8 KV cache, block size 256, prefix caching and expert parallelism. DSPARK speculative decoding is enabled with seven speculative tokens and greedy draft sampling.
-
DeepSeek error-attribution judge. The error-attribution judge uses the same checkpoint and hyperparameters as the statement-alignment judge but is issued as a separate call, and returns either code_error or math_error.
-
Leanstral proof agent. We use mistralai/Leanstral-1.5-119B-A6B through Mistral Vibe 2.18.4, with decoding temperature 1.0, thinking level high and reasoning effort high. The served context length is 200,000 tokens and automatic context compaction is triggered at 168,000 tokens. Compaction preserves the trajectory, and the cumulative token counter is not reset after compaction. The server permits at most 80,000 newly generated tokens per request, while the experimental wrapper applies a stricter 32,000-token per-call output limit. The cumulative output-token budget is 4,000,000 tokens per proof trajectory.
-
Lean tools and final certification. The proof environment uses Lean v4.29.1. A result is accepted only when the theorem statement is unchanged, Lean returns exit code zero, SafeVerify returns exit code zero, neither verifier times out, and the proof contains no forbidden constructs such as sorry, admit, new axioms, unsafe or nativedecide.
-
Codex comparator and fallback. The CODEX formaliser and proof backend use gpt-5.6-sol with reasoning effort ultra.
C REFINEMENT ROUNDS ACROSS MODELS AND DATASETS
Table 5: Reported average and maximum rounds required across models and datasets, counting the initial attempt as round 1. Average counts are rounded.
| Dataset | K2-Horizon-7B | K2-Horizon-375B | ||
|---|---|---|---|---|
| Average | Maximum | Average | Maximum | |
| AIME2025 | 1 | 3 | 1 | 1 |
| AIME2026 | 2 | 5 | 1 | 2 |
| HMMT2026 | 3 | 10 | 1 | 2 |
Table 5 shows that refinement effort varies across both models and datasets. K2-Horizon-7B requires approximately one, two and three rounds on average for AIME2025, AIME2026 and HMMT2026, respectively. Its maximum increases from three to five and ten rounds, showing that some instances require substantially more refinement than the dataset average. K2-Horizon-375B requires approximately one round on average across all three datasets, with at most one additional round on AIME2026 and HMMT2026.
The shorter trajectories of K2-Horizon-375B are consistent with its reported tendency to produce correct answers on the first attempt. For K2-Horizon-7B, the increasing refinement effort suggests that AIME2026 and HMMT2026 pose greater difficulty within this workflow. Lower initial accuracy leaves more instances requiring subsequent correction, providing a possible explanation for the additional rounds. However, the relationship between initial accuracy and round count should be assessed using the corresponding first-attempt results; round counts alone measure refinement effort rather than establish a model-independent ranking of dataset difficulty.
D AIME2026 FORMAL AND INFORMAL PROOF EXAMPLE
We reproduce a complete audited trajectory for an AIME 2026 problem (see also Figure 1), in which the initial informal solution is wrong, the error is attributed to the mathematics rather than to the Lean implementation, and the pipeline recovers. Boxes 1–5 are the failed cycle and boxes 6–9 the corrected one.
Input question
Find the number of functions mapping the set onto such that for every ,
↓
1. Informal reasoner — initial generation
The condition
means that the seventh iterate of is the identity map:
Hence the order of must divide 7. Since 7 is prime, the only possible orders are 1 and 7.
A permutation of a set of size 6 can have order at most 6 (the maximum occurs for a 6-cycle).
Thus a permutation of order 7 cannot exist on a set of six elements.
Consequently the only function satisfying is the identity permutation.
1
↓
2. Goedel formaliser — initial generation
theorem problem_1 : Nat.card {π : Equiv.Perm (Fin 6) | ∀ a : Fin 6, (π ^ 6) a = a} = 1
↓
3. DeepSeek statement judge
right
↓
4. Leanstral — initial proof generation
import Mathlib
open Equiv
theorem problem_1 : Nat.card {π : Equiv.Perm (Fin 6) | ∀ a : Fin 6, (π ^ 7) a = a} = 1 := by have h_set_eq : {π : Equiv.Perm (Fin 6) | ∀ a : Fin 6, (π ^ 7) a = a} = {1} := by ext π constructor · intro h have h_all : ∀ a : Fin 6, (π ^ 7) a = a := h have h_pow : (π ^ 7) = 1 := by apply Equiv.ext intro a simpa using h_all a have h_order_dvd_7 : orderOf π | 7 := orderOf_dvd_of_pow_eq_one h_pow have h_prime_7 : Nat.Prime 7 := Nat.prime_seven have h_order_cases : orderOf π = 1 ∨ orderOf π = 7 := h_prime_7.eq_one_or_self_of_dvd (orderOf π) h_order_dvd_7 rcases h_order_cases with (h_order | h_order) · have h_one : π = 1 := (orderOf_eq_one_iff.mp h_order) simp [h_one] · have h_card : Fintype.card (Equiv.Perm (Fin 6)) = 720 := by rw [Fintype.card_perm, Fintype.card_fin] norm_num have h_order_dvd_card : orderOf π | Fintype.card (Equiv.Perm (Fin 6)) := → orderOf_dvd_card rw [h_card] at h_order_dvd_card rw [h_order] at h_order_dvd_card have h_7_not_dvd_720 : ¬ (7 : N) | 720 := by have h_mod : 720 % intro h_dvd have h_mod_zero : 720 % rw [h_mod] at h_mod_zero linearith exact absurd h_order_dvd_card h_7_not_dvd_720 • intro h have h_one : π = 1 := by simpa using h rw [h_one] intro a simp rw [h_set_eq] simp
- DeepSeek error attribution
math_error
- Informal reasoner — corrected generation
The condition for all means that the sixth iterate of is the identity, i.e., . Since maps onto and is finite, is a bijection, hence a permutation of . The order of divides 6, so we must count the permutations in whose order divides 6.
The order of a permutation is the least common multiple of its cycle lengths. Thus the order divides 6 if and only if all cycle lengths belong to (cycles of length 4 or 5 would give orders 4 or 5, which do not divide 6). We count the permutations by their cycle types:
• One 6-cycle:
• Two 3-cycles:
• One 3-cycle, one 2-cycle, one 1-cycle:
• One 3-cycle, three 1-cycles:
• Three 2-cycles:
• Two 2-cycles, two 1-cycles:
• One 2-cycle, four 1-cycles:
• Six 1-cycles (identity): 1
Summing these gives .
396
- Goedel formaliser — corrected generation
theorem problem_1 :
Set.ncard {π : Equiv.Perm (Fin 6) | ∀ a, (π^[6]) a = a} = 396
- DeepSeek statement judge
yes
- Leanstral — corrected proof generation
import Mathlib
set_option maxRecDepth 10000000 set_option maxHeartbeats 2000000
theorem problem_1 : Set.ncard {π : Equiv.Perm (Fin 6) | ∀ a, (π^[6]) a = a} = 396 := by have h_eq : {π : Equiv.Perm (Fin 6) | ∀ a, (π^[6]) a = a} = {π | π ^ 6 = 1} := by ext π constructor · intro h ext a have ha := h a have hal : (π ^ 6) a = a := by simpa [Equiv.Perm.iterate_eq_pow π 6] using ha simpa [hal] · intro h a have h' := congrArg (λ f : Equiv.Perm (Fin 6) => f a) h simpa [Equiv.Perm.iterate_eq_pow π 6] using h'
rw [h_eq] have h_fin : Set.Finite {π : Equiv.Perm (Fin 6) | π ^ 6 = 1} := by exact Set.finite_coe_iff.mp inferInstance have h_card : Set.ncard {π : Equiv.Perm (Fin 6) | π ^ 6 = 1} = Finset.card ((Finset.univ : Finset (Equiv.Perm (Fin 6))).filter (λ π => π ^ 6 = 1)) → := by rw [Set.ncard_eq_toFinset_card _ h_fin] congrr ext π simp rw [h_card] decide
E ERROR ANALYSIS
E.1 FORMAL STATEMENT ERROR ANALYSIS
Table 6: Formal-statement generation and adjudication errors (%) across all 30 AIME 2026 problems. Generated percentages are normalised over all Goedel statements. Conditional percentages are normalised over the statements reaching the relevant stage: all pre-judge rejections for the error categories and all Lean-passing statements for the DeepSeek outcomes.
| Outcome or first failure category | Generated | Conditional |
|---|---|---|
| All-30 Goedel generation outcomes | ||
| Lean elaborated | 66.55 | - |
| Lean compiler error | 33.08 | - |
| Statement extraction failure | 0.22 | - |
| Input context overflow | 0.16 | - |
| First cause among rejected all-30 statements | ||
| Type, coercion, or projection mismatch | 17.47 | 52.23 |
| Typeclass or instance synthesis | 7.85 | 23.46 |
| Parser or notation syntax | 4.78 | 14.28 |
| Unknown name or API misuse | 2.73 | 8.17 |
| Statement extraction failure | 0.22 | 0.66 |
| Input context overflow | 0.16 | 0.47 |
| Metavariables or underspecified binders | 0.13 | 0.38 |
| Pattern, binder, or match elaboration | 0.10 | 0.31 |
| Tactic failure or open goal | 0.01 | 0.02 |
| Resource timeout | 0.01 | 0.02 |
| All-30 compiler-to-DeepSeek outcomes | ||
| Rejected before judge: Lean error | 33.08 | - |
| Rejected before judge: extraction error | 0.22 | - |
| Rejected before judge: context overflow | 0.16 | - |
| DeepSeek semantic rejection | 44.64 | 67.08 |
| DeepSeek semantic acceptance | 21.91 | 32.92 |
We generate a full grid of candidate answers and Goedel formalisations for each of the 30 AIME 2026 problems. The audit in Table 6 shows that formal-statement failure is primarily an elaboration problem rather than a parsing problem. Type, coercion and projection mismatches account for more than half of rejected statements, and typeclass synthesis for almost a quarter; together these two categories explain over three quarters of pre-proof rejection. Syntax errors form a much smaller share, and extraction, context, tactic and timeout failures are negligible. The main obstacle is therefore expressing the intended mathematics with Lean-compatible types and interfaces, not producing superficially valid Lean syntax.
The DeepSeek audit exposes a separate semantic bottleneck. Even after the compiler and extractor filter malformed statements, the judge rejects 67.08% of the statements it sees and accepts 32.92%; relative to all generated statements these correspond to 44.64% rejected and 21.91% accepted. Compilation is therefore a weak proxy for faithfulness: semantic adjudication removes substantially more compilable-but-misaligned statements than Lean removes malformed ones. Among falsely certified statements in the no- ablation of §4.3, the dominant failure mode is a weakened or answer-baked surrogate goal: three of five certificates prove such surrogates, one drops an essential part of the problem and one mistranslates the underlying geometry; none succeeds through a contradictory context.
E.2 PROOF ERROR ANALYSIS
LEANSTRAL exposes proof errors at two different levels: 54.73% of its de-duplicated internal Lean/LSP results contain an error diagnostic or tool failure, spanning tactic failures, API misuse, protocol failures, syntax, typing, and resource limits (Table 7). By the time a trajectory reaches the external verifier, however, failures are concentrated in unsolved proof obligations and SafeVerify policy violations. This shift shows that Leanstral's agentic inner loop absorbs many local elaboration and implementation errors before they reach the outer correction loop.
Table 7: Proof-error distributions (%) across all 30 AIME 2026 problems. Leanstral internal is normalized over error-bearing Lean/LSP results; the external columns are normalized over failed outer rounds. One category is assigned per result or round, with policy violations taking priority; “–” denotes no assigned error.
| Primary error category | Leanstral int. | Leanstral ext. | Codex ext. |
|---|---|---|---|
| Tactic failure or open goals | 42.70 | 63.78 | 30.28 |
| Forbidden token or policy | - | 26.77 | - |
| Unknown name or API misuse | 15.19 | - | 15.31 |
| Tool, protocol, or runtime failure | 13.68 | - | 2.16 |
| Parser or syntax error | 8.18 | 0.79 | 0.67 |
| Type or coercion mismatch | 6.70 | - | 45.92 |
| Resource limit or timeout | 5.72 | 8.66 | 2.66 |
| Other Lean diagnostic | 5.23 | - | - |
| Typeclass or instance synthesis | 2.60 | - | 1.83 |
| Metavariables or invalid declaration | - | - | 0.83 |
| Noncomputable definition | - | - | 0.33 |
Compared with LEANSTRAL, CODEX exposes a different external failure profile: type and coercion mismatches dominate, followed by tactic failures and API misuse, whereas LEANSTRAL's external failures are dominated by proof search and policy enforcement. Parser errors are negligible for both, showing that syntactic Lean generation is not the main bottleneck. The important distinction is therefore where debugging occurs: LEANSTRAL resolves a broader range of implementation errors internally, while Codex returns more of them to the pipeline. External rounds are consequently not interchangeable units of proof effort, and error attribution should account for both the prover backend and the level at which the error is observed.
E.3 REASONER ERROR ANALYSIS
Table 8: Root causes of the 14 mathematical errors attributed to K2-HORIZON-7B by the error judge while solving the AIME 2026 problems.
| Cause | Percent (%) |
|---|---|
| Input interpretation or transcription | 28.6 |
| Unsupported logical or proof step | 28.6 |
| Arithmetic, algebra, or cardinality | 21.4 |
| Escalation after repeated Lean repair could not preserve the contract | 14.3 |
| Invalid construction or counterexample | 7.1 |
As Table 8 shows, the dominant failures arise less from routine calculation than from preserving the problem statement and justifying key proof steps. Representative examples include changing 17017 to 107017, solving the problem for instead of , reading 39 as 3 or as , interpreting six iterates as seven (Appendix D), and relying on unsupported geometric or combinatorial reductions. These cases show why compiler feedback alone is insufficient: error attribution must sometimes return control to the reasoner to reconstruct the mathematics rather than continue repairing its Lean implementation.
F DETAILS OF IMO 2026
F.1 EXPERIMENTAL SETUP
For IMO 2026 we retain the same pipeline and add a final judge after formal verification to assess whether the formal certificate covers the complete informal solution. The judge compares the original problem and informal reasoning with the generated Lean statement and proof. If it detects a substantive mismatch, or an argument that is present informally but absent from the formal certificate, it returns incomplete_proof. We count a solution as complete only when it passes both Lean/SafeVerify and this final formal–informal alignment check.
F.2 EVALUATION
We evaluate our IMO 2026 solutions under two complementary protocols. First, we use CODEX as an automated judge, supplying it with several publicly available reference solutions, including those from the Art of Problem Solving forums and from Kimi K3, and asking it to score each generated solution against the official marking scheme. Second, for a more robust assessment, we ask a former IMO medallist with access to national IMO score predictions to mark the same solutions independently.
F.3 VERIFICATION-GUIDED TEST-TIME SCALING
Figure 6 shows that MAGENTA adaptively allocates more inference-time computation to more difficult problems. Problems 3 and 6 consume the largest token budgets and require more self-correction, consistent with their higher level of difficulty. Rather than relying on a single fixed generation, MAGENTA uses formal-verification feedback to guide subsequent attempts, allowing the reasoner to revise unsuccessful arguments and devote additional computation where it is most needed. This reflects the principle of test-time scaling (Sahoo et al., 2024), with verification providing a targeted signal for how that additional computation should be used. Through this verification-guided scaling process, K2-HORIZON-7B ultimately solves all six problems on IMO 2026.

Figure 6: Total reasoner-token usage of K2-HORIZON-7B with MAGENTA across the six IMO 2026 problems.
six problems on IMO 2026.
F.4 GENERATED SOLUTIONS
F.4.1 IMO PROBLEM 1
Question
There are 2026 integers greater than 1 written on a blackboard, not necessarily distinct. In one move, Confucius chooses two integers and , written in different positions, and replaces them by
He continues making moves for as long as a move is possible.
(a) Prove that, regardless of his choices, the process terminates after finitely many moves with exactly one integer on the board.
(b) Prove that the value of is independent of all choices made during the process.
K2-Horizon-7B generation
Let the initial integers be with for all . We regard the board as a function . A move consists of choosing two distinct positions with and , and replacing them by
All other positions stay unchanged. The process continues as long as such a move is possible.
(A) TERMINATION AND THE FINAL BOARD
For any board (a function from to positive integers) define
Because every is a positive integer, is a positive integer.
Lemma 1. After a move we have , and if then .
Proof. Let the move act on positions with , . Set and ; then , and for .
For the contribution to and is unchanged, so we only compare the two changed positions.
Case 1: . Then (since ). Because , we have . Thus we replace two numbers > 1 by one number > 1 (namely ) and one number 1 (namely ). Hence . Moreover
Case 2: . Write with . Then
Subcase 2a: . Then , so . We replace two equal numbers > 1 by and 1; therefore . Also
Subcase 2b: . Then we replace two numbers > 1 by two numbers > 1 (, ); hence . Moreover
In every situation , and when we are in subcase 2b, which gives .
The lexicographic order on is well-founded (because is well-ordered). Lemma 1 shows that the pair strictly decreases lexicographically at each move. Hence the process cannot continue indefinitely; it must terminate after finitely many moves.
Let be a terminal board, i.e. no move is possible. Then there are no two distinct positions with values > 1; consequently at most one position contains a number > 1. We claim that exactly one such position exists.
Suppose, for contradiction, that all . Then . The initial board has . Each move can decrease by at most one (Lemma 1). To reach from we would need at least 2026 moves that each reduce by one. However, a move that reduces from 1 to 0 is impossible because a move requires two numbers > 1. More precisely, if at some stage , no move can be performed, so the process would have stopped earlier. Thus the process can never reach a state with . Therefore the final board must have .
Hence there is a unique index with , and for all we have . Set ; then . This proves part (a).
(B) INDEPENDENCE OF THE FINAL VALUE M
For a prime and a positive integer let be the exponent of in the prime factorisation of (with ). For a board define
(If the set consists only of zeros we take the gcd to be 0.)
Lemma 2. is invariant under moves.
Proof. Consider a move on positions with , . Put , . Then
Since ,
Thus the multiset of -adic valuations changes from to . Let be the multiset of valuations of the other 2024 positions. Then
Hence it suffices to prove
(*)
Assume without loss of generality that . Then and . If divides both and , then divides ; conversely, if divides both and , then divides . Thus the sets of common divisors of and coincide, so their greatest common divisors are equal. Hence (*) holds, and the gcd of the whole multiset is unchanged.
Now look at the terminal board: it contains one number and the remaining 2025 numbers equal to 1. The multiset of valuations is (2025 zeros). The gcd of this set is because . Therefore
By Lemma 2, for every prime . Consequently
The prime factorisation of an integer is unique, so
Since the right-hand side depends only on the initial multiset, the value of is independent of the choices made during the process.
The process terminates with exactly one integer on the board, and
which is independent of the choices.
F.4.2 IMO PROBLEM 2
Question
Let be a triangle, and let and be the midpoints of and , respectively. Let and be chosen strictly inside triangles and , respectively, such that lies strictly inside , lies strictly inside , and
If is the circumcentre of triangle , prove that .
K2-Horizon-7B generation
Place triangle in the plane with at the origin. Let and . Since is non-degenerate, the vectors and are linearly independent. Define
For any points we write for the vector from to , and for vectors we denote by the determinant (cross product) and by the dot product.
- COORDINATES OF AND
Because lies inside there exist positive numbers with such that
The midpoint of is ; hence
Set
Then . From and we obtain
Similarly, lies inside . Its midpoint is ; thus there exist positive with such that
Set
Then and
- THE CONDITIONS “ INSIDE ” AND “ INSIDE ”
inside means that the ray lies between and . With this is equivalent to the existence of positive numbers such that
(*)
Write and . Substituting into (*) gives
Because and are independent, we equate coefficients:
From the first equation . Then
Define
A short calculation shows ; hence . Since and ,
Similarly, inside means there exist positive such that
(**)
Write and . Substituting into (**) gives
Equating coefficients:
From the first equation . Then
Define
Again ; hence . Since and ,
- A LEMMA ON ANGLE EQUALITIES
Lemma. Let be non-zero vectors in the plane. If the (undirected) angle between and equals the angle between and and , then
(*)
Proof. Equality of the undirected angles gives equality of the cosines:
The absolute values of the determinants satisfy
Because the determinants have the same sign,
Multiplying the two equalities yields .
4. TRANSLATING THE ANGLE EQUALITIES
We apply the lemma to each given angle equality. First we compute the relevant determinants and dot products.
. Take , , , . Then
Since , and , the product is positive. The dot products are
Lemma gives
Cancelling and simplifying we obtain
(I)
. Take , , , . Then
Since , the product is positive. The dot products are
Lemma yields
Cancelling and multiplying by we get
(II)
. Take , , , . Then
Since , the product is positive. The dot products are
Lemma gives
Cancelling and multiplying by we obtain
(III)
- A CRUCIAL ALGEBRAIC IDENTITY
Set
(from (I)),
(from (II)),
(from (III)).
Define
Consider the linear combination
Since are zero, we have . Now we expand . Substituting the expressions for and ,
and expanding, we obtain after collecting terms:
Because and , we have . Hence the bracket must vanish, which gives
(IV)
- THE CIRCUMCENTER OF
Since is the origin, the condition is equivalent to
Expanding the squares gives
Using and ,
Let and . Then (5) and (6) are a linear system for . We must prove . Because and ,
Thus is equivalent to , i.e.
To obtain (7) from (5) and (6), eliminate and . Multiply (5) by and (6) by and subtract:
The left-hand side simplifies to
Hence
(8)
Now use (IV). Dividing (IV) by 2 gives
Substituting this into (8) yields
Since , we have
The triangle is non-degenerate (its circumcenter exists), therefore and are not collinear with . In our coordinates this means
and because we have . Cancelling this non-zero factor gives
which is exactly (7). Hence , and since distances are non-negative, .
F.4.3 IMO PROBLEM 3
Question
Let be a positive integer. Liu Bang and Xiang Yu have a stick of length 1. First Liu Bang marks at most points on the stick, and then Xiang Yu marks at most further points; all marked points are distinct. The stick is cut at every marked point. The players then alternately claim unclaimed pieces, with Liu Bang moving first, and each player seeks to maximize the total length of the pieces he claims. Determine the largest number that Liu Bang can guarantee, regardless of Xiang Yu's play.
K2-Horizon-7B generation
Let the stick be the interval . Liu marks at most points, then Xiang marks at most further points; all marked points are distinct. The stick is cut at every marked point, producing pieces. The players then alternately claim unclaimed pieces, Liu moving first, each maximizing total length.
Lemma 1 (Optimal play). Let the pieces be sorted in non-increasing order . Under optimal play Liu obtains the pieces at odd positions and Xiang the pieces at even positions. Consequently Liu's total is where
Liu wants to maximise , Xiang to minimise it.
Proof. We prove by induction on that the player whose turn it is always takes the largest remaining piece. For this is trivial. Assume the statement holds for pieces. For pieces, suppose it is the current player's turn. If the player takes (), the remaining pieces are sorted descending with removed. By induction the opponent will obtain the odd-indexed pieces in that sorted list. Let be the opponent's total if the current player takes . For , . For , removing shifts the parity of indices for elements after ; the opponent takes for with odd, and for with even. Hence
Then
Write . Thus
Now consider the cases. If is even, then , . Hence . If is odd, then , . Hence . In both cases , so taking minimises the opponent's total and maximises the current player's total.
Lemma 2 (Pairs-plus-one). Let be a multiset of positive real numbers. Suppose consists of some number of equal pairs (each pair consists of two equal numbers) plus possibly one extra element . (If we may ignore it.) Then when is sorted in non-increasing order, the alternating sum
equals r.
Proof. Sort descending. Group the elements by their values. Since all numbers except possibly appear in pairs, every value block (except possibly the block containing ) has even size. The block containing has odd size. The number of elements before this block is the sum of the sizes of the previous blocks, which are all even, so it is even. In the alternating sum, each block of even size contributes 0 (the alternating sum of an even number of equal terms cancels). The block containing starts at an odd position (because the number of preceding elements is even), so its terms alternate signs starting with +. The sum of an odd number of equal terms with alternating signs starting with + is the value itself. Hence the contribution of this block is . All other blocks contribute 0. Thus . If then .
- LOWER BOUND – LIU CAN GUARANTEE
Set . Liu marks the points for . The stick is divided into intervals
with lengths . Their sum is .
Xiang marks at most further points. The stick is cut at every marked point, producing pieces. Let be the number of positive pieces. Since there are at most marks, . Sort the pieces in non-increasing order and pad with zeros to obtain a list of length (if add zeros; if add one zero). Pair the list as with . Associate each piece with its parent interval ; zero pieces are associated with a dummy vertex .
Construct a directed multigraph : vertices are and . For each pair draw a directed edge from the parent of to the parent of . Thus has vertices and edges. Every contains at least one piece, and is incident to at least one zero piece (since exactly zeros were added), so every vertex has degree .
Consider the undirected version of . For any connected component , we have (a connected graph has at least edges). Summing over all components, , where is the number of components. Since , we get , hence . If every component satisfied , then , contradicting . Therefore there exists at least one component with . Because every vertex has degree , contains at least two vertices. A connected multigraph with has no cycles (any cycle requires at least edges), so is a tree (acyclic, simple). Bipartition this tree into . Both and are non-empty.
Define and . The tree has at least two vertices and only one can be the dummy , so is nonempty. For a directed edge in (where is the parent of , is the parent of ), define if , and if , . Let (so ). For a vertex let be the total length of pieces from (all pieces from are incident to edges in , because belongs to ).
We claim
Indeed, for an edge the contribution is . If , this is ; if , it is . In both cases the piece from the U-endpoint receives +1 and the piece from the W-endpoint receives -1. Summing over all edges in , each piece from is counted +1 and each from is counted -1. Hence the identity holds.
Now for and . The difference is a sum of some with coefficients . Since the are distinct powers of two times , any such sum is a multiple of . Moreover, and are disjoint and is nonempty. If , uniqueness of binary expansion gives ; disjointness then gives , contradicting nonempty. Therefore the signed sum is nonzero and its absolute value is at least .
Now . Since , we have
Thus Liu’s total is at least .
- UPPER BOUND – XIANG CAN FORCE
If Liu marks fewer than n points, he creates at most n intervals. Xiang bisects each interval (using at most n cuts); then all pieces come in equal pairs, so .
Assume Liu marks exactly n points, creating intervals of lengths with .
Consider all subsets of . There are subset sums (counted with multiplicity), all in , including 0 and 1. Sort them: . The consecutive gaps are non-negative and telescope to 1, so one gap is at most . The two entries bounding this gap come from two distinct subsets (if the gap is zero the subsets are still distinct). Hence there exist distinct subsets with .
Among all such pairs, choose one that minimises . Let , with (swap if necessary) and set ; then .
Claim 1. . Proof. If , let , . Then are distinct, , and , contradicting minimality.
Thus A, B are disjoint. Let , .
Case 1: . Then is non-empty and . Minimality forces . Indeed, if , choose a singleton . Then and , contradicting minimality. Thus for some and . Xiang leaves uncut and bisects all other intervals (using cuts). The pieces are one piece of length and pieces forming equal pairs. By Lemma 2, .
Case 2: . Then . We have disjoint. Order the intervals in by their positions on the stick: lengths , cumulative sums , . Similarly for : , .
Claim 2. For all with , . Proof. Suppose for some . Let be the set of indices of corresponding to . Then and (since ). The pair is disjoint, , and , contradicting minimality. Hence .
Now we construct Xiang’s marks. The cumulative numbers and are coordinates in two separate abstract concatenations, not positions on the original stick. Order the actual selected A-intervals left-to-right and translate them end-to-end, preserving lengths, to virtual , where actual interval represents virtual . Separately translate the actual B-intervals to virtual .
Retain Claim 2 and the common sorted boundary union , where
(Recall , so all for are , and .)
For each -boundary () strictly inside a virtual -cell , mark the corresponding actual -interval at distance from its actual left endpoint. For each -boundary () strictly inside a virtual -cell , mark the corresponding actual -interval at distance from its actual left endpoint. Equal boundaries need no cuts. Thus overlay cuts , and all marks are legal and distinct.
Because A and B are disjoint, the A-intervals and B-intervals are distinct intervals on the stick. The two abstract concatenations now have the same refinement boundary list up to , so their resulting physical pieces have paired equal lengths ; they need not be at the same physical locations.
Because , the virtual tail corresponds to one tail in the last actual A-interval, of length ; when it is absent.
Bisect all intervals not in A or B; there are of them, using cuts. Total cuts used is at most . Hence Xiang can use at most n cuts.
The final pieces consist of: • equal pairs from the overlay construction, • equal pairs from the bisected intervals, • one extra piece of length (if ).
By Lemma 2, the alternating sum equals (or 0 if ). Since , we have .
3. CONCLUSION
Liu can guarantee at least and Xiang can force at most . Therefore the largest number Liu Bang can guarantee is
F.4.4 IMO PROBLEM 4
Question
Shan-Yu and Mulan are playing a game. Let be an angle satisfying
known to both players. Initially, Shan-Yu constructs a paper triangle with measurements of his choice. They then repeatedly perform the following steps:
-
If has at least one angle measuring exactly , the game ends and Mulan wins.
-
Otherwise, Mulan chooses a point on the perimeter of , distinct from its three vertices.
-
She makes a straight cut from to the opposite vertex of , dividing into two triangles.
-
Shan-Yu discards one of the two triangles, and the remaining triangle becomes the new .
For which real values of can Mulan guarantee victory in finitely many steps, regardless of how Shan-Yu plays?
K2-Horizon-7B generation
Let be an angle with . A triangle is determined by its three positive angles with . A cut at vertex (with angles ) means choosing a point on side (different from ) and drawing segment . This splits the triangle into two triangles with angles
for some with . (The angles at and remain unchanged, and the new angles at are and ; the third angles are forced by the sum .)
We determine for which Mulan has a strategy that guarantees victory in finitely many steps, no matter how Shan-Yu plays.
- NECESSITY: IF DOES NOT DIVIDE , MULAN CANNOT FORCE A WIN.
Assume ; then there is no integer with .
Lemma 1. Let be a triangle with angles , none of which is an integer multiple of . For any cut of , at most one of the two resulting triangles has an angle that is an integer multiple of .
Proof. Suppose we cut at vertex , splitting into and (). The two triangles are
Assume, for contradiction, that both and contain an angle that is an integer multiple of . We examine the possibilities.
• If 's multiple is or 's multiple is , then itself has a multiple, contradicting the hypothesis. • If 's multiple is and 's multiple is , then is a multiple of , contradiction. • If 's multiple is and 's multiple is the third angle , then
Hence is a multiple of ; because is a multiple of , is also a multiple of , contradiction. • If 's multiple is the third angle and 's multiple is , then
so is a multiple of , contradiction. • If both multiples are the third angles, then
which gives for some integers ; this contradicts .
All cases lead to a contradiction, so at most one of , can have a multiple of .
Shan-Yu's strategy. Choose an initial triangle with no angle a multiple of ; for instance the equilateral triangle with angles , , . (If were a multiple of , then would be a multiple of , contradicting .)
Whenever Mulan makes a cut, Shan-Yu discards the triangle that contains a multiple of (if such a triangle exists); otherwise he discards arbitrarily. By Lemma 1 the remaining triangle has no multiple of . Hence the game never produces an angle equal to , and Mulan never wins. Thus Mulan cannot guarantee victory when .
- SUFFICIENCY: IF DIVIDES , MULAN HAS A WINNING STRATEGY.
Now assume for some integer (because gives ). We describe Mulan's strategy.
Strategy. Given the current triangle T with angles A, B, C.
• If any angle equals , Mulan wins immediately. • Otherwise, we distinguish two cases.
Case 1. T has an angle that is a positive integer multiple of , say with . Mulan cuts at vertex A, splitting it into and . The two resulting triangles are
(One checks that and , so the angles sum to in each triangle.) contains , so Shan-Yu will discard . The remaining triangle is . If , then contains and Mulan wins. If , then has an angle which is a positive integer multiple of ; we are back to Case 1 with a smaller multiple. Hence after at most moves Mulan wins.
Case 2. T has no angle that is a positive integer multiple of . Mulan performs a special cut to create two triangles that both have a multiple of .
Lemma 2. There exist a vertex and a positive integer such that
Proof of Lemma 2. Suppose first that there is a vertex with . Let be the smallest positive integer with (such exists because ). Then . Since ,
so . The inequality holds by construction.
If, on the other hand, every angle satisfies , then because no angle equals we have for all . Pick . Then . Moreover,
Hence , and we may take .
Now let and be as in Lemma 2. Set . Then . Mulan cuts at vertex , splitting the angle into and . The two resulting triangles are
(One verifies the third angles using and .)
Both and have an angle that is a positive integer multiple of . Shan-Yu discards one of them. The remaining triangle has an angle that is a positive integer multiple of . If that multiple is , Mulan wins immediately. If it is larger, say with , Mulan proceeds to Case 1, which will finish in at most moves. Because and the remaining multiple is either or , we have . Thus after the initial cut Mulan wins in at most further moves, i.e. in at most moves altogether.
This completes the description of Mulan's strategy.
- CONCLUSION
Mulan can guarantee her victory in finitely many steps if and only if divides , i.e.
F.4.5 IMO PROBLEM 5
Question
Determine all functions such that for every .
K2-Horizon-7B generation
Let satisfy
All quantities are positive, so squaring preserves the order. The left inequality becomes
and the right inequality becomes
Thus for all
- A FUNCTIONAL EQUATION
Put in (1). Because ,
hence . Since ,
or
- INTRODUCING
Define for ; then . From (2),
- ITERATION AND NON-NEGATIVITY OF
We prove by induction that for every and every ,
Base : and . Inductive step: Assume (4) holds for some . Then
Because , the hypothesis for gives ; hence . Moreover,
where we used (3) and the induction hypothesis. Thus (4) holds for .
Now suppose for some . Then . Choose with . Then
contradicting the second part of (4). Therefore
Consequently for all .
- A KEY INEQUALITY
For arbitrary set . Expanding the two parts of (1) gives
Hence (1) yields
Now observe that
Thus (6) and (7) are exactly the two parts of
So (8) holds for all .
- BOUNDING THE DIFFERENCE OF
Let . We prove
Assume first that . Put , in (8). Using (3),
Since and , the right-hand inequality becomes
Now , , so
Let . Then
Substituting these into the inequality and expanding gives
which simplifies to
Because and , we have
Thus
If instead , we interchange the roles of and (use , in (8)) and obtain
In either case (9) follows.
- IS CONSTANT
Suppose there exist with . Without loss of generality, assume . Put . Choose a natural number such that
Set and define for . Then , and for each we have and .
Applying (9) to the pair yields
Since ,
Summing these inequalities for gives
By the triangle inequality,
Consequently
But (12) implies , a contradiction. Hence our assumption was false, and for all . Therefore is constant.
- DETERMINING
Let for all . Then . The condition for all forces . (If , then for we would have , impossible.) Conversely, if and , then for any ,
Indeed, the right inequality is equivalent to , which simplifies to ; the left inequality is equivalent to , which simplifies to . Both are true.
F.4.6 IMO PROBLEM 6
Question
Let be an infinite sequence of positive integers greater than 1. Suppose that, for every positive integer , the number is the smallest integer greater than such that for every . Prove that there exist positive integers and such that for every positive integer .
K2-Horizon-7B generation
Let be the given sequence of integers > 1. Define a positive integer to be good if for every .
Lemma 1. For all , . Proof. If then so . If , then by the definition of (the smallest integer with for all ) we have and hence . If the same argument with roles reversed gives .
Consequently every term is good: for any , if then by the above; if then ; and if then .
Lemma 2. The sequence is strictly increasing and for all . Proof. The hypothesis gives . By induction, .
Lemma 3. The set of good numbers that are is exactly . Proof. By Lemma 1 every is good and . Conversely, let be good with . If we are done. If , then by Lemma 2 the sequence is unbounded, so there exists a smallest such that . Then . If we are done. If , then by the definition of there exists with , contradicting that is good. Hence .
Lemma 4. Any two good numbers are not coprime. Proof. Let be good. Set . Because and , we have . For any , since is good there is a prime and ; then . Thus for all , so is good. By Lemma 3, for some . Since is good, , hence . If , then , a contradiction. Therefore .
Lemma 5. Let . For every good number and every there exists a prime such that and . Proof. We first establish some auxiliary facts.
Witness Lemma. If is not good, then there exists an index with and . Proof. Since , choose with . Let be the largest integer with (so or ). Because is not good, ; thus . By the definition of there is with . Take ; then and .
Core numbers. A positive integer is called a core if is good and for every good divisor of we have (i.e., has no proper good divisor). Every good number possesses a core divisor: let be the smallest good divisor of . Then is good, , and if is a good divisor of , then is a good divisor of , so by minimality . Hence is core.
Claim. For every core , all prime factors of are . Proof by strong induction on . Base case: is prime. Since is good, ; because is prime, , so . The only prime factor is itself, which is . Inductive step: Assume is composite and the claim holds for all core . Let be a prime divisor of and write with . Because is core, is not good (otherwise would be a smaller good divisor of ). Also . We distinguish two cases.
Case 1: . Since is not good and , the Witness Lemma gives an index with and . Let be the smallest good divisor of . Then is good, , , and is core. Moreover because and . Now and are both good, so by Lemma 4, . Choose a prime . Then , so or . Since , ; hence . As is prime, . Thus . Now is a core number with . By the induction hypothesis, all prime factors of are ; in particular .
Case 2: . Consider . Because and , we have and . Also . We claim is not good. Indeed, if were good then for every ,
; every prime divisor of divides , so for all , making good – a contradiction. Hence is not good and . By the Witness Lemma there exists an index with and . (Note that is not a term, so the lemma applies.) Let be the smallest good divisor of . Then is good, , , and is core. Moreover because and . Again, and are good, so . Let be a prime dividing . Then , and since , ; thus . Hence . Now . Consequently .
In both cases we obtain . This completes the induction.
Now return to the original statement. Let be good and . Take to be the smallest good divisor of ; then is core. By the Claim, every prime factor of is < . Since is good, ; pick a prime . Then and and .
Lemma 6. Let (the factorial of ). For every we have good. Proof. If good, then for any Lemma 5 gives a prime with and . Because , , so . Hence and ; thus good. Conversely, suppose good. Then for any , Lemma 5 applied to gives a prime with and . Since , we have . Thus and . Also : if then (since is a positive integer), but then , impossible. Therefore for all , so good.
Construction of and . Since is good, Lemma 6 yields good. By Lemma 3, is a term of the sequence; let be the index with . Because and the sequence is strictly increasing, . Define
Then and .
Lemma 7. For every we have . Proof by induction on . Base case : by construction. Inductive step. Assume . Because the sequence is strictly increasing, is good, so by Lemma 6, is good. Moreover
Since is the smallest good number larger than , we obtain
Suppose for contradiction that . Set . Then
By the definition of (or the contrapositive of its minimality) there exists with . On the other hand, is a term, hence good. Lemma 6 gives good because good holds. Therefore for all , contradicting . Hence , which is exactly .
Conclusion. We have exhibited positive integers and (depending only on ) such that for every .
There exist positive integers and such that
for all .