Magenta: Closing the Loop Between Mathematical Reasoning and Lean Verification
A training-free agentic loop uses Lean verification as feedback to repair mathematical reasoning and formal proof generation.
Key takeaway
Magenta reports 100% on AIME 2025, AIME 2026, and HMMT February 2026, and all six IMO 2026 problems with K2-Horizon-7B.
Updated on Oct 2, 2026
01
Abstract
Magenta closes the loop between mathematical reasoning and formal Lean verification. A reasoner proposes an answer, a formaliser encodes it, a statement judge checks faithfulness, a prover constructs a proof, and a verifier validates it.
02
Introduction
Natural-language mathematical reasoning can be persuasive while containing silent errors. Formal verification adds deterministic proof checking, but only if the formal statement faithfully represents the original problem.
03
Problem
The central challenge is connecting informal reasoning to executable formal verification while distinguishing proof-syntax failures from genuine mathematical errors.
04
Background
The approach builds on autoformalisation, theorem proving, formal mathematics benchmarks, and verifier-guided generation. Its distinctive contribution is using verification as an active feedback mechanism rather than only a terminal gate.
05
Methodology
The loop is reason -> formalise -> adjudicate -> prove -> verify -> attribute -> repair. Syntax failures trigger local proof regeneration; mathematical failures return feedback to the reasoner; rejected formal statements are resampled.
Closing the loop from mathematical reasoning to a Lean-checked proof
Read the pipeline from left to right. First, the reasoner turns a natural-language problem into an informal derivation and candidate answer. Second, the formaliser translates that proposal into a Lean statement. A statement verifier checks the formal statement, while a separate statement judge assesses whether it faithfully represents the original problem and proposed answer; rejected statements are regenerated. Third, the prover constructs a formal proof, which Lean checks. When verification fails, the error judge distinguishes a Lean or syntax problem from a mathematical reasoning error. Lean errors lead to local proof repair, whereas mathematical errors return to the reasoner for a new derivation. In the pictured example, the initial reasoning uses π⁷ where π⁶ is required, so repairing proof syntax alone cannot fix the underlying mistake. The red feedback paths show how verification can change the reasoning rather than merely approve or reject its final output. A successful proof checks the formal statement, which is why checking the translation against the original problem is also essential.
Source: Magenta: Closing the Loop Between Mathematical Reasoning and Formal Verification, Figure 1; user-supplied paper excerpt.
Formula notes
Mathematical details
Error routing
Syntax failures trigger local proof regeneration; mathematical failures trigger new reasoning conditioned on verification feedback.
- c
- -reasoning chain
- q
- -problem
- s
- -Lean statement
- pi
- -proof
- phi
- -math feedback
- epsilon
- -diagnostic
Statement adjudication
The statement judge accepts or rejects whether the generated Lean statement faithfully represents the original problem and answer.
- a
- -answer
- q
- -problem
- s
- -Lean statement
06
Architecture
Magenta separates Reasoner, Formaliser, Prover, Verifier, and Judge roles. SafeVerify rejects forbidden constructs such as sorry, admit, native_decide, and undeclared axioms.
07
Dataset
The main evaluation covers 93 problems from AIME 2025, AIME 2026, and HMMT February 2026, with additional paraphrased and IMO evaluations.
08
Training
The contribution is primarily a test-time verification and correction architecture. It does not require retraining the underlying reasoner for every correction cycle.
09
Experiments
The main evaluation covers 93 problems from AIME 2025, AIME 2026, and HMMT February 2026. K2-Horizon-7B rises from 74.19% to 100.00% with Magenta; K2-Horizon-375B rises from 84.95% to 100.00%; Qwen3.8-27B rises from 91.40% to 100.00%; GPT-5.6-Sol Codex rises from 84.95% to 100.00%.
10
Baselines
Answer-only Claude Opus 5, Gemini 3.7 Flash, and Kimi K3 provide baseline reasoning systems alongside the evaluated K2-Horizon, Qwen, and GPT systems.
11
Results
Verification-guided correction substantially improves reported mathematical success, with the evaluated systems reaching 100% on the reported main set. The gains require additional test-time computation.
12
Ablation
Formalisation, statement adjudication, proof search, verification, and error attribution are the key components of the correction loop.
13
Limitations
Lean can certify a generated theorem, but a statement judge is still needed to assess faithfulness. Correction rounds also add latency and computation.
14
Conclusion
Magenta demonstrates a reusable verifier-guided reasoning loop that converts reasoning into an executable artifact, verifies it, attributes failures, and feeds structured feedback back into the agent.
15
References
Magenta primary paper; Lean and SafeVerify materials; related autoformalisation and theorem-proving research.
Source trail
Primary papers, implementation pages, and external source records used to ground this explainer.
The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery
arXiv:2408.06292
Related automated scientific discovery work cited by Magenta.
DeepSeek-Prover
Prior formal theorem proving work referenced by the paper.
Continue reading
Related research
GitSwarm
GitSwarm turns inference-time work into a persistent, branchable body of reusable contributions that later agents can build on.
AI AgentsLongHarness
LongHarness helps agents reason over 100M-token document collections by keeping evidence and conclusions as explicit, revisable states that guide one another.
AI AgentsGenerative Agents
An agent architecture combining memory, retrieval, reflection, and planning to simulate believable long-horizon behavior.