Degrees and variables of polynomials #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file establishes many results about the degree and variable sets of a multivariate polynomial.
The variable set of a polynomial $P \in R[X]$ is a finset
containing each $x \in X$
that appears in a monomial in $P$.
The degree set of a polynomial $P \in R[X]$ is a multiset
containing, for each $x$ in the
variable set, $n$ copies of $x$, where $n$ is the maximum number of copies of $x$ appearing in a
monomial of $P$.
Main declarations #
-
mv_polynomial.degrees p
: the multiset of variables representing the union of the multisets corresponding to each non-zero monomial inp
. For example if7 ≠ 0
inR
andp = x²y+7y³
thendegrees p = {x, x, y, y, y}
-
mv_polynomial.vars p
: the finset of variables occurring inp
. For example ifp = x⁴y+yz
thenvars p = {x, y, z}
-
mv_polynomial.degree_of n p : ℕ
: the total degree ofp
with respect to the variablen
. For example ifp = x⁴y+yz
thendegree_of y p = 1
. -
mv_polynomial.total_degree p : ℕ
: the max of the sizes of the multisetss
whose monomialsX^s
occur inp
. For example ifp = x⁴y+yz
thentotal_degree p = 5
.
Notation #
As in other polynomial files, we typically use the notation:
-
σ τ : Type*
(indexing the variables) -
R : Type*
[comm_semiring R]
(the coefficients) -
s : σ →₀ ℕ
, a function fromσ
toℕ
which is zero away from a finite set. This will give rise to a monomial inmv_polynomial σ R
which mathematicians might callX^s
-
r : R
-
i : σ
, with corresponding monomialX i
, often denotedX_i
by mathematicians -
p : mv_polynomial σ R
degrees
#
The maximal degrees of each variable in a multi-variable polynomial, expressed as a multiset.
(For example, degrees (x^2 * y + y^3)
would be {x, x, y, y, y}
.)
Equations
- p.degrees = let _inst : decidable_eq σ := classical.dec_eq σ in p.support.sup (λ (s : σ →₀ ℕ), ⇑finsupp.to_multiset s)
vars
#
vars p
is the set of variables appearing in the polynomial p
Equations
- p.vars = let _inst : decidable_eq σ := classical.dec_eq σ in p.degrees.to_finset
The variables of the product of a family of polynomials are a subset of the union of the sets of variables of each polynomial.
degree_of
#
degree_of n p
gives the highest power of X_n that appears in p
Equations
- mv_polynomial.degree_of n p = let _inst : decidable_eq σ := classical.dec_eq σ in multiset.count n p.degrees
total_degree
#
total_degree p
gives the maximum |s| over the monomials X^s in p
vars
and eval
#
If f₁
and f₂
are ring homs out of the polynomial ring and p₁
and p₂
are polynomials,
then f₁ p₁ = f₂ p₂
if p₁ = p₂
and f₁
and f₂
are equal on R
and on the variables
of p₁
.