feat(rrc): generate full 250-equation Corpus250 and wire into AVM emit

- Add python/build_corpus250.py generator (deterministic, uses classifier
  receipt + PIST matrices, computes labels via SilverSight.PIST.Classify).
- Generate formal/SilverSight/RRC/Corpus250.lean with 250 FixtureRows.
- Register SilverSight.RRC.Corpus250 in lakefile.lean.
- Add AVMIsa.Emit.emitCorpus250 and update rrc-emit-fixture to emit it.
- Regenerate PROJECT_MAP.md/json.

Verification:
- lake build: 2981 jobs, 0 errors
- lake build SilverSightRRC: 2995 jobs, 0 errors
- rrc-emit-fixture | validate_rrc_predictions.py: OK 250 rows, avm_rrc_corpus250_v1
This commit is contained in:
allaun 2026-06-21 10:03:02 -05:00
parent 569c16088a
commit fbb71cffc9
7 changed files with 3869 additions and 20 deletions

View file

@ -1,13 +1,13 @@
{
"schema": "silversight_project_map_v1",
"generated_at": "2026-06-21T14:45:59.149164+00:00",
"generated_at": "2026-06-21T15:02:44.102031+00:00",
"repo": "https://github.com/allaunthefox/SilverSight",
"local_path": "/tmp/SilverSight",
"summary": {
"total_files": 101,
"lean_files": 51,
"python_files": 21,
"active": 100,
"total_files": 103,
"lean_files": 52,
"python_files": 22,
"active": 102,
"quarantined": 1,
"archived": 0,
"receipt_boundary_files": 4
@ -78,10 +78,10 @@
"name": "PythonShims",
"path": "python",
"description": "I/O and feature extraction; no admissibility logic.",
"file_count": 8,
"file_count": 9,
"lean_files": 0,
"python_files": 8,
"active": 8,
"python_files": 9,
"active": 9,
"quarantined": 0,
"archived": 0
},
@ -403,7 +403,7 @@
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 2070
"line_count": 2150
},
{
"path": "docs/PROJECT_MAP.md",
@ -417,7 +417,7 @@
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 189
"line_count": 190
},
{
"path": "docs/RRC_PLACEMENT.md",
@ -1282,12 +1282,13 @@
"SilverSight.AVMIsa.Run",
"SilverSight.ReceiptCore",
"SilverSight.RRCLogogramProjection",
"SilverSight.RRC.Emit"
"SilverSight.RRC.Emit",
"SilverSight.RRC.Corpus250"
],
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 256
"line_count": 280
},
{
"path": "formal/SilverSight/AVMIsa/Instr.lean",
@ -1433,6 +1434,24 @@
"receipt_boundary": false,
"line_count": 213
},
{
"path": "formal/SilverSight/RRC/Corpus250.lean",
"layer": "other",
"language": "lean",
"kind": "formal",
"module": "SilverSight.RRC.Corpus250",
"build_target": "SilverSightFormal",
"status": "active",
"imports": [
"SilverSight.RRC.Emit",
"SilverSight.PIST.Classify",
"SilverSight.PIST.Matrices250"
],
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 3533
},
{
"path": "formal/SilverSight/RRC/Emit.lean",
"layer": "other",
@ -1544,7 +1563,7 @@
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 59
"line_count": 60
},
{
"path": "lean-toolchain",
@ -1574,6 +1593,24 @@
"receipt_boundary": false,
"line_count": 6
},
{
"path": "python/build_corpus250.py",
"layer": "python_shim",
"language": "python",
"kind": "python_shim",
"module": null,
"build_target": null,
"status": "active",
"imports": [
"__future__",
"argparse",
"pathlib"
],
"research_stack_source": null,
"role": "",
"receipt_boundary": false,
"line_count": 233
},
{
"path": "python/build_pist_matrices_250.py",
"layer": "python_shim",
@ -2076,6 +2113,11 @@
"to": "formal/SilverSight/RRC/Emit.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/AVMIsa/Emit.lean",
"to": "formal/SilverSight/RRC/Corpus250.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/AVMIsa/Instr.lean",
"to": "formal/SilverSight/AVMIsa/Value.lean",
@ -2126,6 +2168,21 @@
"to": "Core/SilverSight/FixedPoint.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/RRC/Corpus250.lean",
"to": "formal/SilverSight/RRC/Emit.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/RRC/Corpus250.lean",
"to": "formal/SilverSight/PIST/Classify.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/RRC/Corpus250.lean",
"to": "formal/SilverSight/PIST/Matrices250.lean",
"relation": "imports"
},
{
"from": "formal/SilverSight/RRC/Emit.lean",
"to": "formal/SilverSight/RRCLogogramProjection.lean",

View file

@ -1,6 +1,6 @@
# SilverSight Project Map
**Generated:** 2026-06-21T14:45:59.149164+00:00
**Generated:** 2026-06-21T15:02:44.102031+00:00
**Source repo:** https://github.com/allaunthefox/SilverSight
@ -8,10 +8,10 @@
## 1. Project Overview
- **Total tracked files:** 101
- **Lean files:** 51
- **Python files:** 21
- **Active:** 100 | **Quarantined:** 1 | **Archived:** 0
- **Total tracked files:** 103
- **Lean files:** 52
- **Python files:** 22
- **Active:** 102 | **Quarantined:** 1 | **Archived:** 0
- **Receipt-boundary files:** 4
## 2. Layer Summary
@ -23,7 +23,7 @@
| PVGS_DQ_Bridge | `formal/PVGS_DQ_Bridge` | 9 | 8 | 1 | 9 | 0 | 0 | Photon-varied Gaussian state dual-quaternion bridge. |
| UniversalEncoding | `formal/UniversalEncoding` | 2 | 2 | 0 | 2 | 0 | 0 | Universal math address space and chirality. |
| BindingSite | `formal/BindingSite` | 3 | 3 | 0 | 3 | 0 | 0 | Amino-acid / protein binding sketches. |
| PythonShims | `python` | 8 | 0 | 8 | 8 | 0 | 0 | I/O and feature extraction; no admissibility logic. |
| PythonShims | `python` | 9 | 0 | 9 | 9 | 0 | 0 | I/O and feature extraction; no admissibility logic. |
| QUBOShims | `qubo` | 5 | 0 | 5 | 5 | 0 | 0 | QUBO/QAOA/Finsler optimization shims. |
| Tests | `tests` | 2 | 0 | 2 | 1 | 1 | 0 | Verification fixtures. |
| Infrastructure | `.github` | 6 | 0 | 2 | 6 | 0 | 0 | CI workflows and repo scripts. |
@ -94,6 +94,7 @@
| File | Module | Build Target | Status | Receipt Boundary | Research-Stack Source | Role |
|------|--------|--------------|--------|------------------|----------------------|------|
| `python/build_corpus250.py` | — | — | active | — | — | — |
| `python/build_pist_matrices_250.py` | — | — | active | — | — | — |
| `python/chaos_game.py` | — | — | active | — | `4-Infrastructure/shim/chaos_game_16d.py` | 16D chaos-game basin sampler. |
| `python/pist_matrix_builder.py` | — | — | active | — | — | — |

View file

@ -1,5 +1,5 @@
import SilverSight.AVMIsa.Emit
def main : IO UInt32 := do
IO.println SilverSight.AVMIsa.Emit.emitFixtureCorpus
IO.println SilverSight.AVMIsa.Emit.emitCorpus250
return 0

View file

@ -14,6 +14,7 @@ import SilverSight.AVMIsa.Run
import SilverSight.ReceiptCore
import SilverSight.RRCLogogramProjection
import SilverSight.RRC.Emit
import SilverSight.RRC.Corpus250
namespace SilverSight.AVMIsa.Emit
@ -225,6 +226,29 @@ def emitFixtureCorpus : String :=
s!"\"summary\":{summaryStr}," ++
s!"\"rows\":{classified.rowsJson}}"
open SilverSight.RRC.Corpus250 in
/-- Stamp the full 250-equation corpus: run the alignment gate (RRC.Emit), then
mint an AVM-authority receipt for the whole bundle, and emit JSON.
The AVM canary suite must pass for the bundle receipt to be valid.
Individual row receipts reflect alignment-gate pass/fail independently. -/
def emitCorpus250 : String :=
let classified := SilverSight.RRC.Emit.emitCorpus "rrc_emit_corpus250_v1" corpus250
let avmOk := canaryReceipts.all (·.valid)
let bundleReceipt := leanBuildReceipt "avm.rrc_corpus250.bundle" avmOk
let total := classified.totalRows
let passed := classified.candidateRows
let held := total - passed
let summaryStr :=
s!"\{\"total\":{total},\"passed_alignment\":{passed},\"held\":{held}," ++
s!"\"not_promoted\":{total}}"
s!"\{\"schema\":\"avm_rrc_corpus250_v1\"," ++
s!"\"claim_boundary\":\"admissibility-and-routing-pass-only;not-promoted\"," ++
s!"\"avm_canaries_passed\":{jsonBool avmOk}," ++
s!"\"bundle_receipt_valid\":{jsonBool bundleReceipt.valid}," ++
s!"\"summary\":{summaryStr}," ++
s!"\"rows\":{classified.rowsJson}}"
-- ─────────────────────────────────────────────────────────────────────────────
-- §8 Proof-of-life eval witnesses
-- ─────────────────────────────────────────────────────────────────────────────

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,7 @@ lean_lib «SilverSightRRC» where
`SilverSight.RRCLogogramProjection,
`SilverSight.ReceiptCore,
`SilverSight.RRC.Emit,
`SilverSight.RRC.Corpus250,
`SilverSight.AVMIsa.Types,
`SilverSight.AVMIsa.Value,
`SilverSight.AVMIsa.Instr,

233
python/build_corpus250.py Normal file
View file

@ -0,0 +1,233 @@
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = []
# ///
"""
Build formal/SilverSight/RRC/Corpus250.lean from
archive/experimental-shim-probes/rrc_equation_classifier_receipt.json,
merged with 8×8 braid adjacency matrices from
shared-data/rrc_pist_predictions_250_v1.json.
Python's role:
- read raw features from the classifier receipt
- merge matrices by invariant_receipt.object_id
- emit deterministic Lean source
Lean's role:
- PIST classification (classifyProxy/classifyExact) from the matrix
- alignment gate via determineAlignment
- receipt stamping and all admissibility/promotion decisions
Usage:
python3 python/build_corpus250.py
python3 python/build_corpus250.py \
--receipt /path/to/rrc_equation_classifier_receipt.json \
--predictions /path/to/rrc_pist_predictions_250_v1.json \
--out-lean formal/SilverSight/RRC/Corpus250.lean
"""
from __future__ import annotations
import argparse, hashlib, json, sys
from pathlib import Path
# classifier JSON shape name → SilverSight.RRCLogogramProjection.RRCShape constructor
SHAPE_MAP = {
"CognitiveLoadField": ".cognitiveLoadField",
"SignalShapedRouteCompiler": ".signalShapedRouteCompiler",
"ProjectableGeometryTopology": ".projectableGeometryTopology",
"CadForceProbeReceipt": ".cadForceProbeReceipt",
"LogogramProjection": ".logogramProjection",
"HoldForUnlawfulOrUnderspecifiedShape": ".holdForUnlawfulOrUnderspecifiedShape",
}
def template_key(rrc_kind: str, status: str) -> str:
"""Map rrc_kind + classifier status to a page-generator template key."""
if status == "HOLD":
return "hold"
kind_map = {
"cognitive_field_receipt": "definition",
"compression_route_prior": "master_equation",
"geometry_topology_receipt": "definition",
"cad_force_receipt": "gate",
"logogram_projection": "receipt",
"negative_control": "hold",
}
return kind_map.get(rrc_kind, "definition")
def operator_tokens(er: dict) -> list[str]:
"""Derive operator/domain tokens from route_hint, rrc_kind, and equation text."""
tokens = []
rh = (er.get("route_hint_non_authoritative") or "").strip()
rk = (er.get("rrc_kind") or "").strip()
if rh and rh != "unclassified_equation":
tokens.append(rh)
if rk:
tokens.append(rk)
eq_text = (er.get("equation") or "").lower()
for op in ["exp(", "log(", "max(", "min(", "sum(", "integral", "derivative",
"laplacian", "nabla", "div(", "curl(", "sigmoid", "softmax",
"tanh(", "relu(", "norm(", "dot(", "cross("]:
if op in eq_text:
tokens.append(op.rstrip("("))
return list(dict.fromkeys(tokens))
def lean_str(s: str) -> str:
s = s.replace("\\", "\\\\").replace('"', '\\"')
return f'"{s}"'
def lean_opt(s: str | None) -> str:
return "none" if s is None else f"some {lean_str(s)}"
def lean_str_list(xs: list[str]) -> str:
return "[" + ", ".join(lean_str(x) for x in xs) + "]"
def load_matrices(path: Path) -> dict[str, list[list[int]]]:
"""Load predictions JSON into equation_id → matrix lookup."""
data = json.loads(path.read_text())
return {
p.get("equation_id", ""): p.get("matrix_8x8", [])
for p in data.get("predictions", [])
if p.get("equation_id")
}
def main() -> int:
parser = argparse.ArgumentParser(description="Generate SilverSight RRC Corpus250.lean")
parser.add_argument(
"--receipt",
type=Path,
default=Path("/home/allaun/Research Stack/archive/experimental-shim-probes/rrc_equation_classifier_receipt.json"),
help="Path to rrc_equation_classifier_receipt.json",
)
parser.add_argument(
"--predictions",
type=Path,
default=Path("/home/allaun/Research Stack/shared-data/rrc_pist_predictions_250_v1.json"),
help="Path to rrc_pist_predictions_250_v1.json",
)
parser.add_argument(
"--out-lean",
type=Path,
default=Path("formal/SilverSight/RRC/Corpus250.lean"),
help="Output Lean module path",
)
args = parser.parse_args()
receipt = json.loads(args.receipt.read_text())
eqs = receipt.get("compiled_equations", [])
matrices = load_matrices(args.predictions)
print(f"Loaded {len(eqs)} equations and {len(matrices)} matrices", file=sys.stderr)
# Deterministic order by equation_id.
eqs_sorted = sorted(eqs, key=lambda eq: eq.get("invariant_receipt", {}).get("object_id", ""))
# Content hash over the raw corpus data for reproducibility.
content_blob = json.dumps(
[
{
"object_id": eq.get("invariant_receipt", {}).get("object_id"),
"name": eq.get("equation_record", {}).get("name"),
"shape": eq.get("invariant_receipt", {}).get("shape"),
"status": eq.get("invariant_receipt", {}).get("status"),
"matrix": matrices.get(eq.get("invariant_receipt", {}).get("object_id", "")),
}
for eq in eqs_sorted
],
sort_keys=True,
separators=(",", ":"),
).encode("utf-8")
content_hash = hashlib.sha256(content_blob).hexdigest()
rows: list[str] = []
for eq in eqs_sorted:
er = eq["equation_record"]
ir = eq["invariant_receipt"]
tw = eq["type_witness"]
eq_id = ir.get("object_id", "")
name = er.get("name", "")
shape_str = ir.get("shape", "HoldForUnlawfulOrUnderspecifiedShape")
lean_shape = SHAPE_MAP.get(shape_str, ".holdForUnlawfulOrUnderspecifiedShape")
status_str = ir.get("status", "HOLD")
lean_status = ".candidate" if status_str == "CANDIDATE" else ".hold"
rrc_kind = er.get("rrc_kind", "")
weak_cnt = len(tw.get("missing_or_weak_axes") or [])
op_tokens = operator_tokens(er)
inv_declared = (er.get("domain_type") or "unknown").strip() or "unknown"
bound_conds = (er.get("bind_class") or "unknown").strip() or "unknown"
t_key = template_key(rrc_kind, status_str)
route_hint = er.get("route_hint_non_authoritative") or "unclassified_equation"
t_params = f"route={route_hint};shape={shape_str}"
arxiv_pid = (er.get("arxiv_paper_id") or "").strip() or None
rows.append(
f" {{ equationId := {lean_str(eq_id)}\n"
f" name := {lean_str(name)}\n"
f" shape := {lean_shape}\n"
f" status := {lean_status}\n"
f" rrcKind := {lean_str(rrc_kind)}\n"
f" weakAxesCnt := {weak_cnt}\n"
f" pistProxyLabel := Option.bind (findMatrix {lean_str(eq_id)}) SilverSight.PIST.Classify.classifyProxy\n"
f" pistExactLabel := Option.bind (findMatrix {lean_str(eq_id)}) SilverSight.PIST.Classify.classifyExact\n"
f" arxivPaperId := {lean_opt(arxiv_pid)}\n"
f" operatorTokens := {lean_str_list(op_tokens)}\n"
f" invariantsDeclared := {lean_str(inv_declared)}\n"
f" boundaryConds := {lean_str(bound_conds)}\n"
f" templateKey := {lean_str(t_key)}\n"
f" templateParams := {lean_str(t_params)} }}"
)
lines = [
"-- SilverSight.RRC.Corpus250 — AUTO-GENERATED by python/build_corpus250.py",
"-- DO NOT EDIT BY HAND. Regenerate with:",
"-- python3 python/build_corpus250.py",
"--",
"-- Python role: raw feature extraction + matrix merge.",
"-- Lean role: PIST classification, alignment gate (determineAlignment),",
"-- receipt stamping, and all admissibility/promotion decisions.",
"--",
"-- Source: rrc_equation_classifier_receipt.json",
"-- Matrices: rrc_pist_predictions_250_v1.json",
f"-- Content hash (SHA-256): {content_hash}",
f"-- Equation count: {len(rows)}",
"--",
"import SilverSight.RRC.Emit",
"import SilverSight.PIST.Classify",
"import SilverSight.PIST.Matrices250",
"",
"namespace SilverSight.RRC.Corpus250",
"",
"open SilverSight.RRC.Emit",
"open SilverSight.RRCLogogramProjection",
"open SilverSight.ReceiptCore",
"open SilverSight.PIST.Matrices250",
"",
"/-- Full 250-equation corpus from rrc_equation_classifier_receipt.json,",
" merged with 8×8 braid adjacency matrices from",
" rrc_pist_predictions_250_v1.json.",
" Each row carries raw features only; the alignment gate in",
" SilverSight.RRC.Emit.emitCorpus makes all admissibility decisions. -/",
"def corpus250 : List FixtureRow := [",
",\n".join(rows),
"]",
"",
"end SilverSight.RRC.Corpus250",
"",
]
args.out_lean.parent.mkdir(parents=True, exist_ok=True)
args.out_lean.write_text("\n".join(lines))
print(f"Wrote {args.out_lean} ({len(rows)} rows)", file=sys.stderr)
return 0
if __name__ == "__main__":
sys.exit(main())