Computable multivariate polynomials #
Polynomials of the form α₁ * m₁ + α₂ * m₂ + ... + αₖ * mₖ where αᵢ is any semiring
and mᵢ is a CMvMonomial.
This is implemented as a wrapper around CPoly.Lawful, which ensures that all stored
coefficients are non-zero.
This file contains the core type definition and basic operations. Higher-level definitions
that depend on ring instances (monomial orders, rename, aeval, etc.) are in
CMvPolynomial.lean. The CommSemiring and CommRing instances are in MvPolyEquiv.lean.
Main definitions #
CPoly.CMvPolynomial n R: The type of multivariate polynomials innvariables with coefficients inR.CPoly.CMvPolynomial.C: Constant polynomial constructor.CPoly.CMvPolynomial.X: Variable polynomial constructor.CPoly.CMvPolynomial.monomial: Monomial constructor.CPoly.CMvPolynomial.coeff: Extract the coefficient of a monomial.CPoly.CMvPolynomial.eval₂,CPoly.CMvPolynomial.eval: Polynomial evaluation.CPoly.CMvPolynomial.eval₂Horner,CPoly.CMvPolynomial.evalHorner: Polynomial evaluation using Horner's method.CPoly.CMvPolynomial.support,CPoly.CMvPolynomial.totalDegree,CPoly.CMvPolynomial.degreeOf,CPoly.CMvPolynomial.degrees,CPoly.CMvPolynomial.vars: Degree and support queries.
Construct a constant polynomial.
Instances For
Construct the polynomial $X_i$.
Instances For
Extract the coefficient of a monomial.
Instances For
Extensionality: two polynomials are equal if all their coefficients are equal.
Auxiliary lemma showing that conversion from unlawful polynomials respects the sum fold.
Auxiliary lemma showing that conversion from unlawful polynomials respects the fold over terms.
Evaluate a polynomial at a point given by a ring homomorphism f
and variable assignments vs.
Instances For
Term representation used by the fixed-order multivariate Horner evaluator.
Instances For
Terms grouped by one variable exponent.
Instances For
Read the exponent for a variable index represented as a natural number.
Instances For
Add a term to an association list keyed by the current variable exponent.
Instances For
Insert an exponent group into descending exponent order.
Instances For
Collect terms into association-list groups keyed by the current variable exponent.
Instances For
Sort exponent groups from high exponent to low exponent.
Instances For
Group terms by the current variable exponent, sorted from high to low exponent.
Instances For
Sparse Horner fold for already-evaluated coefficient groups.
Instances For
Evaluate sparse multivariate terms by fixed-order Horner in variables 0, 1, ..., n-1.
Instances For
Evaluate a polynomial using fixed-order multivariate Horner evaluation.
Instances For
Evaluate a polynomial at a given point.
Instances For
Evaluate a polynomial at a given point using fixed-order multivariate Horner evaluation.
Instances For
The support of a polynomial (set of monomials with non-zero coefficients), represented as Finsupps.
Instances For
The total degree of a polynomial (maximum total degree of its monomials).
Instances For
The degree of a polynomial in a specific variable.
Instances For
Construct a monomial c * m as a CMvPolynomial n R.
Creates a polynomial with a single monomial term. If c = 0, returns the zero polynomial.
Instances For
Multiset of all variable degrees appearing in the polynomial.
Each variable i appears degreeOf i p times in the multiset.
Instances For
Extract the set of variables that appear in a polynomial.
Returns the set of variable indices i : Fin n such that degreeOf i p > 0.
Instances For
Filter a polynomial, keeping only monomials for which keep m is true.
Instances For
Restrict polynomial to monomials with total degree ≤ d.
Filters out all monomials where m.totalDegree > d.
Instances For
Restrict polynomial to monomials whose degree in each variable is ≤ d.
Filters out all monomials where m.degreeOf i > d for some variable i.