Exact contractions for tied pair lengths

Domain

The ownership map assigns every fine pair type to one compact group and stays fixed during a derivative evaluation. Each length is positive and finite. Pair inverse distances and their Cartesian Jacobians are evaluated away from collisions and image-boundary discontinuities. Left and right Jacobians may differ. All algebraic identities use real arithmetic.

The implementation keeps each pair’s inverse-square weight. Grouping changes where a contribution is accumulated. It does not divide by the number of members or substitute a group’s average weight.

Kernel and differential

For pair f, let d_f be the difference of inverse distances, w_f its inverse squared length, and L_f and R_f the two Cartesian Jacobians. For each group,

s_b = sum_{f in b} w_f d_f^2
g_b = 2 sum_{f in b} w_f d_f L_f
h_b = 2 sum_{f in b} w_f d_f R_f
M_b = sum_{f in b} w_f L_f R_f^T

Write s, g, h and M for the totals. The kernel is k = m exp(-s), and its joint energy/gradient tile is

V = k [ 1     h^T          ]
      [ -g    -g h^T + 2 M ].

Differentiation in a group’s common log length gives

D_b = 2 s_b V + k [ 0       -2 h_b^T                        ]
                   [ 2 g_b   2 g_b h^T + 2 g h_b^T - 4 M_b ].

This expression is linear in the four bucket statistics. It equals the sum of the members’ fine derivatives. Frobenius, quadratic and diagonal contractions preserve that equality, including nonsymmetric or indefinite contraction weights.

Ties, masks and release screening

Let J be the fine-type by group incidence matrix. For a differentiable objective F and fine log lengths z = J theta, the group gradient is J^T grad F. An existing fine-parameter mask M instead gives the algebraic quantity J^T M grad F. An arbitrary mask is not a proof that this quantity is the derivative of the unrestricted tied objective.

The grouped trace sum is stored at one selected representative per group; its other selected members receive zero. The existing reduction by J^T therefore counts that sum once. Fine quadratic and prior contributions may be combined with it by linearity. Held members still contribute to the kernel totals; their derivatives cannot enter a selected bucket.

A release screen requires individual fine gradients. For the map (0, 1, 0), the nonzero contrast (1, 0, -1) has zero image under J^T. Group sums alone cannot recover that contrast.

Source correspondence

Source

Statement checked

PairLocalKernel.cpp:TileEvaluator::prepare

Distance and Jacobian buckets preserve each pair contribution.

PairLocalKernel.cpp:TileEvaluator::tile

The four channel blocks and the log-length derivative formula.

PairLocalKernel.cpp:TileEvaluator::contract

Frobenius contractions commute with grouping.

PairLocalKernel.cpp:TileEvaluator::quadratic

Outer-vector contractions commute with grouping.

PairLocalKernel.cpp:TileEvaluator::diagonals

Diagonal selection preserves group sums and nugget contractions.

GaussianProcessRegression.inl

Selected representatives combine grouped trace terms with fine quadratic terms.

TiedLengthScaleObjective.h

The wrapper applies the tied-parameter reduction; release screening retains fine derivatives.

The covariance-building path remains separate from the scoped derivative contractions. Constructor validation, scope lifetime, the backend routing and compiled arithmetic are checked by the native test suite.

Verification assets

scripts/derive_tied_length_scales.py retains the tied-objective and release-rule derivations and invokes derive_grouped_pair_contraction.py. The latter differentiates all channel blocks, checks four ownership maps with independent Jacobians, and checks all eight masks of a three-type example. Mutation tests reverse the mixed sign, omit the distance term and reverse the energy/gradient sign; each must fail the differentiation check.

proofs/lean/GPRidge/GroupedPairContraction.lean proves the finite-sum identities for arbitrary finite index types, the transpose action on a differential, the channel coefficients and contraction linearity. The axiom audit runs through proofs/lean/Audit.lean.

scripts/check_grouped_pair_contraction.py requires every named Sollya certificate. Missing, repeated, false and unknown certificates, unexpected diagnostics, and child-process errors fail verification. Optimized Python execution is refused before importing the symbolic library.

Rounding scope

The Sollya script explicitly rounds a scalar instance of the mixed-block formula to binary64 at three input scales. It checks absolute errors against the real expression. Kernel and Jacobian values are inputs; these checks do not certify the exponential library or Eigen’s reduction order. The normal-operation multiplier certificates are conditional on the stated operation counts and the absence of overflow or underflow.

Grouping can change rounding even with identical inputs. For signed contributions (2^53, 1, -2^53, 1), fine buckets containing the first and third terms and the second and fourth terms sum to 2, while accumulation in feature order gives 1 in binary64. The exact sum is 2. The proofs do not assert identical optimizer trajectories, fewer force calls, or shorter walltime. Those claims require production measurements.