Computable multivariate polynomials (extended operations) #
Operations on CMvPolynomial that depend on ring instances from MvPolyEquiv.lean,
such as monomial orders, leading terms, restriction, variable renaming, and substitution.
The core type and basic operations (CMvPolynomial, C, X, coeff, eval, etc.)
are in CMvPolynomial.lean. The CommSemiring and CommRing instances are in
MvPolyEquiv.lean.
Main definitions #
MonomialOrder: Typeclass for comparing monomials.leadingMonomial,leadingCoeff,leadingTerm: Leading term operations according to a monomial order.rename: Rename variables using a functionFin n → Fin m.aeval: Algebra evaluation.bind₁: Substitution of polynomials for variables.
Leading-term operations #
Monomial ordering typeclass for n variables.
Provides a way to compare monomials for determining leading terms.
- compare : CMvMonomial n → CMvMonomial n → Ordering
Instances
Baseline degree of a monomial.
Currently this is the ordinary total degree and is independent of
MonomialOrder.compare.
Instances For
Leading monomial of a polynomial according to a monomial order.
Returns none for the zero polynomial.
Instances For
Leading term of a polynomial according to a monomial order.
Returns 0 for the zero polynomial, and otherwise returns the monomial with
leading monomial and leading coefficient.
Instances For
Leading coefficient of a polynomial according to a monomial order.
Returns 0 for the zero polynomial.
Instances For
Packaged form of leadingCoeff: it is the coefficient at the optional leading monomial,
defaulting to 0 when no leading monomial exists.
Evaluation and substitution #
Algebra evaluation: evaluates polynomial in an algebra.
Given an algebra σ over R and a function f : Fin n → σ, evaluates the polynomial.
Instances For
Substitution: substitutes polynomials for variables.
Given f : Fin n → CMvPolynomial m R, substitutes f i for variable X i.
Instances For
The computable substitution bind₁ agrees with algebraic evaluation.
Core operations #
Rename variables using a function.
Given f : Fin n → Fin m, renames variable X i to X (f i).
Instances For
Iterative reconstruction of a polynomial by folding over terms.
Instances For
Bridge and transport lemmas (technical) #
C and eval₂ as ring homomorphisms #
Two ring homomorphisms out of CMvPolynomial n R are equal once they agree on the constants
and on every variable.
The computable substitution bind₁ agrees with Mathlib substitution after
transporting through fromCMvPolynomial.
Equivalence between npow and npowBySq #
Lawful.npow (defined in Multivariate/Lawful.lean) is the naive O(k)
specification; Lawful.npowBySq is the O(log k) repeated-squaring
implementation. We prove pointwise equality here so that the NatPow instance
can be safely routed through the fast version.
The proofs need mul_assoc / mul_one / mul_comm, which are only available
once the CommSemiring (CMvPolynomial n R) instance has been built — that is
why these lemmas live in Operations.lean rather than in Lawful.lean.
The fast repeated-squaring npowBySq agrees pointwise with the naive
npow. This is the equivalence that lets the NatPow (Lawful n R) instance
be routed through npowBySq without changing observable behavior.