-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphase 1 - theoryPhase 1 of the roadmap, focusing on theory completenessPhase 1 of the roadmap, focusing on theory completeness
Description
Implement monomial ordering functions: MonomialOrder.degree, leadingMonomial, leadingCoeff
Summary
Implement computable versions of monomial ordering functions for CMvPolynomial. These functions allow determining the "leading" term of a polynomial according to a monomial order, which is essential for Gröbner basis computations and polynomial division algorithms.
Context
Part of Phase 1: Foundation Completion (API completeness) as outlined in ROADMAP.md line 49. The MonomialOrder class already exists with a compare method; these functions build on top of it.
What to Implement
-
MonomialOrder.degree {n : ℕ} [MonomialOrder n] (m : CMvMonomial n) : ℕ- Returns the degree of a monomial according to the ordering
- The exact meaning depends on the specific monomial order (e.g., total degree for graded orders, weighted degree, etc.)
- Location:
CompPoly/Multivariate/CMvPolynomial.leanline 162
-
leadingMonomial {n : ℕ} {R : Type} [Zero R] [MonomialOrder n] (p : CMvPolynomial n R) : Option (CMvMonomial n)- Returns the leading monomial of a polynomial according to the monomial order
- Returns
nonefor the zero polynomial - Location:
CompPoly/Multivariate/CMvPolynomial.leanline 169
-
leadingCoeff {n : ℕ} {R : Type} [Zero R] [MonomialOrder n] (p : CMvPolynomial n R) : R- Returns the coefficient of the leading monomial
- Returns
0for the zero polynomial - Location:
CompPoly/Multivariate/CMvPolynomial.leanline 177
Dependencies
MonomialOrderclass (already exists withcomparemethod)CMvPolynomialstructure and monomial accessCMvMonomial.totalDegree(may be useful for graded orders)Lawful.monomials(to iterate over monomials)
Implementation Notes
leadingMonomialshould iterate through all monomials in the polynomial and find the maximum according toMonomialOrder.compareleadingCoeffcan be implemented by finding the leading monomial and then extracting its coefficientMonomialOrder.degreemay need to be defined per-order-type (lex, grlex, etc.) or as a general method- Consider edge cases: zero polynomial, single monomial, etc.
Mathlib References
MvPolynomial.leadingMonomial- Similar concept in MathlibMvPolynomial.leadingCoeff- Similar concept in Mathlib- Monomial ordering theory in
Mathlib.RingTheory.MvPolynomial.Monad
Success Criteria
-
MonomialOrder.degreeis implemented and typechecks -
leadingMonomialcorrectly identifies the maximum monomial according to the order -
leadingCoeffcorrectly extracts the coefficient of the leading monomial - All functions handle the zero polynomial correctly
- Basic properties are proven (e.g.,
leadingCoeff p = coeff (leadingMonomial p) p)
Tags
phase-1api-completenessmultivariate-polynomialsmonomial-ordering
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededphase 1 - theoryPhase 1 of the roadmap, focusing on theory completenessPhase 1 of the roadmap, focusing on theory completeness