physlib-bench / README.md
jgalego's picture
Upload folder using huggingface_hub
d1ef682 verified
|
Raw History Blame Contribute Delete
4.94 kB
metadata
license: apache-2.0
size_categories:
  - 1K<n<10K
task_categories:
  - text-generation
pretty_name: Physlib bench
tags:
  - lean4
  - theorem-proving
  - formal-verification
  - physics
  - benchmark
configs:
  - config_name: test
    data_files:
      - split: test
        path: data/test.jsonl

physlib-bench

Lean 4 tasks from Physlib for testing provers: 1,251 theorems added to the library after a cutoff, so a model trained before it cannot have seen them. A task is the source file up to a theorem, ending in sorry. The model writes the proof and Lean checks it.

📚 What is in it

  • Theorems and lemmas from Physlib at 511abd5 (2026-12-01), in Physlib/ and QuantumInfo/: 239 modules.
  • None has the name or the statement of a theorem at d630c36 (2026-10-02), in Physlib/, QuantumInfo/ or PhyslibAlpha/. Statements are compared without names, comments or whitespace.
  • Checked on Lean v4.36.0. A task stays in only if the library's own proof compiles there and #print axioms shows nothing beyond propext, Classical.choice and Quot.sound.
  • By area: Relativity 239, Mathematics 210, ProbabilisticTheory 167, QuantumMechanics 156, SpaceAndTime 155, ClassicalMechanics 95, Cosmology 63, CondensedMatter 58, Units 31, QuantumInfo 29, Particles 16, ClassicalFieldTheory 15, Optics 11, Electromagnetism 4, StatisticalMechanics 2.
Field Content
library physlib-new
module Source file as a module name, such as Physlib.Relativity.Tensors.Conjugation.Basic
name Theorem or lemma name
id module:name, unique
names The names whose axioms are checked: the theorem's
split test
code The file up to the theorem, ending in := by sorry
completion A lean4 block with the statement and the library's own proof
from datasets import load_dataset

tasks = load_dataset("jgalego/physlib-bench", "test", split="test")

🔧 How the tasks are built

  • Top-level theorem and lemma declarations with a full proof. Proofs by pattern matching, recursion or a structure instance are skipped, and so are names declared twice in a file.
  • Term proofs become exact tactics, so every completion continues the code's := by.
  • Context longer than 20,000 characters is cut at a top-level line outside comments. Imports and scope commands from the cut part are kept.
  • A theorem can depend on definitions and lemmas added earlier in the same file. The context contains them unless it was cut.

📊 Baselines

Each model got this prompt, with the task's code in place of {}:

Complete the following Lean 4 code:

```lean4
{}```

Before producing the Lean 4 code to formally prove the given theorem, provide a detailed proof plan outlining the main proof steps and strategies.
The plan should highlight key ideas, intermediate lemmas, and proof structures that will guide the construction of the final formal proof.

Four samples per theorem at temperature 0.6 and top-p 0.95, up to 8,192 new tokens, and a response cut off at the limit scores nothing. A proof counts if the file compiles within 300 seconds and the axiom check passes. pass@1 is estimated from the samples.

Plain automation is one answer for every theorem, with no model: first | rfl | simp | grind | aesop | simp_all | norm_num | omega | linarith | positivity. It closes 194 of 1,251. The difference is the mean over theorems of a model's pass rate minus the base model's, with its standard error. The last columns are pass@1 on the 1,057 theorems automation leaves open, the mean response length in tokens and the share of responses cut off.

Model pass@1 pass@n Difference to the first row pass@1 where automation fails Mean tokens Cut off
Goedel-Prover-V2-8B 0.117 0.230 n/a 0.075 4,231 33%
jgalego/hilbert-prover-8b 0.310 0.362 +0.193 ± 0.011 0.216 234 1%
Plain automation, no model 0.155 n/a +0.038 ± 0.010 0.000 0 0%

⚠️ Limits

  • One snapshot. A refresh needs a new cutoff and new baselines.
  • The cutoff protects models trained before 2026-10-02. Pull requests are public before they merge, so a theorem merged just after the cutoff may have been visible earlier.
  • Provers trained on older Lean and Mathlib fail some tasks on renamed or removed lemmas, not on the maths.
  • Many tasks are short. Plain automation closes about 15%, so the "automation fails" column is the one that shows what a model adds beyond tactics.
  • Single theorems, not whole projects.

⚖️ License

Apache 2.0, the license of Physlib. The theorems and proofs are the work of their contributors.