Upload CORPUS_README.md with huggingface_hub
Browse files- CORPUS_README.md +62 -0
CORPUS_README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Corpus and verified pairs — vector_behavior
|
| 2 |
+
|
| 3 |
+
Companion to the theorem/embedding/proof bundle already in this repo.
|
| 4 |
+
|
| 5 |
+
| file | contents |
|
| 6 |
+
|---|---|
|
| 7 |
+
| `corpus.jsonl.gz` | all 180,907 Mathlib declarations with source `code`, one JSON object per file: `{path, imports, premises:[{full_name, code, start, end, kind}]}` |
|
| 8 |
+
| `real_pairs_verified.json.gz` | 7,731 verified pairs over 1,666 substitutions, plus per-relation precision for the old name-matched pairs |
|
| 9 |
+
| `llm_judge.json` | blinded LLM verdicts on discovered groups, with decoy floors |
|
| 10 |
+
| `pca_view.json` | 2,761 arrows projected on the duality and strictness axes, and on PCA |
|
| 11 |
+
| `verified_relations.json` | every relation re-measured on verified pairs vs all pairs |
|
| 12 |
+
| `strictness_axis.json` | the strictness-axis test with bootstrap intervals |
|
| 13 |
+
| `ablation_relations*.json` | name-stripping ablation, e5-large and e5-mistral |
|
| 14 |
+
| `normalisation.json` | preprocessing study with a pre-registered decision rule |
|
| 15 |
+
|
| 16 |
+
## The pairs
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
import gzip, json
|
| 20 |
+
vp = json.load(gzip.open("real_pairs_verified.json.gz", "rt"))
|
| 21 |
+
|
| 22 |
+
for a, b, from_tok, to_tok in vp["pairs"][:5]:
|
| 23 |
+
print(f"{from_tok} -> {to_tok}: {a} | {b}")
|
| 24 |
+
|
| 25 |
+
vp["top_substitutions"][:10] # the substitutions Mathlib actually attests
|
| 26 |
+
vp["rule_precision"] # how good the old name-matched pairs were
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
A pair is here if one token can be substituted throughout A's statement to give B's,
|
| 30 |
+
with nothing else changed and declaration names deleted before matching. No embedding
|
| 31 |
+
and no proof was consulted, so the set is usable as ground truth for either.
|
| 32 |
+
|
| 33 |
+
Precision is a **lower bound on relatedness**: a pair can be genuine without being a
|
| 34 |
+
one-substitution match, since statements also differ in binders and `add→mul` usually
|
| 35 |
+
travels with `zero→one`. Trust the ranking, not the level.
|
| 36 |
+
|
| 37 |
+
## The corpus
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
import gzip, json
|
| 41 |
+
for line in gzip.open("corpus.jsonl.gz", "rt"):
|
| 42 |
+
f = json.loads(line)
|
| 43 |
+
for p in f["premises"]:
|
| 44 |
+
if "@[to_additive" in p["code"]:
|
| 45 |
+
print(p["full_name"])
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
180,907 declarations against the bundle's 99,552 theorem statements — the extra ~81,000
|
| 49 |
+
are definitions, instances and structures. Note that `@[to_additive]` twins are
|
| 50 |
+
generated by the compiler and are **not** separate declarations here: of 9,602 marked
|
| 51 |
+
declarations only 157 have a resolvable partner in the corpus and 12 have both halves
|
| 52 |
+
embedded. That route to ground-truth pairs is a dead end, which is why the
|
| 53 |
+
substitution matcher above exists.
|
| 54 |
+
|
| 55 |
+
## Please read this before using either file
|
| 56 |
+
|
| 57 |
+
Both are answer keys, and the study they come from depends on their being held back.
|
| 58 |
+
|
| 59 |
+
Proofs validate discovery *because* no encoder ever saw one. The verified pairs
|
| 60 |
+
validate the pairing step *because* they were not used to build it. Use either to find
|
| 61 |
+
structure and then confirm with the same thing, and you have proved nothing. Validate
|
| 62 |
+
with something else: human judgement, a held-out corpus, or the source organisation.
|