Multivariate polynomials #
This file defines polynomial rings over a base ring (or even semiring),
with variables from a general type σ (which could be infinite).
Important definitions #
Let R be a commutative ring (or a semiring) and let σ be an arbitrary
type. This file creates the type MvPolynomial σ R, which mathematicians
might denote $R[X_i : i \in σ]$. It is the type of multivariate
(a.k.a. multivariable) polynomials, with variables
corresponding to the terms in σ, and coefficients in R.
Notation #
In the definitions below, we use the following notation:
- σ : Type*(indexing the variables)
- R : Type*- [CommSemiring R](the coefficients)
- s : σ →₀ ℕ, a function from- σto- ℕwhich is zero away from a finite set. This will give rise to a monomial in- MvPolynomial σ Rwhich mathematicians might call- X^s
- a : R
- i : σ, with corresponding monomial- X i, often denoted- X_iby mathematicians
- p : MvPolynomial σ R
Definitions #
- MvPolynomial σ R: the type of polynomials with variables of type- σand coefficients in the commutative semiring- R
- monomial s a: the monomial which mathematically would be denoted- a * X^s
- C a: the constant polynomial with value- a
- X i: the degree one monomial corresponding to i; mathematically this might be denoted- Xᵢ.
- coeff s p: the coefficient of- sin- p.
- eval₂ (f : R → S₁) (g : σ → S₁) p: given a semiring homomorphism from- Rto another semiring- S₁, and a map- σ → S₁, evaluates- pat this valuation, returning a term of type- S₁. Note that- eval₂can be made using- evaland- map(see below), and it has been suggested that sticking to- evaland- mapmight make the code less brittle.
- eval (g : σ → R) p: given a map- σ → R, evaluates- pat this valuation, returning a term of type- R
- map (f : R → S₁) p: returns the multivariate polynomial obtained from- pby the change of coefficient semiring corresponding to- f
Implementation notes #
Recall that if Y has a zero, then X →₀ Y is the type of functions from X to Y with finite
support, i.e. such that only finitely many elements of X get sent to non-zero terms in Y.
The definition of MvPolynomial σ R is (σ →₀ ℕ) →₀ R; here σ →₀ ℕ denotes the space of all
monomials in the variables, and the function to R sends a monomial to its coefficient in
the polynomial being represented.
Tags #
polynomial, multivariate polynomial, multivariable polynomial
Multivariate polynomial, where σ is the index set of the variables and
R is the coefficient ring
Equations
- MvPolynomial σ R = AddMonoidAlgebra R (σ →₀ ℕ)
Instances For
Equations
- MvPolynomial.decidableEqMvPolynomial = Finsupp.decidableEq
Equations
- MvPolynomial.commSemiring = AddMonoidAlgebra.commSemiring
Equations
- MvPolynomial.inhabited = { default := 0 }
Equations
- MvPolynomial.distribuMulAction = AddMonoidAlgebra.distribMulAction
Equations
- MvPolynomial.smulZeroClass = AddMonoidAlgebra.smulZeroClass
Equations
- (_ : FaithfulSMul R (MvPolynomial σ S₁)) = (_ : FaithfulSMul R (AddMonoidAlgebra S₁ (σ →₀ ℕ)))
Equations
- MvPolynomial.module = AddMonoidAlgebra.module
Equations
- (_ : IsScalarTower R S₁ (MvPolynomial σ S₂)) = (_ : IsScalarTower R S₁ (AddMonoidAlgebra S₂ (σ →₀ ℕ)))
Equations
- (_ : SMulCommClass R S₁ (MvPolynomial σ S₂)) = (_ : SMulCommClass R S₁ (AddMonoidAlgebra S₂ (σ →₀ ℕ)))
Equations
- (_ : IsCentralScalar R (MvPolynomial σ S₁)) = (_ : IsCentralScalar R (AddMonoidAlgebra S₁ (σ →₀ ℕ)))
Equations
- MvPolynomial.algebra = AddMonoidAlgebra.algebra
Equations
- (_ : IsScalarTower R (MvPolynomial σ S₁) (MvPolynomial σ S₁)) = (_ : IsScalarTower R (AddMonoidAlgebra S₁ (σ →₀ ℕ)) (AddMonoidAlgebra S₁ (σ →₀ ℕ)))
Equations
- (_ : SMulCommClass R (MvPolynomial σ S₁) (MvPolynomial σ S₁)) = (_ : SMulCommClass R (AddMonoidAlgebra S₁ (σ →₀ ℕ)) (AddMonoidAlgebra S₁ (σ →₀ ℕ)))
If R is a subsingleton, then MvPolynomial σ R has a unique element
Equations
- MvPolynomial.unique = AddMonoidAlgebra.unique
monomial s a is the monomial with coefficient a and exponents given by s
Equations
Instances For
C a is the constant polynomial with value a
Equations
- One or more equations did not get rendered due to their size.
Instances For
X n is the degree 1 monomial $X_n$.
Equations
- MvPolynomial.X n = (MvPolynomial.monomial (Finsupp.single n 1)) 1
Instances For
Equations
- (_ : Infinite (MvPolynomial σ R)) = (_ : Infinite (MvPolynomial σ R))
Equations
- (_ : Infinite (MvPolynomial σ R)) = (_ : Infinite (MvPolynomial σ R))
fun s ↦ monomial s 1 as a homomorphism.
Equations
- MvPolynomial.monomialOneHom R σ = AddMonoidAlgebra.of R (σ →₀ ℕ)
Instances For
Analog of Polynomial.induction_on'.
To prove something about mv_polynomials,
it suffices to show the condition is closed under taking sums,
and it holds for monomials.
Similar to MvPolynomial.induction_on but only a weak form of h_add is required.
Similar to MvPolynomial.induction_on but only a yet weaker form of h_add is required.
Analog of Polynomial.induction_on.
See note [partially-applied ext lemmas].
The finite set of all m : σ →₀ ℕ such that X^m has a non-zero coefficient.
Equations
- MvPolynomial.support p = p.support
Instances For
The coefficient of the monomial m in the multi-variable polynomial p.
Equations
- MvPolynomial.coeff m p = p m
Instances For
MvPolynomial.coeff m but promoted to an AddMonoidHom.
Equations
- One or more equations did not get rendered due to their size.
Instances For
constantCoeff p returns the constant term of the polynomial p, defined as coeff 0 p.
This is a ring homomorphism.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluate a polynomial p given a valuation g of all the variables
and a ring hom f from the scalar ring to the target
Equations
- MvPolynomial.eval₂ f g p = Finsupp.sum p fun (s : σ →₀ ℕ) (a : R) => f a * Finsupp.prod s fun (n : σ) (e : ℕ) => g n ^ e
Instances For
MvPolynomial.eval₂ as a RingHom.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluate a polynomial p given a valuation f of all the variables
Equations
Instances For
map f p maps a polynomial p across a ring hom f
Equations
- MvPolynomial.map f = MvPolynomial.eval₂Hom (RingHom.comp MvPolynomial.C f) MvPolynomial.X
Instances For
If f is a left-inverse of g then map f is a left-inverse of map g.
If f is a right-inverse of g then map f is a right-inverse of map g.
If f : S₁ →ₐ[R] S₂ is a morphism of R-algebras, then so is MvPolynomial.map f.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The algebra of multivariate polynomials #
A map σ → S₁ where S₁ is an algebra over R generates an R-algebra homomorphism
from multivariate polynomials over σ to S₁.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Version of aeval for defining algebra homs out of MvPolynomial σ R over a smaller base ring
than R.
Equations
- One or more equations did not get rendered due to their size.