Commit graph

4 commits

Author SHA1 Message Date
4ea68bcecc feat(spectral): gap-aware spectral codebook generator with exact char-poly fingerprints
Implements the Next Steps of docs/SPECTRAL_CODEBOOK_ANALYSIS.md as
python/spectral_codebook.py (stdlib-only; NumPy optional fast path):

- Parses the 250 8x8 braid adjacency matrices from PIST/Matrices250.lean.
- Primary fingerprint: exact integer characteristic-polynomial
  coefficients via Faddeev-LeVerrier in Fraction arithmetic (196 unique
  over 238 distinct matrices, vs 179 unique lambda at 4dp; 6 cospectral
  non-identical groups; 11 exact-duplicate matrix groups / 23 ids).
- Corrects the analysis doc: the 9 'mid band' lambda in (0.5,1) are
  power-iteration non-convergence artifacts - exact rho = 1.0 for all 9
  (peripheral spectra). spectral_radius is now the exact max root
  modulus (numpy eigvals or Durand-Kerner on the exact char poly);
  power-iteration lambda kept only for traceability.
- Gap-aware quantization: dedupe to 238 distinct matrices, boundaries at
  gaps > 3x median gap, min-support guard (>=10 distinct per cluster),
  sparse-tail outlier flagging above lambda ~= 7.66. Result: 9 clusters.
- Round trip encode(matrix) -> (codeword, index) -> decode -> equation_id
  verified bijective over all 250 in tests/test_spectral_codebook.py.
- 278-row RRC/Q16_16Manifold corpus: 28 extra rows are repeated ids;
  boundaries reproduce exactly, no new gaps or clusters.
- Emits data/spectral_codebook.json (schema spectral_codebook_v2) with
  explicit collision classes; docs/SPECTRAL_CODEBOOK_GENERATOR.md notes
  the hashMatrix base-5 injectivity gap and the ClassifyN threshold
  (1.5/4.0 Q16.16) vs analysis-doc (0.5/1.0) mismatch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-01 20:39:40 -05:00
allaunthefox
f96de68af8 feat: exact charpoly codebook + fix design doc
python/charpoly_codebook.py:
- Exact characteristic polynomial as codebook key
- 196 unique fingerprints vs 182 from spectral radius (8% improvement)
- 13 cospectral groups identified (same polynomial, different matrix)
- Cartan floor Δ=17/1792 as operator resolution bound
- 72 pairs within Cartan floor but distinguishable by charpoly
- Cayley-Hamilton verifiable in Z (integer-only doctrine)
- Verification: all checks pass

data/charpoly_codebook.json:
- 250 entries with exact charpoly coefficients
- Spectral radius computed from polynomial (not power iteration)
- Cartan-floor snapped values for operator-level grouping

docs/FIX_DESIGN.md:
- Fix 1: Lean charpoly via Faddeev-LeVerrier (design, not yet implemented)
- Fix 2: Python charpoly codebook (IMPLEMENTED)
- Fix 3: Cartan floor as distinguishability bound (IMPLEMENTED)
- Fix 4: Integer spiral packing (already done in cd91eca)
- Open questions for Lean-side integration
2026-07-01 21:15:46 +00:00
allaunthefox
7d59ad5739 docs: spectral codebook analysis of 250-equation corpus
Key findings:
- 190 distinguishable spectral states (7.57 bits/equation)
- Density-Lambda correlation: 0.9807 (near-perfect)
- Largest spectral gap: 4.88 at lambda=[11.68, 16.56]
- 7 natural clusters from gap-aware boundary detection
- Mid band (9 matrices, lambda=[0.67, 0.95]) is compression sweet spot

Raw data: data/spectral_codebook_raw.json (250 entries)
2026-07-01 20:17:46 +00:00
e6d5a0a8d4 feat: README, CI pipeline, Dependabot config
- README.md: project overview, quick start, verification commands
- GitHub Actions: anti-smuggle entry gate runs on push (4 layers)
- Dependabot: ignore transitive dependencies (h11, opentelemetry, etc.)
- predictions JSON committed to data/ for CI reproducibility
- build_pist_matrices_250.py / build_manifold.py now default to data/
2026-06-30 05:48:50 -05:00