Reverse of a univariate polynomial #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
The main definition is reverse
. Applying reverse
to a polynomial f : R[X]
produces
the polynomial with a reversed list of coefficients, equivalent to X^f.nat_degree * f(1/X)
.
The main result is that reverse (f * g) = reverse f * reverse g
, provided the leading
coefficients of f
and g
do not multiply to zero.
If i ≤ N
, then rev_at_fun N i
returns N - i
, otherwise it returns i
.
This is the map used by the embedding rev_at
.
Equations
- polynomial.rev_at_fun N i = ite (i ≤ N) (N - i) i
If i ≤ N
, then rev_at N i
returns N - i
, otherwise it returns i
.
Essentially, this embedding is only used for i ≤ N
.
The advantage of rev_at N i
over N - i
is that rev_at
is an involution.
We prefer to use the bundled rev_at
over unbundled rev_at_fun
.
reflect N f
is the polynomial such that (reflect N f).coeff i = f.coeff (rev_at N i)
.
In other words, the terms with exponent [0, ..., N]
now have exponent [N, ..., 0]
.
In practice, reflect
is only used when N
is at least as large as the degree of f
.
Eventually, it will be used with N
exactly equal to the degree of f
.
Equations
- polynomial.reflect N {to_finsupp := f} = {to_finsupp := finsupp.emb_domain (polynomial.rev_at N) f}
The reverse of a polynomial f is the polynomial obtained by "reading f backwards". Even though this is not the actual definition, reverse f = f (1/X) * X ^ f.nat_degree.
Equations
- f.reverse = polynomial.reflect f.nat_degree f