|
| 1 | +/- |
| 2 | +Copyright (c) 2020 Aaron Anderson. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Aaron Anderson, Jalex Stark. |
| 5 | +-/ |
| 6 | +import algebra.polynomial.basic |
| 7 | +open polynomial finset |
| 8 | + |
| 9 | +/-! |
| 10 | +# Polynomials |
| 11 | +
|
| 12 | +Lemmas for the interaction between polynomials and ∑ and ∏. |
| 13 | +
|
| 14 | +## Main results |
| 15 | +
|
| 16 | +- `nat_degree_prod_eq_of_monic` : the degree of a product of monic polynomials is the product of |
| 17 | + degrees. We prove this only for [comm_semiring R], |
| 18 | + but it ought to be true for [semiring R] and list.prod. |
| 19 | +- `nat_degree_prod_eq` : for polynomials over an integral domain, |
| 20 | + the degree of the product is the sum of degrees |
| 21 | +- `leading_coeff_prod` : for polynomials over an integral domain, |
| 22 | + the leading coefficient is the product of leading coefficients |
| 23 | +-/ |
| 24 | + |
| 25 | +open_locale big_operators |
| 26 | + |
| 27 | +universes u w |
| 28 | + |
| 29 | +variables {R : Type u} {α : Type w} |
| 30 | + |
| 31 | +namespace polynomial |
| 32 | + |
| 33 | +variable (s : finset α) |
| 34 | + |
| 35 | +section comm_semiring |
| 36 | +variables [comm_semiring R] (f : α → polynomial R) |
| 37 | + |
| 38 | +lemma nat_degree_prod_le : (∏ i in s, f i).nat_degree ≤ ∑ i in s, (f i).nat_degree := |
| 39 | +begin |
| 40 | + classical, |
| 41 | + induction s using finset.induction with a s ha hs, { simp }, |
| 42 | + rw [prod_insert ha, sum_insert ha], |
| 43 | + transitivity (f a).nat_degree + (∏ (x : α) in s, (f x)).nat_degree, |
| 44 | + apply polynomial.nat_degree_mul_le, linarith, |
| 45 | +end |
| 46 | + |
| 47 | +/-- The leading coefficient of a product of polynomials is equal to the product of the leading coefficients, provided that this product is nonzero. |
| 48 | +See `leading_coeff_prod` (without the `'`) for a version for integral domains, where this condition is automatically satisfied. -/ |
| 49 | +lemma leading_coeff_prod' (h : ∏ i in s, (f i).leading_coeff ≠ 0) : |
| 50 | + (∏ i in s, f i).leading_coeff = ∏ i in s, (f i).leading_coeff := |
| 51 | +begin |
| 52 | + classical, |
| 53 | + revert h, induction s using finset.induction with a s ha hs, { simp }, |
| 54 | + repeat { rw prod_insert ha }, |
| 55 | + intro h, rw polynomial.leading_coeff_mul'; { rwa hs, apply right_ne_zero_of_mul h }, |
| 56 | +end |
| 57 | + |
| 58 | +/-- The degree of a product of polynomials is equal to the product of the degrees, provided that the product of leading coefficients is nonzero. |
| 59 | +See `nat_degree_prod_eq` (without the `'`) for a version for integral domains, where this condition is automatically satisfied. -/ |
| 60 | +lemma nat_degree_prod_eq' (h : ∏ i in s, (f i).leading_coeff ≠ 0) : |
| 61 | + (∏ i in s, f i).nat_degree = ∑ i in s, (f i).nat_degree := |
| 62 | +begin |
| 63 | + classical, |
| 64 | + revert h, induction s using finset.induction with a s ha hs, { simp }, |
| 65 | + rw [prod_insert ha, prod_insert ha, sum_insert ha], |
| 66 | + intro h, rw polynomial.nat_degree_mul_eq', rw hs, |
| 67 | + apply right_ne_zero_of_mul h, |
| 68 | + rwa polynomial.leading_coeff_prod', apply right_ne_zero_of_mul h, |
| 69 | +end |
| 70 | + |
| 71 | +lemma monic_prod_of_monic : |
| 72 | + (∀ a : α, a ∈ s → monic (f a)) → monic (∏ i in s, f i) := |
| 73 | +by { apply prod_induction, apply monic_mul, apply monic_one } |
| 74 | + |
| 75 | +lemma nat_degree_prod_eq_of_monic [nontrivial R] (h : ∀ i : α, i ∈ s → (f i).monic) : |
| 76 | + (∏ i in s, f i).nat_degree = ∑ i in s, (f i).nat_degree := |
| 77 | +begin |
| 78 | + apply nat_degree_prod_eq', |
| 79 | + suffices : ∏ (i : α) in s, (f i).leading_coeff = 1, { rw this, simp }, |
| 80 | + rw prod_eq_one, intros, apply h, assumption, |
| 81 | +end |
| 82 | + |
| 83 | +end comm_semiring |
| 84 | + |
| 85 | +section integral_domain |
| 86 | +variables [integral_domain R] (f : α → polynomial R) |
| 87 | + |
| 88 | +lemma nat_degree_prod_eq (h : ∀ i ∈ s, f i ≠ 0) : |
| 89 | + (∏ i in s, f i).nat_degree = ∑ i in s, (f i).nat_degree := |
| 90 | +begin |
| 91 | + apply nat_degree_prod_eq', rw prod_ne_zero_iff, |
| 92 | + intros x hx, simp [h x hx], |
| 93 | +end |
| 94 | + |
| 95 | +lemma leading_coeff_prod : |
| 96 | + (∏ i in s, f i).leading_coeff = ∏ i in s, (f i).leading_coeff := |
| 97 | +by { rw ← leading_coeff_hom_apply, apply monoid_hom.map_prod } |
| 98 | + |
| 99 | +end integral_domain |
| 100 | +end polynomial |
0 commit comments