feat(schema): persist and instantiate scoped multi-role relation schemas
This commit is contained in:
@@ -8,9 +8,15 @@ Evidence base: repo README and code (`leanbench/`, 4,345 lines incl. tests), pro
|
||||
|
||||
## 0. The idea in one page
|
||||
|
||||
**Terminology clarification (2026-10-28).** The owner uses "simplex" for a semantic,
|
||||
multi-role relation schema: one statement joins objects, assumptions and a conclusion.
|
||||
It does not mean a geometric simplex or assert a mathematical simplicial complex.
|
||||
See [the implemented schema design](simplex-schema.md) for scoped slots, storage and
|
||||
candidate retrieval. Existing signature projections and AI source annotations remain partial.
|
||||
|
||||
**Simplex, as it exists in the archived code.**
|
||||
- `Role(name, context, choices)`: a named semantic slot with a description and an optional closed set of allowed values (`is_constrained`, `validate_value`).
|
||||
- `Simplex(name, roles: {alias: Role})`: a reusable unit of **at least two** roles. A Simplex is itself a `Role`, so simplices nest; nesting gives a *simplicial complex*. `Equivalence` is the two-role special case.
|
||||
- `Simplex(name, roles: {alias: Role})`: a reusable unit of **at least two** roles. A Simplex is itself a `Role`, so explicitly supplied schemas can be nested as semantic composition. `Equivalence` is the two-role special case.
|
||||
- `State` / `Fact` / `Goal`: a role plus a value. A `Fact` has a value, a `Goal` does not; `SolvingTask.is_completed()` is "every goal resolved".
|
||||
- `SchemaRegistry` (SQLite): `set_role`, `set_simplex`, `search_roles`, `find_by_roles(known_roles)`, `find_solvable(known_role_names)`.
|
||||
- `SchemaParserAgent`: turns a query into a Simplex through a forced tool call whose JSON schema says `minItems: 2`, with a **search-first, reuse-before-create** rule for roles. `AnalogySchemaMiner`: proposes new simplices by the ratio *Simplex B : Role B :: Simplex A : Role A*.
|
||||
@@ -19,11 +25,11 @@ Evidence base: repo README and code (`leanbench/`, 4,345 lines incl. tests), pro
|
||||
|
||||
| Lean | Simplex view |
|
||||
|---|---|
|
||||
| `(G : Type*) [Group G]` | role `G`, `context` = "carrier", `choices` = admissible type/class constraints |
|
||||
| `(G : Type*) [Group G]` | role `G`, `context` = "carrier", type/class constraints as attributes; `choices` only for explicit finite value sets |
|
||||
| `(h : P x)` hypothesis | `Fact` role |
|
||||
| conclusion after the final `:` | `Goal` role |
|
||||
| `def` / `structure` being introduced | `own` role (what the thing *is*) |
|
||||
| a lemma used inside a proof | nested simplex (edge in the complex) |
|
||||
| a lemma used inside a proof | explicit nested schema reference (when recorded) |
|
||||
|
||||
`leanbench/typeindex.py` already extracts exactly this split: `input` (binders and hypotheses), `goal` (the conclusion), `own` (definitions). So the type index is a simplex index in all but name. The new work is to make it a **first-class schema that steers inference** instead of a passive index.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user