Laurent polynomials #
We introduce Laurent polynomials over a semiring R
. Mathematically, they are expressions of the
form
$$
\sum_{i \in \mathbb{Z}} a_i T ^ i
$$
where the sum extends over a finite subset of ℤ
. Thus, negative exponents are allowed. The
coefficients come from the semiring R
and the variable T
commutes with everything.
Since we are going to convert back and forth between polynomials and Laurent polynomials, we
decided to maintain some distinction by using the symbol T
, rather than X
, as the variable for
Laurent polynomials.
Notation #
The symbol R[T;T⁻¹]
stands for LaurentPolynomial R
. We also define
C : R →+* R[T;T⁻¹]
the inclusion of constant polynomials, analogous to the one forR[X]
;T : ℤ → R[T;T⁻¹]
the sequence of powers of the variableT
.
Implementation notes #
We define Laurent polynomials as AddMonoidAlgebra R ℤ
.
Thus, they are essentially Finsupp
s ℤ →₀ R
.
This choice differs from the current irreducible design of Polynomial
, that instead shields away
the implementation via Finsupp
s. It is closer to the original definition of polynomials.
As a consequence, LaurentPolynomial
plays well with polynomials, but there is a little roughness
in establishing the API, since the Finsupp
implementation of R[X]
is well-shielded.
Unlike the case of polynomials, I felt that the exponent notation was not too easy to use, as only
natural exponents would be allowed. Moreover, in the end, it seems likely that we should aim to
perform computations on exponents in ℤ
anyway and separating this via the symbol T
seems
convenient.
I made a heavy use of simp
lemmas, aiming to bring Laurent polynomials to the form C a * T n
.
Any comments or suggestions for improvements is greatly appreciated!
Future work #
Lots is missing!
-- (Riccardo) add inclusion into Laurent series.
-- (Riccardo) giving a morphism (as R
-alg, so in the commutative case)
from R[T,T⁻¹]
to S
is the same as choosing a unit of S
.
-- A "better" definition of trunc
would be as an R
-linear map. This works:
-- -- def trunc : R[T;T⁻¹] →[R] R[X] := -- begin -- refine (_ : R[ℕ] →[R] R[X]).comp _, -- { exact ⟨(toFinsuppIso R).symm, by simp⟩ }, -- { refine ⟨λ r, comapDomain _ r (Set.injOn_of_injective (λ a b ab, Int.ofNat.inj ab) _), _⟩, -- exact λ r f, comapDomain_smul _ _ _ } -- end --
-- but it would make sense to bundle the maps better, for a smoother user experience.
-- I (DT) did not have the strength to embark on this (possibly short!) journey, after getting to
-- this stage of the Laurent process!
-- This would likely involve adding a comapDomain
analogue of
-- AddMonoidAlgebra.mapDomainAlgHom
and an R
-linear version of
-- Polynomial.toFinsuppIso
.
-- Add degree, int_degree, int_trailing_degree, leading_coeff, trailing_coeff,...
.
The semiring of Laurent polynomials with coefficients in the semiring R
.
We denote it by R[T;T⁻¹]
.
The ring homomorphism C : R →+* R[T;T⁻¹]
includes R
as the constant polynomials.
Equations
Instances For
Equations
- LaurentPolynomial.«term_[T;T⁻¹]» = Lean.ParserDescr.trailingNode `LaurentPolynomial.term_[T;T⁻¹] 9000 0 (Lean.ParserDescr.symbol "[T;T⁻¹]")
Instances For
The ring homomorphism, taking a polynomial with coefficients in R
to a Laurent polynomial
with coefficients in R
.
Equations
- Polynomial.toLaurent = RingHom.comp (AddMonoidAlgebra.mapDomainRingHom R Int.ofNatHom) ↑(Polynomial.toFinsuppIso R)
Instances For
This is not a simp lemma, as it is usually preferable to use the lemmas about C
and X
instead.
The R
-algebra map, taking a polynomial with coefficients in R
to a Laurent polynomial
with coefficients in R
.
Equations
- Polynomial.toLaurentAlg = AlgHom.comp (AddMonoidAlgebra.mapDomainAlgHom R R Int.ofNatHom) ↑(Polynomial.toFinsuppIsoAlg R)
Instances For
When we have [CommSemiring R]
, the function C
is the same as algebraMap R R[T;T⁻¹]
.
(But note that C
is defined when R
is not necessarily commutative, in which case
algebraMap
is not available.)
The function n ↦ T ^ n
, implemented as a sequence ℤ → R[T;T⁻¹]
.
Using directly T ^ n
does not work, since we want the exponents to be of Type ℤ
and there
is no ℤ
-power defined on R[T;T⁻¹]
. Using that T
is a unit introduces extra coercions.
For these reasons, the definition of T
is as a sequence.
Equations
- LaurentPolynomial.T n = fun₀ | n => 1
Instances For
Equations
- One or more equations did not get rendered due to their size.
To prove something about Laurent polynomials, it suffices to show that
- the condition is closed under taking sums, and
- it holds for monomials.
trunc : R[T;T⁻¹] →+ R[X]
maps a Laurent polynomial f
to the polynomial whose terms of
nonnegative degree coincide with the ones of f
. The terms of negative degree of f
"vanish".
trunc
is a left-inverse to Polynomial.toLaurent
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This is a version of exists_T_pow
stated as an induction principle.
Suppose that Q
is a statement about Laurent polynomials such that
Q
is true on ordinary polynomials;Q (f * T)
impliesQ f
; it follow thatQ
is true on all Laurent polynomials.
The support of a polynomial f
is a finset in ℕ
. The lemma toLaurent_support f
shows that the support of f.toLaurent
is the same finset, but viewed in ℤ
under the natural
inclusion ℕ ↪ ℤ
.
The degree of a Laurent polynomial takes values in WithBot ℤ
.
If f : R[T;T⁻¹]
is a Laurent polynomial, then f.degree
is the maximum of its support of f
,
or ⊥
, if f = 0
.
Equations
- LaurentPolynomial.degree f = Finset.max f.support
Instances For
Equations
- LaurentPolynomial.instModulePolynomialLaurentPolynomialSemiringAddCommMonoidInt = Module.compHom (LaurentPolynomial R) Polynomial.toLaurent
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
The map which substitutes T ↦ T⁻¹
into a Laurent polynomial.
Equations
- LaurentPolynomial.invert = AddMonoidAlgebra.domCongr R R (AddEquiv.neg ℤ)