Lean4Physics: Comprehensive Reasoning Framework for College-level Physics in Lean4

Yuxin Li, Minghao Liu, Ruida Wang, Wenzhao Ji, Zhitao He, Rui Pan, Junming Huang, Tong Zhang, Yi R. Fung

TL;DR

Lean4PHYS introduces the first comprehensive framework and benchmark for formal physics reasoning in the Lean 4 programming language. By delivering PhysLib (a foundational library for physical units and theorems) and LeanPhysBench (a 200-problem college-level benchmark), the researchers reveal a stark reality: state-of-the-art math-trained AI provers struggle to transfer their skills to physics, while general-purpose LLMs thrive when equipped with proper domain-specific libraries.

What Problem Does This Paper Address?

While large language models (LLMs) have made massive strides in natural language reasoning, verifying their step-by-step correctness remains a challenge. To solve this, researchers have increasingly turned to Formal Languages (FLs) like Lean 4, which allow compilers to automatically verify mathematical proofs.

However, this success has been almost entirely confined to pure mathematics. Physics reasoning introduces a unique hurdle: it relies on empirical rules, dimensional consistency, and complex unit systems rather than pure definitions. Until now, Lean 4 lacked both a foundational repository to handle physical dimensions (the physics equivalent of Lean's Mathlib) and a rigorous benchmark to evaluate how well AI models can reason through college-level physics problems.

Methods

The authors developed Lean4PHYS using a bottom-up approach consisting of two core components:

  1. PhysLib Construction: Built on top of Lean 4's existing mathematical libraries and a basic unit system kernel, the authors implemented a calculation support layer for SI unit derivations. They formalized core concepts across six major physics branches: mechanics, waves & acoustics, thermodynamics, electromagnetism, optics, and modern physics.
  2. Formalization Pipeline: To build the benchmark, the authors took natural language physics problems and aligned their format from traditional Question-Answering (QA) into closed-end proof statements. They extracted the initial conditions and physical laws, wrote corresponding Lean 4 code, and verified the theorems through a strict process involving a compiler check and peer review by at least two physics and Lean experts.
Overview of the Lean4PHYS framework showing data construction and LLM evaluation pipelines.

Datasets

The paper introduces LeanPhysBench, a dataset containing 200 hand-crafted and peer-reviewed physics statements formalized in Lean 4.

  • Data Sources: Problems are adapted from university textbooks and high school physics Olympiad competition books.
  • Composition: The benchmark consists of 104 college-level problems and 96 competition-level problems (further split into 62 easy and 34 hard tasks).
Distribution of LeanPhysBench across difficulty levels and physics topics.

Key Insights and Ideas

  • Math Mastery $\neq$ Physics Mastery: Specialized Lean expert provers (like DeepSeek-Prover-V2), which dominate mathematical benchmarks, perform poorly in physics. They struggle with out-of-distribution syntax introduced by physical unit systems.
  • The "Overthinking" Trap: Expert math models tend to generate highly granular, tedious, step-by-step proofs. In physics domains underrepresented in their training, this prolonged deliberation leads to overthinking and complex substitutions, increasing the likelihood of errors.
  • Abstraction Wins: General-purpose models (like Gemini 2.5 Pro) perform better because they reason at a higher level of abstraction, combining built-in simplification rules with numerical calculations rather than getting bogged down in pedantic intermediate mathematical steps.
Comparison of proof styles showing DeepSeek-Prover-V2's granular approach versus Gemini-2.5-pro's concise abstraction.

Key Results

The authors evaluated eight major LLMs in two modes: with and without providing PhysLib theorems in the prompt context.

  • Top Performers: Closed-source general models significantly outperformed open-source math provers. Gemini-2.5-pro achieved the highest overall accuracy at 39.50%, followed by Claude-Sonnet-4 at 34.50%. The best open-source expert prover, DeepSeek-Prover-V2-7B, reached only 14.50%.
  • The PhysLib Advantage: Integrating PhysLib into the prompt context yielded a dramatic 11.75% average performance boost across all models. Without PhysLib, Claude-Sonnet-4's performance plummeted from 34.50% to just 2.00%, proving that models cannot inherently guess the required formal unit-handling rules without in-context support.
  • Hard vs. Easy Split: On competition-hard problems, closed-source models scored 0% due to their inability to handle extremely long, complex symbolic deductions. On these specific tasks, specialized expert provers performed slightly better (up to 8.82%).

Limitations and Future Work

While PhysLib provides a solid baseline, its current implementation is heavily weighted toward mechanics (which makes up 50% of the benchmark). Other fields like optics and modern physics remain small-scale and require further community-driven expansion. Additionally, the authors note that future work must focus on developing adaptive reasoning techniques that can prevent expert provers from overthinking when transitioning from pure math to applied scientific domains.

Summary updated

BibTeX
@misc{li2025lean,
  author = {Yuxin Li and Minghao Liu and Ruida Wang and Wenzhao Ji and Zhitao He and Rui Pan and Junming Huang and Tong Zhang and Yi R. Fung},
  title = {{Lean4Physics: Comprehensive Reasoning Framework for College-level Physics in Lean4}},
  year = {2025},
  eprint = {2510.26094},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.26094},
}
Figure