Papers › REFACTOR: Learning to Extract Theorems from Proofs

REFACTOR: Learning to Extract Theorems from Proofs

26 Feb 2024arXiv:2402.17032archive 2025-07-28

Jin Peng Zhou, Yuhuai Wu, Qiyang Li, Roger Grosse

Human mathematicians are often good at recognizing modular and reusable theorems that make complex mathematical results within reach. In this paper, we propose a novel method called theoREm-from-prooF extrACTOR (REFACTOR) for training neural networks to mimic this ability in formal mathematical theorem proving. We show on a set of unseen proofs, REFACTOR is able to extract 19.6% of the theorems that humans would use to write the proofs. When applying the model to the existing Metamath library, REFACTOR extracted 16 new theorems. With newly extracted theorems, we show that the existing proofs in the MetaMath database can be refactored. The new theorems are used very frequently after refactoring, with an average usage of 733.5 times, and help shorten the proof lengths. Lastly, we demonstrate that the prover trained on the new-theorem refactored dataset proves more test theorems and outperforms state-of-the-art baselines by frequently leveraging a diverse set of newly extracted theorems. Code can be found at https://github.com/jinpz/refactor.

PaperPDFConference PDFCodeCode 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="2402.17032")

Code

Syntology Ran 5 of 10 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 4 ran · our draft was wrong; 1 ran · fixture could not drive it.

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

jinpz/refactor officialmentioned in papermentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. 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

10 samples harvested; 5 ran; 0 honoured the contract we drafted; 5 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.

4ran · our draft was wrong
1ran · fixture could not drive it
5unverified

Licence: 10 of the 10 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 jinpz/refactor. “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.

export_expanded_proof jinpz/refactor/theorem_expansion.py official repository ran · our draft was wrong no licence file found · pointer only · 15039402e49532f8 · report
export_proofs_with_fixed_word_dict jinpz/refactor/theorem_expansion.py official repository ran · our draft was wrong no licence file found · pointer only · bbba677db0d43623 · report
get_dfs jinpz/refactor/theorem_refactor.py official repository ran · our draft was wrong no licence file found · pointer only · f0c6a82aae692795 · report
get_post_order jinpz/refactor/theorem_refactor.py official repository ran · our draft was wrong no licence file found · pointer only · db40d5002162de5e · report
get_proof_level_acc jinpz/refactor/theorem_verification.py official repository ran · fixture could not drive it no licence file found · pointer only · 56fcc9d1c8e19c76 · report
evaluate_loader jinpz/refactor/theorem_verification.py official repository unverified no licence file found · pointer only · 0af7e62a184b94f1 · report
follow_color jinpz/refactor/theorem_refactor.py official repository unverified no licence file found · pointer only · 37e1021bf4e47dda · report
get_correct_total_stat jinpz/refactor/theorem_verification.py official repository unverified no licence file found · pointer only · 44afba786ad88c30 · report
get_expression_indices_update_word_dict jinpz/refactor/theorem_expansion.py official repository unverified no licence file found · pointer only · a15ed6ff6756225c · report
refactor_proof_single jinpz/refactor/theorem_refactor.py official repository unverified no licence file found · pointer only · 73abad27553083e4 · report

Tasks

Automated Theorem Proving

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SET

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