Documentation

Mathlib.Algebra.Polynomial.Reverse

Reverse of a univariate polynomial #

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.natDegree * 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 revAtFun N i returns N - i, otherwise it returns i. This is the map used by the embedding revAt.

Equations

If i ≤ N, then revAt N i returns N - i, otherwise it returns i. Essentially, this embedding is only used for i ≤ N. The advantage of revAt N i over N - i is that revAt is an involution.

Equations
@[simp]
theorem Polynomial.revAtFun_eq (N i : ) :
revAtFun N i = (revAt N) i

We prefer to use the bundled revAt over unbundled revAtFun.

@[simp]
theorem Polynomial.revAt_invol {N i : } :
(revAt N) ((revAt N) i) = i
@[simp]
theorem Polynomial.revAt_le {N i : } (H : i N) :
(revAt N) i = N - i
theorem Polynomial.revAt_eq_self_of_lt {N i : } (h : N < i) :
(revAt N) i = i
theorem Polynomial.revAt_add {N O n o : } (hn : n N) (ho : o O) :
(revAt (N + O)) (n + o) = (revAt N) n + (revAt O) o
theorem Polynomial.revAt_zero (N : ) :
(revAt N) 0 = N
noncomputable def Polynomial.reflect {R : Type u_1} [Semiring R] (N : ) :

reflect N f is the polynomial such that (reflect N f).coeff i = f.coeff (revAt 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
theorem Polynomial.reflect_support {R : Type u_1} [Semiring R] (N : ) (f : Polynomial R) :
@[simp]
theorem Polynomial.coeff_reflect {R : Type u_1} [Semiring R] (N : ) (f : Polynomial R) (i : ) :
(reflect N f).coeff i = f.coeff ((revAt N) i)
@[simp]
theorem Polynomial.reflect_zero {R : Type u_1} [Semiring R] {N : } :
reflect N 0 = 0
@[simp]
theorem Polynomial.reflect_eq_zero_iff {R : Type u_1} [Semiring R] {N : } {f : Polynomial R} :
reflect N f = 0 f = 0
@[simp]
theorem Polynomial.reflect_add {R : Type u_1} [Semiring R] (f g : Polynomial R) (N : ) :
reflect N (f + g) = reflect N f + reflect N g
@[simp]
theorem Polynomial.reflect_C_mul {R : Type u_1} [Semiring R] (f : Polynomial R) (r : R) (N : ) :
reflect N (C r * f) = C r * reflect N f
theorem Polynomial.reflect_C_mul_X_pow {R : Type u_1} [Semiring R] (N n : ) {c : R} :
reflect N (C c * X ^ n) = C c * X ^ (revAt N) n
@[simp]
theorem Polynomial.reflect_C {R : Type u_1} [Semiring R] (r : R) (N : ) :
reflect N (C r) = C r * X ^ N
@[simp]
theorem Polynomial.reflect_monomial {R : Type u_1} [Semiring R] (N n : ) :
reflect N (X ^ n) = X ^ (revAt N) n
@[simp]
theorem Polynomial.reflect_one_X {R : Type u_1} [Semiring R] :
reflect 1 X = 1
theorem Polynomial.reflect_map {R : Type u_1} [Semiring R] {S : Type u_2} [Semiring S] (f : R →+* S) (p : Polynomial R) (n : ) :
reflect n (map f p) = map f (reflect n p)
@[simp]
theorem Polynomial.reflect_one {R : Type u_1} [Semiring R] (n : ) :
reflect n 1 = X ^ n
theorem Polynomial.reflect_mul_induction {R : Type u_1} [Semiring R] (cf cg N O : ) (f g : Polynomial R) :
f.support.card cf.succg.support.card cg.succf.natDegree Ng.natDegree Oreflect (N + O) (f * g) = reflect N f * reflect O g
@[simp]
theorem Polynomial.reflect_mul {R : Type u_1} [Semiring R] (f g : Polynomial R) {F G : } (Ff : f.natDegree F) (Gg : g.natDegree G) :
reflect (F + G) (f * g) = reflect F f * reflect G g
theorem Polynomial.eval₂_reflect_mul_pow {R : Type u_1} [Semiring R] {S : Type u_2} [CommSemiring S] (i : R →+* S) (x : S) [Invertible x] (N : ) (f : Polynomial R) (hf : f.natDegree N) :
eval₂ i ( x) (reflect N f) * x ^ N = eval₂ i x f
theorem Polynomial.eval₂_reflect_eq_zero_iff {R : Type u_1} [Semiring R] {S : Type u_2} [CommSemiring S] (i : R →+* S) (x : S) [Invertible x] (N : ) (f : Polynomial R) (hf : f.natDegree N) :
eval₂ i ( x) (reflect N f) = 0 eval₂ i x f = 0
noncomputable def Polynomial.reverse {R : Type u_1} [Semiring R] (f : Polynomial R) :

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.natDegree.

Equations
theorem Polynomial.coeff_reverse {R : Type u_1} [Semiring R] (f : Polynomial R) (n : ) :
@[simp]
theorem Polynomial.reverse_zero {R : Type u_1} [Semiring R] :
@[simp]
theorem Polynomial.reverse_eq_zero {R : Type u_1} [Semiring R] {f : Polynomial R} :
f.reverse = 0 f = 0
theorem Polynomial.reverse_mul {R : Type u_1} [Semiring R] {f g : Polynomial R} (fg : f.leadingCoeff * g.leadingCoeff 0) :
@[simp]
@[simp]
theorem Polynomial.reverse_C {R : Type u_1} [Semiring R] (t : R) :
(C t).reverse = C t
@[simp]
theorem Polynomial.reverse_mul_X {R : Type u_1} [Semiring R] (p : Polynomial R) :
@[simp]
theorem Polynomial.reverse_X_mul {R : Type u_1} [Semiring R] (p : Polynomial R) :
@[simp]
theorem Polynomial.reverse_mul_X_pow {R : Type u_1} [Semiring R] (p : Polynomial R) (n : ) :
(p * X ^ n).reverse = p.reverse
@[simp]
theorem Polynomial.reverse_X_pow_mul {R : Type u_1} [Semiring R] (p : Polynomial R) (n : ) :
(X ^ n * p).reverse = p.reverse
@[simp]
theorem Polynomial.reverse_add_C {R : Type u_1} [Semiring R] (p : Polynomial R) (t : R) :
(p + C t).reverse = p.reverse + C t * X ^ p.natDegree
@[simp]
theorem Polynomial.reverse_C_add {R : Type u_1} [Semiring R] (p : Polynomial R) (t : R) :
(C t + p).reverse = C t * X ^ p.natDegree + p.reverse
theorem Polynomial.eval₂_reverse_mul_pow {R : Type u_1} [Semiring R] {S : Type u_2} [CommSemiring S] (i : R →+* S) (x : S) [Invertible x] (f : Polynomial R) :
eval₂ i ( x) f.reverse * x ^ f.natDegree = eval₂ i x f
@[simp]
theorem Polynomial.eval₂_reverse_eq_zero_iff {R : Type u_1} [Semiring R] {S : Type u_2} [CommSemiring S] (i : R →+* S) (x : S) [Invertible x] (f : Polynomial R) :
eval₂ i ( x) f.reverse = 0 eval₂ i x f = 0
@[simp]
theorem Polynomial.reflect_neg {R : Type u_1} [Ring R] (f : Polynomial R) (N : ) :
reflect N (-f) = -reflect N f
@[simp]
theorem Polynomial.reflect_sub {R : Type u_1} [Ring R] (f g : Polynomial R) (N : ) :
reflect N (f - g) = reflect N f - reflect N g
@[simp]
theorem Polynomial.reverse_neg {R : Type u_1} [Ring R] (f : Polynomial R) :