LeanPlan: Optimal Planning with LLM-Generated Heuristics and Admissibility Proofs

André G. Pereira, Augusto B. Corrêa, Felipe Meneguzzi, Jendrik SeipparXiv 2026

This paper introduces LeanPlan, a novel planning system that bridges the gap between the creative potential of Large Language Models (LLMs) and the rigorous requirements of formal verification. By using LLMs to generate both heuristic functions and machine-checked proofs of their correctness, LeanPlan achieves state-of-the-art performance in optimal planning while maintaining a mathematical guarantee of plan quality.

TL;DR

LeanPlan is the first planning system to use an LLM-driven agentic loop to generate domain-specific heuristics alongside machine-checked admissibility proofs in Lean 4. This approach allows it to outperform state-of-the-art optimal planners by finding better heuristics that are formally guaranteed to never compromise plan optimality.

What Problem Does This Paper Address?

In classical planning, the goal is to find a sequence of actions to reach a target state. Optimal planning specifically requires finding the cheapest possible sequence. To do this efficiently, planners use "heuristics"—rules of thumb that estimate the remaining cost to the goal.

For a planner (like A) to guarantee it has found the best plan, the heuristic must be admissible*, meaning it never overestimates the true cost. While LLMs are excellent at writing "clever" domain-specific heuristics that speed up search, they are prone to hallucinations and logical errors. A heuristic that works on three small test cases might fail on a fourth, leading the planner to return a suboptimal solution. Proving admissibility manually is a grueling task for human experts, and until now, there was no automated way to ensure LLM-generated heuristics were safe for optimal planning.

Methods

LeanPlan employs an "agentic loop" powered by GPT-5.6 Sol to automate the design and verification of heuristics. The process, illustrated in Figure 1, follows these steps:

  1. Translation: A deterministic generator translates a PDDL (Planning Domain Definition Language) domain into a Lean 4 module.
  2. Synthesis: The LLM agent writes three things in Lean 4:
  3. A heuristic program (the code that estimates costs).
  4. A certificate (Boolean checks that verify domain assumptions at runtime).
  5. An admissibility proof (formal logic showing the heuristic is goal-aware and consistent).
  6. Verification: The Lean kernel—a small, highly trusted piece of software—checks the proof. If the proof fails, the agent receives the error as feedback and tries again.
  7. Execution: Once a proof is accepted, the heuristic is compiled into an A* planner. At runtime, the system checks the "certificate" to ensure the specific task matches the assumptions made in the proof.
Figure 1: Proof-guided heuristic development and reuse in LeanPlan. A deterministic generator translates the domain into a Lean module, and an agent revises a heuristic and its proof using feedback from Lean. At planning time, task checks enforce the proof assumptions.

By using Lean 4, the authors ensure that the code being proved is the exact same code being executed, leaving no room for implementation discrepancies.

Datasets

The authors evaluated LeanPlan on:

  • 10 domains from the IPC 2023 Learning Track: Including classic benchmarks like Blocksworld, Miconic, and Spanner.
  • 3 New Domains: Orrery, Cisterns, and Qubit Routing. These were created specifically for this study to ensure the LLM had no prior exposure to them in its training data.
  • Scaling: Test tasks were significantly harder than training tasks, featuring up to 57 times as many objects.

Key Insights and Ideas

  • Logic as a Hallucination Filter: The core "aha" moment is that you don't need to trust the LLM's output if you can force it to provide a proof that a rigid mathematical kernel can verify. This turns the LLM's creative coding into a reliable engineering tool.
  • Generalization through Proof: Unlike neural heuristics that rely on statistical generalization, a formal proof covers every possible state in every possible task that meets the domain assumptions, regardless of size.
  • The Power of "Certificates": PDDL often lacks the nuance to describe certain invariants (e.g., "a block can only be on one other block"). By allowing the LLM to define these as "certificates" checked at runtime, the system can use highly specialized heuristics that would otherwise be considered "unsafe."

Key Results

LeanPlan was compared against Scorpion, a state-of-the-art domain-independent optimal planner.

  • Higher Coverage: LeanPlan solved 348 tasks in total, significantly outperforming Scorpion’s 272. On the IPC 2023 suite alone, it solved 27.1% more tasks.
  • Efficiency: As shown in Figure 3, LeanPlan often expands orders of magnitude fewer states than Scorpion because its domain-specific heuristics are much more "informed" than general-purpose ones.
  • Success in New Domains: LeanPlan successfully generated verified heuristics for all 13 domains, including the ones it had never seen before.
Figure 3: A∗search with heuristics on IPC 2023. Left: number of tasks solved within each reported per-task time threshold, with a logarithmic horizontal axis. Right: expansions of LeanPlan and SCP on the 211 tasks that both solve, with logarithmic axes. Each point represents one task, points below the diagonal favor LeanPlan and colors identify domains.

The quantitative breakdown in Table 1 (Figure 5) highlights massive gains in specific domains like Spanner, where LeanPlan solved 72 tasks compared to Scorpion's 30.

Table 1: Tasks solved across different domains.

Limitations and Future Work

While a major step forward, LeanPlan has constraints:

  • Scope: It currently only supports unit-cost STRIPS planning. Extending this to complex action costs and richer PDDL features is a primary goal for future work.
  • Unsolvability: The current proofs guarantee that if a plan is found, it is optimal. They do not yet provide formal certificates that a task is unsolvable.
  • Trusted Base: The system still relies on the correctness of the Lean kernel, the PDDL parser, and the formal definitions of PDDL semantics provided to the LLM.

LeanPlan demonstrates that we don't have to choose between the efficiency of LLM-generated code and the safety of formal methods—we can have both.

Summary updated

BibTeX
@misc{pereira2026leanplan,
  author = {André G. Pereira and Augusto B. Corrêa and Felipe Meneguzzi and Jendrik Seipp},
  title = {{LeanPlan: Optimal Planning with LLM-Generated Heuristics and Admissibility Proofs}},
  year = {2026},
  eprint = {2610.08246},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.08246},
}
Figure