perf: packed sums of multiples in `grind`'s Gröbner certificates

This PR makes the kernel check of `grind`'s ring solver proofs cheaper when a chain of simplification steps is certified at once (`Stepwise.simps`, `Stepwise.d_steps`).

The chain `p = p₁ + Σ kᵢ * mᵢ * qᵢ` is now checked with packed monomials (`Grind.CommRing.PSumTree`, `Stepwise.simpsP`, `Stepwise.d_stepsP`): each polynomial `qᵢ` is packed once (`PSumTree.leaf_zero`), the multiples are added in a balanced tree without merge hints, and the result is compared with the packed `p`. The operations take the normalization of the coefficients as an argument, so the same theorems serve characteristic zero and characteristic `c` (`simpsPC`, `d_stepsPC`). A constant stays a constant when it is multiplied by the monomial `1`.

Kernel instructions on `groebner_hard` go from 10.96 G to 9.37 G (−14.5%), on `grind_ring_5` from 0.88 G to 0.76 G (−13.4%), and on `groebner` from 2.05 G to 1.87 G (−9.0%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed