---
title: 'Numina-Lean-MCP: Multi-Chain Planner in Lean'
url: https://www.emergentmind.com/topics/numina-lean-mcp
type: topic
---

# Numina-Lean-MCP: Multi-Chain Planner in Lean

Numina-Lean-MCP is the multi-chain planner and controller at the center of the Numina-Lean-Agent system, supporting robust, multi-paradigm, agentic reasoning workflows for formal mathematics within the Lean proof assistant. It acts as a dispatcher that orchestrates parallel chains of mathematical reasoning, dynamically schedules tool invocations, and maintains a unified context for tool outputs, thereby enabling the integration of formal and informal proof strategies, semantic retrieval, and collaborative agent interaction without reliance on task-specific pipelines or retrained provers [2601.14027].

## 1. Role and Architectural Positioning

Numina-Lean-MCP ("Model-Context Protocol") functions as the conductor within the Numina-Lean-Agent architecture. Its primary responsibility is to maintain and orchestrate multiple active reasoning chains, where each chain can correspond to a subgoal, auxiliary lemma, proof strategy, or exploration avenue. Chains progress asynchronously and are dynamically reprioritized based on their states and urgency. MCP determines, at every iteration, which specialized tool to invoke—including Lean-LSP (Lean’s Language Server Protocol), the LeanDex semantic retrieval engine, an Informal Prover (generator-verifier loop), or an external Discussion Partner (an LLM interface for collaborative brainstorming). This orchestration supports:

- Autonomous, context-driven selection of specialized tools without hard-coded per-theorem scripts.
- Interleaving high-level, informal reasoning—including human-style sketching and outline verification—with formal Lean execution.
- Flexible extensibility: new tools and reasoning capabilities can be introduced under a coherent, unified planning interface.

By handling these tasks generically, Numina-Lean-MCP obviates the need for specialized, pipeline-centric frameworks and supports direct interaction between a general coding agent (such as Claude Code) and the Lean formal system [2601.14027].

## 2. Design Principles and Workflow

At its core, Numina-Lean-MCP maintains:

- A queue of active reasoning chains, each encoding its partial proof state, outstanding subgoals, and a "TODO" action specifying its immediate next requirement.
- A registry of tool interfaces:
    - **Lean-LSP-MCP:** Functions for file outlining, goal state querying, code execution, parallel tactic attempts, local search, and Lean’s semantic search tool (lean_loogle).
    - **LeanDex:** Cross-package, semantic retrieval of relevant theorems or definitions.
    - **Informal Prover:** A generator-verifier LLM loop for producing and critically assessing informal human-style proof sketches.
    - **Discussion Partner:** Access to external LLMs for overcoming strategic impasses or brainstorming.
- A scoring/prioritization module to determine which chain to advance and which tool to utilize based on the current "TODO".

The iterative workflow is as follows:

1. Inspect the leading chain in the queue and extract its current TODO, which may target:
    - Dispatching a tactic or proof step to Lean.
    - Requesting retrieval of missing lemmas/theorems.
    - Generating informal (human-like) sketch arguments.
    - Consulting a discussion agent when blocked.
2. Select and invoke the appropriate tool interface according to the type of TODO.
3. Update the chain’s proof state and feedback results—formal tactics, semantic retrievals, or informal sketches—into the agentic context.
4. Reprioritize chains based on updated progress and urgency.
5. Mark the chain as complete once all subgoals are discharged, merging results into any parent chain if relevant.
6. Iterate until all chains are completed and a unified proof script is assembled [2601.14027].

## 3. Formal Definitions and Planning/Scoring Model

The planning and scoring regime for chain selection and tool invocation is formally defined as follows:

Let 
\[
\begin{aligned}
\mathcal{C} &= \{\,c_1,\dots,c_N\} \quad\text{(active reasoning chains)}, \\
\mathrm{state}(c_i) &= (g_i, \mathrm{todo}_i, b_i),\; \text{where} \\
&\quad g_i:\text{ current Lean goal},\; \mathrm{todo}_i\in\{\text{Lean},\text{Retrieve},\text{Informal},\text{Discuss}\},\; b_i:\text{ backlog/subgoal count}, \\
\mathrm{ToolSet} &= \{\mathrm{Lean},\, \mathrm{LocalSearch},\, \mathrm{Loogle},\, \mathrm{Dex},\, \mathrm{Informal},\, \mathrm{Discuss}\}.
\end{aligned}
\]

The score of each chain is given by
\[
\mathrm{Score}(c_i) = \alpha |\mathrm{todo}_i| - \beta b_i + \gamma \mathrm{proximity}(g_i)
\]
where:
- $|\mathrm{todo}_i|$ measures urgency or recency for the TODO,
- $b_i$ is the number of remaining subgoals,
- $\mathrm{proximity}(g_i) \in [0,1]$ quantifies task completion proximity (e.g., fraction of Lean goals resolved).

Chain selection:
\[
c^* = \arg\max_{c_i \in \mathcal{C}} \mathrm{Score}(c_i)
\]

Tool selection policy:
\[
\mathrm{SelectTool}(c^*)
= \begin{cases}
\mathrm{Lean}        & \text{if } \mathrm{todo}_{c^*} = \text{Lean} \\
\mathrm{LocalSearch} \cup \mathrm{Loogle} \cup \mathrm{Dex}  & \text{if } \mathrm{todo}_{c^*} = \text{Retrieve} \\
\mathrm{Informal}    & \text{if } \mathrm{todo}_{c^*} = \text{Informal} \\
\mathrm{Discuss}     & \text{if } \mathrm{todo}_{c^*} = \text{Discuss}
\end{cases}
\]

The coefficients $\alpha, \beta, \gamma$ can be hand-designed or, in principle, learned from prior proof runs [2601.14027].


## 4. Main Execution Loop

A stylized pseudocode for the MCP’s execution follows:

```pseudo
Initialize 𝒞 ← {initial goal chain}; register all tool interfaces
while some c ∈ 𝒞 is not complete:
    For each chain c_i ∈ 𝒞, compute Score(c_i)
    c* ← argmax_{c_i} Score(c_i)
    τ ← next action type of c*    # Lean / Retrieve / Informal / Discuss
    tool ← SelectTool(c*)
    o ← tool.Call(state(c*))
    state(c*) ← UpdateChain(c*, o)
    if new subchains were spawned (e.g., from blueprint decomposition):
        add them to 𝒞
    if chain c* is complete:
        remove c* from 𝒞; merge into parent if needed
return concatenation of all completed chain proofs
```
Each "ToolCall" is mapped to the specialized MCP tools described above. Advancement for each chain is contingent on successful invocation and digest of the selected tool’s output [2601.14027].

## 5. Tool-Orchestrated Reasoning: Case Examples

Numina-Lean-MCP's flexible orchestration is evidenced in several scenarios:

**a) Theorem Retrieval**  
A subgoal requiring a sum-of-squares simplification triggers MCP to invoke `lean_loogle("sum_of_squares formula")` and `lean_local_search`, yielding library facts such as `Finset.sum_range_succ` and the closed formula for $\sum_{i=0}^n i^2$, which are then injected into the formal context.

**b) Informal Proof Sketching**  
Encountering a gap in the induction strategy (as in Putnam B4), MCP invokes the Informal Prover for outline generation:  
- The Generator suggests “Use strong induction and rewrite $\binom{2n}{n}$.”  
- The Verifier detects a mis-index, prompting refinement.
- After several generator-verifier loops, a correct sketch emerges. Claude Code then translates this outline into formal Lean tactics.

**c) Formal Proof Execution**  
Given all required lemmas, MCP calls `lean_run_code("by induction n; simp; rw …; field_simp; ring")`. Upon receipt of a diagnostic “🏷 goal closed” from Lean-LSP-MCP, the corresponding chain is marked as discharged, and remaining subgoals are reprioritized [2601.14027].

## 6. Significance for Agentic Formal Mathematics

Numina-Lean-MCP enables agentic mathematical reasoning that is modular, tool-agnostic, and responsive to the idiosyncrasies of mathematical discovery—including the alternation between informal human-inspired sketches and machine-verifiable Lean proofs. By supporting queues of asynchronous proof chains, flexible tool invocation, and context-aware scheduling, MCP allows the agent to:

- Seamlessly bridge formal and informal reasoning without manual intervention.
- Integrate evolving reasoning tools or LLM backends via a unified control plane.
- Scale from single-proof strategies (e.g., Putnam 2025) to interactive projects (e.g., formalizing the Brascamp–Lieb theorem).

This approach sidesteps the rigidity of pre-baked pipelines and enables open-ended exploration, robust to the unpredictability of mathematical problem solving. A plausible implication is that such a multi-chain, tool-orchestrating dispatcher could become a standard interface pattern for future collaborative theorem proving agents and complex mathematical assistants [2601.14027].

## 7. Relation to Broader Formalization Efforts

While Numina-Lean-MCP centers on Lean and formal mathematics, its architectural paradigm—multi-chain planning, dynamic tool orchestration, and autonomous agent-tool interface—addresses general challenges found in symbolic reasoning across domains. In geometry, for instance, systems such as LeanGeo [2508.14644] address integrative workflows by merging analytic and synthetic reasoning. Numina-Lean-MCP’s design is extensible to such cases, allowing the interleaving of synthetic tactics, external SMT solvers, and analytic libraries under a single agentic controller—a capability essential for tackling diverse mathematical domains and enhancing LLM-based automated reasoning [2601.14027, 2508.14644].

Source: https://www.emergentmind.com/topics/numina-lean-mcp