hilbert-libraries / README.md
jgalego's picture
Upload folder using huggingface_hub
afa1dba verified
|
Raw History Blame Contribute Delete
2.99 kB
---
license: apache-2.0
size_categories:
- 10K<n<100K
task_categories:
- text-generation
pretty_name: Hilbert libraries
tags:
- lean4
- theorem-proving
- formal-verification
- physics
configs:
- config_name: default
data_files:
- split: train
path: data/train.jsonl
- split: test
path: data/test.jsonl
---
# hilbert-libraries
Theorems from [Physlib](https://github.com/leanprover-community/physlib) and [CSLib](https://github.com/leanprover/cslib) as prompt/completion pairs, for training [Hilbert](https://huggingface.co/jgalego/hilbert-prover-8b), a Lean 4 prover. Each prompt is the source file up to a theorem, with the proof replaced by `sorry`, in the prompt format of [Goedel-LM/Goedel-Prover-V2-8B](https://huggingface.co/Goedel-LM/Goedel-Prover-V2-8B). The completion is the theorem with the library's own proof.
| Library | Commit | Lean | Folders | Train | Test |
|---|---|---|---|---|---|
| [physlib](https://github.com/leanprover-community/physlib) | [`d630c36`](https://github.com/leanprover-community/physlib/tree/d630c363063ae1de81abcf227c258e4394d50438) | `v4.34.1` | `Physlib/`, `QuantumInfo/` | 8,162 | 1,005 |
| [cslib](https://github.com/leanprover/cslib) | [`cd62719`](https://github.com/leanprover/cslib/tree/cd62719369800391201fcc1feb4e41427b83035d) | `v4.35.0-rc3` | `Cslib/` | 2,227 | 283 |
## 📄 Rows
| Field | Content |
|---|---|
| `library` | `physlib` or `cslib` |
| `module` | Source file as a module name, such as `Physlib.ClassicalMechanics.EulerLagrange` |
| `name` | Theorem or lemma name |
| `split` | `train`, or `test` for held-out modules |
| `prompt` | One user message: the file up to the theorem, ending in `:= by sorry` |
| `completion` | One assistant message: a `lean4` block with the statement and its proof |
```python
from datasets import load_dataset
data = load_dataset("jgalego/hilbert-libraries")
```
`prompt` and `completion` follow the conversational prompt/completion format of TRL's `SFTTrainer`.
## 🔧 How it is built
- Top-level `theorem` and `lemma` declarations in the folders above: 11,677 kept of 11,915. A theorem is skipped if its proof uses `sorry` or `admit`, works by pattern matching or recursion, or has no top-level `:=`.
- Term proofs become `exact` tactics, so every completion continues the prompt'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 (`namespace`, `section`, `open`, `variable`, notation) are kept, so names still resolve. Prompts run to 7,031 characters at the median and 23,307 at most.
- The test split holds out about a tenth of the modules whole, chosen by the SHA-256 of the module name, so no test theorem shares a file with a training one.
- Proofs are not re-checked: the libraries' CI compiles them. A prompt with cut context may not compile on its own.
## ⚖️ License
Apache 2.0, the license of both libraries. The theorems and proofs are the work of their contributors.