fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
degree_radical_le {a : k[X]} (h : a ≠ 0) : (radical a).degree ≤ a.degree := degree_le_of_dvd radical_dvd_self h
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.FieldDivision", "Mathlib.RingTheory.Polynomial.Wronskian", "Mathlib.RingTheory.Radical", "Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative" ]
Mathlib/RingTheory/Polynomial/Radical.lean
degree_radical_le
null
natDegree_radical_le {a : k[X]} : (radical a).natDegree ≤ a.natDegree := by by_cases ha : a = 0 · simp [ha] · exact natDegree_le_of_dvd radical_dvd_self ha
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.FieldDivision", "Mathlib.RingTheory.Polynomial.Wronskian", "Mathlib.RingTheory.Radical", "Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative" ]
Mathlib/RingTheory/Polynomial/Radical.lean
natDegree_radical_le
null
divRadical_dvd_derivative (a : k[X]) : divRadical a ∣ derivative a := by induction a using induction_on_coprime · case h0 => rw [derivative_zero] apply dvd_zero · case h1 a ha => exact (divRadical_isUnit ha).dvd · case hpr p i hp => cases i · rw [pow_zero, derivative_one] apply dvd_zero · case succ i => rw [← mul_dvd_mul_iff_left radical_ne_zero, radical_mul_divRadical, radical_pow_of_prime hp i.succ_ne_zero, derivative_pow_succ, ← mul_assoc] apply dvd_mul_of_dvd_left rw [mul_comm, mul_assoc] apply dvd_mul_of_dvd_right rw [pow_succ, mul_dvd_mul_iff_left (pow_ne_zero i hp.ne_zero), dvd_normalize_iff] · -- If it holds for coprime pair a and b, then it also holds for a * b. case hcp x y hpxy hx hy => have hc : IsCoprime x y := EuclideanDomain.isCoprime_of_dvd (fun ⟨hx, hy⟩ => not_isUnit_zero (hpxy (zero_dvd_iff.mpr hx) (zero_dvd_iff.mpr hy))) fun p hp _ hpx hpy => hp (hpxy hpx hpy) rw [divRadical_mul hc, derivative_mul] exact dvd_add (mul_dvd_mul hx (divRadical_dvd_self y)) (mul_dvd_mul (divRadical_dvd_self x) hy)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.FieldDivision", "Mathlib.RingTheory.Polynomial.Wronskian", "Mathlib.RingTheory.Radical", "Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative" ]
Mathlib/RingTheory/Polynomial/Radical.lean
divRadical_dvd_derivative
null
divRadical_dvd_wronskian_left (a b : k[X]) : divRadical a ∣ wronskian a b := by rw [wronskian] apply dvd_sub · apply dvd_mul_of_dvd_left exact divRadical_dvd_self a · apply dvd_mul_of_dvd_left exact divRadical_dvd_derivative a
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.FieldDivision", "Mathlib.RingTheory.Polynomial.Wronskian", "Mathlib.RingTheory.Radical", "Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative" ]
Mathlib/RingTheory/Polynomial/Radical.lean
divRadical_dvd_wronskian_left
null
divRadical_dvd_wronskian_right (a b : k[X]) : divRadical b ∣ wronskian a b := by rw [← wronskian_neg_eq, dvd_neg] exact divRadical_dvd_wronskian_left _ _
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.FieldDivision", "Mathlib.RingTheory.Polynomial.Wronskian", "Mathlib.RingTheory.Radical", "Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative" ]
Mathlib/RingTheory/Polynomial/Radical.lean
divRadical_dvd_wronskian_right
null
scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero {p : A[X]} {r : A} {s : M} (hr : aeval (mk' S r s) p = 0) : aeval (algebraMap A S r) (scaleRoots p s) = 0 := by convert scaleRoots_eval₂_eq_zero (algebraMap A S) hr funext rw [aeval_def, mk'_spec' _ r s] variable [IsDomain A]
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero
null
num_isRoot_scaleRoots_of_aeval_eq_zero [UniqueFactorizationMonoid A] {p : A[X]} {x : K} (hr : aeval x p = 0) : IsRoot (scaleRoots p (den A x)) (num A x) := by apply isRoot_of_eval₂_map_eq_zero (IsFractionRing.injective A K) refine scaleRoots_aeval_eq_zero_of_aeval_mk'_eq_zero ?_ rw [mk'_num_den] exact hr
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
num_isRoot_scaleRoots_of_aeval_eq_zero
null
num_dvd_of_is_root {p : A[X]} {r : K} (hr : aeval r p = 0) : num A r ∣ p.coeff 0 := by suffices num A r ∣ (scaleRoots p (den A r)).coeff 0 by simp only [coeff_scaleRoots, tsub_zero] at this haveI inst := Classical.propDecidable by_cases hr : num A r = 0 · simp_all [nonZeroDivisors.coe_ne_zero] · refine dvd_of_dvd_mul_left_of_no_prime_factors hr ?_ this intro q dvd_num dvd_denom_pow hq apply hq.not_unit exact num_den_reduced A r dvd_num (hq.dvd_of_dvd_pow dvd_denom_pow) convert dvd_term_of_isRoot_of_dvd_terms 0 (num_isRoot_scaleRoots_of_aeval_eq_zero hr) _ · rw [pow_zero, mul_one] intro j hj apply dvd_mul_of_dvd_right convert pow_dvd_pow (num A r) (Nat.succ_le_of_lt (bot_lt_iff_ne_bot.mpr hj)) exact (pow_one _).symm
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
num_dvd_of_is_root
**Rational root theorem** part 1: if `r : f.codomain` is a root of a polynomial over the ufd `A`, then the numerator of `r` divides the constant coefficient
den_dvd_of_is_root {p : A[X]} {r : K} (hr : aeval r p = 0) : (den A r : A) ∣ p.leadingCoeff := by suffices (den A r : A) ∣ p.leadingCoeff * num A r ^ p.natDegree by refine dvd_of_dvd_mul_left_of_no_prime_factors (mem_nonZeroDivisors_iff_ne_zero.mp (den A r).2) ?_ this intro q dvd_den dvd_num_pow hq apply hq.not_unit exact num_den_reduced A r (hq.dvd_of_dvd_pow dvd_num_pow) dvd_den rw [← coeff_scaleRoots_natDegree] apply dvd_term_of_isRoot_of_dvd_terms _ (num_isRoot_scaleRoots_of_aeval_eq_zero hr) intro j hj by_cases h : j < p.natDegree · rw [coeff_scaleRoots] refine (dvd_mul_of_dvd_right ?_ _).mul_right _ convert pow_dvd_pow (den A r : A) (Nat.succ_le_iff.mpr (lt_tsub_iff_left.mpr _)) · exact (pow_one _).symm simpa using h rw [← natDegree_scaleRoots p (den A r)] at * rw [coeff_eq_zero_of_natDegree_lt (lt_of_le_of_ne (le_of_not_gt h) hj.symm), zero_mul] exact dvd_zero _
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
den_dvd_of_is_root
Rational root theorem part 2: if `r : f.codomain` is a root of a polynomial over the ufd `A`, then the denominator of `r` divides the leading coefficient
isInteger_of_is_root_of_monic {p : A[X]} (hp : Monic p) {r : K} (hr : aeval r p = 0) : IsInteger A r := isInteger_of_isUnit_den (isUnit_of_dvd_one (hp ▸ den_dvd_of_is_root hr))
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
isInteger_of_is_root_of_monic
**Integral root theorem**: if `r : f.codomain` is a root of a monic polynomial over the ufd `A`, then `r` is an integer
exists_integer_of_is_root_of_monic {p : A[X]} (hp : Monic p) {r : K} (hr : aeval r p = 0) : ∃ r' : A, r = algebraMap A K r' ∧ r' ∣ p.coeff 0 := by /- I tried deducing this from above by unwrapping IsInteger, but the divisibility condition is annoying -/ obtain ⟨inv, h_inv⟩ := hp ▸ den_dvd_of_is_root hr use num A r * inv, ?_ · have h : inv ∣ 1 := ⟨den A r, by simpa [mul_comm] using h_inv⟩ simpa using mul_dvd_mul (num_dvd_of_is_root hr) h · have d_ne_zero : algebraMap A K (den A r) ≠ 0 := IsFractionRing.to_map_ne_zero_of_mem_nonZeroDivisors (den A r).prop nth_rw 1 [← mk'_num_den' A r] rw [div_eq_iff d_ne_zero, map_mul, mul_assoc, mul_comm ((algebraMap A K) inv), ← map_mul, ← h_inv, map_one, mul_one]
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
exists_integer_of_is_root_of_monic
null
integer_of_integral {x : K} : IsIntegral A x → IsInteger A x := fun ⟨_, hp, hx⟩ => isInteger_of_is_root_of_monic hp hx
theorem
RingTheory
[ "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Localization.NumDen", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/RationalRoot.lean
integer_of_integral
null
noncomputable scaleRoots (p : R[X]) (s : R) : R[X] := ∑ i ∈ p.support, monomial i (p.coeff i * s ^ (p.natDegree - i)) @[simp]
def
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots
`scaleRoots p s` is a polynomial with root `r * s` for each root `r` of `p`.
coeff_scaleRoots (p : R[X]) (s : R) (i : ℕ) : (scaleRoots p s).coeff i = coeff p i * s ^ (p.natDegree - i) := by simp +contextual [scaleRoots, coeff_monomial]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
coeff_scaleRoots
null
coeff_scaleRoots_natDegree (p : R[X]) (s : R) : (scaleRoots p s).coeff p.natDegree = p.leadingCoeff := by rw [leadingCoeff, coeff_scaleRoots, tsub_self, pow_zero, mul_one] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
coeff_scaleRoots_natDegree
null
zero_scaleRoots (s : R) : scaleRoots 0 s = 0 := by ext simp
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
zero_scaleRoots
null
scaleRoots_ne_zero {p : R[X]} (hp : p ≠ 0) (s : R) : scaleRoots p s ≠ 0 := by intro h have : p.coeff p.natDegree ≠ 0 := mt leadingCoeff_eq_zero.mp hp have : (scaleRoots p s).coeff p.natDegree = 0 := congr_fun (congr_arg (coeff : R[X] → ℕ → R) h) p.natDegree rw [coeff_scaleRoots_natDegree] at this contradiction
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_ne_zero
null
support_scaleRoots_le (p : R[X]) (s : R) : (scaleRoots p s).support ≤ p.support := by intro simpa using left_ne_zero_of_mul
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
support_scaleRoots_le
null
support_scaleRoots_eq (p : R[X]) {s : R} (hs : s ∈ nonZeroDivisors R) : (scaleRoots p s).support = p.support := le_antisymm (support_scaleRoots_le p s) (by intro i simp only [coeff_scaleRoots, Polynomial.mem_support_iff] intro p_ne_zero ps_zero have := (pow_mem hs (p.natDegree - i)).2 _ ps_zero contradiction) @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
support_scaleRoots_eq
null
degree_scaleRoots (p : R[X]) {s : R} : degree (scaleRoots p s) = degree p := by haveI := Classical.propDecidable by_cases hp : p = 0 · rw [hp, zero_scaleRoots] refine le_antisymm (Finset.sup_mono (support_scaleRoots_le p s)) (degree_le_degree ?_) rw [coeff_scaleRoots_natDegree] intro h have := leadingCoeff_eq_zero.mp h contradiction @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
degree_scaleRoots
null
natDegree_scaleRoots (p : R[X]) (s : R) : natDegree (scaleRoots p s) = natDegree p := by simp only [natDegree, degree_scaleRoots]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
natDegree_scaleRoots
null
monic_scaleRoots_iff {p : R[X]} (s : R) : Monic (scaleRoots p s) ↔ Monic p := by simp only [Monic, leadingCoeff, natDegree_scaleRoots, coeff_scaleRoots_natDegree]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
monic_scaleRoots_iff
null
map_scaleRoots (p : R[X]) (x : R) (f : R →+* S) (h : f p.leadingCoeff ≠ 0) : (p.scaleRoots x).map f = (p.map f).scaleRoots (f x) := by ext simp [Polynomial.natDegree_map_of_leadingCoeff_ne_zero _ h] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
map_scaleRoots
null
scaleRoots_C (r c : R) : (C c).scaleRoots r = C c := by ext; simp @[simp]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_C
null
scaleRoots_one (p : R[X]) : p.scaleRoots 1 = p := by ext; simp @[simp]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_one
null
scaleRoots_zero (p : R[X]) : p.scaleRoots 0 = p.leadingCoeff • X ^ p.natDegree := by ext n simp only [coeff_scaleRoots, tsub_eq_zero_iff_le, zero_pow_eq, mul_ite, mul_one, mul_zero, coeff_smul, coeff_X_pow, smul_eq_mul] split_ifs with h₁ h₂ h₂ · subst h₂; rfl · exact coeff_eq_zero_of_natDegree_lt (lt_of_le_of_ne h₁ (Ne.symm h₂)) · exact (h₁ h₂.ge).elim · rfl @[simp]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_zero
null
one_scaleRoots (r : R) : (1 : R[X]).scaleRoots r = 1 := by ext; simp
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
one_scaleRoots
null
scaleRoots_eval₂_mul_of_commute {p : S[X]} (f : S →+* A) (a : A) (s : S) (hsa : Commute (f s) a) (hf : ∀ s₁ s₂, Commute (f s₁) (f s₂)) : eval₂ f (f s * a) (scaleRoots p s) = f s ^ p.natDegree * eval₂ f a p := by calc _ = (scaleRoots p s).support.sum fun i => f (coeff p i * s ^ (p.natDegree - i)) * (f s * a) ^ i := by simp [eval₂_eq_sum, sum_def] _ = p.support.sum fun i => f (coeff p i * s ^ (p.natDegree - i)) * (f s * a) ^ i := (Finset.sum_subset (support_scaleRoots_le p s) fun i _hi hi' => by let this : coeff p i * s ^ (p.natDegree - i) = 0 := by simpa using hi' simp [this]) _ = p.support.sum fun i : ℕ => f (p.coeff i) * f s ^ (p.natDegree - i + i) * a ^ i := (Finset.sum_congr rfl fun i _hi => by simp_rw [f.map_mul, f.map_pow, pow_add, hsa.mul_pow, mul_assoc]) _ = p.support.sum fun i : ℕ => f s ^ p.natDegree * (f (p.coeff i) * a ^ i) := Finset.sum_congr rfl fun i hi => by rw [mul_assoc, ← map_pow, (hf _ _).left_comm, map_pow, tsub_add_cancel_of_le] exact le_natDegree_of_ne_zero (Polynomial.mem_support_iff.mp hi) _ = f s ^ p.natDegree * eval₂ f a p := by simp [← Finset.mul_sum, eval₂_eq_sum, sum_def]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_eval₂_mul_of_commute
null
scaleRoots_eval₂_mul {p : S[X]} (f : S →+* R) (r : R) (s : S) : eval₂ f (f s * r) (scaleRoots p s) = f s ^ p.natDegree * eval₂ f r p := scaleRoots_eval₂_mul_of_commute f r s (mul_comm _ _) fun _ _ ↦ mul_comm _ _
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_eval₂_mul
null
scaleRoots_eval₂_eq_zero {p : S[X]} (f : S →+* R) {r : R} {s : S} (hr : eval₂ f r p = 0) : eval₂ f (f s * r) (scaleRoots p s) = 0 := by rw [scaleRoots_eval₂_mul, hr, mul_zero]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_eval₂_eq_zero
null
scaleRoots_aeval_eq_zero [Algebra R A] {p : R[X]} {a : A} {r : R} (ha : aeval a p = 0) : aeval (algebraMap R A r * a) (scaleRoots p r) = 0 := by rw [aeval_def, scaleRoots_eval₂_mul_of_commute, ← aeval_def, ha, mul_zero] · apply Algebra.commutes · intros; rw [Commute, SemiconjBy, ← map_mul, ← map_mul, mul_comm]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_aeval_eq_zero
null
scaleRoots_eval₂_eq_zero_of_eval₂_div_eq_zero {p : S[X]} {f : S →+* K} (hf : Function.Injective f) {r s : S} (hr : eval₂ f (f r / f s) p = 0) (hs : s ∈ nonZeroDivisors S) : eval₂ f (f r) (scaleRoots p s) = 0 := by nontriviality S using Subsingleton.eq_zero (_ : S) convert @scaleRoots_eval₂_eq_zero _ _ _ _ p f _ s hr rw [← mul_div_assoc, mul_comm, mul_div_cancel_right₀] exact map_ne_zero_of_mem_nonZeroDivisors _ hf hs
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_eval₂_eq_zero_of_eval₂_div_eq_zero
null
scaleRoots_aeval_eq_zero_of_aeval_div_eq_zero [Algebra R K] (inj : Function.Injective (algebraMap R K)) {p : R[X]} {r s : R} (hr : aeval (algebraMap R K r / algebraMap R K s) p = 0) (hs : s ∈ nonZeroDivisors R) : aeval (algebraMap R K r) (scaleRoots p s) = 0 := scaleRoots_eval₂_eq_zero_of_eval₂_div_eq_zero inj hr hs @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_aeval_eq_zero_of_aeval_div_eq_zero
null
scaleRoots_mul (p : R[X]) (r s) : p.scaleRoots (r * s) = (p.scaleRoots r).scaleRoots s := by ext; simp [mul_pow, mul_assoc]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_mul
null
mul_scaleRoots (p q : R[X]) (r : R) : r ^ (natDegree p + natDegree q - natDegree (p * q)) • (p * q).scaleRoots r = p.scaleRoots r * q.scaleRoots r := by ext n; simp only [coeff_scaleRoots, coeff_smul, smul_eq_mul] trans (∑ x ∈ Finset.antidiagonal n, coeff p x.1 * coeff q x.2) * r ^ (natDegree p + natDegree q - n) · rw [← coeff_mul] cases lt_or_ge (natDegree (p * q)) n with | inl h => simp only [coeff_eq_zero_of_natDegree_lt h, zero_mul, mul_zero] | inr h => rw [mul_comm, mul_assoc, ← pow_add, add_comm, tsub_add_tsub_cancel natDegree_mul_le h] · rw [coeff_mul, Finset.sum_mul] apply Finset.sum_congr rfl simp only [Finset.mem_antidiagonal, coeff_scaleRoots, Prod.forall] intro a b e cases lt_or_ge (natDegree p) a with | inl h => simp only [coeff_eq_zero_of_natDegree_lt h, zero_mul] | inr ha => cases lt_or_ge (natDegree q) b with | inl h => simp only [coeff_eq_zero_of_natDegree_lt h, zero_mul, mul_zero] | inr hb => simp only [← e, mul_assoc, mul_comm (r ^ (_ - a)), ← pow_add] rw [add_comm (_ - _), tsub_add_tsub_comm ha hb]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
mul_scaleRoots
Multiplication and `scaleRoots` commute up to a power of `r`. The factor disappears if we assume that the product of the leading coeffs does not vanish. See `Polynomial.mul_scaleRoots'`.
mul_scaleRoots' (p q : R[X]) (r : R) (h : leadingCoeff p * leadingCoeff q ≠ 0) : (p * q).scaleRoots r = p.scaleRoots r * q.scaleRoots r := by rw [← mul_scaleRoots, natDegree_mul' h, tsub_self, pow_zero, one_smul]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
mul_scaleRoots'
null
mul_scaleRoots_of_noZeroDivisors (p q : R[X]) (r : R) [NoZeroDivisors R] : (p * q).scaleRoots r = p.scaleRoots r * q.scaleRoots r := by by_cases hp : p = 0; · simp [hp] by_cases hq : q = 0; · simp [hq] apply mul_scaleRoots' simp only [ne_eq, mul_eq_zero, leadingCoeff_eq_zero, hp, hq, or_self, not_false_eq_true]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
mul_scaleRoots_of_noZeroDivisors
null
add_scaleRoots_of_natDegree_eq (p q : R[X]) (r : R) (h : natDegree p = natDegree q) : r ^ (natDegree p - natDegree (p + q)) • (p + q).scaleRoots r = p.scaleRoots r + q.scaleRoots r := by ext n; simp only [coeff_smul, coeff_scaleRoots, coeff_add, smul_eq_mul, mul_comm (r ^ _), ← h, ← add_mul] #adaptation_note /-- v4.7.0-rc1 Previously `mul_assoc` was part of the `simp only` above, and this `rw` was not needed. but this now causes a max rec depth error. -/ rw [mul_assoc, ← pow_add] cases lt_or_ge (natDegree (p + q)) n with | inl hn => simp only [← coeff_add, coeff_eq_zero_of_natDegree_lt hn, zero_mul] | inr hn => rw [add_comm (_ - n), tsub_add_tsub_cancel (natDegree_add_le_of_degree_le le_rfl h.ge) hn]
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
add_scaleRoots_of_natDegree_eq
null
scaleRoots_dvd' (p q : R[X]) {r : R} (hr : IsUnit r) (hpq : p ∣ q) : p.scaleRoots r ∣ q.scaleRoots r := by obtain ⟨a, rfl⟩ := hpq rw [← ((hr.pow (natDegree p + natDegree a - natDegree (p * a))).map (algebraMap R R[X])).dvd_mul_left, ← Algebra.smul_def, mul_scaleRoots] exact dvd_mul_right (scaleRoots p r) (scaleRoots a r)
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_dvd'
null
scaleRoots_dvd (p q : R[X]) {r : R} [NoZeroDivisors R] (hpq : p ∣ q) : p.scaleRoots r ∣ q.scaleRoots r := by obtain ⟨a, rfl⟩ := hpq rw [mul_scaleRoots_of_noZeroDivisors] exact dvd_mul_right (scaleRoots p r) (scaleRoots a r) alias _root_.Dvd.dvd.scaleRoots := scaleRoots_dvd
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_dvd
null
scaleRoots_dvd_iff (p q : R[X]) {r : R} (hr : IsUnit r) : p.scaleRoots r ∣ q.scaleRoots r ↔ p ∣ q := by refine ⟨?_ ∘ scaleRoots_dvd' _ _ (hr.unit⁻¹).isUnit, scaleRoots_dvd' p q hr⟩ simp [← scaleRoots_mul, scaleRoots_one] alias _root_.IsUnit.scaleRoots_dvd_iff := scaleRoots_dvd_iff
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
scaleRoots_dvd_iff
null
isCoprime_scaleRoots (p q : R[X]) (r : R) (hr : IsUnit r) (h : IsCoprime p q) : IsCoprime (p.scaleRoots r) (q.scaleRoots r) := by obtain ⟨a, b, e⟩ := h let s : R := ↑hr.unit⁻¹ have : natDegree (a * p) = natDegree (b * q) := by apply natDegree_eq_of_natDegree_add_eq_zero rw [e, natDegree_one] use s ^ natDegree (a * p) • s ^ (natDegree a + natDegree p - natDegree (a * p)) • a.scaleRoots r use s ^ natDegree (a * p) • s ^ (natDegree b + natDegree q - natDegree (b * q)) • b.scaleRoots r simp only [s, smul_mul_assoc, ← mul_scaleRoots, smul_smul, mul_assoc, ← mul_pow, IsUnit.val_inv_mul, one_pow, mul_one, ← smul_add, one_smul, e, natDegree_one, one_scaleRoots, ← add_scaleRoots_of_natDegree_eq _ _ _ this, tsub_zero] alias _root_.IsCoprime.scaleRoots := isCoprime_scaleRoots
lemma
RingTheory
[ "Mathlib.Algebra.GroupWithZero.NonZeroDivisors", "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.RingTheory.Coprime.Basic", "Mathlib.Tactic.AdaptationNote" ]
Mathlib/RingTheory/Polynomial/ScaleRoots.lean
isCoprime_scaleRoots
null
X_pow_sub_X_sub_one_irreducible_aux (z : ℂ) : ¬(z ^ n = z + 1 ∧ z ^ n + z ^ 2 = 0) := by rintro ⟨h1, h2⟩ replace h3 : z ^ 3 = 1 := by linear_combination (1 - z - z ^ 2 - z ^ n) * h1 + (z ^ n - 2) * h2 have key : z ^ n = 1 ∨ z ^ n = z ∨ z ^ n = z ^ 2 := by rw [← Nat.mod_add_div n 3, pow_add, pow_mul, h3, one_pow, mul_one] have : n % 3 < 3 := Nat.mod_lt n zero_lt_three interval_cases n % 3 <;> simp only [pow_zero, pow_one, or_true, true_or] have z_ne_zero : z ≠ 0 := fun h => zero_ne_one ((zero_pow three_ne_zero).symm.trans (show (0 : ℂ) ^ 3 = 1 from h ▸ h3)) rcases key with (key | key | key) · exact z_ne_zero (by rwa [key, right_eq_add] at h1) · exact one_ne_zero (by rwa [key, left_eq_add] at h1) · exact z_ne_zero (pow_eq_zero (by rwa [key, add_self_eq_zero] at h2))
theorem
RingTheory
[ "Mathlib.Analysis.Complex.Polynomial.UnitTrinomial", "Mathlib.RingTheory.Polynomial.GaussLemma", "Mathlib.Tactic.LinearCombination" ]
Mathlib/RingTheory/Polynomial/Selmer.lean
X_pow_sub_X_sub_one_irreducible_aux
null
X_pow_sub_X_sub_one_irreducible (hn1 : n ≠ 1) : Irreducible (X ^ n - X - 1 : ℤ[X]) := by by_cases hn0 : n = 0 · rw [hn0, pow_zero, sub_sub, add_comm, ← sub_sub, sub_self, zero_sub] exact Associated.irreducible ⟨-1, mul_neg_one X⟩ irreducible_X have hn : 1 < n := Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn0, hn1⟩ have hp : (X ^ n - X - 1 : ℤ[X]) = trinomial 0 1 n (-1) (-1) 1 := by simp only [trinomial, C_neg, C_1]; ring rw [hp] apply IsUnitTrinomial.irreducible_of_coprime' ⟨0, 1, n, zero_lt_one, hn, -1, -1, 1, rfl⟩ rintro z ⟨h1, h2⟩ apply X_pow_sub_X_sub_one_irreducible_aux (n := n) z rw [trinomial_mirror zero_lt_one hn (-1 : ℤˣ).ne_zero (1 : ℤˣ).ne_zero] at h2 simp_rw [trinomial, aeval_add, aeval_mul, aeval_X_pow, aeval_C, Units.val_neg, Units.val_one, map_neg, map_one] at h1 h2 replace h1 : z ^ n = z + 1 := by linear_combination h1 replace h2 := mul_eq_zero_of_left h2 z rw [add_mul, add_mul, add_zero, mul_assoc (-1 : ℂ), ← pow_succ, Nat.sub_add_cancel hn.le] at h2 rw [h1] at h2 ⊢ exact ⟨rfl, by linear_combination -h2⟩
theorem
RingTheory
[ "Mathlib.Analysis.Complex.Polynomial.UnitTrinomial", "Mathlib.RingTheory.Polynomial.GaussLemma", "Mathlib.Tactic.LinearCombination" ]
Mathlib/RingTheory/Polynomial/Selmer.lean
X_pow_sub_X_sub_one_irreducible
null
X_pow_sub_X_sub_one_irreducible_rat (hn1 : n ≠ 1) : Irreducible (X ^ n - X - 1 : ℚ[X]) := by by_cases hn0 : n = 0 · rw [hn0, pow_zero, sub_sub, add_comm, ← sub_sub, sub_self, zero_sub] exact Associated.irreducible ⟨-1, mul_neg_one X⟩ irreducible_X have hp : (X ^ n - X - 1 : ℤ[X]) = trinomial 0 1 n (-1) (-1) 1 := by simp only [trinomial, C_neg, C_1]; ring have hn : 1 < n := Nat.one_lt_iff_ne_zero_and_ne_one.mpr ⟨hn0, hn1⟩ have h := (IsPrimitive.Int.irreducible_iff_irreducible_map_cast ?_).mp (X_pow_sub_X_sub_one_irreducible hn1) · rwa [Polynomial.map_sub, Polynomial.map_sub, Polynomial.map_pow, Polynomial.map_one, Polynomial.map_X] at h · exact hp.symm ▸ (trinomial_monic zero_lt_one hn).isPrimitive
theorem
RingTheory
[ "Mathlib.Analysis.Complex.Polynomial.UnitTrinomial", "Mathlib.RingTheory.Polynomial.GaussLemma", "Mathlib.Tactic.LinearCombination" ]
Mathlib/RingTheory/Polynomial/Selmer.lean
X_pow_sub_X_sub_one_irreducible_rat
null
IsSeparableContraction (f : F[X]) (g : F[X]) : Prop := g.Separable ∧ ∃ m : ℕ, expand F (q ^ m) g = f
def
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
IsSeparableContraction
A separable contraction of a polynomial `f` is a separable polynomial `g` such that `g(x^(q^m)) = f(x)` for some `m : ℕ`.
HasSeparableContraction (f : F[X]) : Prop := ∃ g : F[X], IsSeparableContraction q f g variable {q} {f : F[X]} (hf : HasSeparableContraction q f)
def
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction
The condition of having a separable contraction.
HasSeparableContraction.contraction : F[X] := Classical.choose hf
def
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.contraction
A choice of a separable contraction.
HasSeparableContraction.degree : ℕ := hf.contraction.natDegree
def
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.degree
The separable degree of a polynomial is the degree of a given separable contraction.
HasSeparableContraction.isSeparableContraction : IsSeparableContraction q f hf.contraction := Classical.choose_spec hf
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.isSeparableContraction
The `HasSeparableContraction.contraction` is indeed a separable contraction.
IsSeparableContraction.dvd_degree' {g} (hf : IsSeparableContraction q f g) : ∃ m : ℕ, g.natDegree * q ^ m = f.natDegree := by obtain ⟨m, rfl⟩ := hf.2 use m rw [natDegree_expand]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
IsSeparableContraction.dvd_degree'
The separable degree divides the degree, in function of the exponential characteristic of F.
HasSeparableContraction.dvd_degree' : ∃ m : ℕ, hf.degree * q ^ m = f.natDegree := (Classical.choose_spec hf).dvd_degree'
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.dvd_degree'
null
HasSeparableContraction.dvd_degree : hf.degree ∣ f.natDegree := let ⟨a, ha⟩ := hf.dvd_degree' Dvd.intro (q ^ a) ha
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.dvd_degree
The separable degree divides the degree.
HasSeparableContraction.eq_degree {f : F[X]} (hf : HasSeparableContraction 1 f) : hf.degree = f.natDegree := by let ⟨a, ha⟩ := hf.dvd_degree' rw [← ha, one_pow a, mul_one]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
HasSeparableContraction.eq_degree
In exponential characteristic one, the separable degree equals the degree.
@[stacks 09H0] _root_.Irreducible.hasSeparableContraction (q : ℕ) [hF : ExpChar F q] {f : F[X]} (irred : Irreducible f) : HasSeparableContraction q f := by cases hF · exact ⟨f, irred.separable, ⟨0, by rw [pow_zero, expand_one]⟩⟩ · rcases exists_separable_of_irreducible q irred ‹q.Prime›.ne_zero with ⟨n, g, hgs, hge⟩ exact ⟨g, hgs, n, hge⟩
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
_root_.Irreducible.hasSeparableContraction
Every irreducible polynomial can be contracted to a separable polynomial.
contraction_degree_eq_or_insep [hq : NeZero q] [CharP F q] (g g' : F[X]) (m m' : ℕ) (h_expand : expand F (q ^ m) g = expand F (q ^ m') g') (hg : g.Separable) (hg' : g'.Separable) : g.natDegree = g'.natDegree := by wlog hm : m ≤ m' · exact (this q g' g m' m h_expand.symm hg' hg (le_of_not_ge hm)).symm obtain ⟨s, rfl⟩ := exists_add_of_le hm rw [pow_add, expand_mul, expand_inj (pow_pos (NeZero.pos q) m)] at h_expand subst h_expand rcases isUnit_or_eq_zero_of_separable_expand q s (NeZero.pos q) hg with (h | rfl) · rw [natDegree_expand, natDegree_eq_zero_of_isUnit h, zero_mul] · rw [natDegree_expand, pow_zero, mul_one]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
contraction_degree_eq_or_insep
If two expansions (along the positive characteristic) of two separable polynomials `g` and `g'` agree, then they have the same degree.
IsSeparableContraction.degree_eq [hF : ExpChar F q] (g : F[X]) (hg : IsSeparableContraction q f g) : g.natDegree = hf.degree := by cases hF · rcases hg with ⟨_, m, hm⟩ rw [one_pow, expand_one] at hm rw [hf.eq_degree, hm] · rcases hg with ⟨hg, m, hm⟩ let g' := Classical.choose hf obtain ⟨hg', m', hm'⟩ := Classical.choose_spec hf haveI : Fact q.Prime := ⟨by assumption⟩ refine contraction_degree_eq_or_insep q g g' m m' ?_ hg hg' rw [hm, hm']
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Defs", "Mathlib.FieldTheory.Separable" ]
Mathlib/RingTheory/Polynomial/SeparableDegree.lean
IsSeparableContraction.degree_eq
The separable degree equals the degree of any separable contraction, i.e., it is unique.
noncomputable shiftedLegendre (n : ℕ) : ℤ[X] := ∑ k ∈ Finset.range (n + 1), C ((-1 : ℤ) ^ k * n.choose k * (n + k).choose n) * X ^ k
def
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
shiftedLegendre
`shiftedLegendre n` is an integer polynomial for each `n : ℕ`, defined by: `Pₙ(x) = ∑ k ∈ Finset.range (n + 1), (-1)ᵏ * choose n k * choose (n + k) n * xᵏ` These polynomials appear in combinatorics and the theory of orthogonal polynomials.
factorial_mul_shiftedLegendre_eq (n : ℕ) : (n ! : ℤ[X]) * (shiftedLegendre n) = derivative^[n] (X ^ n * (1 - (X : ℤ[X])) ^ n) := by symm calc _ = derivative^[n] (((X : ℤ[X]) - X ^ 2) ^ n) := by rw [← mul_pow, mul_one_sub, ← pow_two] _ = derivative^[n] (∑ m ∈ range (n + 1), n.choose m • (-1) ^ m * X ^ (n + m)) := by congr rw [sub_eq_add_neg, add_comm, add_pow] congr! 1 with m hm rw [neg_pow, pow_two, mul_pow, ← mul_assoc, mul_comm, mul_assoc, pow_mul_pow_sub, mul_assoc, ← pow_add, ← mul_assoc, nsmul_eq_mul, add_comm] rw [Finset.mem_range] at hm linarith _ = ∑ x ∈ range (n + 1), ↑((n + x)! / x !) * C (↑(n.choose x) * (-1) ^ x) * X ^ x := by rw [iterate_derivative_sum] congr! 1 with x _ rw [show (n.choose x • (-1) ^ x : ℤ[X]) = C (n.choose x • (-1) ^ x) by simp, iterate_derivative_C_mul, iterate_derivative_X_pow_eq_smul, descFactorial_eq_div (by cutsat), show n + x - n = x by cutsat] simp only [Int.reduceNeg, nsmul_eq_mul, eq_intCast, Int.cast_mul, Int.cast_natCast, Int.cast_pow, Int.cast_neg, Int.cast_one, zsmul_eq_mul] ring _ = ∑ i ∈ range (n + 1), ↑n ! * C ((-1) ^ i * ↑(n.choose i) * ↑((n + i).choose n)) * X ^ i := by congr! 2 with x _ rw [C_mul (b := ((n + x).choose n : ℤ)), mul_comm, mul_comm (n ! : ℤ[X]), mul_comm _ ((-1) ^ x), mul_assoc] congr 1 rw [add_comm, add_choose] simp only [Int.natCast_ediv, cast_mul, eq_intCast] norm_cast rw [mul_comm, ← Nat.mul_div_assoc] · rw [mul_comm, Nat.mul_div_mul_right _ _ (by positivity)] · simp only [factorial_mul_factorial_dvd_factorial_add] _ = (n ! : ℤ[X]) * (shiftedLegendre n) := by simp [← mul_assoc, shiftedLegendre, mul_sum]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
factorial_mul_shiftedLegendre_eq
The shifted Legendre polynomial multiplied by a factorial equals the higher-order derivative of the combinatorial function `X ^ n * (1 - X) ^ n`. This is the analogue of Rodrigues' formula for the shifted Legendre polynomials.
coeff_shiftedLegendre (n k : ℕ) : (shiftedLegendre n).coeff k = (-1) ^ k * n.choose k * (n + k).choose n := by rw [shiftedLegendre, finset_sum_coeff] simp_rw [coeff_C_mul_X_pow] simp +contextual [choose_eq_zero_of_lt, add_one_le_iff]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
coeff_shiftedLegendre
The coefficient of the shifted Legendre polynomial at `k` is `(-1) ^ k * (n.choose k) * (n + k).choose n`.
@[simp] degree_shiftedLegendre (n : ℕ) : (shiftedLegendre n).degree = n := by refine le_antisymm ?_ (le_degree_of_ne_zero ?_) · rw [degree_le_iff_coeff_zero] intro k h norm_cast at h simp [coeff_shiftedLegendre, choose_eq_zero_of_lt h] · simp [coeff_shiftedLegendre, (choose_pos (show n ≤ n + n by simp)).ne'] @[simp] theorem natDegree_shiftedLegendre (n : ℕ) : (shiftedLegendre n).natDegree = n := natDegree_eq_of_degree_eq_some (degree_shiftedLegendre n)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
degree_shiftedLegendre
The degree of `shiftedLegendre n` is `n`.
neg_one_pow_mul_shiftedLegendre_comp_one_sub_X_eq (n : ℕ) : (-1) ^ n * (shiftedLegendre n).comp (1 - X) = shiftedLegendre n := by refine nat_mul_inj' ?_ (factorial_ne_zero n) rw [← mul_assoc, mul_comm (n ! : ℤ[X]), mul_assoc, ← natCast_mul_comp, factorial_mul_shiftedLegendre_eq, ← iterate_derivative_comp_one_sub_X] simp [mul_comm]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
neg_one_pow_mul_shiftedLegendre_comp_one_sub_X_eq
null
shiftedLegendre_eval_symm (n : ℕ) {R : Type*} [Ring R] (x : R) : aeval x (shiftedLegendre n) = (-1) ^ n * aeval (1 - x) (shiftedLegendre n) := by have := congr(aeval x $(neg_one_pow_mul_shiftedLegendre_comp_one_sub_X_eq n)) simpa [aeval_comp] using this.symm
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative" ]
Mathlib/RingTheory/Polynomial/ShiftedLegendre.lean
shiftedLegendre_eval_symm
The values ​​of the Legendre polynomial at `x` and `1 - x` differ by a factor `(-1)ⁿ`.
eq_neg_mul_add_of_roots_quadratic_eq_pair [CommRing R] [IsDomain R] {a b c x1 x2 : R} (hroots : (C a * X ^ 2 + C b * X + C c).roots = {x1, x2}) : b = -a * (x1 + x2) := by let p : R[X] := C a * X ^ 2 + C b * X + C c have hp_natDegree : p.natDegree = 2 := le_antisymm natDegree_quadratic_le (by convert p.card_roots'; rw [hroots, Multiset.card_pair]) have hp_roots_card : p.roots.card = p.natDegree := by rw [hp_natDegree, hroots, Multiset.card_pair] simpa [leadingCoeff, hp_natDegree, p, hroots, mul_assoc, add_comm x1] using coeff_eq_esymm_roots_of_card hp_roots_card (k := 1) (by simp [hp_natDegree])
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
eq_neg_mul_add_of_roots_quadratic_eq_pair
**Vieta's formula** for quadratics.
eq_mul_mul_of_roots_quadratic_eq_pair [CommRing R] [IsDomain R] {a b c x1 x2 : R} (hroots : (C a * X ^ 2 + C b * X + C c).roots = {x1, x2}) : c = a * x1 * x2 := by let p : R[X] := C a * X ^ 2 + C b * X + C c have hp_natDegree : p.natDegree = 2 := le_antisymm natDegree_quadratic_le (by convert p.card_roots'; rw [hroots, Multiset.card_pair]) have hp_roots_card : p.roots.card = p.natDegree := by rw [hp_natDegree, hroots, Multiset.card_pair] simpa [leadingCoeff, hp_natDegree, p, hroots, mul_assoc, add_comm x1] using coeff_eq_esymm_roots_of_card hp_roots_card (k := 0) (by simp [hp_natDegree])
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
eq_mul_mul_of_roots_quadratic_eq_pair
**Vieta's formula** for quadratics.
eq_neg_mul_add_of_aroots_quadratic_eq_pair [CommRing T] [CommRing S] [IsDomain S] [Algebra T S] {a b c : T} {x1 x2 : S} (haroots : (C a * X ^ 2 + C b * X + C c).aroots S = {x1, x2}) : algebraMap T S b = -algebraMap T S a * (x1 + x2) := by rw [aroots_def, show map (algebraMap T S) (C a * X ^ 2 + C b * X + C c) = C ((algebraMap T S) a) * X ^ 2 + C ((algebraMap T S) b) * X + C ((algebraMap T S) c) by simp] at haroots exact eq_neg_mul_add_of_roots_quadratic_eq_pair haroots
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
eq_neg_mul_add_of_aroots_quadratic_eq_pair
**Vieta's formula** for quadratics (`aroots` version).
eq_mul_mul_of_aroots_quadratic_eq_pair [CommRing T] [CommRing S] [IsDomain S] [Algebra T S] {a b c : T} {x1 x2 : S} (haroots : (C a * X ^ 2 + C b * X + C c).aroots S = {x1, x2}) : algebraMap T S c = algebraMap T S a * x1 * x2 := by rw [aroots_def, show map (algebraMap T S) (C a * X ^ 2 + C b * X + C c) = C ((algebraMap T S) a) * X ^ 2 + C ((algebraMap T S) b) * X + C ((algebraMap T S) c) by simp] at haroots exact eq_mul_mul_of_roots_quadratic_eq_pair haroots
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
eq_mul_mul_of_aroots_quadratic_eq_pair
**Vieta's formula** for quadratics (`aroots` version).
roots_quadratic_eq_pair_iff_of_ne_zero [CommRing R] [IsDomain R] {a b c x1 x2 : R} (ha : a ≠ 0) : (C a * X ^ 2 + C b * X + C c).roots = {x1, x2} ↔ b = -a * (x1 + x2) ∧ c = a * x1 * x2 := have roots_of_ne_zero_of_vieta (hvieta : b = -a * (x1 + x2) ∧ c = a * x1 * x2) : (C a * X ^ 2 + C b * X + C c).roots = {x1, x2} := by suffices C a * X ^ 2 + C b * X + C c = C a * (X - C x1) * (X - C x2) by have h1 : C a * (X - C x1) ≠ 0 := mul_ne_zero (by simpa) (Polynomial.X_sub_C_ne_zero _) have h2 : C a * (X - C x1) * (X - C x2) ≠ 0 := mul_ne_zero h1 (Polynomial.X_sub_C_ne_zero _) simp [this, Polynomial.roots_mul h2, Polynomial.roots_mul h1] simpa [hvieta.1, hvieta.2] using by ring ⟨fun h => ⟨eq_neg_mul_add_of_roots_quadratic_eq_pair h, eq_mul_mul_of_roots_quadratic_eq_pair h⟩, roots_of_ne_zero_of_vieta⟩
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
roots_quadratic_eq_pair_iff_of_ne_zero
**Vieta's formula** for quadratics as an iff.
aroots_quadratic_eq_pair_iff_of_ne_zero [CommRing T] [CommRing S] [IsDomain S] [Algebra T S] {a b c : T} {x1 x2 : S} (ha : algebraMap T S a ≠ 0) : (C a * X ^ 2 + C b * X + C c).aroots S = {x1, x2} ↔ algebraMap T S b = -algebraMap T S a * (x1 + x2) ∧ algebraMap T S c = algebraMap T S a * x1 * x2 := by rw [aroots_def, show map (algebraMap T S) (C a * X ^ 2 + C b * X + C c) = C ((algebraMap T S) a) * X ^ 2 + C ((algebraMap T S) b) * X + C ((algebraMap T S) c) by simp] exact roots_quadratic_eq_pair_iff_of_ne_zero ha
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
aroots_quadratic_eq_pair_iff_of_ne_zero
**Vieta's formula** for quadratics as an iff (`aroots` version).
roots_quadratic_eq_pair_iff_of_ne_zero' [Field R] {a b c x1 x2 : R} (ha : a ≠ 0) : (C a * X ^ 2 + C b * X + C c).roots = {x1, x2} ↔ x1 + x2 = -b / a ∧ x1 * x2 = c / a := by rw [roots_quadratic_eq_pair_iff_of_ne_zero ha] field_simp exact and_congr ⟨fun h => by linear_combination h, fun h => by linear_combination h⟩ ⟨fun h => by linear_combination -h, fun h => by linear_combination -h⟩
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
roots_quadratic_eq_pair_iff_of_ne_zero'
**Vieta's formula** for quadratics as an iff (`Field` version).
aroots_quadratic_eq_pair_iff_of_ne_zero' [CommRing T] [Field S] [Algebra T S] {a b c : T} {x1 x2 : S} (ha : algebraMap T S a ≠ 0) : (C a * X ^ 2 + C b * X + C c).aroots S = {x1, x2} ↔ x1 + x2 = -algebraMap T S b / algebraMap T S a ∧ x1 * x2 = algebraMap T S c / algebraMap T S a := by rw [aroots_def, show map (algebraMap T S) (C a * X ^ 2 + C b * X + C c) = C ((algebraMap T S) a) * X ^ 2 + C ((algebraMap T S) b) * X + C ((algebraMap T S) c) by simp] exact roots_quadratic_eq_pair_iff_of_ne_zero' ha
lemma
RingTheory
[ "Mathlib.Tactic.FieldSimp", "Mathlib.Tactic.LinearCombination", "Mathlib.RingTheory.Polynomial.Vieta" ]
Mathlib/RingTheory/Polynomial/SmallDegreeVieta.lean
aroots_quadratic_eq_pair_iff_of_ne_zero'
**Vieta's formula** for quadratics as an iff (`aroots, Field` version).
@[simp] aeval_map_algebraMap (x : B) (p : R[X]) : aeval x (map (algebraMap R A) p) = aeval x p := by rw [aeval_def, aeval_def, eval₂_map, IsScalarTower.algebraMap_eq R A B]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Tower", "Mathlib.Algebra.Polynomial.AlgebraMap" ]
Mathlib/RingTheory/Polynomial/Tower.lean
aeval_map_algebraMap
null
aeval_algebraMap_apply (x : A) (p : R[X]) : aeval (algebraMap A B x) p = algebraMap A B (aeval x p) := by rw [aeval_def, aeval_def, hom_eval₂, ← IsScalarTower.algebraMap_eq] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Tower", "Mathlib.Algebra.Polynomial.AlgebraMap" ]
Mathlib/RingTheory/Polynomial/Tower.lean
aeval_algebraMap_apply
null
aeval_algebraMap_eq_zero_iff [NoZeroSMulDivisors A B] [Nontrivial B] (x : A) (p : R[X]) : aeval (algebraMap A B x) p = 0 ↔ aeval x p = 0 := by rw [aeval_algebraMap_apply, Algebra.algebraMap_eq_smul_one, smul_eq_zero, iff_false_intro (one_ne_zero' B), or_false] variable {B}
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Tower", "Mathlib.Algebra.Polynomial.AlgebraMap" ]
Mathlib/RingTheory/Polynomial/Tower.lean
aeval_algebraMap_eq_zero_iff
null
aeval_algebraMap_eq_zero_iff_of_injective {x : A} {p : R[X]} (h : Function.Injective (algebraMap A B)) : aeval (algebraMap A B x) p = 0 ↔ aeval x p = 0 := by rw [aeval_algebraMap_apply, ← (algebraMap A B).map_zero, h.eq_iff]
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Tower", "Mathlib.Algebra.Polynomial.AlgebraMap" ]
Mathlib/RingTheory/Polynomial/Tower.lean
aeval_algebraMap_eq_zero_iff_of_injective
null
@[simp] aeval_coe (S : Subalgebra R A) (x : S) (p : R[X]) : aeval (x : A) p = aeval x p := aeval_algebraMap_apply A x p
theorem
RingTheory
[ "Mathlib.Algebra.Algebra.Tower", "Mathlib.Algebra.Polynomial.AlgebraMap" ]
Mathlib/RingTheory/Polynomial/Tower.lean
aeval_coe
null
exists_irreducible_of_degree_pos (hf : 0 < f.degree) : ∃ g, Irreducible g ∧ g ∣ f := WfDvdMonoid.exists_irreducible_factor (fun huf => ne_of_gt hf <| degree_eq_zero_of_isUnit huf) fun hf0 => not_lt_of_gt hf <| hf0.symm ▸ (@degree_zero R _).symm ▸ WithBot.bot_lt_coe _
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
exists_irreducible_of_degree_pos
null
exists_irreducible_of_natDegree_pos (hf : 0 < f.natDegree) : ∃ g, Irreducible g ∧ g ∣ f := exists_irreducible_of_degree_pos <| by contrapose! hf exact natDegree_le_of_degree_le hf
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
exists_irreducible_of_natDegree_pos
null
exists_irreducible_of_natDegree_ne_zero (hf : f.natDegree ≠ 0) : ∃ g, Irreducible g ∧ g ∣ f := exists_irreducible_of_natDegree_pos <| Nat.pos_of_ne_zero hf
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
exists_irreducible_of_natDegree_ne_zero
null
noncomputable fintypeSubtypeMonicDvd (f : D[X]) (hf : f ≠ 0) : Fintype { g : D[X] // g.Monic ∧ g ∣ f } := by set G := { g : D[X] // g.Monic ∧ g ∣ f } let y : Associates D[X] := Associates.mk f have hy : y ≠ 0 := Associates.mk_ne_zero.mpr hf let H := { x : Associates D[X] // x ∣ y } let hfin : Fintype H := UniqueFactorizationMonoid.fintypeSubtypeDvd y hy let i : G → H := fun x ↦ ⟨Associates.mk x.1, Associates.mk_dvd_mk.2 x.2.2⟩ refine Fintype.ofInjective i fun x y heq ↦ ?_ rw [Subtype.mk.injEq] at heq ⊢ exact eq_of_monic_of_associated x.2.1 y.2.1 (Associates.mk_eq_mk_iff_associated.mp heq)
def
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
fintypeSubtypeMonicDvd
If `D` is a unique factorization domain, `f` is a non-zero polynomial in `D[X]`, then `f` has only finitely many monic factors. (Note that its factors up to unit may be more than monic factors.) See also `UniqueFactorizationMonoid.fintypeSubtypeDvd`.
private uniqueFactorizationMonoid_of_fintype [Fintype σ] : UniqueFactorizationMonoid (MvPolynomial σ D) := (renameEquiv D (Fintype.equivFin σ)).toMulEquiv.symm.uniqueFactorizationMonoid <| by induction Fintype.card σ with | zero => apply (isEmptyAlgEquiv D (Fin 0)).toMulEquiv.symm.uniqueFactorizationMonoid infer_instance | succ d hd => apply (finSuccEquiv D d).toMulEquiv.symm.uniqueFactorizationMonoid exact Polynomial.uniqueFactorizationMonoid
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
uniqueFactorizationMonoid_of_fintype
null
Polynomial.exists_monic_irreducible_factor {F : Type*} [Field F] (f : F[X]) (hu : ¬IsUnit f) : ∃ g : F[X], g.Monic ∧ Irreducible g ∧ g ∣ f := by by_cases hf : f = 0 · exact ⟨X, monic_X, irreducible_X, hf ▸ dvd_zero X⟩ obtain ⟨g, hi, hf⟩ := WfDvdMonoid.exists_irreducible_factor hu hf have ha : Associated g (g * C g.leadingCoeff⁻¹) := associated_mul_unit_right _ _ <| isUnit_C.2 (leadingCoeff_ne_zero.2 hi.ne_zero).isUnit.inv exact ⟨_, monic_mul_leadingCoeff_inv hi.ne_zero, ha.irreducible hi, ha.dvd_iff_dvd_left.1 hf⟩
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Basic", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.UniqueFactorizationDomain.Basic", "Mathlib.RingTheory.UniqueFactorizationDomain.Finite", "Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid" ]
Mathlib/RingTheory/Polynomial/UniqueFactorization.lean
Polynomial.exists_monic_irreducible_factor
A polynomial over a field which is not a unit must have a monic irreducible factor. See also `WfDvdMonoid.exists_irreducible_factor`.
prod_X_add_C_eq_sum_esymm (s : Multiset R) : (s.map fun r => X + C r).prod = ∑ j ∈ Finset.range (Multiset.card s + 1), (C (s.esymm j) * X ^ (Multiset.card s - j)) := by classical rw [prod_map_add, antidiagonal_eq_map_powerset, map_map, ← bind_powerset_len, map_bind, sum_bind, Finset.sum_eq_multiset_sum, Finset.range_val, map_congr (Eq.refl _)] intro _ _ rw [esymm, ← sum_hom', ← sum_map_mul_right, map_congr (Eq.refl _)] intro s ht rw [mem_powersetCard] at ht dsimp rw [prod_hom' s (Polynomial.C : R →+* R[X])] simp [ht, prod_replicate, map_id', card_sub]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
prod_X_add_C_eq_sum_esymm
A sum version of **Vieta's formula** for `Multiset`: the product of the linear terms `X + λ` where `λ` runs through a multiset `s` is equal to a linear combination of the symmetric functions `esymm s` of the `λ`'s .
prod_X_add_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun r => X + C r).prod.coeff k = s.esymm (Multiset.card s - k) := by convert Polynomial.ext_iff.mp (prod_X_add_C_eq_sum_esymm s) k using 1 simp_rw [finset_sum_coeff, coeff_C_mul_X_pow] rw [Finset.sum_eq_single_of_mem (Multiset.card s - k) _] <;> grind
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
prod_X_add_C_coeff
Vieta's formula for the coefficients of the product of linear terms `X + λ` where `λ` runs through a multiset `s` : the `k`th coefficient is the symmetric function `esymm (card s - k) s`.
prod_X_add_C_coeff' {σ} (s : Multiset σ) (r : σ → R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun i => X + C (r i)).prod.coeff k = (s.map r).esymm (Multiset.card s - k) := by rw [← Function.comp_def (f := fun r => X + C r) (g := r), ← map_map, prod_X_add_C_coeff] <;> rw [s.card_map r]; assumption
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
prod_X_add_C_coeff'
null
_root_.Finset.prod_X_add_C_coeff {σ} (s : Finset σ) (r : σ → R) {k : ℕ} (h : k ≤ #s) : (∏ i ∈ s, (X + C (r i))).coeff k = ∑ t ∈ s.powersetCard (#s - k), ∏ i ∈ t, r i := by rw [Finset.prod, prod_X_add_C_coeff' _ r h, Finset.esymm_map_val] rfl
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
_root_.Finset.prod_X_add_C_coeff
null
esymm_neg (s : Multiset R) (k : ℕ) : (map Neg.neg s).esymm k = (-1) ^ k * esymm s k := by rw [esymm, esymm, ← Multiset.sum_map_mul_left, Multiset.powersetCard_map, Multiset.map_map, map_congr rfl] intro x hx rw [(mem_powersetCard.mp hx).right.symm, ← prod_replicate, ← Multiset.map_const] nth_rw 3 [← map_id' x] rw [← prod_map_mul, map_congr rfl, Function.comp_apply] exact fun z _ => neg_one_mul z
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
esymm_neg
null
prod_X_sub_X_eq_sum_esymm (s : Multiset R) : (s.map fun t => X - C t).prod = ∑ j ∈ Finset.range (Multiset.card s + 1), (-1) ^ j * (C (s.esymm j) * X ^ (Multiset.card s - j)) := by conv_lhs => congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_eq_sum_esymm (map (fun t => -t) s) using 1 · rw [map_map]; rfl · simp only [esymm_neg, card_map, mul_assoc, map_mul, map_pow, map_neg, map_one]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
prod_X_sub_X_eq_sum_esymm
null
prod_X_sub_C_coeff (s : Multiset R) {k : ℕ} (h : k ≤ Multiset.card s) : (s.map fun t => X - C t).prod.coeff k = (-1) ^ (Multiset.card s - k) * s.esymm (Multiset.card s - k) := by conv_lhs => congr congr congr ext x rw [sub_eq_add_neg] rw [← map_neg C x] convert prod_X_add_C_coeff (map (fun t => -t) s) _ using 1 · rw [map_map]; rfl · rw [esymm_neg, card_map] · rwa [card_map]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
prod_X_sub_C_coeff
null
_root_.Polynomial.coeff_eq_esymm_roots_of_card [IsDomain R] {p : R[X]} (hroots : Multiset.card p.roots = p.natDegree) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := by conv_lhs => rw [← C_leadingCoeff_mul_prod_multiset_X_sub_C hroots] rw [coeff_C_mul, mul_assoc]; congr have : k ≤ card (roots p) := by rw [hroots]; exact h convert p.roots.prod_X_sub_C_coeff this using 3 <;> rw [hroots]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
_root_.Polynomial.coeff_eq_esymm_roots_of_card
Vieta's formula for the coefficients and the roots of a polynomial over an integral domain with as many roots as its degree.
_root_.Polynomial.coeff_eq_esymm_roots_of_splits {F} [Field F] {p : F[X]} (hsplit : p.Splits (RingHom.id F)) {k : ℕ} (h : k ≤ p.natDegree) : p.coeff k = p.leadingCoeff * (-1) ^ (p.natDegree - k) * p.roots.esymm (p.natDegree - k) := Polynomial.coeff_eq_esymm_roots_of_card (splits_iff_card_roots.1 hsplit) h
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
_root_.Polynomial.coeff_eq_esymm_roots_of_splits
Vieta's formula for split polynomials over a field.
MvPolynomial.prod_C_add_X_eq_sum_esymm : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i))) = ∑ j ∈ range (card σ + 1), Polynomial.C (MvPolynomial.esymm σ R j) * Polynomial.X ^ (card σ - j) := by let s := Finset.univ.val.map fun i : σ => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] simp_rw [this, MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_eq_sum_esymm s simp_rw [s, Multiset.map_map, Function.comp_apply]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
MvPolynomial.prod_C_add_X_eq_sum_esymm
A sum version of Vieta's formula for `MvPolynomial`: viewing `X i` as variables, the product of linear terms `λ + X i` is equal to a linear combination of the symmetric polynomials `esymm σ R j`.
MvPolynomial.prod_X_add_C_coeff (k : ℕ) (h : k ≤ card σ) : (∏ i : σ, (Polynomial.X + Polynomial.C (MvPolynomial.X i)) : Polynomial _).coeff k = MvPolynomial.esymm σ R (card σ - k) := by let s := Finset.univ.val.map fun i => (MvPolynomial.X i : MvPolynomial σ R) have : Fintype.card σ = Multiset.card s := by rw [Multiset.card_map, ← Finset.card_univ, Finset.card_def] rw [this] at h ⊢ rw [MvPolynomial.esymm_eq_multiset_esymm σ R, Finset.prod_eq_multiset_prod] convert Multiset.prod_X_add_C_coeff s h dsimp simp_rw [s, Multiset.map_map, Function.comp_apply]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Splits", "Mathlib.RingTheory.MvPolynomial.Symmetric.Defs" ]
Mathlib/RingTheory/Polynomial/Vieta.lean
MvPolynomial.prod_X_add_C_coeff
null
wronskian (a b : R[X]) : R[X] := a * (derivative b) - (derivative a) * b variable (R) in
def
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskian
Wronskian of a pair of polynomials, `W(a, b) = ab' - a'b`.
wronskianBilin : R[X] →ₗ[R] R[X] →ₗ[R] R[X] := (LinearMap.mul R R[X]).compl₂ derivative - (LinearMap.mul R R[X]).comp derivative @[simp]
def
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskianBilin
`Polynomial.wronskian` as a bilinear map.
wronskianBilin_apply (a b : R[X]) : wronskianBilin R a b = wronskian a b := rfl @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskianBilin_apply
null
wronskian_zero_left (a : R[X]) : wronskian 0 a = 0 := by rw [← wronskianBilin_apply 0 a, map_zero]; rfl @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskian_zero_left
null
wronskian_zero_right (a : R[X]) : wronskian a 0 = 0 := (wronskianBilin R a).map_zero
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskian_zero_right
null
wronskian_neg_left (a b : R[X]) : wronskian (-a) b = -wronskian a b := LinearMap.map_neg₂ (wronskianBilin R) a b
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskian_neg_left
null
wronskian_neg_right (a b : R[X]) : wronskian a (-b) = -wronskian a b := (wronskianBilin R a).map_neg b
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.AlgebraMap", "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.SesquilinearForm", "Mathlib.RingTheory.Coprime.Basic" ]
Mathlib/RingTheory/Polynomial/Wronskian.lean
wronskian_neg_right
null