fix(cam-blend): first-principles FD error bound in curvature proptest #80

Merged
patman merged 1 commit from patman/blend-fd-bound into main 2026-07-17 12:59:54 +00:00 AGit
Owner

The FD-curvature proptest in cam-blend produced two genuine random counterexamples (septics with large curvature-rate endpoints, |k'| up to ~36): its ad-hoc 1e-5 * scale tolerance ignored the finite-difference TRUNCATION error, which dominates in that regime. The exact-math side (curvature_at) was never wrong; the test's error model was.

Replaces the tolerance with a first-principles interval bound computed from the spline's own coefficients: E1 = h^2/6 * M3 + 2*eps*P/h, E2 = h^2/12 * M4 + 4*eps*P/h^2 (M3/M4/P = coefficient-sum bounds on max |p'''|, |p''''|, |p| over [0,1]), cross-product error propagation dc = s*E2 + |d2|*E1 + E1*E2, and enclosure [lo, hi] containing both the true and FD curvature magnitudes. Both counterexamples are checked in as pinned regression seeds (they must now pass), and a deterministic companion test pins the bound at ~2.6e-6 on a gentle spline so the interval can never silently go vacuous.

Adversarially reviewed (independent re-derivation of every bound term, enclosure proof, seed replay x2): PASS, no findings above INFO.

The FD-curvature proptest in cam-blend produced two genuine random counterexamples (septics with large curvature-rate endpoints, |k'| up to ~36): its ad-hoc `1e-5 * scale` tolerance ignored the finite-difference TRUNCATION error, which dominates in that regime. The exact-math side (`curvature_at`) was never wrong; the test's error model was. Replaces the tolerance with a first-principles interval bound computed from the spline's own coefficients: `E1 = h^2/6 * M3 + 2*eps*P/h`, `E2 = h^2/12 * M4 + 4*eps*P/h^2` (M3/M4/P = coefficient-sum bounds on max |p'''|, |p''''|, |p| over [0,1]), cross-product error propagation `dc = s*E2 + |d2|*E1 + E1*E2`, and enclosure `[lo, hi]` containing both the true and FD curvature magnitudes. Both counterexamples are checked in as pinned regression seeds (they must now pass), and a deterministic companion test pins the bound at ~2.6e-6 on a gentle spline so the interval can never silently go vacuous. Adversarially reviewed (independent re-derivation of every bound term, enclosure proof, seed replay x2): PASS, no findings above INFO.
fix(cam-blend): first-principles FD error bound in curvature proptest
Some checks failed
CI / build-test (pull_request) Has been cancelled
4464862b17
Co-authored-by: patman-assist <patrick-ai@kgroo.co>
patman changed target branch from patman/drive-fourth to main 2026-07-17 12:59:53 +00:00
patman merged commit dc7f76fbfd into main 2026-07-17 12:59:54 +00:00
Sign in to join this conversation.
No description provided.