refactor(math): drop Polynomial operator impls unused by production#618
Open
diegokingston wants to merge 1 commit into
Open
refactor(math): drop Polynomial operator impls unused by production#618diegokingston wants to merge 1 commit into
diegokingston wants to merge 1 commit into
Conversation
Removes 6 operator families from polynomial.rs that no production code
reaches — proven by a clean `cargo build --workspace`:
- Sub Polynomial - Polynomial
- Mul Polynomial * FieldElement (and FieldElement * Polynomial)
- Add Polynomial +/- FieldElement (and FieldElement +/- Polynomial)
- Sub FieldElement - Polynomial
Production uses exactly two operator entry points, both when building
the product-of-linear-factors polynomial prod(x - r_i):
- boundary.rs:149 zerofier * binomial -> Mul Poly x Poly
- transition.rs:127 acc * (x_poly - current) -> Mul Poly x Poly,
Sub Poly - FieldElement
Sub<FieldElement> for Polynomial is implemented as `-monomial + self`,
so Neg and Add Poly+/-Poly remain as transitive dependencies; those four
families (Mul Poly x Poly, Sub Poly - FieldElement, Neg, Add Poly+/-Poly)
are kept.
Also removes the 2 self-referential Sub Poly-Poly tests and the
now-orphaned polynomial_b_minus_a test helper.
Codex Code ReviewFindings
Notes I attempted |
|
Review: LGTM with one merge-order note Pure dead-code removal - no logic changes, no correctness issues, no security concerns. Verified:
Merge order: This PR is stacked on #598 (cleanup/math-dead-code), which is still open. Do not merge this until #598 lands on main and this branch is rebased, or the base ref will be wrong. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #598. Removes 6
Polynomialoperator families frompolynomial.rsthat no production code reaches — proven by a cleancargo build --workspace.Removed (319 lines, 24
impls):SubPolynomial − PolynomialMulPolynomial × FieldElement (and FieldElement × Polynomial)AddPolynomial ± FieldElement (and FieldElement ± Polynomial)SubFieldElement − PolynomialOf these, only
Sub Poly−Polyhad tests (2, self-referential); the other 5 families were fully dead with no test coverage at all.Why these 4 families stay
Production uses operators at exactly 2 call sites, both building
∏(x − rᵢ):boundary.rs:149—zerofier * binomial→Mul Poly×Polytransition.rs:127—acc * (x_poly - current)→Mul Poly×Poly,Sub Poly−FieldElementSub<FieldElement> for Polynomialis implemented as-monomial + self, soNegandAdd Poly±Polyremain as transitive dependencies. Kept families:Mul Poly×Poly,Sub Poly−FieldElement,Neg,Add Poly±Poly.Test plan
cargo build --workspace— cleancargo clippy -p math --all-targets -- -D warnings— cleancargo test -p math— 196 passed (−2: the removed self-referentialSub Poly−Polytests)