Papers › An In-Context Learning Agent for Formal Theorem-Proving

An In-Context Learning Agent for Formal Theorem-Proving

6 Oct 2023arXiv:2310.04353archive 2025-07-28

Amitayush Thakur, George Tsoukalas, Yeming Wen, Jimmy Xin, Swarat Chaudhuri

We present an in-context learning agent for formal theorem-proving in environments like Lean and Coq. Current state-of-the-art models for the problem are finetuned on environment-specific proof data. By contrast, our approach, called COPRA, repeatedly asks a high-capacity, general-purpose large language model (GPT-4) to propose tactic applications from within a stateful backtracking search. Proposed tactics are executed in the underlying proof environment. Feedback from the execution is used to build the prompt for the next model query, along with selected information from the search history and lemmas retrieved from an external database. We evaluate our implementation of COPRA on the miniF2F benchmark for Lean and a set of Coq tasks from the CompCert project. On these benchmarks, COPRA significantly outperforms few-shot invocations of GPT-4. It also compares favorably against finetuning-based approaches, outperforming ReProver, a state-of-the-art finetuned approach for Lean, in terms of the pass@1 metric. Our code and data are available at https://github.com/trishullab/copra.

PaperPDFCode

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

Code

trishullab/copra officialmentioned in papermentioned on GitHub 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

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Automated Theorem ProvingIn-Context LearningLanguage ModelingLanguage ModellingLarge Language Model

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Automated Theorem Proving miniF2F-test COPRA + GPT-4-turbo ITP Lean #16 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-4-turbo Pass@1 30.7 #16 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-4-turbo cumulative 30.7 #16 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-4 ITP Lean #24 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-4 Pass@1 23.3 #24 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-4 cumulative 23.3 #24 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-3.5 ITP Lean #27 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-3.5 Pass@1 11.9 #27 of 29 Archive leaderboard report
Automated Theorem Proving miniF2F-test COPRA + GPT-3.5 cumulative 11.9 #27 of 29 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

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