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

Open
patman wants to merge 1 commit from patman/blend-fd-bound into patman/drive-fourth 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 are pending
CI / build-test (pull_request) Waiting to run
4464862b17
Co-authored-by: patman-assist <patrick-ai@kgroo.co>
Some checks are pending
CI / build-test (pull_request) Waiting to run
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/80/head:patman/blend-fd-bound
git switch patman/blend-fd-bound

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch patman/drive-fourth
git merge --no-ff patman/blend-fd-bound
git switch patman/blend-fd-bound
git rebase patman/drive-fourth
git switch patman/drive-fourth
git merge --ff-only patman/blend-fd-bound
git switch patman/blend-fd-bound
git rebase patman/drive-fourth
git switch patman/drive-fourth
git merge --no-ff patman/blend-fd-bound
git switch patman/drive-fourth
git merge --squash patman/blend-fd-bound
git switch patman/drive-fourth
git merge --ff-only patman/blend-fd-bound
git switch patman/drive-fourth
git merge patman/blend-fd-bound
git push origin patman/drive-fourth
Sign in to join this conversation.
No description provided.