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 inMvPolynomial σ R
which mathematicians might callX^s
a : R
i : σ
, with corresponding monomialX i
, often denotedX_i
by mathematiciansp : MvPolynomial σ R
Definitions #
MvPolynomial σ R
: the type of polynomials with variables of typeσ
and coefficients in the commutative semiringR
monomial s a
: the monomial which mathematically would be denoteda * X^s
C a
: the constant polynomial with valuea
X i
: the degree one monomial corresponding to i; mathematically this might be denotedXᵢ
.coeff s p
: the coefficient ofs
inp
.
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.inhabited = { default := 0 }
Equations
If R
is a subsingleton, then MvPolynomial σ R
has a unique element
Equations
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
- MvPolynomial.C = { toFun := ⇑(MvPolynomial.monomial 0), map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
X n
is the degree 1
monomial $X_n$.
Equations
- MvPolynomial.X n = (MvPolynomial.monomial (Finsupp.single n 1)) 1
Instances For
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
- p.support = 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
- MvPolynomial.coeffAddMonoidHom m = { toFun := MvPolynomial.coeff m, map_zero' := ⋯, map_add' := ⋯ }
Instances For
MvPolynomial.coeff m
but promoted to a LinearMap
.
Equations
- MvPolynomial.lcoeff R m = { toFun := MvPolynomial.coeff m, map_add' := ⋯, map_smul' := ⋯ }
Instances For
The finset of nonzero coefficients of a multivariate polynomial.
Equations
- p.coeffs = Finset.image (fun (m : σ →₀ ℕ) => MvPolynomial.coeff m p) p.support
Instances For
constantCoeff p
returns the constant term of the polynomial p
, defined as coeff 0 p
.
This is a ring homomorphism.
Equations
- MvPolynomial.constantCoeff = { toFun := MvPolynomial.coeff 0, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }