Official open-source implementation of the ICML 2026 paper "Editable Proof Sketch for Automated Theorem Proving".
SketchRefine is a multi-stage pipeline that builds, verifies, and iteratively refines editable proof sketches in Lean 4. It coordinates large language models, a theorem search service, and a Lean verifier to solve formal mathematics problems such as those in MiniF2F.
Requires Python 3.9+.
pip install -r requirements.txtYou also need access to the following external services:
-
A reasoning LLM endpoint (e.g. DeepSeek-compatible API).
-
A prover LLM endpoint (OpenAI-compatible
/v1API). -
A Lean 4 verifier service. SketchRefine uses
kimina-clientto talk to a Kimina Lean server. Set up the server by following project-numina/kimina-lean-server, then pointKIMINA_URLat it. -
A theorem search service. SketchRefine uses
lean-exploreas the retrieval backend. Installlean-exploreand download its local data following that repository's instructions, then start the HTTP wrapper shipped with this project:python src/lean_explore_server.py --host 127.0.0.1 --port 8210
Point
QUERY_URLat the resulting endpoint (e.g.http://127.0.0.1:8210).
Copy .env.example to .env and fill in the endpoints and API key:
cp .env.example .env| Variable | Description |
|---|---|
ARK_API_KEY |
API key for the token-limited reasoning LLM. |
REASONER_URL |
Base URL of the reasoning LLM endpoint. |
REASONER_MODEL |
Model name for the reasoner. |
QUERY_URL |
URL of the theorem search service. |
PROVER_URL |
URL of the prover LLM (OpenAI-compatible). |
KIMINA_URL |
URL of the Lean 4 verifier service. |
Pipeline behavior (which stages run, retry counts, prompts, default header,
etc.) is configured per benchmark in config/<benchmark>.yaml. See
config/minif2f.yaml for the full schema.
Run the full MiniF2F benchmark with default paths:
python src/main.pyCommon options:
python src/main.py \
--data data/minif2f.jsonl \
--config config/minif2f.yaml \
--work-dir work/minif2f \
--output results/minif2f_results.json \
--token-limit 2000000 \
--limit 10Arguments:
--dataPath to a JSONL benchmark file (each line hasnameandlean4_code).--configYAML configuration describing pipeline stages.--work-dirPer-problem working directory (logs, intermediate sketches).--outputAggregated results JSON file.--token-limitToken budget per problem for the reasoning LLM.--limit/--skipSlice the problem list for partial runs.
A summary JSON is written to --output and detailed per-problem logs are saved
under --work-dir/<problem_name>/logs/.
The MiniF2F benchmark file data/minif2f.jsonl can be downloaded from the
Goedel-Prover-V2 repository,
specifically
dataset/minif2f.jsonl.