FormalScience: Scalable Human-in-the-Loop Autoformalisation of Science with Agentic Code Generation in Lean
Jordan Meadows, Lan Zhang, André Freitas
Abstract
Formalising informal mathematical reasoning into formally verifiable code is a significant challenge for large language models. In scientific fields such as physics, domain-specific machinery (e.g. Dirac notation, vector calculus) imposes additional formalisation challenges that modern LLMs and agentic approaches have yet to tackle. To aid autoformalisation in scientific domains, we present FormalScience; a domain-agnostic human-in-the-loop agentic pipeline that enables a single domain expert (without deep formal language experience) to produce syntactically correct and semantically aligned formal proofs of informal reasoning for low economic cost. Applying FormalScience to physics, we construct FormalPhysics, a dataset of 200 university-level (LaTeX) physics problems and solutions (primarily quantum mechanics and electromagnetism), along with their Lean4 formal representations. Compared to existing formal math benchmarks, FormalPhysics achieves perfect formal validity and exhibits greater statement complexity. We evaluate open-source models and proprietary systems on a statement autoformalisation task on our dataset via zero-shot prompting, self-refinement with error feedback, and a novel multi-stage agentic approach, and explore autoformalisation limitations in modern LLM-based approaches. We provide the first systematic characterisation of semantic drift in physics autoformalisation in terms of concepts such as notational collapse and abstraction elevation which reveals what formal language verifies when full semantic preservation is unattainable. We release the codebase together with an interactive UI-based FormalScience system which facilitates autoformalisation and theorem proving in scientific domains beyond physics.https://github.com/jmeadows17/formal-science
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext ca3de831-6b3e-4756-a034-05bd7d45e9d5Builds on17
- Executable Code Actions Elicit Better LLM AgentsXingyao Wang, Yangyi Chen, Lifan Yuan, Yizhe Zhang et al.ICML 2024 · 436 citations
- Llemma: An Open Language Model for MathematicsZhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos et al.ICLR 2024 · 433 citations
- Autoformalization with Large Language ModelsYuhuai Wu, Albert Qiaochu Jiang, Wenda Li, Markus N. Rabe et al.NeurIPS 2022 · 364 citations
- Autoformalize Mathematical Statements by Symbolic Equivalence and Semantic ConsistencyZenan Li, Yifan Wu, Zhaoyu Li, Xinming Wei et al.NeurIPS 2024 · 48 citations
- Draft, Sketch, and Prove: Guiding Formal Theorem Provers with Informal ProofsAlbert Qiaochu Jiang, Sean Welleck, Jin Peng Zhou, Timothée Lacroix et al.ICLR 2023 · 25 citations
Related papers
- PRISM-Physics: Causal DAG-Based Process Evaluation for Physics ReasoningWanjia Zhao, Qinwei Ma, Jingzhe Shi, Shirley Wu et al.ICLR 2026 · 4 citations
- Autoformalizing Euclidean GeometryLogan Murphy, Kaiyu Yang, Jialiang Sun, Zhaoyu Li et al.ICML 2024 · 16 citations
- Lean4Physics: Comprehensive Reasoning Framework for College-level Physics in Lean4Yuxin Li, Minghao Liu, Ruida Wang, Wenzhao Ji et al.ICLR 2026 · 7 citations
- LoC-Decomp: LLM Autoformalization via Logical Concept Decomposition and Iterative Feedback CorrectionJiangze Shi, Zhiwei Zhang, Baoquan Ma, Shuai Zhao et al.ICLR 2026
- ProofFlow: A Dependency Graph Approach to Faithful Proof AutoformalizationRafael Cabral, Tuan Manh Do, Xuejun Yu, Wai Ming Tai et al.ICLR 2026 · 21 citations
