Papers › FormalScience: Scalable Human-in-the-Loop Autoformalisation of Science with Agentic...

FormalScience: Scalable Human-in-the-Loop Autoformalisation of Science with Agentic Code Generation in Lean

24 Apr 2026arXiv:2604.23002added by Syntology

Jordan Meadows, Lan Zhang, Andre Freitas

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

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 (\textit{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 \textit{syntactically correct} and \textit{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

PaperPDFCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2604.23002")

Code

Syntology Ran 10 of 18 code samples harvested from 1 repository linked to this paper; 8 have no recorded run. Of those that ran: 10 ran with no contract checked.

By repository: found in paper text by Syntology: 18 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

jmeadows17/formal-science found in paper text by Syntology report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

18 samples harvested; 10 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

10ran
8unverified

Licence: 18 of the 18 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from jmeadows17/formal-science. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

build_lean_prompt jmeadows17/formal-science/src/app/lean_prompts.py found in paper text by Syntology ran no licence file found · pointer only · 3f591af4077d1334 · report
capture_msg jmeadows17/formal-science/src/app/lean_app.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · 292fbce17179b3f1 · report
flatten_structured_proofs jmeadows17/formal-science/src/app/flatten_structured_proofs.py found in paper text by Syntology ran no licence file found · pointer only · 3b923c6ca15115d6 · report
get_qa_batch jmeadows17/formal-science/src/app/lean_prompts.py found in paper text by Syntology ran no licence file found · pointer only · bea63caee1e73b2f · report
load_structured_proofs jmeadows17/formal-science/src/app/postprocessing_pipeline.py found in paper text by Syntology ran no licence file found · pointer only · e4a71e1814a2f956 · report
postprocess_raw_dataset jmeadows17/formal-science/src/qa/qa_postprocessing.py found in paper text by Syntology ran no licence file found · pointer only · ff7e50034dfffbdd · report
resolve_prompt jmeadows17/formal-science/src/app/claude_generate_compile_loop.py found in paper text by Syntology ran no licence file found · pointer only · d57caf45c8ba6356 · report
split_formal_proofs jmeadows17/formal-science/src/app/flatten_structured_proofs.py found in paper text by Syntology ran no licence file found · pointer only · 6899f148b5ea5f1f · report
split_qas_markdown jmeadows17/formal-science/src/qa/qa_postprocessing.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · b854f3824585eab7 · report
write_flattened_structured_proofs jmeadows17/formal-science/src/app/flatten_structured_proofs.py found in paper text by Syntology ran no licence file found · pointer only · 05bc7565ec711eb5 · report
compile_lean jmeadows17/formal-science/legacy/lean_utils.py found in paper text by Syntology unverified no licence file found · pointer only · ea8b2d7fb3799925 · report
compile_lean jmeadows17/formal-science/src/app/compile_lean.py found in paper text by Syntology unverified no licence file found · pointer only · f7546f4078fef874 · report
default_few_shot_prompt_generation jmeadows17/formal-science/src/qa/qa_prompt_generation.py found in paper text by Syntology unverified no licence file found · pointer only · fd80353252a42ea7 · report
load_formal_qa_data jmeadows17/formal-science/src/app/postprocessing_pipeline.py found in paper text by Syntology unverified no licence file found · pointer only · 335d1ead6e46a569 · report
load_postprocessing_audit jmeadows17/formal-science/src/app/postprocessing_pipeline.py found in paper text by Syntology unverified no licence file found · pointer only · 28ccff155d266348 · report
load_qa_batches jmeadows17/formal-science/src/app/lean_prompts.py found in paper text by Syntology unverified no licence file found · pointer only · a2df4f81e844be6b · report
postprocess_file jmeadows17/formal-science/src/qa/qa_postprocessing.py found in paper text by Syntology unverified no licence file found · pointer only · e575724a8eaebe1d · report
run_loop jmeadows17/formal-science/src/app/claude_generate_compile_loop.py found in paper text by Syntology unverified no licence file found · pointer only · e47cd584f0ce0b55 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2604.23002, was issued in April 2026, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections