Commit graph

2 commits

Author SHA1 Message Date
allaunthefox
cd91eca22f fix: address 3 bugs from spectral codebook review
Bug 1: Phinary packing not injective (integration_sprint.py)
- Old: float accumulation (phinary += c * PHI^(-i)) loses precision
- New: integer positional packing with provable injectivity
  - Integer coefficients: base = max(|coeff|) + 1
  - Float coefficients: quantize to 16-bit, pack in base 65536
- Round-trip is now guaranteed injective

Bug 2: Torus winding saturates at n >= 65536 (pist_braid_bridge.py)
- spiral_to_torus_winding stores b = n//2 as Q16.16, clamps at 32768
- Added spiral_to_torus_winding_safe() with saturation detection
- Returns (winding, saturated) tuple so callers can handle overflow
- Documented the limitation in docstrings

Bug 3: Power iteration non-convergence (pist_braid_bridge.py + MatrixN.lean)
- power_iteration_q16 now returns (eigenvalue, converged) tuple
- Detects oscillation via Rayleigh quotient stability check
- Added exact_eigenvalue_q16() fallback using numpy
- compute_pist_spectral auto-falls-back on non-convergence
- Lean MatrixN.lean: documented known limitation in docstring

All 3 bugs are from the independent review by Claude Fable.
2026-07-01 21:08:41 +00:00
Allaun Silverfox
1ea9b9a75b feat(bridge): PIST + Braid bridge — sprint results to Lean formalism
- Q16_16 fixed-point arithmetic matching Lean SilverSight.FixedPoint
- PIST.Spectral bridge: float eigenvalues → Q16_16 → SpectralProfile
- Torus winding: spiral index → T² (a,b) winding counts
- PIST field: 4-mode receipts → B/G/A/P operator
- Eigensolid convergence check (cross-mode agreement)
- Golden centering compression (φ⁻¹ = 40560)
- Φ-corkscrew ↔ Q16_16 roundtrip
2026-06-23 04:16:43 -05:00