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
cyclotomic.roots_eq_primitiveRoots_val [NeZero (n : R)] : (cyclotomic n R).roots = (primitiveRoots n R).val := by rw [← cyclotomic.roots_to_finset_eq_primitiveRoots]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic.roots_eq_primitiveRoots_val
null
isRoot_cyclotomic_iff_charZero {n : ℕ} {R : Type*} [CommRing R] [IsDomain R] [CharZero R] {μ : R} (hn : 0 < n) : (Polynomial.cyclotomic n R).IsRoot μ ↔ IsPrimitiveRoot μ n := letI := NeZero.of_gt hn isRoot_cyclotomic_iff
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
isRoot_cyclotomic_iff_charZero
If `R` is of characteristic zero, then `ζ` is a root of `cyclotomic n R` if and only if it is a primitive `n`-th root of unity.
cyclotomic_injective [CharZero R] : Function.Injective fun n => cyclotomic n R := by intro n m hnm simp only at hnm rcases eq_or_ne n 0 with (rfl | hzero) · rw [cyclotomic_zero] at hnm replace hnm := congr_arg natDegree hnm rwa [natDegree_one, natDegree_cyclotomic, eq_comm, Nat.totient_eq_zero, eq_comm] at hnm · haveI := NeZero.mk hzero rw [← map_cyclotomic_int _ R, ← map_cyclotomic_int _ R] at hnm replace hnm := map_injective (Int.castRingHom R) Int.cast_injective hnm replace hnm := congr_arg (map (Int.castRingHom ℂ)) hnm rw [map_cyclotomic_int, map_cyclotomic_int] at hnm have hprim := Complex.isPrimitiveRoot_exp _ hzero have hroot := isRoot_cyclotomic_iff (R := ℂ).2 hprim rw [hnm] at hroot haveI hmzero : NeZero m := ⟨fun h => by simp [h] at hroot⟩ rw [isRoot_cyclotomic_iff (R := ℂ)] at hroot replace hprim := hprim.eq_orderOf rwa [← IsPrimitiveRoot.eq_orderOf hroot] at hprim
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic_injective
Over a ring `R` of characteristic zero, `fun n => cyclotomic n R` is injective.
_root_.IsPrimitiveRoot.minpoly_dvd_cyclotomic {n : ℕ} {K : Type*} [Field K] {μ : K} (h : IsPrimitiveRoot μ n) (hpos : 0 < n) [CharZero K] : minpoly ℤ μ ∣ cyclotomic n ℤ := by apply minpoly.isIntegrallyClosed_dvd (h.isIntegral hpos) simpa [aeval_def, eval₂_eq_eval_map, IsRoot.def] using h.isRoot_cyclotomic hpos
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
_root_.IsPrimitiveRoot.minpoly_dvd_cyclotomic
The minimal polynomial of a primitive `n`-th root of unity `μ` divides `cyclotomic n ℤ`.
_root_.IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible {K : Type*} [Field K] {R : Type*} [CommRing R] [IsDomain R] {μ : R} {n : ℕ} [Algebra K R] (hμ : IsPrimitiveRoot μ n) (h : Irreducible <| cyclotomic n K) [NeZero (n : K)] : cyclotomic n K = minpoly K μ := by haveI := NeZero.of_faithfulSMul K R n refine minpoly.eq_of_irreducible_of_monic h ?_ (cyclotomic.monic n K) rwa [aeval_def, eval₂_eq_eval_map, map_cyclotomic, ← IsRoot.def, isRoot_cyclotomic_iff]
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
_root_.IsPrimitiveRoot.minpoly_eq_cyclotomic_of_irreducible
null
cyclotomic_eq_minpoly {n : ℕ} {K : Type*} [Field K] {μ : K} (h : IsPrimitiveRoot μ n) (hpos : 0 < n) [CharZero K] : cyclotomic n ℤ = minpoly ℤ μ := by refine eq_of_monic_of_dvd_of_natDegree_le (minpoly.monic (IsPrimitiveRoot.isIntegral h hpos)) (cyclotomic.monic n ℤ) (h.minpoly_dvd_cyclotomic hpos) ?_ simpa [natDegree_cyclotomic n ℤ] using totient_le_degree_minpoly h
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic_eq_minpoly
`cyclotomic n ℤ` is the minimal polynomial of a primitive `n`-th root of unity `μ`.
cyclotomic_eq_minpoly_rat {n : ℕ} {K : Type*} [Field K] {μ : K} (h : IsPrimitiveRoot μ n) (hpos : 0 < n) [CharZero K] : cyclotomic n ℚ = minpoly ℚ μ := by rw [← map_cyclotomic_int, cyclotomic_eq_minpoly h hpos] exact (minpoly.isIntegrallyClosed_eq_field_fractions' _ (IsPrimitiveRoot.isIntegral h hpos)).symm
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic_eq_minpoly_rat
`cyclotomic n ℚ` is the minimal polynomial of a primitive `n`-th root of unity `μ`.
cyclotomic.irreducible {n : ℕ} (hpos : 0 < n) : Irreducible (cyclotomic n ℤ) := by rw [cyclotomic_eq_minpoly (isPrimitiveRoot_exp n hpos.ne') hpos] apply minpoly.irreducible exact (isPrimitiveRoot_exp n hpos.ne').isIntegral hpos
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic.irreducible
`cyclotomic n ℤ` is irreducible.
cyclotomic.irreducible_rat {n : ℕ} (hpos : 0 < n) : Irreducible (cyclotomic n ℚ) := by rw [← map_cyclotomic_int] exact (IsPrimitive.irreducible_iff_irreducible_map_fraction_map (cyclotomic.isPrimitive n ℤ)).1 (cyclotomic.irreducible hpos)
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic.irreducible_rat
`cyclotomic n ℚ` is irreducible.
cyclotomic.isCoprime_rat {n m : ℕ} (h : n ≠ m) : IsCoprime (cyclotomic n ℚ) (cyclotomic m ℚ) := by rcases n.eq_zero_or_pos with (rfl | hnzero) · exact isCoprime_one_left rcases m.eq_zero_or_pos with (rfl | hmzero) · exact isCoprime_one_right rw [Irreducible.coprime_iff_not_dvd <| cyclotomic.irreducible_rat <| hnzero] exact fun hdiv => h <| cyclotomic_injective <| eq_of_monic_of_associated (cyclotomic.monic n ℚ) (cyclotomic.monic m ℚ) <| Irreducible.associated_of_dvd (cyclotomic.irreducible_rat hnzero) (cyclotomic.irreducible_rat hmzero) hdiv
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Cyclotomic.Basic", "Mathlib.RingTheory.RootsOfUnity.Minpoly" ]
Mathlib/RingTheory/Polynomial/Cyclotomic/Roots.lean
cyclotomic.isCoprime_rat
If `n ≠ m`, then `(cyclotomic n ℚ)` and `(cyclotomic m ℚ)` are coprime.
@[mk_iff] IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟
structure
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
IsWeaklyEisensteinAt
Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]` is *weakly Eisenstein at `𝓟`* if `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟`.
@[mk_iff] IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 notMem : f.coeff 0 ∉ 𝓟 ^ 2
structure
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
IsEisensteinAt
Given an ideal `𝓟` of a commutative semiring `R`, we say that a polynomial `f : R[X]` is *Eisenstein at `𝓟`* if `f.leadingCoeff ∉ 𝓟`, `∀ n, n < f.natDegree → f.coeff n ∈ 𝓟` and `f.coeff 0 ∉ 𝓟 ^ 2`.
map (hf : f.IsWeaklyEisensteinAt 𝓟) {A : Type v} [CommSemiring A] (φ : R →+* A) : (f.map φ).IsWeaklyEisensteinAt (𝓟.map φ) := by refine (isWeaklyEisensteinAt_iff _ _).2 fun hn => ?_ rw [coeff_map] exact mem_map_of_mem _ (hf.mem (lt_of_lt_of_le hn natDegree_map_le))
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
map
null
mul (hf : f.IsWeaklyEisensteinAt 𝓟) (hf' : f'.IsWeaklyEisensteinAt 𝓟) : (f * f').IsWeaklyEisensteinAt 𝓟 := by rw [isWeaklyEisensteinAt_iff] at hf hf' ⊢ intro n hn rw [coeff_mul] refine sum_mem _ fun x hx ↦ ?_ rcases lt_or_ge x.1 f.natDegree with hx1 | hx1 · exact mul_mem_right _ _ (hf hx1) replace hx1 : x.2 < f'.natDegree := by by_contra! rw [HasAntidiagonal.mem_antidiagonal] at hx replace hn := hn.trans_le natDegree_mul_le linarith exact mul_mem_left _ _ (hf' hx1)
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
mul
null
exists_mem_adjoin_mul_eq_pow_natDegree {x : S} (hx : aeval x f = 0) (hmo : f.Monic) (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : ∃ y ∈ adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ (f.map (algebraMap R S)).natDegree := by rw [aeval_def, Polynomial.eval₂_eq_eval_map, eval_eq_sum_range, range_add_one, sum_insert notMem_range_self, sum_range, (hmo.map (algebraMap R S)).coeff_natDegree, one_mul] at hx replace hx := eq_neg_of_add_eq_zero_left hx have : ∀ n < f.natDegree, p ∣ f.coeff n := by intro n hn exact mem_span_singleton.1 (by simpa using hf.mem hn) choose! φ hφ using this conv_rhs at hx => congr congr · skip ext i rw [coeff_map, hφ i.1 (lt_of_lt_of_le i.2 natDegree_map_le), RingHom.map_mul, mul_assoc] rw [hx, ← mul_sum, neg_eq_neg_one_mul, ← mul_assoc (-1 : S), mul_comm (-1 : S), mul_assoc] refine ⟨-1 * ∑ i : Fin (f.map (algebraMap R S)).natDegree, (algebraMap R S) (φ i.1) * x ^ i.1, ?_, rfl⟩ exact Subalgebra.mul_mem _ (Subalgebra.neg_mem _ (Subalgebra.one_mem _)) (Subalgebra.sum_mem _ fun i _ => Subalgebra.mul_mem _ (Subalgebra.algebraMap_mem _ _) (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _))
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
exists_mem_adjoin_mul_eq_pow_natDegree
null
exists_mem_adjoin_mul_eq_pow_natDegree_le {x : S} (hx : aeval x f = 0) (hmo : f.Monic) (hf : f.IsWeaklyEisensteinAt (Submodule.span R {p})) : ∀ i, (f.map (algebraMap R S)).natDegree ≤ i → ∃ y ∈ adjoin R ({x} : Set S), (algebraMap R S) p * y = x ^ i := by intro i hi obtain ⟨k, hk⟩ := exists_add_of_le hi rw [hk, pow_add] obtain ⟨y, hy, H⟩ := exists_mem_adjoin_mul_eq_pow_natDegree hx hmo hf refine ⟨y * x ^ k, ?_, ?_⟩ · exact Subalgebra.mul_mem _ hy (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton x)) _) · rw [← mul_assoc _ y, H]
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
exists_mem_adjoin_mul_eq_pow_natDegree_le
null
pow_natDegree_le_of_root_of_monic_mem (hf : f.IsWeaklyEisensteinAt 𝓟) {x : R} (hroot : IsRoot f x) (hmo : f.Monic) : ∀ i, f.natDegree ≤ i → x ^ i ∈ 𝓟 := by intro i hi obtain ⟨k, hk⟩ := exists_add_of_le hi rw [hk, pow_add] suffices x ^ f.natDegree ∈ 𝓟 by exact mul_mem_right (x ^ k) 𝓟 this rw [IsRoot.def, eval_eq_sum_range, Finset.range_add_one, Finset.sum_insert Finset.notMem_range_self, Finset.sum_range, hmo.coeff_natDegree, one_mul] at * rw [eq_neg_of_add_eq_zero_left hroot, neg_mem_iff] exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
pow_natDegree_le_of_root_of_monic_mem
null
pow_natDegree_le_of_aeval_zero_of_monic_mem_map (hf : f.IsWeaklyEisensteinAt 𝓟) {x : S} (hx : aeval x f = 0) (hmo : f.Monic) : ∀ i, (f.map (algebraMap R S)).natDegree ≤ i → x ^ i ∈ 𝓟.map (algebraMap R S) := by suffices x ^ (f.map (algebraMap R S)).natDegree ∈ 𝓟.map (algebraMap R S) by intro i hi obtain ⟨k, hk⟩ := exists_add_of_le hi rw [hk, pow_add] exact mul_mem_right _ _ this rw [aeval_def, eval₂_eq_eval_map, ← IsRoot.def] at hx exact pow_natDegree_le_of_root_of_monic_mem (hf.map _) hx (hmo.map _) _ rfl.le
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
pow_natDegree_le_of_aeval_zero_of_monic_mem_map
null
scaleRoots.isWeaklyEisensteinAt (p : R[X]) {x : R} {P : Ideal R} (hP : x ∈ P) : (scaleRoots p x).IsWeaklyEisensteinAt P := by refine ⟨fun i => ?_⟩ rw [coeff_scaleRoots] rw [natDegree_scaleRoots, ← tsub_pos_iff_lt] at i exact Ideal.mul_mem_left _ _ (Ideal.pow_mem_of_mem P hP _ i)
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
scaleRoots.isWeaklyEisensteinAt
null
dvd_pow_natDegree_of_eval₂_eq_zero {f : R →+* A} (hf : Function.Injective f) {p : R[X]} (hp : p.Monic) (x y : R) (z : A) (h : p.eval₂ f z = 0) (hz : f x * z = f y) : x ∣ y ^ p.natDegree := by rw [← natDegree_scaleRoots p x, ← Ideal.mem_span_singleton] refine (scaleRoots.isWeaklyEisensteinAt _ (Ideal.mem_span_singleton.mpr <| dvd_refl x)).pow_natDegree_le_of_root_of_monic_mem ?_ ((monic_scaleRoots_iff x).mpr hp) _ le_rfl rw [injective_iff_map_eq_zero'] at hf have : eval₂ f _ (p.scaleRoots x) = 0 := scaleRoots_eval₂_eq_zero f h rwa [hz, Polynomial.eval₂_at_apply, hf] at this
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
dvd_pow_natDegree_of_eval₂_eq_zero
null
dvd_pow_natDegree_of_aeval_eq_zero [Algebra R A] [Nontrivial A] [NoZeroSMulDivisors R A] {p : R[X]} (hp : p.Monic) (x y : R) (z : A) (h : Polynomial.aeval z p = 0) (hz : z * algebraMap R A x = algebraMap R A y) : x ∣ y ^ p.natDegree := dvd_pow_natDegree_of_eval₂_eq_zero (FaithfulSMul.algebraMap_injective R A) hp x y z h ((mul_comm _ _).trans hz)
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
dvd_pow_natDegree_of_aeval_eq_zero
null
_root_.Polynomial.Monic.leadingCoeff_notMem (hf : f.Monic) (h : 𝓟 ≠ ⊤) : f.leadingCoeff ∉ 𝓟 := hf.leadingCoeff.symm ▸ (Ideal.ne_top_iff_one _).1 h @[deprecated (since := "2025-05-23")] alias _root_.Polynomial.Monic.leadingCoeff_not_mem := _root_.Polynomial.Monic.leadingCoeff_notMem
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
_root_.Polynomial.Monic.leadingCoeff_notMem
null
_root_.Polynomial.Monic.isEisensteinAt_of_mem_of_notMem (hf : f.Monic) (h : 𝓟 ≠ ⊤) (hmem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟) (hnotMem : f.coeff 0 ∉ 𝓟 ^ 2) : f.IsEisensteinAt 𝓟 := { leading := Polynomial.Monic.leadingCoeff_notMem hf h mem := fun hn => hmem hn notMem := hnotMem } @[deprecated (since := "2025-05-23")] alias _root_.Polynomial.Monic.isEisensteinAt_of_mem_of_not_mem := _root_.Polynomial.Monic.isEisensteinAt_of_mem_of_notMem
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
_root_.Polynomial.Monic.isEisensteinAt_of_mem_of_notMem
null
isWeaklyEisensteinAt (hf : f.IsEisensteinAt 𝓟) : IsWeaklyEisensteinAt f 𝓟 := ⟨fun h => hf.mem h⟩
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
isWeaklyEisensteinAt
null
coeff_mem (hf : f.IsEisensteinAt 𝓟) {n : ℕ} (hn : n ≠ f.natDegree) : f.coeff n ∈ 𝓟 := by rcases ne_iff_lt_or_gt.1 hn with h₁ | h₂ · exact hf.mem h₁ · rw [coeff_eq_zero_of_natDegree_lt h₂] exact Ideal.zero_mem _
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
coeff_mem
null
irreducible (hf : f.IsEisensteinAt 𝓟) (hprime : 𝓟.IsPrime) (hu : f.IsPrimitive) (hfd0 : 0 < f.natDegree) : Irreducible f := irreducible_of_eisenstein_criterion hprime hf.leading (fun _ hn => hf.mem (coe_lt_degree.1 hn)) (natDegree_pos_iff_degree_pos.1 hfd0) hf.notMem hu
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.BigOperators", "Mathlib.RingTheory.Polynomial.Eisenstein.Criterion", "Mathlib.RingTheory.Polynomial.ScaleRoots" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
irreducible
If a primitive `f` satisfies `f.IsEisensteinAt 𝓟`, where `𝓟.IsPrime`, then `f` is irreducible.
private generalizedEisenstein_aux {q f g : R[X]} {p : ℕ} (hq_irr : Irreducible (q.map (algebraMap R K))) (hq_monic : q.Monic) (hf_lC : algebraMap R K f.leadingCoeff ≠ 0) (hf_prim : f.IsPrimitive) (hfmodP : f.map (algebraMap R K) = C (algebraMap R K f.leadingCoeff) * q.map (algebraMap R K) ^ p) (hg_div : g ∣ f) : ∃ m r, g = C g.leadingCoeff * q ^ m + r ∧ r.map (algebraMap R K) = 0 ∧ (m = 0 → IsUnit g) := by set P := ker (algebraMap R K) have hP : P.IsPrime := ker_isPrime (algebraMap R K) have hgP : g.leadingCoeff ∉ P := by simp only [mem_ker, P] obtain ⟨h, rfl⟩ := hg_div simp only [leadingCoeff_mul, map_mul, ne_eq, mul_eq_zero, not_or] at hf_lC exact hf_lC.1 have map_dvd_pow_q : g.map (algebraMap R K) ∣ q.map (algebraMap R K) ^ p := by rw [← IsUnit.dvd_mul_left _, ← hfmodP] · exact Polynomial.map_dvd _ hg_div · simp_all obtain ⟨m, hm, hf⟩ := (dvd_prime_pow hq_irr.prime _).mp map_dvd_pow_q set r := g - C g.leadingCoeff * q ^ m have hg : g = C g.leadingCoeff * q ^ m + r := by ring have hr : r.map (algebraMap R K) = 0 := by obtain ⟨u, hu⟩ := hf.symm obtain ⟨a, ha, ha'⟩ := Polynomial.isUnit_iff.mp u.isUnit suffices C (algebraMap R K g.leadingCoeff) = u by simp [r, ← this, Polynomial.map_sub, ← hu, Polynomial.map_mul, map_C, Polynomial.map_pow, mul_comm] rw [← leadingCoeff_map_of_leadingCoeff_ne_zero _ hgP, ← hu, ← ha', leadingCoeff_mul, leadingCoeff_C, (hq_monic.map _).pow m, one_mul] use m, r, hg, hr intro hm rw [isPrimitive_iff_isUnit_of_C_dvd] at hf_prim rw [hm, pow_zero, mul_one] at hg suffices g.natDegree = 0 by obtain ⟨a, rfl⟩ := Polynomial.natDegree_eq_zero.mp this apply IsUnit.map apply hf_prim rwa [leadingCoeff_C] at hgP by_contra hg' apply hgP rw [hg, leadingCoeff, coeff_add, ← hg, coeff_C, if_neg hg', zero_add, mem_ker, ← coeff_map, hr, coeff_zero]
lemma
RingTheory
[ "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.Ideal.Quotient.Operations" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Criterion.lean
generalizedEisenstein_aux
null
generalizedEisenstein {q f : R[X]} {p : ℕ} (hq_irr : Irreducible (q.map (algebraMap R K))) (hq_monic : q.Monic) (hf_prim : f.IsPrimitive) (hfd0 : 0 < natDegree f) (hfP : algebraMap R K f.leadingCoeff ≠ 0) (hfmodP : f.map (algebraMap R K) = C (algebraMap R K f.leadingCoeff) * q.map (algebraMap R K) ^ p) (hfmodP2 : (f.modByMonic q).map (mk ((ker (algebraMap R K)) ^ 2)) ≠ 0) : Irreducible f where not_isUnit := mt degree_eq_zero_of_isUnit fun h => by simp_all [natDegree_pos_iff_degree_pos] isUnit_or_isUnit g h h_eq := by set P : Ideal R := ker (algebraMap R K) obtain ⟨m, r, hg, hr, hm0⟩ := generalizedEisenstein_aux hq_irr hq_monic hfP hf_prim hfmodP (h_eq ▸ dvd_mul_right g h) obtain ⟨n, s, hh, hs, hn0⟩ := generalizedEisenstein_aux hq_irr hq_monic hfP hf_prim hfmodP (h_eq ▸ dvd_mul_left h g) by_cases hm : m = 0 · left; exact hm0 hm by_cases hn : n = 0 · right; exact hn0 hn exfalso apply hfmodP2 suffices f %ₘ q = (r * s) %ₘ q by suffices h : map (Ideal.Quotient.mk (P ^ 2)) (r * s) = 0 by simp [this, h, map_modByMonic, hq_monic] ext n have h (x : ℕ × ℕ) : (Ideal.Quotient.mk (P ^ 2)) (r.coeff x.1 * s.coeff x.2) = 0 := by rw [eq_zero_iff_mem, pow_two] apply mul_mem_mul · rw [mem_ker, ← coeff_map, hr, coeff_zero] · rw [mem_ker, ← coeff_map, hs, coeff_zero] simp [- Polynomial.map_mul, coeff_mul, h] rw [h_eq, hg, hh] simp only [add_mul, mul_add, map_add, ← modByMonicHom_apply] simp only [← add_assoc, modByMonicHom_apply] iterate 3 rw [(modByMonic_eq_zero_iff_dvd hq_monic).mpr] · simp · exact ((dvd_pow_self q hm).mul_left _).mul_right _ · simp only [← mul_assoc] exact (dvd_pow_self q hn).mul_left _ · exact ((dvd_pow_self q hn).mul_left _).mul_left _
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.Ideal.Quotient.Operations" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Criterion.lean
generalizedEisenstein
A generalized Eisenstein criterion Let `R` be an integral domain and `K` an `R`-algebra which is a domain. Let `q : R[X]` be a monic polynomial which is prime in `K[X]`. Let `f : R[X]` be a primitive polynomial of strictly positive degree whose leading coefficient is not zero in `K` and such that the image `f` in `K[X]` is a power of `q`. Assume moreover that `f.modByMonic q` is not zero in `(R ⧸ (P ^ 2))[X]`, where `P` is the kernel of `algebraMap R K`. Then `f` is irreducible.
irreducible_of_eisenstein_criterion {f : R[X]} {P : Ideal R} (hP : P.IsPrime) (hfl : f.leadingCoeff ∉ P) (hfP : ∀ n : ℕ, ↑n < degree f → f.coeff n ∈ P) (hfd0 : 0 < degree f) (h0 : f.coeff 0 ∉ P ^ 2) (hu : f.IsPrimitive) : Irreducible f := by apply generalizedEisenstein (K := FractionRing (R ⧸ P)) (q := X) (p := f.natDegree) (by simp [map_X, irreducible_X]) monic_X hu (natDegree_pos_iff_degree_pos.mpr hfd0) · simp only [IsScalarTower.algebraMap_eq R (R ⧸ P) (FractionRing (R ⧸ P)), Quotient.algebraMap_eq, coe_comp, Function.comp_apply, ne_eq, FaithfulSMul.algebraMap_eq_zero_iff] rw [Ideal.Quotient.eq_zero_iff_mem] exact hfl · rw [← map_C, ← Polynomial.map_pow, ← Polynomial.map_mul] simp only [IsScalarTower.algebraMap_eq R (R ⧸ P) (FractionRing (R ⧸ P)), Quotient.algebraMap_eq, ← map_map] congr 1 ext n simp only [coeff_map, Ideal.Quotient.mk_eq_mk_iff_sub_mem] simp only [coeff_C_mul, coeff_X_pow, mul_ite, mul_one, mul_zero, sub_ite, sub_zero] split_ifs with hn · rw [hn, leadingCoeff, sub_self] exact zero_mem _ · by_cases hn' : n < f.natDegree · exact hfP _ (coe_lt_degree.mpr hn') · rw [f.coeff_eq_zero_of_natDegree_lt] · exact P.zero_mem · simp [Nat.lt_iff_le_and_ne, ← Nat.not_lt, hn', Ne.symm hn] · rw [modByMonic_X, map_C, ne_eq, C_eq_zero, Ideal.Quotient.eq_zero_iff_mem, ← coeff_zero_eq_eval_zero] convert h0 · rw [IsScalarTower.algebraMap_eq R (R ⧸ P) (FractionRing (R ⧸ P))] rw [ker_comp_of_injective] · ext a; simp · exact FaithfulSMul.algebraMap_injective (R ⧸ P) (FractionRing (R ⧸ P))
theorem
RingTheory
[ "Mathlib.RingTheory.Ideal.Maps", "Mathlib.RingTheory.Polynomial.Content", "Mathlib.RingTheory.Ideal.Quotient.Operations" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Criterion.lean
irreducible_of_eisenstein_criterion
If `f` is a nonconstant polynomial with coefficients in `R`, and `P` is a prime ideal in `R`, then if every coefficient in `R` except the leading coefficient is in `P`, and the trailing coefficient is not in `P^2` and no nonunits in `R` divide `f`, then `f` is irreducible.
Polynomial.IsDistinguishedAt (f : R[X]) (I : Ideal R) : Prop extends f.IsWeaklyEisensteinAt I where monic : f.Monic
structure
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
Polynomial.IsDistinguishedAt
Given an ideal `I` of a commutative ring `R`, we say that a polynomial `f : R[X]` is *Distinguished at `I`* if `f` is monic and `IsWeaklyEisensteinAt I`. i.e. `f` is of the form `xⁿ + a₁xⁿ⁻¹ + ⋯ + aₙ` with `aᵢ ∈ I` for all `i`.
mul {f f' : R[X]} {I : Ideal R} (hf : f.IsDistinguishedAt I) (hf' : f'.IsDistinguishedAt I) : (f * f').IsDistinguishedAt I := ⟨hf.toIsWeaklyEisensteinAt.mul hf'.toIsWeaklyEisensteinAt, hf.monic.mul hf'.monic⟩
lemma
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
mul
null
map_eq_X_pow {f : R[X]} {I : Ideal R} (distinguish : f.IsDistinguishedAt I) : f.map (Ideal.Quotient.mk I) = Polynomial.X ^ f.natDegree := by ext i by_cases ne : i = f.natDegree · simp [ne, distinguish.monic] · rcases lt_or_gt_of_ne ne with lt|gt · simpa [ne, eq_zero_iff_mem] using (distinguish.mem lt) · simp [ne, Polynomial.coeff_eq_zero_of_natDegree_lt gt] @[deprecated (since := "2025-04-27")] alias _root_.IsDistinguishedAt.map_eq_X_pow := map_eq_X_pow
lemma
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
map_eq_X_pow
null
map_ne_zero_of_eq_mul (distinguish : g.IsDistinguishedAt I) (notMem : PowerSeries.constantCoeff h ∉ I) (eq : f = g * h) : f.map (Ideal.Quotient.mk I) ≠ 0 := fun H ↦ by have mapf : f.map (Ideal.Quotient.mk I) = (Polynomial.X ^ g.natDegree : (R ⧸ I)[X]) * h.map (Ideal.Quotient.mk I) := by simp [← map_eq_X_pow distinguish, eq] apply_fun PowerSeries.coeff g.natDegree at H simp [mapf, PowerSeries.coeff_X_pow_mul', eq_zero_iff_mem, notMem] at H
lemma
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
map_ne_zero_of_eq_mul
null
degree_eq_coe_lift_order_map (distinguish : g.IsDistinguishedAt I) (notMem : PowerSeries.constantCoeff h ∉ I) (eq : f = g * h) : g.degree = (f.map (Ideal.Quotient.mk I)).order.lift (order_finite_iff_ne_zero.2 (distinguish.map_ne_zero_of_eq_mul f h notMem eq)) := by have : Nontrivial R := _root_.nontrivial_iff.mpr ⟨0, PowerSeries.constantCoeff h, ne_of_mem_of_not_mem I.zero_mem notMem⟩ rw [Polynomial.degree_eq_natDegree distinguish.monic.ne_zero, Nat.cast_inj, ← ENat.coe_inj, ENat.coe_lift, Eq.comm, PowerSeries.order_eq_nat] have mapf : f.map (Ideal.Quotient.mk I) = (Polynomial.X ^ g.natDegree : (R ⧸ I)[X]) * h.map (Ideal.Quotient.mk I) := by simp [← map_eq_X_pow distinguish, eq] constructor · simp [mapf, PowerSeries.coeff_X_pow_mul', eq_zero_iff_mem, notMem] · intro i hi simp [mapf, PowerSeries.coeff_X_pow_mul', hi] @[deprecated (since := "2025-04-27")] alias _root_.IsDistinguishedAt.degree_eq_order_map := degree_eq_coe_lift_order_map @[deprecated (since := "2025-05-19")] alias degree_eq_order_map := degree_eq_coe_lift_order_map
lemma
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
degree_eq_coe_lift_order_map
null
coe_natDegree_eq_order_map (distinguish : g.IsDistinguishedAt I) (notMem : PowerSeries.constantCoeff h ∉ I) (eq : f = g * h) : g.natDegree = (f.map (Ideal.Quotient.mk I)).order := by rw [natDegree, distinguish.degree_eq_coe_lift_order_map f h notMem eq] exact ENat.coe_lift _ <| order_finite_iff_ne_zero.2 <| distinguish.map_ne_zero_of_eq_mul f h notMem eq
lemma
RingTheory
[ "Mathlib.RingTheory.Polynomial.Eisenstein.Basic", "Mathlib.RingTheory.PowerSeries.Order" ]
Mathlib/RingTheory/Polynomial/Eisenstein/Distinguished.lean
coe_natDegree_eq_order_map
null
cyclotomic_comp_X_add_one_isEisensteinAt [hp : Fact p.Prime] : ((cyclotomic p ℤ).comp (X + 1)).IsEisensteinAt 𝓟 := by refine Monic.isEisensteinAt_of_mem_of_notMem ?_ (Ideal.IsPrime.ne_top <| (Ideal.span_singleton_prime (mod_cast hp.out.ne_zero)).2 <| Nat.prime_iff_prime_int.1 hp.out) (fun {i hi} => ?_) ?_ · rw [show (X + 1 : ℤ[X]) = X + C 1 by simp] refine (cyclotomic.monic p ℤ).comp (monic_X_add_C 1) fun h => ?_ rw [natDegree_X_add_C] at h exact zero_ne_one h.symm · rw [cyclotomic_prime, geom_sum_X_comp_X_add_one_eq_sum, ← lcoeff_apply, map_sum] conv => congr congr next => skip congr next => skip ext rw [lcoeff_apply, ← C_eq_natCast, C_mul_X_pow_eq_monomial, coeff_monomial] rw [natDegree_comp, show (X + 1 : ℤ[X]) = X + C 1 by simp, natDegree_X_add_C, mul_one, natDegree_cyclotomic, Nat.totient_prime hp.out] at hi simp only [hi.trans_le (Nat.sub_le _ _), sum_ite_eq', mem_range, if_true, Ideal.submodule_span_eq, Ideal.mem_span_singleton, Int.natCast_dvd_natCast] exact hp.out.dvd_choose_self i.succ_ne_zero (lt_tsub_iff_right.1 hi) · rw [coeff_zero_eq_eval_zero, eval_comp, cyclotomic_prime, eval_add, eval_X, eval_one, zero_add, eval_geom_sum, one_geom_sum, Ideal.submodule_span_eq, Ideal.span_singleton_pow, Ideal.mem_span_singleton] intro h obtain ⟨k, hk⟩ := Int.natCast_dvd_natCast.1 h rw [mul_assoc, mul_comm 1, mul_one] at hk nth_rw 1 [← Nat.mul_one p] at hk rw [mul_right_inj' hp.out.ne_zero] at hk exact Nat.Prime.not_dvd_one hp.out (Dvd.intro k hk.symm)
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
cyclotomic_comp_X_add_one_isEisensteinAt
null
cyclotomic_prime_pow_comp_X_add_one_isEisensteinAt [hp : Fact p.Prime] (n : ℕ) : ((cyclotomic (p ^ (n + 1)) ℤ).comp (X + 1)).IsEisensteinAt 𝓟 := by refine Monic.isEisensteinAt_of_mem_of_notMem ?_ (Ideal.IsPrime.ne_top <| (Ideal.span_singleton_prime (mod_cast hp.out.ne_zero)).2 <| Nat.prime_iff_prime_int.1 hp.out) ?_ ?_ · rw [show (X + 1 : ℤ[X]) = X + C 1 by simp] refine (cyclotomic.monic _ ℤ).comp (monic_X_add_C 1) fun h => ?_ rw [natDegree_X_add_C] at h exact zero_ne_one h.symm · induction n with | zero => intro i hi rw [Nat.zero_add, pow_one] at hi ⊢ exact (cyclotomic_comp_X_add_one_isEisensteinAt p).mem hi | succ n hn => intro i hi rw [Ideal.submodule_span_eq, Ideal.mem_span_singleton, ← ZMod.intCast_zmod_eq_zero_iff_dvd, show ↑(_ : ℤ) = Int.castRingHom (ZMod p) _ by rfl, ← coeff_map, map_comp, map_cyclotomic, Polynomial.map_add, map_X, Polynomial.map_one, pow_add, pow_one, cyclotomic_mul_prime_dvd_eq_pow, pow_comp, ← ZMod.expand_card, coeff_expand hp.out.pos] · simp only [ite_eq_right_iff] rintro ⟨k, hk⟩ rw [natDegree_comp, show (X + 1 : ℤ[X]) = X + C 1 by simp, natDegree_X_add_C, mul_one, natDegree_cyclotomic, Nat.totient_prime_pow hp.out (Nat.succ_pos _), Nat.add_one_sub_one] at hn hi rw [hk, pow_succ', mul_assoc] at hi rw [hk, mul_comm, Nat.mul_div_cancel _ hp.out.pos] replace hn := hn (lt_of_mul_lt_mul_left' hi) rw [Ideal.submodule_span_eq, Ideal.mem_span_singleton, ← ZMod.intCast_zmod_eq_zero_iff_dvd, show ↑(_ : ℤ) = Int.castRingHom (ZMod p) _ by rfl, ← coeff_map] at hn simpa [map_comp] using hn · exact ⟨p ^ n, by rw [pow_succ']⟩ · rw [coeff_zero_eq_eval_zero, eval_comp, cyclotomic_prime_pow_eq_geom_sum hp.out, eval_add, eval_X, eval_one, zero_add, eval_finset_sum] simp only [eval_pow, eval_X, one_pow, sum_const, card_range, Nat.smul_one_eq_cast, submodule_span_eq, Ideal.submodule_span_eq, Ideal.span_singleton_pow, Ideal.mem_span_singleton] intro h obtain ⟨k, hk⟩ := Int.natCast_dvd_natCast.1 h rw [mul_assoc, mul_comm 1, mul_one] at hk nth_rw 1 [← Nat.mul_one p] at hk rw [mul_right_inj' hp.out.ne_zero] at hk exact Nat.Prime.not_dvd_one hp.out (Dvd.intro k hk.symm)
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
cyclotomic_prime_pow_comp_X_add_one_isEisensteinAt
null
dvd_coeff_zero_of_aeval_eq_prime_smul_of_minpoly_isEisensteinAt {B : PowerBasis K L} (hp : Prime p) (hBint : IsIntegral R B.gen) {z : L} {Q : R[X]} (hQ : aeval B.gen Q = p • z) (hzint : IsIntegral R z) (hei : (minpoly R B.gen).IsEisensteinAt 𝓟) : p ∣ Q.coeff 0 := by letI := B.finite let P := minpoly R B.gen obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero B.dim_pos.ne' have finrank_K_L : Module.finrank K L = B.dim := B.finrank have deg_K_P : (minpoly K B.gen).natDegree = B.dim := B.natDegree_minpoly have deg_R_P : P.natDegree = B.dim := by rw [← deg_K_P, minpoly.isIntegrallyClosed_eq_field_fractions' K hBint, (minpoly.monic hBint).natDegree_map (algebraMap R K)] choose! f hf using hei.isWeaklyEisensteinAt.exists_mem_adjoin_mul_eq_pow_natDegree_le (minpoly.aeval R B.gen) (minpoly.monic hBint) simp only [P, (minpoly.monic hBint).natDegree_map, deg_R_P] at hf suffices p ^ n.succ ∣ Q.coeff 0 ^ n.succ * ((-1) ^ (n.succ * n) * (minpoly R B.gen).coeff 0 ^ n) by have hndiv : ¬p ^ 2 ∣ (minpoly R B.gen).coeff 0 := fun h => hei.notMem ((span_singleton_pow p 2).symm ▸ Ideal.mem_span_singleton.2 h) refine @Prime.dvd_of_pow_dvd_pow_mul_pow_of_square_not_dvd R _ _ _ _ n hp (?_ : _ ∣ _) hndiv convert (IsUnit.dvd_mul_right ⟨(-1) ^ (n.succ * n), rfl⟩).mpr this using 1 push_cast ring_nf rw [mul_comm _ 2, pow_mul, neg_one_sq, one_pow, mul_one] have aux : ∀ i ∈ (range (Q.natDegree + 1)).erase 0, B.dim ≤ i + n := by grind have hintsum : IsIntegral R (z * B.gen ^ n - ∑ x ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff x • f (x + n)) := by refine (hzint.mul (hBint.pow _)).sub (.sum _ fun i hi => .smul _ ?_) exact adjoin_le_integralClosure hBint (hf _ (aux i hi)).1 obtain ⟨r, hr⟩ := isIntegral_iff.1 (isIntegral_norm K hintsum) use r apply IsFractionRing.injective R K simp only [map_mul, map_pow, map_neg, map_one] calc _ = norm K (Q.coeff 0 • B.gen ^ n) := ?_ _ = norm K (p • (z * B.gen ^ n) - ∑ x ∈ (range (Q.natDegree + 1)).erase 0, p • Q.coeff x • f (x + n)) := (congr_arg (norm K) (eq_sub_of_add_eq ?_)) _ = _ := ?_ · simp only [Algebra.smul_def, algebraMap_apply R K L, Algebra.norm_algebraMap, map_mul, map_pow, finrank_K_L, PowerBasis.norm_gen_eq_coeff_zero_minpoly, minpoly.isIntegrallyClosed_eq_field_fractions' K hBint, coeff_map, ← hn] ring swap · simp_rw [← smul_sum, ← smul_sub, Algebra.smul_def p, algebraMap_apply R K L, map_mul, Algebra.norm_algebraMap, finrank_K_L, hr, ← hn] calc _ = (Q.coeff 0 • ↑1 + ∑ x ∈ (range (Q.natDegree + 1)).erase 0, Q.coeff x • B.gen ^ x) * B.gen ^ n := ?_ _ = (Q.coeff 0 • B.gen ^ 0 + ...
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
dvd_coeff_zero_of_aeval_eq_prime_smul_of_minpoly_isEisensteinAt
Let `K` be the field of fraction of an integrally closed domain `R` and let `L` be a separable extension of `K`, generated by an integral power basis `B` such that the minimal polynomial of `B.gen` is Eisenstein at `p`. Given `z : L` integral over `R`, if `Q : R[X]` is such that `aeval B.gen Q = p • z`, then `p ∣ Q.coeff 0`.
mem_adjoin_of_dvd_coeff_of_dvd_aeval {A B : Type*} [CommSemiring A] [Ring B] [Algebra A B] [NoZeroSMulDivisors A B] {Q : A[X]} {p : A} {x z : B} (hp : p ≠ 0) (hQ : ∀ i ∈ range (Q.natDegree + 1), p ∣ Q.coeff i) (hz : aeval x Q = p • z) : z ∈ adjoin A ({x} : Set B) := by choose! f hf using hQ rw [aeval_eq_sum_range, sum_range] at hz conv_lhs at hz => congr next => skip ext i rw [hf i (mem_range.2 (Fin.is_lt i)), ← smul_smul] rw [← smul_sum] at hz rw [← smul_right_injective _ hp hz] exact Subalgebra.sum_mem _ fun _ _ => Subalgebra.smul_mem _ (Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton _)) _) _
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
mem_adjoin_of_dvd_coeff_of_dvd_aeval
null
mem_adjoin_of_smul_prime_smul_of_minpoly_isEisensteinAt {B : PowerBasis K L} (hp : Prime p) (hBint : IsIntegral R B.gen) {z : L} (hzint : IsIntegral R z) (hz : p • z ∈ adjoin R ({B.gen} : Set L)) (hei : (minpoly R B.gen).IsEisensteinAt 𝓟) : z ∈ adjoin R ({B.gen} : Set L) := by have hndiv : ¬p ^ 2 ∣ (minpoly R B.gen).coeff 0 := fun h => hei.notMem ((span_singleton_pow p 2).symm ▸ Ideal.mem_span_singleton.2 h) have := B.finite set P := minpoly R B.gen with hP obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero B.dim_pos.ne' haveI : NoZeroSMulDivisors R L := NoZeroSMulDivisors.trans_faithfulSMul R K L let _ := P.map (algebraMap R L) rw [adjoin_singleton_eq_range_aeval] at hz obtain ⟨Q₁, hQ⟩ := hz set Q := Q₁ %ₘ P with hQ₁ replace hQ : aeval B.gen Q = p • z := by rw [← modByMonic_add_div Q₁ (minpoly.monic hBint)] at hQ simpa using hQ by_cases hQzero : Q = 0 · simp only [hQzero, Algebra.smul_def, zero_eq_mul, aeval_zero] at hQ rcases hQ with H | H₁ · have : Function.Injective (algebraMap R L) := by rw [algebraMap_eq R K L] exact (algebraMap K L).injective.comp (IsFractionRing.injective R K) exfalso exact hp.ne_zero ((injective_iff_map_eq_zero _).1 this _ H) · rw [H₁] exact Subalgebra.zero_mem _ refine mem_adjoin_of_dvd_coeff_of_dvd_aeval hp.ne_zero (fun i => ?_) hQ induction i using Nat.case_strong_induction_on with | hz => intro exact dvd_coeff_zero_of_aeval_eq_prime_smul_of_minpoly_isEisensteinAt hp hBint hQ hzint hei | hi j hind => intro hj convert hp.dvd_of_pow_dvd_pow_mul_pow_of_square_not_dvd (n := n) _ hndiv have H := degree_modByMonic_lt Q₁ (minpoly.monic hBint) rw [← hQ₁, ← hP] at H replace H := Nat.lt_iff_add_one_le.1 (lt_of_lt_of_le (lt_of_le_of_lt (Nat.lt_iff_add_one_le.1 (Nat.lt_of_succ_lt_succ (mem_range.1 hj))) (lt_succ_self _)) (Nat.lt_iff_add_one_le.1 ((natDegree_lt_natDegree_iff hQzero).2 H))) have Hj : Q.natDegree + 1 = j + 1 + (Q.natDegree - j) := by rw [← add_comm 1, ← add_comm 1, add_assoc, add_right_inj, ← Nat.add_sub_assoc (Nat.lt_of_succ_lt_succ (mem_range.1 hj)).le, add_comm, Nat.add_sub_cancel] choose! g hg using hind replace hg : ∀ k ∈ range (j + 1), Q.coeff k • B.gen ^ k = algebraMap R L p * g k • B.gen ^ k := by intro k hk rw [hg k (mem_range_succ_iff.1 hk) (mem_range_succ_iff.2 ...
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
mem_adjoin_of_smul_prime_smul_of_minpoly_isEisensteinAt
Let `K` be the field of fraction of an integrally closed domain `R` and let `L` be a separable extension of `K`, generated by an integral power basis `B` such that the minimal polynomial of `B.gen` is Eisenstein at `p`. Given `z : L` integral over `R`, if `p • z ∈ adjoin R {B.gen}`, then `z ∈ adjoin R {B.gen}`.
mem_adjoin_of_smul_prime_pow_smul_of_minpoly_isEisensteinAt {B : PowerBasis K L} (hp : Prime p) (hBint : IsIntegral R B.gen) {n : ℕ} {z : L} (hzint : IsIntegral R z) (hz : p ^ n • z ∈ adjoin R ({B.gen} : Set L)) (hei : (minpoly R B.gen).IsEisensteinAt 𝓟) : z ∈ adjoin R ({B.gen} : Set L) := by induction n with | zero => simpa using hz | succ n hn => rw [_root_.pow_succ', mul_smul] at hz exact hn (mem_adjoin_of_smul_prime_smul_of_minpoly_isEisensteinAt hp hBint (hzint.smul _) hz hei)
theorem
RingTheory
[ "Mathlib.Data.Nat.Choose.Dvd", "Mathlib.RingTheory.IntegralClosure.IntegrallyClosed", "Mathlib.RingTheory.Norm.Basic", "Mathlib.RingTheory.Polynomial.Cyclotomic.Expand" ]
Mathlib/RingTheory/Polynomial/Eisenstein/IsIntegral.lean
mem_adjoin_of_smul_prime_pow_smul_of_minpoly_isEisensteinAt
Let `K` be the field of fraction of an integrally closed domain `R` and let `L` be a separable extension of `K`, generated by an integral power basis `B` such that the minimal polynomial of `B.gen` is Eisenstein at `p`. Given `z : L` integral over `R`, if `p ^ n • z ∈ adjoin R {B.gen}`, then `z ∈ adjoin R {B.gen}`. Together with `Algebra.discr_mul_isIntegral_mem_adjoin` this result often allows to compute the ring of integers of `L`.
noncomputable hermite : ℕ → Polynomial ℤ | 0 => 1 | n + 1 => X * hermite n - derivative (hermite n)
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite
the probabilists' Hermite polynomials.
@[simp] hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by rw [hermite]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite_succ
The recursion `hermite (n+1) = (x - d/dx) (hermite n)`
hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by induction n with | zero => rfl | succ n ih => rw [Function.iterate_succ_apply', ← ih, hermite_succ] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite_eq_iterate
null
hermite_zero : hermite 0 = C 1 := rfl
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite_zero
null
hermite_one : hermite 1 = X := by rw [hermite_succ, hermite_zero] simp only [map_one, mul_one, derivative_one, sub_zero] /-! ### Lemmas about `Polynomial.coeff` -/
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite_one
null
coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by simp [coeff_derivative]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_succ_zero
null
coeff_hermite_succ_succ (n k : ℕ) : coeff (hermite (n + 1)) (k + 1) = coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) := by rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm] norm_cast
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_succ_succ
null
coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0 := by obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnk clear hnk induction n generalizing k with | zero => exact coeff_C | succ n ih => have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring rw [coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2), mul_zero, sub_zero] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_of_lt
null
coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by induction n with | zero => exact coeff_C | succ n ih => rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero] simp @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_self
null
degree_hermite (n : ℕ) : (hermite n).degree = n := by rw [degree_eq_of_le_of_coeff_ne_zero] · simp_rw [degree_le_iff_coeff_zero, Nat.cast_lt] rintro m hnm exact coeff_hermite_of_lt hnm · simp [coeff_hermite_self n] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
degree_hermite
null
natDegree_hermite {n : ℕ} : (hermite n).natDegree = n := natDegree_eq_of_degree_eq_some (degree_hermite n) @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
natDegree_hermite
null
leadingCoeff_hermite (n : ℕ) : (hermite n).leadingCoeff = 1 := by rw [← coeff_natDegree, natDegree_hermite, coeff_hermite_self]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
leadingCoeff_hermite
null
hermite_monic (n : ℕ) : (hermite n).Monic := leadingCoeff_hermite n
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
hermite_monic
null
coeff_hermite_of_odd_add {n k : ℕ} (hnk : Odd (n + k)) : coeff (hermite n) k = 0 := by induction n generalizing k with | zero => rw [zero_add k] at hnk exact coeff_hermite_of_lt hnk.pos | succ n ih => cases k with | zero => rw [Nat.succ_add_eq_add_succ] at hnk rw [coeff_hermite_succ_zero, ih hnk, neg_zero] | succ k => rw [coeff_hermite_succ_succ, ih, ih, mul_zero, sub_zero] · rwa [Nat.succ_add_eq_add_succ] at hnk · rw [(by rw [Nat.succ_add, Nat.add_succ] : n.succ + k.succ = n + k + 2)] at hnk exact (Nat.odd_add.mp hnk).mpr even_two
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_of_odd_add
null
coeff_hermite_explicit : ∀ n k : ℕ, coeff (hermite (2 * n + k)) k = (-1) ^ n * (2 * n - 1)‼ * Nat.choose (2 * n + k) k | 0, _ => by simp | n + 1, 0 => by convert coeff_hermite_succ_zero (2 * n + 1) using 1 rw [coeff_hermite_explicit n 1, (by grind : 2 * (n + 1) - 1 = 2 * n + 1), Nat.doubleFactorial_add_one, Nat.choose_zero_right, Nat.choose_one_right, pow_succ] push_cast ring | n + 1, k + 1 => by let hermite_explicit : ℕ → ℕ → ℤ := fun n k => (-1) ^ n * (2 * n - 1)‼ * Nat.choose (2 * n + k) k have hermite_explicit_recur : ∀ n k : ℕ, hermite_explicit (n + 1) (k + 1) = hermite_explicit (n + 1) k - (k + 2) * hermite_explicit n (k + 2) := by intro n k simp only [hermite_explicit] rw [mul_comm (↑k + _ : ℤ), sub_eq_add_neg] nth_rw 3 [neg_eq_neg_one_mul] simp only [mul_assoc, ← mul_add, pow_succ'] congr 2 norm_cast rw [(by grind : 2 * (n + 1) - 1 = 2 * n + 1), Nat.doubleFactorial_add_one, mul_comm (2 * n + 1)] simp only [mul_assoc, ← mul_add] congr 1 rw [(by ring : 2 * (n + 1) + (k + 1) = 2 * n + 1 + (k + 1) + 1), (by ring : 2 * (n + 1) + k = 2 * n + 1 + (k + 1)), (by ring : 2 * n + (k + 2) = 2 * n + 1 + (k + 1))] rw [Nat.choose, Nat.choose_succ_right_eq (2 * n + 1 + (k + 1)) (k + 1), Nat.add_sub_cancel] ring change _ = hermite_explicit _ _ rw [← add_assoc, coeff_hermite_succ_succ, hermite_explicit_recur] congr · rw [coeff_hermite_explicit (n + 1) k] · rw [(by ring : 2 * (n + 1) + k = 2 * n + (k + 2)), coeff_hermite_explicit n (k + 2)]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_explicit
Because of `coeff_hermite_of_odd_add`, every nonzero coefficient is described as follows.
coeff_hermite_of_even_add {n k : ℕ} (hnk : Even (n + k)) : coeff (hermite n) k = (-1) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k := by rcases le_or_gt k n with h_le | h_lt · rw [Nat.even_add, ← Nat.even_sub h_le] at hnk obtain ⟨m, hm⟩ := hnk rw [(by cutsat : n = 2 * m + k), Nat.add_sub_cancel, Nat.mul_div_cancel_left _ (Nat.succ_pos 1), coeff_hermite_explicit] · simp [Nat.choose_eq_zero_of_lt h_lt, coeff_hermite_of_lt h_lt]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite_of_even_add
null
coeff_hermite (n k : ℕ) : coeff (hermite n) k = if Even (n + k) then (-1 : ℤ) ^ ((n - k) / 2) * (n - k - 1)‼ * Nat.choose n k else 0 := by split_ifs with h · exact coeff_hermite_of_even_add h · exact coeff_hermite_of_odd_add (Nat.not_even_iff_odd.1 h)
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.Data.Nat.Factorial.DoubleFactorial" ]
Mathlib/RingTheory/Polynomial/Hermite/Basic.lean
coeff_hermite
null
deriv_gaussian_eq_hermite_mul_gaussian (n : ℕ) (x : ℝ) : deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x = (-1 : ℝ) ^ n * aeval x (hermite n) * Real.exp (-(x ^ 2 / 2)) := by rw [mul_assoc] induction n generalizing x with | zero => rw [Function.iterate_zero_apply, pow_zero, one_mul, hermite_zero, C_1, map_one, one_mul] | succ n ih => replace ih : deriv^[n] _ = _ := _root_.funext ih have deriv_gaussian : deriv (fun y => Real.exp (-(y ^ 2 / 2))) x = -x * Real.exp (-(x ^ 2 / 2)) := by rw [deriv_exp (by simp)] simp [mul_comm] rw [Function.iterate_succ_apply', ih, deriv_const_mul_field, deriv_fun_mul, pow_succ (-1 : ℝ), deriv_gaussian, hermite_succ, map_sub, map_mul, aeval_X, Polynomial.deriv_aeval] · ring · apply Polynomial.differentiable_aeval · apply DifferentiableAt.exp; simp -- Porting note: was just `simp`
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Hermite.Basic", "Mathlib.Analysis.Calculus.Deriv.Add", "Mathlib.Analysis.Calculus.Deriv.Polynomial", "Mathlib.Analysis.SpecialFunctions.Exp", "Mathlib.Analysis.SpecialFunctions.ExpDeriv" ]
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
deriv_gaussian_eq_hermite_mul_gaussian
`hermite n` is (up to sign) the factor appearing in `deriv^[n]` of a Gaussian.
hermite_eq_deriv_gaussian (n : ℕ) (x : ℝ) : aeval x (hermite n) = (-1 : ℝ) ^ n * deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x / Real.exp (-(x ^ 2 / 2)) := by rw [deriv_gaussian_eq_hermite_mul_gaussian] field_simp rw [← pow_mul] simp
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Hermite.Basic", "Mathlib.Analysis.Calculus.Deriv.Add", "Mathlib.Analysis.Calculus.Deriv.Polynomial", "Mathlib.Analysis.SpecialFunctions.Exp", "Mathlib.Analysis.SpecialFunctions.ExpDeriv" ]
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
hermite_eq_deriv_gaussian
null
hermite_eq_deriv_gaussian' (n : ℕ) (x : ℝ) : aeval x (hermite n) = (-1 : ℝ) ^ n * deriv^[n] (fun y => Real.exp (-(y ^ 2 / 2))) x * Real.exp (x ^ 2 / 2) := by rw [hermite_eq_deriv_gaussian, Real.exp_neg] field_simp
theorem
RingTheory
[ "Mathlib.RingTheory.Polynomial.Hermite.Basic", "Mathlib.Analysis.Calculus.Deriv.Add", "Mathlib.Analysis.Calculus.Deriv.Polynomial", "Mathlib.Analysis.SpecialFunctions.Exp", "Mathlib.Analysis.SpecialFunctions.ExpDeriv" ]
Mathlib/RingTheory/Polynomial/Hermite/Gaussian.lean
hermite_eq_deriv_gaussian'
null
sylvester (f g : R[X]) (m n : ℕ) : Matrix (Fin (n + m)) (Fin (n + m)) R := .of fun i j ↦ j.addCases (fun j₁ ↦ if (i : ℕ) ∈ Set.Icc (j₁ : ℕ) (j₁ + m) then f.coeff (i - j₁) else 0) (fun j₁ ↦ if (i : ℕ) ∈ Set.Icc (j₁ : ℕ) (j₁ + n) then g.coeff (i - j₁) else 0) variable (f g : R[X]) (m n : ℕ) @[simp] theorem sylvester_C_right (a : R) : sylvester f (C a) m 0 = Matrix.diagonal (fun _ ↦ a) := Matrix.ext fun i j ↦ j.addCases nofun fun j ↦ by rw [sylvester, Matrix.of_apply, Fin.addCases_right, Matrix.diagonal_apply] split_ifs <;> simp_all [Fin.ext_iff]
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
sylvester
The Sylvester matrix of two polynomials `f` and `g` of degrees `m` and `n` respectively is a `(n+m) × (n+m)` matrix with the coefficients of `f` and `g` arranged in a specific way. Here, `m` and `n` are free variables, not necessarily equal to the actual degrees of the polynomials `f` and `g`.
noncomputable sylvesterDeriv (f : R[X]) : Matrix (Fin (f.natDegree - 1 + f.natDegree)) (Fin (f.natDegree - 1 + f.natDegree)) R := letI n := f.natDegree if hn : n = 0 then 0 else (f.sylvester f.derivative n (n - 1)).updateRow ⟨2 * n - 2, by cutsat⟩ (fun j ↦ if ↑j = n - 2 then 1 else (if ↑j = 2 * n - 2 then n else 0))
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
sylvesterDeriv
The Sylvester matrix for `f` and `f.derivative`, modified by dividing the bottom row by the leading coefficient of `f`. Important because its determinant is (up to a sign) the discriminant of `f`.
sylvesterDeriv_updateRow (f : R[X]) (hf : 0 < f.natDegree) : (sylvesterDeriv f).updateRow ⟨2 * f.natDegree - 2, by cutsat⟩ (f.leadingCoeff • (sylvesterDeriv f ⟨2 * f.natDegree - 2, by cutsat⟩)) = (sylvester f f.derivative f.natDegree (f.natDegree - 1)) := by by_cases hn : f.natDegree = 0 · ext ⟨i, hi⟩; cutsat ext ⟨i, hi⟩ ⟨j, hj⟩ rw [sylvesterDeriv, dif_neg hn] rcases ne_or_eq i (2 * f.natDegree - 2) with hi' | rfl · -- Top part of matrix rw [Matrix.updateRow_ne (Fin.ne_of_val_ne hi'), Matrix.updateRow_ne (Fin.ne_of_val_ne hi')] · -- Bottom row simp only [sylvester, Fin.addCases, mem_Icc, coeff_derivative, eq_rec_constant, leadingCoeff, Matrix.updateRow_self, Matrix.updateRow_apply, ↓reduceIte, Pi.smul_apply, smul_eq_mul, mul_ite, mul_one, mul_zero, Matrix.of_apply, Fin.castLT_mk, tsub_le_iff_right, Fin.cast_mk, Fin.subNat_mk, dite_eq_ite] split_ifs on_goal 2 => rw [show f.natDegree = 1 by cutsat] on_goal 3 => rw [← Nat.cast_one (R := R), ← Nat.cast_add, show f.natDegree = 1 by cutsat] norm_num on_goal 6 => rw [← Nat.cast_one (R := R), ← Nat.cast_add] #adaptation_note /-- Prior to nightly-2025-09-09, these two steps were not needed (i.e. `grind` just finished from here) -/ have : 2 * f.natDegree - 2 - (j - (f.natDegree - 1)) + 1 = f.natDegree := by grind simp [this] all_goals grind
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
sylvesterDeriv_updateRow
We can get the usual Sylvester matrix of `f` and `f.derivative` back from the modified one by multiplying the last row by the leading coefficient of `f`.
resultant (f g : R[X]) (m : ℕ := f.natDegree) (n : ℕ := g.natDegree) : R := (sylvester f g m n).det variable (f g : R[X]) (m n : ℕ)
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
resultant
The resultant of two polynomials `f` and `g` is the determinant of the Sylvester matrix of `f` and `g`. The size arguments `m` and `n` are implemented as `optParam`, meaning that the default values are `f.natDegree` and `g.natDegree` respectively, but they can also be specified to be other values.
@[simp] resultant_C_zero_right (a : R) : resultant f (C a) m 0 = a ^ m := by simp [resultant]
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
resultant_C_zero_right
For polynomial `f` and constant `a`, `Res(f, a) = a ^ m`.
resultant_C_right (a : R) : resultant f (C a) m = a ^ m := by simp
theorem
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
resultant_C_right
For polynomial `f` and constant `a`, `Res(f, a) = a ^ m`.
noncomputable disc (f : R[X]) : R := f.sylvesterDeriv.det * (-1) ^ (f.natDegree * (f.natDegree - 1) / 2)
def
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
disc
The discriminant of a polynomial, defined as the determinant of `f.sylvesterDeriv` modified by a sign. The sign is chosen so polynomials over `ℝ` with all roots real have non-negative discriminant.
@[simp] disc_C (r : R) : disc (C r) = 1 := by let e : Fin ((C r).natDegree - 1 + (C r).natDegree) ≃ Fin 0 := finCongr (by simp) simp [disc, ← Matrix.det_reindex_self e]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
disc_C
The discriminant of a constant polynomial is `1`.
disc_of_degree_eq_one {f : R[X]} (hf : f.degree = 1) : disc f = 1 := by rw [← Nat.cast_one, degree_eq_iff_natDegree_eq_of_pos one_pos] at hf let e : Fin (f.natDegree - 1 + f.natDegree) ≃ Fin 1 := finCongr (by cutsat) have : f.sylvesterDeriv.reindex e e = !![1] := by have : NeZero (f.natDegree - 1 + f.natDegree) := ⟨by cutsat⟩ ext ⟨i, hi⟩ ⟨j, hj⟩ obtain ⟨rfl⟩ : i = 0 := by cutsat obtain ⟨rfl⟩ : j = 0 := by cutsat simp [e, sylvesterDeriv, mul_comm, hf] simp [disc, ← Matrix.det_reindex_self e, this, hf]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
disc_of_degree_eq_one
The discriminant of a linear polynomial is `1`.
disc_of_degree_eq_two {f : R[X]} (hf : f.degree = 2) : disc f = f.coeff 1 ^ 2 - 4 * f.coeff 0 * f.coeff 2 := by rw [← Nat.cast_two, degree_eq_iff_natDegree_eq_of_pos two_pos] at hf let e : Fin (f.natDegree - 1 + f.natDegree) ≃ Fin 3 := finCongr (by cutsat) rw [disc, ← Matrix.det_reindex_self e] have : f.sylvesterDeriv.reindex e e = !![f.coeff 0, f.coeff 1, 0; f.coeff 1, 2 * f.coeff 2, f.coeff 1; 1, 0, 2] := by ext i j fin_cases i <;> fin_cases j <;> simp [e, sylvesterDeriv, sylvester, coeff_derivative, mul_comm, Fin.addCases, one_add_one_eq_two, hf, Fin.cast] simp only [this, Matrix.det_fin_three, Matrix.of_apply, Matrix.cons_val', Matrix.cons_val_zero, Matrix.cons_val_fin_one, Matrix.cons_val_one, Matrix.cons_val, hf] ring_nf
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
disc_of_degree_eq_two
Standard formula for the discriminant of a quadratic polynomial.
resultant_deriv {f : R[X]} (hf : 0 < f.degree) : resultant f f.derivative f.natDegree (f.natDegree - 1) = (-1) ^ (f.natDegree * (f.natDegree - 1) / 2) * f.leadingCoeff * f.disc := by rw [← natDegree_pos_iff_degree_pos] at hf rw [resultant, ← sylvesterDeriv_updateRow f hf, Matrix.det_updateRow_smul, Matrix.updateRow_eq_self, disc] suffices ∀ (r s : R), s * r = s * r * (-1) ^ (f.natDegree * (f.natDegree - 1) / 2 * 2) by ring_nf apply this simp only [mul_comm _ 2, pow_mul, neg_one_sq, one_pow, mul_one, implies_true]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
resultant_deriv
Relation between the resultant and the discriminant. (Note this is actually false when `f` is a constant polynomial not equal to 1, so the assumption on the degree is genuinely needed.)
private sylvesterDeriv_of_natDegree_eq_three {f : R[X]} (hf : f.natDegree = 3) : f.sylvesterDeriv.reindex (finCongr <| by rw [hf]) (finCongr <| by rw [hf]) = !![ f.coeff 0, 0, 1 * f.coeff 1, 0, 0; f.coeff 1, f.coeff 0, 2 * f.coeff 2, 1 * f.coeff 1, 0; f.coeff 2, f.coeff 1, 3 * f.coeff 3, 2 * f.coeff 2, 1 * f.coeff 1; f.coeff 3, f.coeff 2, 0, 3 * f.coeff 3, 2 * f.coeff 2; 0, 1, 0, 0, 3] := by ext ⟨i, hi⟩ ⟨j, hj⟩ simp only [sylvesterDeriv, hf, OfNat.ofNat_ne_zero, ↓reduceDIte, sylvester, Fin.addCases, Nat.add_one_sub_one, Fin.coe_castLT, mem_Icc, Fin.val_fin_le, Fin.coe_subNat, Fin.coe_cast, tsub_le_iff_right, coeff_derivative, eq_rec_constant, dite_eq_ite, Nat.reduceMul, Nat.reduceSub, Nat.cast_ofNat, Matrix.reindex_apply, finCongr_symm, Matrix.submatrix_apply, finCongr_apply, Fin.cast_mk, Matrix.updateRow_apply, Fin.mk.injEq, Matrix.of_apply, Fin.mk_le_mk, one_mul, Matrix.cons_val', Matrix.cons_val_fin_one] have hi' : i ∈ Finset.range 5 := Finset.mem_range.mpr hi have hj' : j ∈ Finset.range 5 := Finset.mem_range.mpr hj fin_cases hi' <;> · simp only [and_true, Fin.isValue, Fin.mk_one, Fin.reduceFinMk, Fin.zero_eta, le_add_iff_nonneg_left, Matrix.cons_val_one, Matrix.cons_val_zero, Matrix.cons_val, mul_one, Nat.cast_zero, Nat.reduceAdd, Nat.reduceEqDiff, Nat.reduceLeDiff, nonpos_iff_eq_zero, OfNat.one_ne_ofNat, OfNat.zero_ne_ofNat, ↓reduceIte, zero_add, zero_le, zero_tsub] fin_cases hj' <;> simp [mul_comm, one_add_one_eq_two, (by norm_num : (2 : R) + 1 = 3)]
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
sylvesterDeriv_of_natDegree_eq_three
null
disc_of_degree_eq_three {f : R[X]} (hf : f.degree = 3) : disc f = f.coeff 2 ^ 2 * f.coeff 1 ^ 2 - 4 * f.coeff 3 * f.coeff 1 ^ 3 - 4 * f.coeff 2 ^ 3 * f.coeff 0 - 27 * f.coeff 3 ^ 2 * f.coeff 0 ^ 2 + 18 * f.coeff 3 * f.coeff 2 * f.coeff 1 * f.coeff 0 := by apply natDegree_eq_of_degree_eq_some at hf let e : Fin ((f.natDegree - 1) + f.natDegree) ≃ Fin 5 := finCongr (by rw [hf]) rw [disc, ← Matrix.det_reindex_self e, sylvesterDeriv_of_natDegree_eq_three hf] simp [Matrix.det_succ_row_zero (n := 4), Matrix.det_succ_row_zero (n := 3), Fin.succAbove, Matrix.det_fin_three, Finset.sum_fin_eq_sum_range, Finset.sum_range_succ, hf] ring_nf
lemma
RingTheory
[ "Mathlib.Algebra.Polynomial.Derivative", "Mathlib.LinearAlgebra.Matrix.Determinant.Basic" ]
Mathlib/RingTheory/Polynomial/Resultant/Basic.lean
disc_of_degree_eq_three
Standard formula for the discriminant of a cubic polynomial.
@[simps] equivSubtype : MaximalSpectrum R ≃ {I : Ideal R // I.IsMaximal} where toFun I := ⟨I.asIdeal, I.2⟩ invFun I := ⟨I, I.2⟩
def
RingTheory
[ "Mathlib.RingTheory.Spectrum.Maximal.Defs", "Mathlib.RingTheory.Spectrum.Prime.Defs" ]
Mathlib/RingTheory/Spectrum/Maximal/Basic.lean
equivSubtype
The prime spectrum is in bijection with the set of prime ideals.
range_asIdeal : Set.range MaximalSpectrum.asIdeal = {J : Ideal R | J.IsMaximal} := Set.ext fun J ↦ ⟨fun hJ ↦ let ⟨j, hj⟩ := Set.mem_range.mp hJ; Set.mem_setOf.mpr <| hj ▸ j.isMaximal, fun hJ ↦ Set.mem_range.mpr ⟨⟨J, Set.mem_setOf.mp hJ⟩, rfl⟩⟩ variable {R}
theorem
RingTheory
[ "Mathlib.RingTheory.Spectrum.Maximal.Defs", "Mathlib.RingTheory.Spectrum.Prime.Defs" ]
Mathlib/RingTheory/Spectrum/Maximal/Basic.lean
range_asIdeal
null
toPrimeSpectrum (x : MaximalSpectrum R) : PrimeSpectrum R := ⟨x.asIdeal, x.isMaximal.isPrime⟩
def
RingTheory
[ "Mathlib.RingTheory.Spectrum.Maximal.Defs", "Mathlib.RingTheory.Spectrum.Prime.Defs" ]
Mathlib/RingTheory/Spectrum/Maximal/Basic.lean
toPrimeSpectrum
The natural inclusion from the maximal spectrum to the prime spectrum.
toPrimeSpectrum_injective : (@toPrimeSpectrum R _).Injective := fun ⟨_, _⟩ ⟨_, _⟩ h => by simpa only [MaximalSpectrum.mk.injEq] using PrimeSpectrum.ext_iff.mp h
theorem
RingTheory
[ "Mathlib.RingTheory.Spectrum.Maximal.Defs", "Mathlib.RingTheory.Spectrum.Prime.Defs" ]
Mathlib/RingTheory/Spectrum/Maximal/Basic.lean
toPrimeSpectrum_injective
null
@[ext] MaximalSpectrum (R : Type*) [CommSemiring R] where asIdeal : Ideal R isMaximal : asIdeal.IsMaximal attribute [instance] MaximalSpectrum.isMaximal
structure
RingTheory
[ "Mathlib.RingTheory.Ideal.Maximal" ]
Mathlib/RingTheory/Spectrum/Maximal/Defs.lean
MaximalSpectrum
The maximal spectrum of a commutative (semi)ring `R` is the type of all maximal ideals of `R`.
iInf_localization_eq_bot : (⨅ v : MaximalSpectrum R, Localization.subalgebra.ofField K _ v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by ext x rw [Algebra.mem_bot, Algebra.mem_iInf] constructor · contrapose intro hrange hlocal let denom : Ideal R := (1 : Submodule R K).comap (LinearMap.toSpanSingleton R K x) have hdenom : (1 : R) ∉ denom := by simpa [denom] using hrange rcases denom.exists_le_maximal (denom.ne_top_iff_one.mpr hdenom) with ⟨max, hmax, hle⟩ rcases hlocal ⟨max, hmax⟩ with ⟨n, d, hd, rfl⟩ exact hd (hle ⟨n, by simp [Algebra.smul_def, mul_left_comm, mul_inv_cancel₀ <| (map_ne_zero_iff _ <| IsFractionRing.injective R K).mpr fun h ↦ hd (h ▸ max.zero_mem :)]⟩) · rintro ⟨y, rfl⟩ ⟨v, hv⟩ exact ⟨y, 1, v.ne_top_iff_one.mp hv.ne_top, by rw [map_one, inv_one, mul_one]⟩
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
iInf_localization_eq_bot
An integral domain is equal to the intersection of its localizations at all its maximal ideals viewed as subalgebras of its field of fractions.
iInf_localization_eq_bot : ⨅ v : PrimeSpectrum R, Localization.subalgebra.ofField K _ (v.asIdeal.primeCompl_le_nonZeroDivisors) = ⊥ := by refine bot_unique (.trans (fun _ ↦ ?_) (MaximalSpectrum.iInf_localization_eq_bot R K).le) simpa only [Algebra.mem_iInf] using fun hx ⟨v, hv⟩ ↦ hx ⟨v, hv.isPrime⟩
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
iInf_localization_eq_bot
An integral domain is equal to the intersection of its localizations at all its prime ideals viewed as subalgebras of its field of fractions.
PiLocalization : Type _ := Π I : MaximalSpectrum R, Localization.AtPrime I.1
abbrev
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
PiLocalization
The product of localizations at all maximal ideals of a commutative semiring.
toPiLocalization : R →+* PiLocalization R := algebraMap R _
def
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization
The canonical ring homomorphism from a commutative semiring to the product of its localizations at all maximal ideals. It is always injective.
toPiLocalization_injective : Function.Injective (toPiLocalization R) := fun r r' eq ↦ by rw [← one_mul r, ← one_mul r'] by_contra ne have ⟨I, mI, hI⟩ := (Module.eqIdeal R r r').exists_le_maximal ((Ideal.ne_top_iff_one _).mpr ne) have ⟨s, hs⟩ := (IsLocalization.eq_iff_exists I.primeCompl _).mp (congr_fun eq ⟨I, mI⟩) exact s.2 (hI hs)
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization_injective
null
toPiLocalization_apply_apply {r I} : toPiLocalization R r I = algebraMap R _ r := rfl variable {R S} (f : R →+* S) (g : S →+* P) (hf : Function.Bijective f) (hg : Function.Bijective g)
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization_apply_apply
null
noncomputable mapPiLocalization : PiLocalization R →+* PiLocalization S := Pi.ringHom fun I ↦ (Localization.localRingHom _ _ f rfl).comp <| Pi.evalRingHom _ (⟨_, I.2.comap_bijective f hf⟩ : MaximalSpectrum R)
def
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
mapPiLocalization
Functoriality of `PiLocalization` but restricted to bijective ring homs. If R and S are commutative rings, surjectivity would be enough.
mapPiLocalization_naturality : (mapPiLocalization f hf).comp (toPiLocalization R) = (toPiLocalization S).comp f := by ext r I change Localization.localRingHom _ _ _ rfl (algebraMap _ _ r) = algebraMap _ _ (f r) simp_rw [← IsLocalization.mk'_one (M := (I.1.comap f).primeCompl), Localization.localRingHom_mk', ← IsLocalization.mk'_one (M := I.1.primeCompl), Submonoid.coe_one, map_one f] rfl
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
mapPiLocalization_naturality
null
mapPiLocalization_id : mapPiLocalization (.id R) Function.bijective_id = .id _ := RingHom.ext fun _ ↦ funext fun _ ↦ congr($(Localization.localRingHom_id _) _)
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
mapPiLocalization_id
null
mapPiLocalization_comp : mapPiLocalization (g.comp f) (hg.comp hf) = (mapPiLocalization g hg).comp (mapPiLocalization f hf) := RingHom.ext fun _ ↦ funext fun _ ↦ congr($(Localization.localRingHom_comp _ _ _ _ rfl _ rfl) _)
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
mapPiLocalization_comp
null
mapPiLocalization_bijective : Function.Bijective (mapPiLocalization f hf) := by let f := RingEquiv.ofBijective f hf let e := RingEquiv.ofRingHom (mapPiLocalization f hf) (mapPiLocalization (f.symm : S →+* R) f.symm.bijective) ?_ ?_ · exact e.bijective · rw [← mapPiLocalization_comp] simp_rw [RingEquiv.comp_symm, mapPiLocalization_id] · rw [← mapPiLocalization_comp] simp_rw [RingEquiv.symm_comp, mapPiLocalization_id]
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
mapPiLocalization_bijective
null
toPiLocalization_not_surjective_of_infinite [Infinite ι] : ¬ Function.Surjective (toPiLocalization (Π i, R i)) := fun surj ↦ by classical have ⟨J, max, notMem⟩ := PrimeSpectrum.exists_maximal_notMem_range_sigmaToPi_of_infinite R obtain ⟨r, hr⟩ := surj (Function.update 0 ⟨J, max⟩ 1) have : r = 0 := funext fun i ↦ toPiLocalization_injective _ <| funext fun I ↦ by replace hr := congr_fun hr ⟨_, I.2.comap_piEvalRingHom⟩ dsimp only [toPiLocalization_apply_apply, Subtype.coe_mk] at hr simp_rw [toPiLocalization_apply_apply, ← Localization.AtPrime.mapPiEvalRingHom_algebraMap_apply, hr] rw [Function.update_of_ne]; · simp_rw [Pi.zero_apply, map_zero] exact fun h ↦ notMem ⟨⟨i, I.1, I.2.isPrime⟩, PrimeSpectrum.ext congr($h.1)⟩ replace hr := congr_fun hr ⟨J, max⟩ rw [this, map_zero, Function.update_self] at hr exact zero_ne_one hr variable {R}
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization_not_surjective_of_infinite
null
finite_of_toPiLocalization_pi_surjective (h : Function.Surjective (toPiLocalization (Π i, R i))) : Finite ι := by contrapose! h exact toPiLocalization_not_surjective_of_infinite _
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
finite_of_toPiLocalization_pi_surjective
null
finite_of_toPiLocalization_surjective (surj : Function.Surjective (toPiLocalization R)) : Finite (MaximalSpectrum R) := by replace surj := mapPiLocalization_bijective _ ⟨toPiLocalization_injective R, surj⟩ |>.2.comp surj rw [← RingHom.coe_comp, mapPiLocalization_naturality, RingHom.coe_comp] at surj exact finite_of_toPiLocalization_pi_surjective surj.of_comp
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
finite_of_toPiLocalization_surjective
null
PiLocalization : Type _ := Π p : PrimeSpectrum R, Localization p.asIdeal.primeCompl
abbrev
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
PiLocalization
The product of localizations at all prime ideals of a commutative semiring.
toPiLocalization : R →+* PiLocalization R := algebraMap R _
def
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization
The canonical ring homomorphism from a commutative semiring to the product of its localizations at all prime ideals. It is always injective.
toPiLocalization_injective : Function.Injective (toPiLocalization R) := fun _ _ eq ↦ MaximalSpectrum.toPiLocalization_injective R <| funext fun I ↦ congr_fun eq I.toPrimeSpectrum
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
toPiLocalization_injective
null
piLocalizationToMaximal : PiLocalization R →+* MaximalSpectrum.PiLocalization R := Pi.ringHom fun I ↦ Pi.evalRingHom _ I.toPrimeSpectrum open scoped Classical in
def
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
piLocalizationToMaximal
The projection from the product of localizations at primes to the product of localizations at maximal ideals.
piLocalizationToMaximal_surjective : Function.Surjective (piLocalizationToMaximal R) := fun r ↦ ⟨fun I ↦ if h : I.1.IsMaximal then r ⟨_, h⟩ else 0, funext fun _ ↦ dif_pos _⟩ variable {R}
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
piLocalizationToMaximal_surjective
null
piLocalizationToMaximalEquiv (h : ∀ I : Ideal R, I.IsPrime → I.IsMaximal) : PiLocalization R ≃+* MaximalSpectrum.PiLocalization R where __ := piLocalizationToMaximal R invFun := Pi.ringHom fun I ↦ Pi.evalRingHom _ (⟨_, h _ I.2⟩ : MaximalSpectrum R)
def
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
piLocalizationToMaximalEquiv
If R has Krull dimension ≤ 0, then `piLocalizationToIsMaximal R` is an isomorphism.
piLocalizationToMaximal_bijective (h : ∀ I : Ideal R, I.IsPrime → I.IsMaximal) : Function.Bijective (piLocalizationToMaximal R) := (piLocalizationToMaximalEquiv h).bijective
theorem
RingTheory
[ "Mathlib.RingTheory.Localization.AsSubring", "Mathlib.RingTheory.Spectrum.Maximal.Basic", "Mathlib.RingTheory.Spectrum.Prime.RingHom" ]
Mathlib/RingTheory/Spectrum/Maximal/Localization.lean
piLocalizationToMaximal_bijective
null