Skip to content

Commit 1bff8cf

Browse files
committed
docs(handover): THEOREM-METADATA-MIGRATION follow-up plan
Documents the 8 parser sites that currently mix structural meta-tags ("axiom", "constructor", "dedukti-import", etc.) into Theorem.aspects. D1's boundary filter contains the damage; this doc tracks the deferred refactor that splits structural metadata into a dedicated TheoremKind field and import_source/prover_source/has_proof fields, freeing aspects to carry only dotted math-domain keys. https://claude.ai/code/session_01YPqu7gti4azBach6ZvpRFJ
1 parent 32a275a commit 1bff8cf

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!-- SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> -->
2+
<!-- SPDX-License-Identifier: MPL-2.0 -->
3+
4+
# Theorem Metadata Migration (deferred)
5+
6+
## Purpose
7+
8+
`Theorem.aspects` currently serves two unrelated roles:
9+
10+
1. **Math-domain tags** — dotted keys like `"arithmetic.natural_numbers"` produced by
11+
`Aspect::dotted_key()`. These drive the learning loop, GNN domain hints, and
12+
coprocessor routing.
13+
2. **Structural / provenance meta-tags** — plain strings like `"axiom"`, `"constructor"`,
14+
`"dedukti-import"` injected by parsers. These describe the *kind* of theorem, not
15+
its mathematical content.
16+
17+
The D1 boundary filter (`s.contains('.')`) prevents structural tags from leaking into
18+
the learning-loop key space, so correctness is preserved. However, mixing the two kinds
19+
in a single `Vec<String>` field is a hygiene problem. This document tracks the deferred
20+
migration.
21+
22+
## Current state — 8 parser sites using structural tags
23+
24+
| File | Line(s) | Tag(s) used |
25+
|------|---------|-------------|
26+
| `src/rust/provers/agda.rs` | 297 | `"axiom"` |
27+
| `src/rust/provers/metamath.rs` | 316, 328 | `"axiom"`, `"theorem"` |
28+
| `src/rust/provers/idris2.rs` | 522, 550, 586 | `"constructor"`, `"projection"`, `"interface-method"` |
29+
| `src/rust/provers/hol_light.rs` | 457 | `"hol_light"` |
30+
| `src/rust/exchange/dedukti.rs` | 101, 118 | `"dedukti-import"`, `"has-definition"` |
31+
| `src/rust/exchange/opentheory.rs` | 84 | `"opentheory-import"` |
32+
33+
These are **not migrated** in D1. The boundary filter contains the damage.
34+
35+
## Proposed target structure
36+
37+
```rust
38+
pub enum TheoremKind {
39+
Axiom,
40+
Theorem,
41+
Definition,
42+
Constructor,
43+
Projection,
44+
InterfaceMethod,
45+
}
46+
47+
pub struct Theorem {
48+
// ... existing fields ...
49+
pub kind: TheoremKind,
50+
pub import_source: Option<String>, // e.g. "dedukti", "opentheory"
51+
pub prover_source: Option<ProverKind>,
52+
pub has_proof: bool,
53+
// aspects contains ONLY dotted math-domain keys after migration
54+
pub aspects: Vec<String>,
55+
}
56+
```
57+
58+
## Scope of migration work
59+
60+
- **8 parser sites**: replace `aspects: vec!["axiom"]` etc. with `kind: TheoremKind::Axiom`.
61+
- **Callers that read `Theorem.aspects` for structural meaning**: find with
62+
`rg "theorem.*\.aspects" src/` — expected ~4-6 call sites.
63+
- **Remove boundary filter** once no structural tags can appear in `aspects`.
64+
65+
Estimated effort: ~3-4 hours of mechanical work. No algorithmic changes required.
66+
67+
## Not blocking
68+
69+
The boundary filter introduced in D1 (`src/rust/provers/mod.rs::gnn_augment_tactics`
70+
and `src/rust/agent/meta_controller.rs::primary_domain`) is sufficient to prevent
71+
correctness issues. This migration is hygiene, not a correctness fix. Schedule
72+
opportunistically alongside the next `Theorem` struct refactor.

0 commit comments

Comments
 (0)