Context
stringlengths
57
6.04k
file_name
stringlengths
21
79
start
int64
14
1.49k
end
int64
18
1.5k
theorem
stringlengths
25
1.55k
proof
stringlengths
5
7.36k
rank
int64
0
2.4k
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff' theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl #align matrix.represents.mul Matrix.Represents.mul
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
124
128
theorem Matrix.Represents.one : (1 : Matrix ι ι R).Represents b 1 := by
delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_one] ext rfl
1,941
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff' theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl #align matrix.represents.mul Matrix.Represents.mul theorem Matrix.Represents.one : (1 : Matrix ι ι R).Represents b 1 := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_one] ext rfl #align matrix.represents.one Matrix.Represents.one
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
131
133
theorem Matrix.Represents.add {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A + A').Represents b (f + f') := by
delta Matrix.Represents at h h' ⊢; rw [map_add, map_add, h, h']
1,941
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff' theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl #align matrix.represents.mul Matrix.Represents.mul theorem Matrix.Represents.one : (1 : Matrix ι ι R).Represents b 1 := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_one] ext rfl #align matrix.represents.one Matrix.Represents.one theorem Matrix.Represents.add {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A + A').Represents b (f + f') := by delta Matrix.Represents at h h' ⊢; rw [map_add, map_add, h, h'] #align matrix.represents.add Matrix.Represents.add
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
136
138
theorem Matrix.Represents.zero : (0 : Matrix ι ι R).Represents b 0 := by
delta Matrix.Represents rw [map_zero, map_zero]
1,941
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin #align_import linear_algebra.matrix.charpoly.linear_map from "leanprover-community/mathlib"@"62c0a4ef1441edb463095ea02a06e87f3dfe135c" variable {ι : Type*} [Fintype ι] variable {M : Type*} [AddCommGroup M] (R : Type*) [CommRing R] [Module R M] (I : Ideal R) variable (b : ι → M) (hb : Submodule.span R (Set.range b) = ⊤) open Polynomial Matrix def PiToModule.fromMatrix [DecidableEq ι] : Matrix ι ι R →ₗ[R] (ι → R) →ₗ[R] M := (LinearMap.llcomp R _ _ _ (Fintype.total R R b)).comp algEquivMatrix'.symm.toLinearMap #align pi_to_module.from_matrix PiToModule.fromMatrix theorem PiToModule.fromMatrix_apply [DecidableEq ι] (A : Matrix ι ι R) (w : ι → R) : PiToModule.fromMatrix R b A w = Fintype.total R R b (A *ᵥ w) := rfl #align pi_to_module.from_matrix_apply PiToModule.fromMatrix_apply theorem PiToModule.fromMatrix_apply_single_one [DecidableEq ι] (A : Matrix ι ι R) (j : ι) : PiToModule.fromMatrix R b A (Pi.single j 1) = ∑ i : ι, A i j • b i := by rw [PiToModule.fromMatrix_apply, Fintype.total_apply, Matrix.mulVec_single] simp_rw [mul_one] #align pi_to_module.from_matrix_apply_single_one PiToModule.fromMatrix_apply_single_one def PiToModule.fromEnd : Module.End R M →ₗ[R] (ι → R) →ₗ[R] M := LinearMap.lcomp _ _ (Fintype.total R R b) #align pi_to_module.from_End PiToModule.fromEnd theorem PiToModule.fromEnd_apply (f : Module.End R M) (w : ι → R) : PiToModule.fromEnd R b f w = f (Fintype.total R R b w) := rfl #align pi_to_module.from_End_apply PiToModule.fromEnd_apply theorem PiToModule.fromEnd_apply_single_one [DecidableEq ι] (f : Module.End R M) (i : ι) : PiToModule.fromEnd R b f (Pi.single i 1) = f (b i) := by rw [PiToModule.fromEnd_apply] congr convert Fintype.total_apply_single (S := R) R b i (1 : R) rw [one_smul] #align pi_to_module.from_End_apply_single_one PiToModule.fromEnd_apply_single_one theorem PiToModule.fromEnd_injective (hb : Submodule.span R (Set.range b) = ⊤) : Function.Injective (PiToModule.fromEnd R b) := by intro x y e ext m obtain ⟨m, rfl⟩ : m ∈ LinearMap.range (Fintype.total R R b) := by rw [(Fintype.range_total R b).trans hb] exact Submodule.mem_top exact (LinearMap.congr_fun e m : _) #align pi_to_module.from_End_injective PiToModule.fromEnd_injective section variable {R} [DecidableEq ι] def Matrix.Represents (A : Matrix ι ι R) (f : Module.End R M) : Prop := PiToModule.fromMatrix R b A = PiToModule.fromEnd R b f #align matrix.represents Matrix.Represents variable {b} theorem Matrix.Represents.congr_fun {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (x) : Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := LinearMap.congr_fun h x #align matrix.represents.congr_fun Matrix.Represents.congr_fun theorem Matrix.represents_iff {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ x, Fintype.total R R b (A *ᵥ x) = f (Fintype.total R R b x) := ⟨fun e x => e.congr_fun x, fun H => LinearMap.ext fun x => H x⟩ #align matrix.represents_iff Matrix.represents_iff theorem Matrix.represents_iff' {A : Matrix ι ι R} {f : Module.End R M} : A.Represents b f ↔ ∀ j, ∑ i : ι, A i j • b i = f (b j) := by constructor · intro h i have := LinearMap.congr_fun h (Pi.single i 1) rwa [PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] at this · intro h -- Porting note: was `ext` refine LinearMap.pi_ext' (fun i => LinearMap.ext_ring ?_) simp_rw [LinearMap.comp_apply, LinearMap.coe_single, PiToModule.fromEnd_apply_single_one, PiToModule.fromMatrix_apply_single_one] apply h #align matrix.represents_iff' Matrix.represents_iff' theorem Matrix.Represents.mul {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A * A').Represents b (f * f') := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_mul] ext dsimp [PiToModule.fromEnd] rw [← h'.congr_fun, ← h.congr_fun] rfl #align matrix.represents.mul Matrix.Represents.mul theorem Matrix.Represents.one : (1 : Matrix ι ι R).Represents b 1 := by delta Matrix.Represents PiToModule.fromMatrix rw [LinearMap.comp_apply, AlgEquiv.toLinearMap_apply, _root_.map_one] ext rfl #align matrix.represents.one Matrix.Represents.one theorem Matrix.Represents.add {A A' : Matrix ι ι R} {f f' : Module.End R M} (h : A.Represents b f) (h' : Matrix.Represents b A' f') : (A + A').Represents b (f + f') := by delta Matrix.Represents at h h' ⊢; rw [map_add, map_add, h, h'] #align matrix.represents.add Matrix.Represents.add theorem Matrix.Represents.zero : (0 : Matrix ι ι R).Represents b 0 := by delta Matrix.Represents rw [map_zero, map_zero] #align matrix.represents.zero Matrix.Represents.zero
Mathlib/LinearAlgebra/Matrix/Charpoly/LinearMap.lean
141
144
theorem Matrix.Represents.smul {A : Matrix ι ι R} {f : Module.End R M} (h : A.Represents b f) (r : R) : (r • A).Represents b (r • f) := by
delta Matrix.Represents at h ⊢ rw [_root_.map_smul, _root_.map_smul, h]
1,941
import Mathlib.Data.Nat.Cast.WithTop import Mathlib.RingTheory.Prime import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" open Polynomial Ideal.Quotient variable {R : Type*} [CommRing R] namespace Polynomial open Polynomial namespace EisensteinCriterionAux -- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion` theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R} (hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) : map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree := Polynomial.ext fun n => by by_cases hf0 : f = 0 · simp [hf0] rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h) · erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg, mul_zero] rintro rfl exact not_lt_of_ge degree_le_natDegree h · have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map] · rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt] · refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_ rwa [← degree_eq_natDegree hf0] · exact lt_of_le_of_lt (degree_map_le _ _) h set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem
Mathlib/RingTheory/EisensteinCriterion.lean
52
61
theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.natDegree := Nat.cast_le.1 (calc ↑n = degree (q.map (mk P)) := by
rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one] _ ≤ degree q := degree_map_le _ _ _ ≤ natDegree q := degree_le_natDegree )
1,942
import Mathlib.Data.Nat.Cast.WithTop import Mathlib.RingTheory.Prime import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" open Polynomial Ideal.Quotient variable {R : Type*} [CommRing R] namespace Polynomial open Polynomial namespace EisensteinCriterionAux -- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion` theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R} (hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) : map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree := Polynomial.ext fun n => by by_cases hf0 : f = 0 · simp [hf0] rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h) · erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg, mul_zero] rintro rfl exact not_lt_of_ge degree_le_natDegree h · have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map] · rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt] · refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_ rwa [← degree_eq_natDegree hf0] · exact lt_of_le_of_lt (degree_map_le _ _) h set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.natDegree := Nat.cast_le.1 (calc ↑n = degree (q.map (mk P)) := by rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one] _ ≤ degree q := degree_map_le _ _ _ ≤ natDegree q := degree_le_natDegree ) set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow
Mathlib/RingTheory/EisensteinCriterion.lean
65
68
theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : Ideal R} {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n ≠ 0) : eval 0 q ∈ P := by
rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map, hq, coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero]
1,942
import Mathlib.Data.Nat.Cast.WithTop import Mathlib.RingTheory.Prime import Mathlib.RingTheory.Polynomial.Content import Mathlib.RingTheory.Ideal.Quotient #align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff" open Polynomial Ideal.Quotient variable {R : Type*} [CommRing R] namespace Polynomial open Polynomial namespace EisensteinCriterionAux -- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion` theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R} (hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) : map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree := Polynomial.ext fun n => by by_cases hf0 : f = 0 · simp [hf0] rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h) · erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg, mul_zero] rintro rfl exact not_lt_of_ge degree_le_natDegree h · have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map] · rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt] · refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_ rwa [← degree_eq_natDegree hf0] · exact lt_of_le_of_lt (degree_map_le _ _) h set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) : n ≤ q.natDegree := Nat.cast_le.1 (calc ↑n = degree (q.map (mk P)) := by rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one] _ ≤ degree q := degree_map_le _ _ _ ≤ natDegree q := degree_le_natDegree ) set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : Ideal R} {q : R[X]} {c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n ≠ 0) : eval 0 q ∈ P := by rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map, hq, coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero] set_option linter.uppercaseLean3 false in #align polynomial.eisenstein_criterion_aux.eval_zero_mem_ideal_of_eq_mul_X_pow Polynomial.EisensteinCriterionAux.eval_zero_mem_ideal_of_eq_mul_X_pow
Mathlib/RingTheory/EisensteinCriterion.lean
72
78
theorem isUnit_of_natDegree_eq_zero_of_isPrimitive {p q : R[X]} -- Porting note: stated using `IsPrimitive` which is defeq to old statement. (hu : IsPrimitive (p * q)) (hpm : p.natDegree = 0) : IsUnit p := by
rw [eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm), isUnit_C] refine hu _ ?_ rw [← eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm)] exact dvd_mul_right _ _
1,942
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommSemiring variable [CommSemiring R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟)
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
66
69
theorem map {A : Type v} [CommRing 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 _ _)))
1,943
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] section Principal variable {p : R}
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
83
108
theorem 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 not_mem_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)) _))
1,943
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] section Principal variable {p : R} theorem 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 not_mem_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)) _)) #align polynomial.is_weakly_eisenstein_at.exists_mem_adjoin_mul_eq_pow_nat_degree Polynomial.IsWeaklyEisensteinAt.exists_mem_adjoin_mul_eq_pow_natDegree
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
111
121
theorem 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]
1,943
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] -- Porting note: `Ideal.neg_mem_iff` was `neg_mem_iff` on line 142 but Lean was not able to find -- NegMemClass
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
128
138
theorem pow_natDegree_le_of_root_of_monic_mem {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.not_mem_range_self, Finset.sum_range, hmo.coeff_natDegree, one_mul] at * rw [eq_neg_of_add_eq_zero_left hroot, Ideal.neg_mem_iff] exact Submodule.sum_mem _ fun i _ => mul_mem_right _ _ (hf.mem (Fin.is_lt i))
1,943
import Mathlib.RingTheory.EisensteinCriterion import Mathlib.RingTheory.Polynomial.ScaleRoots #align_import ring_theory.polynomial.eisenstein.basic from "leanprover-community/mathlib"@"2032a878972d5672e7c27c957e7a6e297b044973" universe u v w z variable {R : Type u} open Ideal Algebra Finset open Polynomial namespace Polynomial @[mk_iff] structure IsWeaklyEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 #align polynomial.is_weakly_eisenstein_at Polynomial.IsWeaklyEisensteinAt @[mk_iff] structure IsEisensteinAt [CommSemiring R] (f : R[X]) (𝓟 : Ideal R) : Prop where leading : f.leadingCoeff ∉ 𝓟 mem : ∀ {n}, n < f.natDegree → f.coeff n ∈ 𝓟 not_mem : f.coeff 0 ∉ 𝓟 ^ 2 #align polynomial.is_eisenstein_at Polynomial.IsEisensteinAt namespace IsWeaklyEisensteinAt section CommRing variable [CommRing R] {𝓟 : Ideal R} {f : R[X]} (hf : f.IsWeaklyEisensteinAt 𝓟) variable {S : Type v} [CommRing S] [Algebra R S] section ScaleRoots variable {A : Type*} [CommRing R] [CommRing A]
Mathlib/RingTheory/Polynomial/Eisenstein/Basic.lean
161
166
theorem 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)
1,943
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite
Mathlib/FieldTheory/Minpoly/Field.lean
53
62
theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by
have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x))
1,944
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique
Mathlib/FieldTheory/Minpoly/Field.lean
68
76
theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by
by_cases hp0 : p = 0 · simp only [hp0, dvd_zero] have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩ rw [← modByMonic_eq_zero_iff_dvd (monic hx)] by_contra hnz apply degree_le_of_ne_zero A x hnz ((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt exact degree_modByMonic_lt _ (monic hx)
1,944
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by by_cases hp0 : p = 0 · simp only [hp0, dvd_zero] have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩ rw [← modByMonic_eq_zero_iff_dvd (monic hx)] by_contra hnz apply degree_le_of_ne_zero A x hnz ((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt exact degree_modByMonic_lt _ (monic hx) #align minpoly.dvd minpoly.dvd variable {A x} in lemma dvd_iff {p : A[X]} : minpoly A x ∣ p ↔ Polynomial.aeval x p = 0 := ⟨fun ⟨q, hq⟩ ↦ by rw [hq, map_mul, aeval, zero_mul], minpoly.dvd A x⟩ theorem isRadical [IsReduced B] : IsRadical (minpoly A x) := fun n p dvd ↦ by rw [dvd_iff] at dvd ⊢; rw [map_pow] at dvd; exact IsReduced.eq_zero _ ⟨n, dvd⟩
Mathlib/FieldTheory/Minpoly/Field.lean
86
90
theorem dvd_map_of_isScalarTower (A K : Type*) {R : Type*} [CommRing A] [Field K] [CommRing R] [Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) : minpoly K x ∣ (minpoly A x).map (algebraMap A K) := by
refine minpoly.dvd K x ?_ rw [aeval_map_algebraMap, minpoly.aeval]
1,944
import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Algebraic #align_import field_theory.minpoly.field from "leanprover-community/mathlib"@"cbdf7b565832144d024caa5a550117c6df0204a5" open scoped Classical open Polynomial Set Function minpoly namespace minpoly variable {A B : Type*} variable (A) [Field A] section Ring variable [Ring B] [Algebra A B] (x : B) theorem degree_le_of_ne_zero {p : A[X]} (pnz : p ≠ 0) (hp : Polynomial.aeval x p = 0) : degree (minpoly A x) ≤ degree p := calc degree (minpoly A x) ≤ degree (p * C (leadingCoeff p)⁻¹) := min A x (monic_mul_leadingCoeff_inv pnz) (by simp [hp]) _ = degree p := degree_mul_leadingCoeff_inv p pnz #align minpoly.degree_le_of_ne_zero minpoly.degree_le_of_ne_zero theorem ne_zero_of_finite (e : B) [FiniteDimensional A B] : minpoly A e ≠ 0 := minpoly.ne_zero <| .of_finite A _ #align minpoly.ne_zero_of_finite_field_extension minpoly.ne_zero_of_finite theorem unique {p : A[X]} (pmonic : p.Monic) (hp : Polynomial.aeval x p = 0) (pmin : ∀ q : A[X], q.Monic → Polynomial.aeval x q = 0 → degree p ≤ degree q) : p = minpoly A x := by have hx : IsIntegral A x := ⟨p, pmonic, hp⟩ symm; apply eq_of_sub_eq_zero by_contra hnz apply degree_le_of_ne_zero A x hnz (by simp [hp]) |>.not_lt apply degree_sub_lt _ (minpoly.ne_zero hx) · rw [(monic hx).leadingCoeff, pmonic.leadingCoeff] · exact le_antisymm (min A x pmonic hp) (pmin (minpoly A x) (monic hx) (aeval A x)) #align minpoly.unique minpoly.unique theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by by_cases hp0 : p = 0 · simp only [hp0, dvd_zero] have hx : IsIntegral A x := IsAlgebraic.isIntegral ⟨p, hp0, hp⟩ rw [← modByMonic_eq_zero_iff_dvd (monic hx)] by_contra hnz apply degree_le_of_ne_zero A x hnz ((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_lt exact degree_modByMonic_lt _ (monic hx) #align minpoly.dvd minpoly.dvd variable {A x} in lemma dvd_iff {p : A[X]} : minpoly A x ∣ p ↔ Polynomial.aeval x p = 0 := ⟨fun ⟨q, hq⟩ ↦ by rw [hq, map_mul, aeval, zero_mul], minpoly.dvd A x⟩ theorem isRadical [IsReduced B] : IsRadical (minpoly A x) := fun n p dvd ↦ by rw [dvd_iff] at dvd ⊢; rw [map_pow] at dvd; exact IsReduced.eq_zero _ ⟨n, dvd⟩ theorem dvd_map_of_isScalarTower (A K : Type*) {R : Type*} [CommRing A] [Field K] [CommRing R] [Algebra A K] [Algebra A R] [Algebra K R] [IsScalarTower A K R] (x : R) : minpoly K x ∣ (minpoly A x).map (algebraMap A K) := by refine minpoly.dvd K x ?_ rw [aeval_map_algebraMap, minpoly.aeval] #align minpoly.dvd_map_of_is_scalar_tower minpoly.dvd_map_of_isScalarTower
Mathlib/FieldTheory/Minpoly/Field.lean
93
99
theorem dvd_map_of_isScalarTower' (R : Type*) {S : Type*} (K L : Type*) [CommRing R] [CommRing S] [Field K] [CommRing L] [Algebra R S] [Algebra R K] [Algebra S L] [Algebra K L] [Algebra R L] [IsScalarTower R K L] [IsScalarTower R S L] (s : S) : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (minpoly R s) := by
apply minpoly.dvd K (algebraMap S L s) rw [← map_aeval_eq_aeval_map, minpoly.aeval, map_zero] rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
1,944
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V]
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
32
43
theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by
rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one]
1,945
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
46
51
theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) : LinearMap.ker (aeval f (c : K[X])) = ⊥ := by
rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, eval₂_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c
1,945
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1 theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) : LinearMap.ker (aeval f (c : K[X])) = ⊥ := by rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, eval₂_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c #align module.End.ker_aeval_ring_hom'_unit_polynomial Module.End.ker_aeval_ring_hom'_unit_polynomial
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
54
62
theorem aeval_apply_of_hasEigenvector {f : End K V} {p : K[X]} {μ : K} {x : V} (h : f.HasEigenvector μ x) : aeval f p x = p.eval μ • x := by
refine p.induction_on ?_ ?_ ?_ · intro a; simp [Module.algebraMap_end_apply] · intro p q hp hq; simp [hp, hq, add_smul] · intro n a hna rw [mul_comm, pow_succ', mul_assoc, AlgHom.map_mul, LinearMap.mul_apply, mul_comm, hna] simp only [mem_eigenspace_iff.1 h.1, smul_smul, aeval_X, eval_mul, eval_C, eval_pow, eval_X, LinearMap.map_smulₛₗ, RingHom.id_apply, mul_comm]
1,945
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1 theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) : LinearMap.ker (aeval f (c : K[X])) = ⊥ := by rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, eval₂_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c #align module.End.ker_aeval_ring_hom'_unit_polynomial Module.End.ker_aeval_ring_hom'_unit_polynomial theorem aeval_apply_of_hasEigenvector {f : End K V} {p : K[X]} {μ : K} {x : V} (h : f.HasEigenvector μ x) : aeval f p x = p.eval μ • x := by refine p.induction_on ?_ ?_ ?_ · intro a; simp [Module.algebraMap_end_apply] · intro p q hp hq; simp [hp, hq, add_smul] · intro n a hna rw [mul_comm, pow_succ', mul_assoc, AlgHom.map_mul, LinearMap.mul_apply, mul_comm, hna] simp only [mem_eigenspace_iff.1 h.1, smul_smul, aeval_X, eval_mul, eval_C, eval_pow, eval_X, LinearMap.map_smulₛₗ, RingHom.id_apply, mul_comm] #align module.End.aeval_apply_of_has_eigenvector Module.End.aeval_apply_of_hasEigenvector
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
65
69
theorem isRoot_of_hasEigenvalue {f : End K V} {μ : K} (h : f.HasEigenvalue μ) : (minpoly K f).IsRoot μ := by
rcases (Submodule.ne_bot_iff _).1 h with ⟨w, ⟨H, ne0⟩⟩ refine Or.resolve_right (smul_eq_zero.1 ?_) ne0 simp [← aeval_apply_of_hasEigenvector ⟨H, ne0⟩, minpoly.aeval K f]
1,945
import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.FieldTheory.Minpoly.Field #align_import linear_algebra.eigenspace.minpoly from "leanprover-community/mathlib"@"c3216069e5f9369e6be586ccbfcde2592b3cec92" universe u v w namespace Module namespace End open Polynomial FiniteDimensional open scoped Polynomial variable {K : Type v} {V : Type w} [Field K] [AddCommGroup V] [Module K V] theorem eigenspace_aeval_polynomial_degree_1 (f : End K V) (q : K[X]) (hq : degree q = 1) : eigenspace f (-q.coeff 0 / q.leadingCoeff) = LinearMap.ker (aeval f q) := calc eigenspace f (-q.coeff 0 / q.leadingCoeff) _ = LinearMap.ker (q.leadingCoeff • f - algebraMap K (End K V) (-q.coeff 0)) := by rw [eigenspace_div] intro h rw [leadingCoeff_eq_zero_iff_deg_eq_bot.1 h] at hq cases hq _ = LinearMap.ker (aeval f (C q.leadingCoeff * X + C (q.coeff 0))) := by rw [C_mul', aeval_def]; simp [algebraMap, Algebra.toRingHom] _ = LinearMap.ker (aeval f q) := by rwa [← eq_X_add_C_of_degree_eq_one] #align module.End.eigenspace_aeval_polynomial_degree_1 Module.End.eigenspace_aeval_polynomial_degree_1 theorem ker_aeval_ring_hom'_unit_polynomial (f : End K V) (c : K[X]ˣ) : LinearMap.ker (aeval f (c : K[X])) = ⊥ := by rw [Polynomial.eq_C_of_degree_eq_zero (degree_coe_units c)] simp only [aeval_def, eval₂_C] apply ker_algebraMap_end apply coeff_coe_units_zero_ne_zero c #align module.End.ker_aeval_ring_hom'_unit_polynomial Module.End.ker_aeval_ring_hom'_unit_polynomial theorem aeval_apply_of_hasEigenvector {f : End K V} {p : K[X]} {μ : K} {x : V} (h : f.HasEigenvector μ x) : aeval f p x = p.eval μ • x := by refine p.induction_on ?_ ?_ ?_ · intro a; simp [Module.algebraMap_end_apply] · intro p q hp hq; simp [hp, hq, add_smul] · intro n a hna rw [mul_comm, pow_succ', mul_assoc, AlgHom.map_mul, LinearMap.mul_apply, mul_comm, hna] simp only [mem_eigenspace_iff.1 h.1, smul_smul, aeval_X, eval_mul, eval_C, eval_pow, eval_X, LinearMap.map_smulₛₗ, RingHom.id_apply, mul_comm] #align module.End.aeval_apply_of_has_eigenvector Module.End.aeval_apply_of_hasEigenvector theorem isRoot_of_hasEigenvalue {f : End K V} {μ : K} (h : f.HasEigenvalue μ) : (minpoly K f).IsRoot μ := by rcases (Submodule.ne_bot_iff _).1 h with ⟨w, ⟨H, ne0⟩⟩ refine Or.resolve_right (smul_eq_zero.1 ?_) ne0 simp [← aeval_apply_of_hasEigenvector ⟨H, ne0⟩, minpoly.aeval K f] #align module.End.is_root_of_has_eigenvalue Module.End.isRoot_of_hasEigenvalue variable [FiniteDimensional K V] (f : End K V) variable {f} {μ : K}
Mathlib/LinearAlgebra/Eigenspace/Minpoly.lean
75
91
theorem hasEigenvalue_of_isRoot (h : (minpoly K f).IsRoot μ) : f.HasEigenvalue μ := by
cases' dvd_iff_isRoot.2 h with p hp rw [HasEigenvalue, eigenspace] intro con cases' (LinearMap.isUnit_iff_ker_eq_bot _).2 con with u hu have p_ne_0 : p ≠ 0 := by intro con apply minpoly.ne_zero (Algebra.IsIntegral.isIntegral (R := K) f) rw [hp, con, mul_zero] have : (aeval f) p = 0 := by have h_aeval := minpoly.aeval K f revert h_aeval simp [hp, ← hu] have h_deg := minpoly.degree_le_of_ne_zero K f p_ne_0 this rw [hp, degree_mul, degree_X_sub_C, Polynomial.degree_eq_natDegree p_ne_0] at h_deg norm_cast at h_deg omega
1,945
import Mathlib.FieldTheory.Minpoly.Field import Mathlib.LinearAlgebra.FiniteDimensional import Mathlib.Algebra.Polynomial.Module.AEval open Polynomial variable {R K M A : Type*} {a : A} namespace Module.AEval
Mathlib/Algebra/Polynomial/Module/FiniteDimensional.lean
29
34
theorem isTorsion_of_aeval_eq_zero [CommSemiring R] [NoZeroDivisors R] [Semiring A] [Algebra R A] [AddCommMonoid M] [Module A M] [Module R M] [IsScalarTower R A M] {p : R[X]} (h : aeval a p = 0) (h' : p ≠ 0) : IsTorsion R[X] (AEval R M a) := by
have hp : p ∈ nonZeroDivisors R[X] := fun q hq ↦ Or.resolve_right (mul_eq_zero.mp hq) h' exact fun x ↦ ⟨⟨p, hp⟩, (of R M a).symm.injective <| by simp [h]⟩
1,946
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite
Mathlib/RingTheory/PowerBasis.lean
84
86
theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by
rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin]
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank
Mathlib/RingTheory/PowerBasis.lean
89
102
theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by
have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl #align power_basis.mem_span_pow' PowerBasis.mem_span_pow'
Mathlib/RingTheory/PowerBasis.lean
105
116
theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by
rw [mem_span_pow'] constructor <;> · rintro ⟨f, h, hy⟩ refine ⟨f, ?_, hy⟩ by_cases hf : f = 0 · simp only [hf, natDegree_zero, degree_zero] at h ⊢ first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d simp_all only [degree_eq_natDegree hf] · first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl #align power_basis.mem_span_pow' PowerBasis.mem_span_pow' theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by rw [mem_span_pow'] constructor <;> · rintro ⟨f, h, hy⟩ refine ⟨f, ?_, hy⟩ by_cases hf : f = 0 · simp only [hf, natDegree_zero, degree_zero] at h ⊢ first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d simp_all only [degree_eq_natDegree hf] · first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h #align power_basis.mem_span_pow PowerBasis.mem_span_pow theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim ≠ 0 := fun h => not_nonempty_iff.mpr (h.symm ▸ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty #align power_basis.dim_ne_zero PowerBasis.dim_ne_zero theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim := Nat.pos_of_ne_zero pb.dim_ne_zero #align power_basis.dim_pos PowerBasis.dim_pos theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) : ∃ f : R[X], f.natDegree < pb.dim ∧ y = aeval pb.gen f := (mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y) #align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval
Mathlib/RingTheory/PowerBasis.lean
132
135
theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : ∃ f : R[X], y = aeval pb.gen f := by
nontriviality S obtain ⟨f, _, hf⟩ := exists_eq_aeval pb y exact ⟨f, hf⟩
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl #align power_basis.mem_span_pow' PowerBasis.mem_span_pow' theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by rw [mem_span_pow'] constructor <;> · rintro ⟨f, h, hy⟩ refine ⟨f, ?_, hy⟩ by_cases hf : f = 0 · simp only [hf, natDegree_zero, degree_zero] at h ⊢ first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d simp_all only [degree_eq_natDegree hf] · first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h #align power_basis.mem_span_pow PowerBasis.mem_span_pow theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim ≠ 0 := fun h => not_nonempty_iff.mpr (h.symm ▸ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty #align power_basis.dim_ne_zero PowerBasis.dim_ne_zero theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim := Nat.pos_of_ne_zero pb.dim_ne_zero #align power_basis.dim_pos PowerBasis.dim_pos theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) : ∃ f : R[X], f.natDegree < pb.dim ∧ y = aeval pb.gen f := (mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y) #align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : ∃ f : R[X], y = aeval pb.gen f := by nontriviality S obtain ⟨f, _, hf⟩ := exists_eq_aeval pb y exact ⟨f, hf⟩ #align power_basis.exists_eq_aeval' PowerBasis.exists_eq_aeval'
Mathlib/RingTheory/PowerBasis.lean
138
142
theorem algHom_ext {S' : Type*} [Semiring S'] [Algebra R S'] (pb : PowerBasis R S) ⦃f g : S →ₐ[R] S'⦄ (h : f pb.gen = g pb.gen) : f = g := by
ext x obtain ⟨f, rfl⟩ := pb.exists_eq_aeval' x rw [← Polynomial.aeval_algHom_apply, ← Polynomial.aeval_algHom_apply, h]
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl #align power_basis.mem_span_pow' PowerBasis.mem_span_pow' theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by rw [mem_span_pow'] constructor <;> · rintro ⟨f, h, hy⟩ refine ⟨f, ?_, hy⟩ by_cases hf : f = 0 · simp only [hf, natDegree_zero, degree_zero] at h ⊢ first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d simp_all only [degree_eq_natDegree hf] · first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h #align power_basis.mem_span_pow PowerBasis.mem_span_pow theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim ≠ 0 := fun h => not_nonempty_iff.mpr (h.symm ▸ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty #align power_basis.dim_ne_zero PowerBasis.dim_ne_zero theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim := Nat.pos_of_ne_zero pb.dim_ne_zero #align power_basis.dim_pos PowerBasis.dim_pos theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) : ∃ f : R[X], f.natDegree < pb.dim ∧ y = aeval pb.gen f := (mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y) #align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : ∃ f : R[X], y = aeval pb.gen f := by nontriviality S obtain ⟨f, _, hf⟩ := exists_eq_aeval pb y exact ⟨f, hf⟩ #align power_basis.exists_eq_aeval' PowerBasis.exists_eq_aeval' theorem algHom_ext {S' : Type*} [Semiring S'] [Algebra R S'] (pb : PowerBasis R S) ⦃f g : S →ₐ[R] S'⦄ (h : f pb.gen = g pb.gen) : f = g := by ext x obtain ⟨f, rfl⟩ := pb.exists_eq_aeval' x rw [← Polynomial.aeval_algHom_apply, ← Polynomial.aeval_algHom_apply, h] #align power_basis.alg_hom_ext PowerBasis.algHom_ext section minpoly variable [Algebra A S] noncomputable def minpolyGen (pb : PowerBasis A S) : A[X] := X ^ pb.dim - ∑ i : Fin pb.dim, C (pb.basis.repr (pb.gen ^ pb.dim) i) * X ^ (i : ℕ) #align power_basis.minpoly_gen PowerBasis.minpolyGen
Mathlib/RingTheory/PowerBasis.lean
154
159
theorem aeval_minpolyGen (pb : PowerBasis A S) : aeval pb.gen (minpolyGen pb) = 0 := by
simp_rw [minpolyGen, AlgHom.map_sub, AlgHom.map_sum, AlgHom.map_mul, AlgHom.map_pow, aeval_C, ← Algebra.smul_def, aeval_X] refine sub_eq_zero.mpr ((pb.basis.total_repr (pb.gen ^ pb.dim)).symm.trans ?_) rw [Finsupp.total_apply, Finsupp.sum_fintype] <;> simp only [pb.coe_basis, zero_smul, eq_self_iff_true, imp_true_iff]
1,947
import Mathlib.FieldTheory.Minpoly.Field #align_import ring_theory.power_basis from "leanprover-community/mathlib"@"d1d69e99ed34c95266668af4e288fc1c598b9a7f" open Polynomial open Polynomial variable {R S T : Type*} [CommRing R] [Ring S] [Algebra R S] variable {A B : Type*} [CommRing A] [CommRing B] [IsDomain B] [Algebra A B] variable {K : Type*} [Field K] -- Porting note(#5171): this linter isn't ported yet. -- @[nolint has_nonempty_instance] structure PowerBasis (R S : Type*) [CommRing R] [Ring S] [Algebra R S] where gen : S dim : ℕ basis : Basis (Fin dim) R S basis_eq_pow : ∀ (i), basis i = gen ^ (i : ℕ) #align power_basis PowerBasis -- this is usually not needed because of `basis_eq_pow` but can be needed in some cases; -- in such circumstances, add it manually using `@[simps dim gen basis]`. initialize_simps_projections PowerBasis (-basis) namespace PowerBasis @[simp] theorem coe_basis (pb : PowerBasis R S) : ⇑pb.basis = fun i : Fin pb.dim => pb.gen ^ (i : ℕ) := funext pb.basis_eq_pow #align power_basis.coe_basis PowerBasis.coe_basis theorem finite (pb : PowerBasis R S) : Module.Finite R S := .of_basis pb.basis #align power_basis.finite_dimensional PowerBasis.finite @[deprecated] alias finiteDimensional := PowerBasis.finite theorem finrank [StrongRankCondition R] (pb : PowerBasis R S) : FiniteDimensional.finrank R S = pb.dim := by rw [FiniteDimensional.finrank_eq_card_basis pb.basis, Fintype.card_fin] #align power_basis.finrank PowerBasis.finrank theorem mem_span_pow' {x y : S} {d : ℕ} : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.degree < d ∧ y = aeval x f := by have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by ext n simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range] exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩ simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support, exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum, Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop, LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight, Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe] simp_rw [@eq_comm _ y] exact Iff.rfl #align power_basis.mem_span_pow' PowerBasis.mem_span_pow' theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) : y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔ ∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by rw [mem_span_pow'] constructor <;> · rintro ⟨f, h, hy⟩ refine ⟨f, ?_, hy⟩ by_cases hf : f = 0 · simp only [hf, natDegree_zero, degree_zero] at h ⊢ first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d simp_all only [degree_eq_natDegree hf] · first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h #align power_basis.mem_span_pow PowerBasis.mem_span_pow theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim ≠ 0 := fun h => not_nonempty_iff.mpr (h.symm ▸ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty #align power_basis.dim_ne_zero PowerBasis.dim_ne_zero theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim := Nat.pos_of_ne_zero pb.dim_ne_zero #align power_basis.dim_pos PowerBasis.dim_pos theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) : ∃ f : R[X], f.natDegree < pb.dim ∧ y = aeval pb.gen f := (mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y) #align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : ∃ f : R[X], y = aeval pb.gen f := by nontriviality S obtain ⟨f, _, hf⟩ := exists_eq_aeval pb y exact ⟨f, hf⟩ #align power_basis.exists_eq_aeval' PowerBasis.exists_eq_aeval' theorem algHom_ext {S' : Type*} [Semiring S'] [Algebra R S'] (pb : PowerBasis R S) ⦃f g : S →ₐ[R] S'⦄ (h : f pb.gen = g pb.gen) : f = g := by ext x obtain ⟨f, rfl⟩ := pb.exists_eq_aeval' x rw [← Polynomial.aeval_algHom_apply, ← Polynomial.aeval_algHom_apply, h] #align power_basis.alg_hom_ext PowerBasis.algHom_ext open PowerBasis
Mathlib/RingTheory/PowerBasis.lean
425
438
theorem linearIndependent_pow [Algebra K S] (x : S) : LinearIndependent K fun i : Fin (minpoly K x).natDegree => x ^ (i : ℕ) := by
by_cases h : IsIntegral K x; swap · rw [minpoly.eq_zero h, natDegree_zero] exact linearIndependent_empty_type refine Fintype.linearIndependent_iff.2 fun g hg i => ?_ simp only at hg simp_rw [Algebra.smul_def, ← aeval_monomial, ← map_sum] at hg apply (fun hn0 => (minpoly.degree_le_of_ne_zero K x (mt (fun h0 => ?_) hn0) hg).not_lt).mtr · simp_rw [← C_mul_X_pow_eq_monomial] exact (degree_eq_natDegree <| minpoly.ne_zero h).symm ▸ degree_sum_fin_lt _ · apply_fun lcoeff K i at h0 simp_rw [map_sum, lcoeff_apply, coeff_monomial, Fin.val_eq_val, Finset.sum_ite_eq'] at h0 exact (if_pos <| Finset.mem_univ _).symm.trans h0
1,947
import Mathlib.Algebra.Algebra.Defs import Mathlib.Algebra.Polynomial.FieldDivision import Mathlib.FieldTheory.Minpoly.Basic import Mathlib.RingTheory.Adjoin.Basic import Mathlib.RingTheory.FinitePresentation import Mathlib.RingTheory.FiniteType import Mathlib.RingTheory.PowerBasis import Mathlib.RingTheory.PrincipalIdealDomain import Mathlib.RingTheory.QuotientNoetherian #align_import ring_theory.adjoin_root from "leanprover-community/mathlib"@"5c4b3d41a84bd2a1d79c7d9265e58a891e71be89" noncomputable section open scoped Classical open Polynomial universe u v w variable {R : Type u} {S : Type v} {K : Type w} open Polynomial Ideal def AdjoinRoot [CommRing R] (f : R[X]) : Type u := Polynomial R ⧸ (span {f} : Ideal R[X]) #align adjoin_root AdjoinRoot namespace AdjoinRoot section CommRing variable [CommRing R] (f : R[X]) instance instCommRing : CommRing (AdjoinRoot f) := Ideal.Quotient.commRing _ #align adjoin_root.comm_ring AdjoinRoot.instCommRing instance : Inhabited (AdjoinRoot f) := ⟨0⟩ instance : DecidableEq (AdjoinRoot f) := Classical.decEq _ protected theorem nontrivial [IsDomain R] (h : degree f ≠ 0) : Nontrivial (AdjoinRoot f) := Ideal.Quotient.nontrivial (by simp_rw [Ne, span_singleton_eq_top, Polynomial.isUnit_iff, not_exists, not_and] rintro x hx rfl exact h (degree_C hx.ne_zero)) #align adjoin_root.nontrivial AdjoinRoot.nontrivial def mk : R[X] →+* AdjoinRoot f := Ideal.Quotient.mk _ #align adjoin_root.mk AdjoinRoot.mk @[elab_as_elim] theorem induction_on {C : AdjoinRoot f → Prop} (x : AdjoinRoot f) (ih : ∀ p : R[X], C (mk f p)) : C x := Quotient.inductionOn' x ih #align adjoin_root.induction_on AdjoinRoot.induction_on def of : R →+* AdjoinRoot f := (mk f).comp C #align adjoin_root.of AdjoinRoot.of instance instSMulAdjoinRoot [DistribSMul S R] [IsScalarTower S R R] : SMul S (AdjoinRoot f) := Submodule.Quotient.instSMul' _ instance [DistribSMul S R] [IsScalarTower S R R] : DistribSMul S (AdjoinRoot f) := Submodule.Quotient.distribSMul' _ @[simp] theorem smul_mk [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R[X]) : a • mk f x = mk f (a • x) := rfl #align adjoin_root.smul_mk AdjoinRoot.smul_mk
Mathlib/RingTheory/AdjoinRoot.lean
120
121
theorem smul_of [DistribSMul S R] [IsScalarTower S R R] (a : S) (x : R) : a • of f x = of f (a • x) := by
rw [of, RingHom.comp_apply, RingHom.comp_apply, smul_mk, smul_C]
1,948
import Mathlib.LinearAlgebra.Matrix.Charpoly.Coeff import Mathlib.LinearAlgebra.Matrix.ToLin import Mathlib.RingTheory.PowerBasis #align_import linear_algebra.matrix.charpoly.minpoly from "leanprover-community/mathlib"@"7ae139f966795f684fc689186f9ccbaedd31bf31" noncomputable section universe u v w open Polynomial Matrix variable {R : Type u} [CommRing R] variable {n : Type v} [DecidableEq n] [Fintype n] variable {N : Type w} [AddCommGroup N] [Module R N] open Finset section PowerBasis open Algebra
Mathlib/LinearAlgebra/Matrix/Charpoly/Minpoly.lean
83
92
theorem charpoly_leftMulMatrix {S : Type*} [Ring S] [Algebra R S] (h : PowerBasis R S) : (leftMulMatrix h.basis h.gen).charpoly = minpoly R h.gen := by
cases subsingleton_or_nontrivial R; · apply Subsingleton.elim apply minpoly.unique' R h.gen (charpoly_monic _) · apply (injective_iff_map_eq_zero (G := S) (leftMulMatrix _)).mp (leftMulMatrix_injective h.basis) rw [← Polynomial.aeval_algHom_apply, aeval_self_charpoly] refine fun q hq => or_iff_not_imp_left.2 fun h0 => ?_ rw [Matrix.charpoly_degree_eq_dim, Fintype.card_fin] at hq contrapose! hq; exact h.dim_le_degree_of_root h0 hq
1,949
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
42
54
theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by
by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl
1,950
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
64
70
theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by
refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩
1,950
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
73
76
theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by
simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg]
1,950
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg] #align polynomial.tendsto_at_bot_iff_leading_coeff_nonpos Polynomial.tendsto_atBot_iff_leadingCoeff_nonpos theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≤ 0) : Tendsto (fun x => eval x P) atTop atBot := P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩ #align polynomial.tendsto_at_bot_of_leading_coeff_nonpos Polynomial.tendsto_atBot_of_leadingCoeff_nonpos
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
84
88
theorem abs_tendsto_atTop (hdeg : 0 < P.degree) : Tendsto (fun x => abs <| eval x P) atTop atTop := by
rcases le_total 0 P.leadingCoeff with hP | hP · exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP) · exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP)
1,950
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg] #align polynomial.tendsto_at_bot_iff_leading_coeff_nonpos Polynomial.tendsto_atBot_iff_leadingCoeff_nonpos theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≤ 0) : Tendsto (fun x => eval x P) atTop atBot := P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩ #align polynomial.tendsto_at_bot_of_leading_coeff_nonpos Polynomial.tendsto_atBot_of_leadingCoeff_nonpos theorem abs_tendsto_atTop (hdeg : 0 < P.degree) : Tendsto (fun x => abs <| eval x P) atTop atTop := by rcases le_total 0 P.leadingCoeff with hP | hP · exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP) · exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP) #align polynomial.abs_tendsto_at_top Polynomial.abs_tendsto_atTop
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
91
97
theorem abs_isBoundedUnder_iff : (IsBoundedUnder (· ≤ ·) atTop fun x => |eval x P|) ↔ P.degree ≤ 0 := by
refine ⟨fun h => ?_, fun h => ⟨|P.coeff 0|, eventually_map.mpr (eventually_of_forall (forall_imp (fun _ => le_of_eq) fun x => congr_arg abs <| _root_.trans (congr_arg (eval x) (eq_C_of_degree_le_zero h)) eval_C))⟩⟩ contrapose! h exact not_isBoundedUnder_of_tendsto_atTop (abs_tendsto_atTop P h)
1,950
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Analysis.Asymptotics.AsymptoticEquivalent import Mathlib.Analysis.Asymptotics.SpecificAsymptotics #align_import analysis.special_functions.polynomials from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982" open Filter Finset Asymptotics open Asymptotics Polynomial Topology namespace Polynomial variable {𝕜 : Type*} [NormedLinearOrderedField 𝕜] (P Q : 𝕜[X]) theorem eventually_no_roots (hP : P ≠ 0) : ∀ᶠ x in atTop, ¬P.IsRoot x := atTop_le_cofinite <| (finite_setOf_isRoot hP).compl_mem_cofinite #align polynomial.eventually_no_roots Polynomial.eventually_no_roots variable [OrderTopology 𝕜] section PolynomialAtTop theorem isEquivalent_atTop_lead : (fun x => eval x P) ~[atTop] fun x => P.leadingCoeff * x ^ P.natDegree := by by_cases h : P = 0 · simp [h, IsEquivalent.refl] · simp only [Polynomial.eval_eq_sum_range, sum_range_succ] exact IsLittleO.add_isEquivalent (IsLittleO.sum fun i hi => IsLittleO.const_mul_left ((IsLittleO.const_mul_right fun hz => h <| leadingCoeff_eq_zero.mp hz) <| isLittleO_pow_pow_atTop_of_lt (mem_range.mp hi)) _) IsEquivalent.refl #align polynomial.is_equivalent_at_top_lead Polynomial.isEquivalent_atTop_lead theorem tendsto_atTop_of_leadingCoeff_nonneg (hdeg : 0 < P.degree) (hnng : 0 ≤ P.leadingCoeff) : Tendsto (fun x => eval x P) atTop atTop := P.isEquivalent_atTop_lead.symm.tendsto_atTop <| tendsto_const_mul_pow_atTop (natDegree_pos_iff_degree_pos.2 hdeg).ne' <| hnng.lt_of_ne' <| leadingCoeff_ne_zero.mpr <| ne_zero_of_degree_gt hdeg #align polynomial.tendsto_at_top_of_leading_coeff_nonneg Polynomial.tendsto_atTop_of_leadingCoeff_nonneg theorem tendsto_atTop_iff_leadingCoeff_nonneg : Tendsto (fun x => eval x P) atTop atTop ↔ 0 < P.degree ∧ 0 ≤ P.leadingCoeff := by refine ⟨fun h => ?_, fun h => tendsto_atTop_of_leadingCoeff_nonneg P h.1 h.2⟩ have : Tendsto (fun x => P.leadingCoeff * x ^ P.natDegree) atTop atTop := (isEquivalent_atTop_lead P).tendsto_atTop h rw [tendsto_const_mul_pow_atTop_iff, ← pos_iff_ne_zero, natDegree_pos_iff_degree_pos] at this exact ⟨this.1, this.2.le⟩ #align polynomial.tendsto_at_top_iff_leading_coeff_nonneg Polynomial.tendsto_atTop_iff_leadingCoeff_nonneg theorem tendsto_atBot_iff_leadingCoeff_nonpos : Tendsto (fun x => eval x P) atTop atBot ↔ 0 < P.degree ∧ P.leadingCoeff ≤ 0 := by simp only [← tendsto_neg_atTop_iff, ← eval_neg, tendsto_atTop_iff_leadingCoeff_nonneg, degree_neg, leadingCoeff_neg, neg_nonneg] #align polynomial.tendsto_at_bot_iff_leading_coeff_nonpos Polynomial.tendsto_atBot_iff_leadingCoeff_nonpos theorem tendsto_atBot_of_leadingCoeff_nonpos (hdeg : 0 < P.degree) (hnps : P.leadingCoeff ≤ 0) : Tendsto (fun x => eval x P) atTop atBot := P.tendsto_atBot_iff_leadingCoeff_nonpos.2 ⟨hdeg, hnps⟩ #align polynomial.tendsto_at_bot_of_leading_coeff_nonpos Polynomial.tendsto_atBot_of_leadingCoeff_nonpos theorem abs_tendsto_atTop (hdeg : 0 < P.degree) : Tendsto (fun x => abs <| eval x P) atTop atTop := by rcases le_total 0 P.leadingCoeff with hP | hP · exact tendsto_abs_atTop_atTop.comp (P.tendsto_atTop_of_leadingCoeff_nonneg hdeg hP) · exact tendsto_abs_atBot_atTop.comp (P.tendsto_atBot_of_leadingCoeff_nonpos hdeg hP) #align polynomial.abs_tendsto_at_top Polynomial.abs_tendsto_atTop theorem abs_isBoundedUnder_iff : (IsBoundedUnder (· ≤ ·) atTop fun x => |eval x P|) ↔ P.degree ≤ 0 := by refine ⟨fun h => ?_, fun h => ⟨|P.coeff 0|, eventually_map.mpr (eventually_of_forall (forall_imp (fun _ => le_of_eq) fun x => congr_arg abs <| _root_.trans (congr_arg (eval x) (eq_C_of_degree_le_zero h)) eval_C))⟩⟩ contrapose! h exact not_isBoundedUnder_of_tendsto_atTop (abs_tendsto_atTop P h) #align polynomial.abs_is_bounded_under_iff Polynomial.abs_isBoundedUnder_iff theorem abs_tendsto_atTop_iff : Tendsto (fun x => abs <| eval x P) atTop atTop ↔ 0 < P.degree := ⟨fun h => not_le.mp (mt (abs_isBoundedUnder_iff P).mpr (not_isBoundedUnder_of_tendsto_atTop h)), abs_tendsto_atTop P⟩ #align polynomial.abs_tendsto_at_top_iff Polynomial.abs_tendsto_atTop_iff
Mathlib/Analysis/SpecialFunctions/Polynomials.lean
105
117
theorem tendsto_nhds_iff {c : 𝕜} : Tendsto (fun x => eval x P) atTop (𝓝 c) ↔ P.leadingCoeff = c ∧ P.degree ≤ 0 := by
refine ⟨fun h => ?_, fun h => ?_⟩ · have := P.isEquivalent_atTop_lead.tendsto_nhds h by_cases hP : P.leadingCoeff = 0 · simp only [hP, zero_mul, tendsto_const_nhds_iff] at this exact ⟨_root_.trans hP this, by simp [leadingCoeff_eq_zero.1 hP]⟩ · rw [tendsto_const_mul_pow_nhds_iff hP, natDegree_eq_zero_iff_degree_le_zero] at this exact this.symm · refine P.isEquivalent_atTop_lead.symm.tendsto_nhds ?_ have : P.natDegree = 0 := natDegree_eq_zero_iff_degree_le_zero.2 h.2 simp only [h.1, this, pow_zero, mul_one] exact tendsto_const_nhds
1,950
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat section CancelMonoidWithZero -- There doesn't seem to be a better home for these right now variable {M : Type*} [CancelMonoidWithZero M] [Finite M] theorem mul_right_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => a * b := Finite.injective_iff_bijective.1 <| mul_right_injective₀ ha #align mul_right_bijective_of_finite₀ mul_right_bijective_of_finite₀ theorem mul_left_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => b * a := Finite.injective_iff_bijective.1 <| mul_left_injective₀ ha #align mul_left_bijective_of_finite₀ mul_left_bijective_of_finite₀ def Fintype.groupWithZeroOfCancel (M : Type*) [CancelMonoidWithZero M] [DecidableEq M] [Fintype M] [Nontrivial M] : GroupWithZero M := { ‹Nontrivial M›, ‹CancelMonoidWithZero M› with inv := fun a => if h : a = 0 then 0 else Fintype.bijInv (mul_right_bijective_of_finite₀ h) 1 mul_inv_cancel := fun a ha => by simp only [Inv.inv, dif_neg ha] exact Fintype.rightInverse_bijInv _ _ inv_zero := by simp [Inv.inv, dif_pos rfl] } #align fintype.group_with_zero_of_cancel Fintype.groupWithZeroOfCancel
Mathlib/RingTheory/IntegralDomain.lean
61
69
theorem exists_eq_pow_of_mul_eq_pow_of_coprime {R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {a b c : R} {n : ℕ} (cp : IsCoprime a b) (h : a * b = c ^ n) : ∃ d : R, a = d ^ n := by
refine exists_eq_pow_of_mul_eq_pow (isUnit_of_dvd_one ?_) h obtain ⟨x, y, hxy⟩ := cp rw [← hxy] exact -- Porting note: added `GCDMonoid.` twice dvd_add (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_left _ _) _) (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_right _ _) _)
1,951
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat section CancelMonoidWithZero -- There doesn't seem to be a better home for these right now variable {M : Type*} [CancelMonoidWithZero M] [Finite M] theorem mul_right_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => a * b := Finite.injective_iff_bijective.1 <| mul_right_injective₀ ha #align mul_right_bijective_of_finite₀ mul_right_bijective_of_finite₀ theorem mul_left_bijective_of_finite₀ {a : M} (ha : a ≠ 0) : Bijective fun b => b * a := Finite.injective_iff_bijective.1 <| mul_left_injective₀ ha #align mul_left_bijective_of_finite₀ mul_left_bijective_of_finite₀ def Fintype.groupWithZeroOfCancel (M : Type*) [CancelMonoidWithZero M] [DecidableEq M] [Fintype M] [Nontrivial M] : GroupWithZero M := { ‹Nontrivial M›, ‹CancelMonoidWithZero M› with inv := fun a => if h : a = 0 then 0 else Fintype.bijInv (mul_right_bijective_of_finite₀ h) 1 mul_inv_cancel := fun a ha => by simp only [Inv.inv, dif_neg ha] exact Fintype.rightInverse_bijInv _ _ inv_zero := by simp [Inv.inv, dif_pos rfl] } #align fintype.group_with_zero_of_cancel Fintype.groupWithZeroOfCancel theorem exists_eq_pow_of_mul_eq_pow_of_coprime {R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {a b c : R} {n : ℕ} (cp : IsCoprime a b) (h : a * b = c ^ n) : ∃ d : R, a = d ^ n := by refine exists_eq_pow_of_mul_eq_pow (isUnit_of_dvd_one ?_) h obtain ⟨x, y, hxy⟩ := cp rw [← hxy] exact -- Porting note: added `GCDMonoid.` twice dvd_add (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_left _ _) _) (dvd_mul_of_dvd_right (GCDMonoid.gcd_dvd_right _ _) _) #align exists_eq_pow_of_mul_eq_pow_of_coprime exists_eq_pow_of_mul_eq_pow_of_coprime nonrec
Mathlib/RingTheory/IntegralDomain.lean
73
84
theorem Finset.exists_eq_pow_of_mul_eq_pow_of_coprime {ι R : Type*} [CommSemiring R] [IsDomain R] [GCDMonoid R] [Unique Rˣ] {n : ℕ} {c : R} {s : Finset ι} {f : ι → R} (h : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → IsCoprime (f i) (f j)) (hprod : ∏ i ∈ s, f i = c ^ n) : ∀ i ∈ s, ∃ d : R, f i = d ^ n := by
classical intro i hi rw [← insert_erase hi, prod_insert (not_mem_erase i s)] at hprod refine exists_eq_pow_of_mul_eq_pow_of_coprime (IsCoprime.prod_right fun j hj => h i hi j (erase_subset i s hj) fun hij => ?_) hprod rw [hij] at hj exact (s.not_mem_erase _) hj
1,951
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead
Mathlib/RingTheory/IntegralDomain.lean
122
133
theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by
haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption
1,951
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units
Mathlib/RingTheory/IntegralDomain.lean
137
142
theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by
classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1))
1,951
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1)) #align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain instance [Finite Rˣ] : IsCyclic Rˣ := isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext section variable (S : Subgroup Rˣ) [Finite S] instance subgroup_units_cyclic : IsCyclic S := by -- Porting note: the original proof used a `coe`, but I was not able to get it to work. apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _ · exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp) · exact Units.ext.comp Subtype.val_injective #align subgroup_units_cyclic subgroup_units_cyclic end section EuclideanDivision namespace Polynomial open Polynomial variable (K : Type) [Field K] [Algebra R[X] K] [IsFractionRing R[X] K]
Mathlib/RingTheory/IntegralDomain.lean
174
185
theorem div_eq_quo_add_rem_div (f : R[X]) {g : R[X]} (hg : g.Monic) : ∃ q r : R[X], r.degree < g.degree ∧ (algebraMap R[X] K f) / (algebraMap R[X] K g) = algebraMap R[X] K q + (algebraMap R[X] K r) / (algebraMap R[X] K g) := by
refine ⟨f /ₘ g, f %ₘ g, ?_, ?_⟩ · exact degree_modByMonic_lt _ hg · have hg' : algebraMap R[X] K g ≠ 0 := -- Porting note: the proof was `by exact_mod_cast Monic.ne_zero hg` (map_ne_zero_iff _ (IsFractionRing.injective R[X] K)).mpr (Monic.ne_zero hg) field_simp [hg'] -- Porting note: `norm_cast` was here, but does nothing. rw [add_comm, mul_comm, ← map_mul, ← map_add, modByMonic_add_div f hg]
1,951
import Mathlib.Algebra.GeomSum import Mathlib.Algebra.Polynomial.Roots import Mathlib.GroupTheory.SpecificGroups.Cyclic #align_import ring_theory.integral_domain from "leanprover-community/mathlib"@"6e70e0d419bf686784937d64ed4bfde866ff229e" section open Finset Polynomial Function Nat variable {R : Type*} {G : Type*} variable [CommRing R] [IsDomain R] [Group G] -- Porting note: Finset doesn't seem to have `{g ∈ univ | g^n = g₀}` notation anymore, -- so we have to use `Finset.filter` instead theorem card_nthRoots_subgroup_units [Fintype G] [DecidableEq G] (f : G →* R) (hf : Injective f) {n : ℕ} (hn : 0 < n) (g₀ : G) : Finset.card (Finset.univ.filter (fun g ↦ g^n = g₀)) ≤ Multiset.card (nthRoots n (f g₀)) := by haveI : DecidableEq R := Classical.decEq _ refine le_trans ?_ (nthRoots n (f g₀)).toFinset_card_le apply card_le_card_of_inj_on f · intro g hg rw [mem_filter] at hg rw [Multiset.mem_toFinset, mem_nthRoots hn, ← f.map_pow, hg.2] · intros apply hf assumption #align card_nth_roots_subgroup_units card_nthRoots_subgroup_units theorem isCyclic_of_subgroup_isDomain [Finite G] (f : G →* R) (hf : Injective f) : IsCyclic G := by classical cases nonempty_fintype G apply isCyclic_of_card_pow_eq_one_le intro n hn exact le_trans (card_nthRoots_subgroup_units f hf hn 1) (card_nthRoots n (f 1)) #align is_cyclic_of_subgroup_is_domain isCyclic_of_subgroup_isDomain instance [Finite Rˣ] : IsCyclic Rˣ := isCyclic_of_subgroup_isDomain (Units.coeHom R) <| Units.ext section variable (S : Subgroup Rˣ) [Finite S] instance subgroup_units_cyclic : IsCyclic S := by -- Porting note: the original proof used a `coe`, but I was not able to get it to work. apply isCyclic_of_subgroup_isDomain (R := R) (G := S) _ _ · exact MonoidHom.mk (OneHom.mk (fun s => ↑s.val) rfl) (by simp) · exact Units.ext.comp Subtype.val_injective #align subgroup_units_cyclic subgroup_units_cyclic end section EuclideanDivision variable [Fintype G] @[deprecated (since := "2024-06-10")] alias card_fiber_eq_of_mem_range := MonoidHom.card_fiber_eq_of_mem_range
Mathlib/RingTheory/IntegralDomain.lean
200
254
theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0 := by
classical obtain ⟨x, hx⟩ : ∃ x : MonoidHom.range f.toHomUnits, ∀ y : MonoidHom.range f.toHomUnits, y ∈ Submonoid.powers x := IsCyclic.exists_monoid_generator have hx1 : x ≠ 1 := by rintro rfl apply hf ext g rw [MonoidHom.one_apply] cases' hx ⟨f.toHomUnits g, g, rfl⟩ with n hn rwa [Subtype.ext_iff, Units.ext_iff, Subtype.coe_mk, MonoidHom.coe_toHomUnits, one_pow, eq_comm] at hn replace hx1 : (x.val : R) - 1 ≠ 0 := -- Porting note: was `(x : R)` fun h => hx1 (Subtype.eq (Units.ext (sub_eq_zero.1 h))) let c := (univ.filter fun g => f.toHomUnits g = 1).card calc ∑ g : G, f g = ∑ g : G, (f.toHomUnits g : R) := rfl _ = ∑ u ∈ univ.image f.toHomUnits, (univ.filter fun g => f.toHomUnits g = u).card • (u : R) := (sum_comp ((↑) : Rˣ → R) f.toHomUnits) _ = ∑ u ∈ univ.image f.toHomUnits, c • (u : R) := (sum_congr rfl fun u hu => congr_arg₂ _ ?_ rfl) -- remaining goal 1, proven below -- Porting note: have to change `(b : R)` into `((b : Rˣ) : R)` _ = ∑ b : MonoidHom.range f.toHomUnits, c • ((b : Rˣ) : R) := (Finset.sum_subtype _ (by simp) _) _ = c • ∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R) := smul_sum.symm _ = c • (0 : R) := congr_arg₂ _ rfl ?_ -- remaining goal 2, proven below _ = (0 : R) := smul_zero _ · -- remaining goal 1 show (univ.filter fun g : G => f.toHomUnits g = u).card = c apply MonoidHom.card_fiber_eq_of_mem_range f.toHomUnits · simpa only [mem_image, mem_univ, true_and, Set.mem_range] using hu · exact ⟨1, f.toHomUnits.map_one⟩ -- remaining goal 2 show (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = 0 calc (∑ b : MonoidHom.range f.toHomUnits, ((b : Rˣ) : R)) = ∑ n ∈ range (orderOf x), ((x : Rˣ) : R) ^ n := Eq.symm <| sum_nbij (x ^ ·) (by simp only [mem_univ, forall_true_iff]) (by simpa using pow_injOn_Iio_orderOf) (fun b _ => let ⟨n, hn⟩ := hx b ⟨n % orderOf x, mem_range.2 (Nat.mod_lt _ (orderOf_pos _)), -- Porting note: have to use `dsimp` to apply the function by dsimp at hn ⊢; rw [pow_mod_orderOf, hn]⟩) (by simp only [imp_true_iff, eq_self_iff_true, Subgroup.coe_pow, Units.val_pow_eq_pow_val]) _ = 0 := ?_ rw [← mul_left_inj' hx1, zero_mul, geom_sum_mul] norm_cast simp [pow_orderOf_eq_one]
1,951
import Mathlib.Algebra.Polynomial.Roots import Mathlib.Tactic.IntervalCases namespace Polynomial section IsDomain variable {R : Type*} [CommRing R] [IsDomain R]
Mathlib/Algebra/Polynomial/SpecificDegree.lean
22
34
theorem Monic.irreducible_iff_roots_eq_zero_of_degree_le_three {p : R[X]} (hp : p.Monic) (hp2 : 2 ≤ p.natDegree) (hp3 : p.natDegree ≤ 3) : Irreducible p ↔ p.roots = 0 := by
have hp0 : p ≠ 0 := hp.ne_zero have hp1 : p ≠ 1 := by rintro rfl; rw [natDegree_one] at hp2; cases hp2 rw [hp.irreducible_iff_lt_natDegree_lt hp1] simp_rw [show p.natDegree / 2 = 1 from (Nat.div_le_div_right hp3).antisymm (by apply Nat.div_le_div_right (c := 2) hp2), show Finset.Ioc 0 1 = {1} from rfl, Finset.mem_singleton, Multiset.eq_zero_iff_forall_not_mem, mem_roots hp0, ← dvd_iff_isRoot] refine ⟨fun h r ↦ h _ (monic_X_sub_C r) (natDegree_X_sub_C r), fun h q hq hq1 ↦ ?_⟩ rw [hq.eq_X_add_C hq1, ← sub_neg_eq_add, ← C_neg] apply h
1,952
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
45
47
theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by
simp [weightedDegree, degree, Finsupp.total, Finsupp.sum]
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R]
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
57
61
theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by
simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one]
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R)
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
99
102
theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by
simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R]
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
116
119
theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by
simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (σ)
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
124
127
theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by
rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous]
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (σ) theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous] alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous #align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
132
134
theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial σ R) 0 := by
apply isHomogeneous_monomial simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero]
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (σ) theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous] alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous #align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial σ R) 0 := by apply isHomogeneous_monomial simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_C MvPolynomial.isHomogeneous_C variable (R) theorem isHomogeneous_zero (n : ℕ) : IsHomogeneous (0 : MvPolynomial σ R) n := (homogeneousSubmodule σ R n).zero_mem #align mv_polynomial.is_homogeneous_zero MvPolynomial.isHomogeneous_zero theorem isHomogeneous_one : IsHomogeneous (1 : MvPolynomial σ R) 0 := isHomogeneous_C _ _ #align mv_polynomial.is_homogeneous_one MvPolynomial.isHomogeneous_one variable {σ}
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
150
153
theorem isHomogeneous_X (i : σ) : IsHomogeneous (X i : MvPolynomial σ R) 1 := by
apply isHomogeneous_monomial rw [degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton] exact Finsupp.single_eq_same
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (σ) theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous] alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous #align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial σ R) 0 := by apply isHomogeneous_monomial simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_C MvPolynomial.isHomogeneous_C variable (R) theorem isHomogeneous_zero (n : ℕ) : IsHomogeneous (0 : MvPolynomial σ R) n := (homogeneousSubmodule σ R n).zero_mem #align mv_polynomial.is_homogeneous_zero MvPolynomial.isHomogeneous_zero theorem isHomogeneous_one : IsHomogeneous (1 : MvPolynomial σ R) 0 := isHomogeneous_C _ _ #align mv_polynomial.is_homogeneous_one MvPolynomial.isHomogeneous_one variable {σ} theorem isHomogeneous_X (i : σ) : IsHomogeneous (X i : MvPolynomial σ R) 1 := by apply isHomogeneous_monomial rw [degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton] exact Finsupp.single_eq_same set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_X MvPolynomial.isHomogeneous_X end namespace IsHomogeneous variable [CommSemiring R] [CommSemiring S] {φ ψ : MvPolynomial σ R} {m n : ℕ}
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
163
166
theorem coeff_eq_zero (hφ : IsHomogeneous φ n) {d : σ →₀ ℕ} (hd : degree d ≠ n) : coeff d φ = 0 := by
simp_rw [← weightedDegree_one] at hd exact IsWeightedHomogeneous.coeff_eq_zero hφ d hd
1,953
import Mathlib.Algebra.DirectSum.Internal import Mathlib.Algebra.GradedMonoid import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.Algebra.MvPolynomial.Equiv import Mathlib.Algebra.MvPolynomial.Variables import Mathlib.RingTheory.MvPolynomial.WeightedHomogeneous import Mathlib.Algebra.Polynomial.Roots #align_import ring_theory.mv_polynomial.homogeneous from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4" namespace MvPolynomial variable {σ : Type*} {τ : Type*} {R : Type*} {S : Type*} def degree (d : σ →₀ ℕ) := ∑ i ∈ d.support, d i theorem weightedDegree_one (d : σ →₀ ℕ) : weightedDegree 1 d = degree d := by simp [weightedDegree, degree, Finsupp.total, Finsupp.sum] def IsHomogeneous [CommSemiring R] (φ : MvPolynomial σ R) (n : ℕ) := IsWeightedHomogeneous 1 φ n #align mv_polynomial.is_homogeneous MvPolynomial.IsHomogeneous variable [CommSemiring R] theorem weightedTotalDegree_one (φ : MvPolynomial σ R) : weightedTotalDegree (1 : σ → ℕ) φ = φ.totalDegree := by simp only [totalDegree, weightedTotalDegree, weightedDegree, LinearMap.toAddMonoidHom_coe, Finsupp.total, Pi.one_apply, Finsupp.coe_lsum, LinearMap.coe_smulRight, LinearMap.id_coe, id, Algebra.id.smul_eq_mul, mul_one] variable (σ R) def homogeneousSubmodule (n : ℕ) : Submodule R (MvPolynomial σ R) where carrier := { x | x.IsHomogeneous n } smul_mem' r a ha c hc := by rw [coeff_smul] at hc apply ha intro h apply hc rw [h] exact smul_zero r zero_mem' d hd := False.elim (hd <| coeff_zero _) add_mem' {a b} ha hb c hc := by rw [coeff_add] at hc obtain h | h : coeff c a ≠ 0 ∨ coeff c b ≠ 0 := by contrapose! hc simp only [hc, add_zero] · exact ha h · exact hb h #align mv_polynomial.homogeneous_submodule MvPolynomial.homogeneousSubmodule @[simp] lemma weightedHomogeneousSubmodule_one (n : ℕ) : weightedHomogeneousSubmodule R 1 n = homogeneousSubmodule σ R n := rfl variable {σ R} @[simp] theorem mem_homogeneousSubmodule [CommSemiring R] (n : ℕ) (p : MvPolynomial σ R) : p ∈ homogeneousSubmodule σ R n ↔ p.IsHomogeneous n := Iff.rfl #align mv_polynomial.mem_homogeneous_submodule MvPolynomial.mem_homogeneousSubmodule variable (σ R) theorem homogeneousSubmodule_eq_finsupp_supported [CommSemiring R] (n : ℕ) : homogeneousSubmodule σ R n = Finsupp.supported _ R { d | degree d = n } := by simp_rw [← weightedDegree_one] exact weightedHomogeneousSubmodule_eq_finsupp_supported R 1 n #align mv_polynomial.homogeneous_submodule_eq_finsupp_supported MvPolynomial.homogeneousSubmodule_eq_finsupp_supported variable {σ R} theorem homogeneousSubmodule_mul [CommSemiring R] (m n : ℕ) : homogeneousSubmodule σ R m * homogeneousSubmodule σ R n ≤ homogeneousSubmodule σ R (m + n) := weightedHomogeneousSubmodule_mul 1 m n #align mv_polynomial.homogeneous_submodule_mul MvPolynomial.homogeneousSubmodule_mul section variable [CommSemiring R] theorem isHomogeneous_monomial {d : σ →₀ ℕ} (r : R) {n : ℕ} (hn : degree d = n) : IsHomogeneous (monomial d r) n := by simp_rw [← weightedDegree_one] at hn exact isWeightedHomogeneous_monomial 1 d r hn #align mv_polynomial.is_homogeneous_monomial MvPolynomial.isHomogeneous_monomial variable (σ) theorem totalDegree_zero_iff_isHomogeneous {p : MvPolynomial σ R} : p.totalDegree = 0 ↔ IsHomogeneous p 0 := by rw [← weightedTotalDegree_one, ← isWeightedHomogeneous_zero_iff_weightedTotalDegree_eq_zero, IsHomogeneous] alias ⟨isHomogeneous_of_totalDegree_zero, _⟩ := totalDegree_zero_iff_isHomogeneous #align mv_polynomial.is_homogeneous_of_total_degree_zero MvPolynomial.isHomogeneous_of_totalDegree_zero theorem isHomogeneous_C (r : R) : IsHomogeneous (C r : MvPolynomial σ R) 0 := by apply isHomogeneous_monomial simp only [degree, Finsupp.zero_apply, Finset.sum_const_zero] set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_C MvPolynomial.isHomogeneous_C variable (R) theorem isHomogeneous_zero (n : ℕ) : IsHomogeneous (0 : MvPolynomial σ R) n := (homogeneousSubmodule σ R n).zero_mem #align mv_polynomial.is_homogeneous_zero MvPolynomial.isHomogeneous_zero theorem isHomogeneous_one : IsHomogeneous (1 : MvPolynomial σ R) 0 := isHomogeneous_C _ _ #align mv_polynomial.is_homogeneous_one MvPolynomial.isHomogeneous_one variable {σ} theorem isHomogeneous_X (i : σ) : IsHomogeneous (X i : MvPolynomial σ R) 1 := by apply isHomogeneous_monomial rw [degree, Finsupp.support_single_ne_zero _ one_ne_zero, Finset.sum_singleton] exact Finsupp.single_eq_same set_option linter.uppercaseLean3 false in #align mv_polynomial.is_homogeneous_X MvPolynomial.isHomogeneous_X end namespace IsHomogeneous variable [CommSemiring R] [CommSemiring S] {φ ψ : MvPolynomial σ R} {m n : ℕ} theorem coeff_eq_zero (hφ : IsHomogeneous φ n) {d : σ →₀ ℕ} (hd : degree d ≠ n) : coeff d φ = 0 := by simp_rw [← weightedDegree_one] at hd exact IsWeightedHomogeneous.coeff_eq_zero hφ d hd #align mv_polynomial.is_homogeneous.coeff_eq_zero MvPolynomial.IsHomogeneous.coeff_eq_zero
Mathlib/RingTheory/MvPolynomial/Homogeneous.lean
169
171
theorem inj_right (hm : IsHomogeneous φ m) (hn : IsHomogeneous φ n) (hφ : φ ≠ 0) : m = n := by
obtain ⟨d, hd⟩ : ∃ d, coeff d φ ≠ 0 := exists_coeff_ne_zero hφ rw [← hm hd, ← hn hd]
1,953
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity
Mathlib/RingTheory/RootsOfUnity/Basic.lean
93
94
theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by
rw [mem_rootsOfUnity]; norm_cast
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
98
98
theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by
ext; simp
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq
Mathlib/RingTheory/RootsOfUnity/Basic.lean
119
122
theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by
obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd
Mathlib/RingTheory/RootsOfUnity/Basic.lean
125
127
theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by
rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
131
133
theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by
rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow section IsDomain variable [CommRing R] [IsDomain R]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
187
190
theorem mem_rootsOfUnity_iff_mem_nthRoots {ζ : Rˣ} : ζ ∈ rootsOfUnity k R ↔ (ζ : R) ∈ nthRoots k (1 : R) := by
simp only [mem_rootsOfUnity, mem_nthRoots k.pos, Units.ext_iff, Units.val_one, Units.val_pow_eq_pow_val]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow section Reduced variable (R) [CommRing R] [IsReduced R] -- @[simp] -- Porting note: simp normal form is `mem_rootsOfUnity_prime_pow_mul_iff'`
Mathlib/RingTheory/RootsOfUnity/Basic.lean
268
271
theorem mem_rootsOfUnity_prime_pow_mul_iff (p k : ℕ) (m : ℕ+) [ExpChar R p] {ζ : Rˣ} : ζ ∈ rootsOfUnity (⟨p, expChar_pos R p⟩ ^ k * m) R ↔ ζ ∈ rootsOfUnity m R := by
simp only [mem_rootsOfUnity', PNat.mul_coe, PNat.pow_coe, PNat.mk_coe, ExpChar.pow_prime_pow_mul_eq_one_iff]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow section Reduced variable (R) [CommRing R] [IsReduced R] -- @[simp] -- Porting note: simp normal form is `mem_rootsOfUnity_prime_pow_mul_iff'` theorem mem_rootsOfUnity_prime_pow_mul_iff (p k : ℕ) (m : ℕ+) [ExpChar R p] {ζ : Rˣ} : ζ ∈ rootsOfUnity (⟨p, expChar_pos R p⟩ ^ k * m) R ↔ ζ ∈ rootsOfUnity m R := by simp only [mem_rootsOfUnity', PNat.mul_coe, PNat.pow_coe, PNat.mk_coe, ExpChar.pow_prime_pow_mul_eq_one_iff] #align mem_roots_of_unity_prime_pow_mul_iff mem_rootsOfUnity_prime_pow_mul_iff @[simp]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
275
278
theorem mem_rootsOfUnity_prime_pow_mul_iff' (p k : ℕ) (m : ℕ+) [ExpChar R p] {ζ : Rˣ} : ζ ^ (p ^ k * ↑m) = 1 ↔ ζ ∈ rootsOfUnity m R := by
rw [← PNat.mk_coe p (expChar_pos R p), ← PNat.pow_coe, ← PNat.mul_coe, ← mem_rootsOfUnity, mem_rootsOfUnity_prime_pow_mul_iff]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow @[mk_iff IsPrimitiveRoot.iff_def] structure IsPrimitiveRoot (ζ : M) (k : ℕ) : Prop where pow_eq_one : ζ ^ (k : ℕ) = 1 dvd_of_pow_eq_one : ∀ l : ℕ, ζ ^ l = 1 → k ∣ l #align is_primitive_root IsPrimitiveRoot #align is_primitive_root.iff_def IsPrimitiveRoot.iff_def @[simps!] def IsPrimitiveRoot.toRootsOfUnity {μ : M} {n : ℕ+} (h : IsPrimitiveRoot μ n) : rootsOfUnity n M := rootsOfUnity.mkOfPowEq μ h.pow_eq_one #align is_primitive_root.to_roots_of_unity IsPrimitiveRoot.toRootsOfUnity #align is_primitive_root.coe_to_roots_of_unity_coe IsPrimitiveRoot.val_toRootsOfUnity_coe #align is_primitive_root.coe_inv_to_roots_of_unity_coe IsPrimitiveRoot.val_inv_toRootsOfUnity_coe section primitiveRoots variable {k : ℕ} def primitiveRoots (k : ℕ) (R : Type*) [CommRing R] [IsDomain R] : Finset R := (nthRoots k (1 : R)).toFinset.filter fun ζ => IsPrimitiveRoot ζ k #align primitive_roots primitiveRoots variable [CommRing R] [IsDomain R] @[simp]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
314
316
theorem mem_primitiveRoots {ζ : R} (h0 : 0 < k) : ζ ∈ primitiveRoots k R ↔ IsPrimitiveRoot ζ k := by
rw [primitiveRoots, mem_filter, Multiset.mem_toFinset, mem_nthRoots h0, and_iff_right_iff_imp] exact IsPrimitiveRoot.pow_eq_one
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow @[mk_iff IsPrimitiveRoot.iff_def] structure IsPrimitiveRoot (ζ : M) (k : ℕ) : Prop where pow_eq_one : ζ ^ (k : ℕ) = 1 dvd_of_pow_eq_one : ∀ l : ℕ, ζ ^ l = 1 → k ∣ l #align is_primitive_root IsPrimitiveRoot #align is_primitive_root.iff_def IsPrimitiveRoot.iff_def @[simps!] def IsPrimitiveRoot.toRootsOfUnity {μ : M} {n : ℕ+} (h : IsPrimitiveRoot μ n) : rootsOfUnity n M := rootsOfUnity.mkOfPowEq μ h.pow_eq_one #align is_primitive_root.to_roots_of_unity IsPrimitiveRoot.toRootsOfUnity #align is_primitive_root.coe_to_roots_of_unity_coe IsPrimitiveRoot.val_toRootsOfUnity_coe #align is_primitive_root.coe_inv_to_roots_of_unity_coe IsPrimitiveRoot.val_inv_toRootsOfUnity_coe section primitiveRoots variable {k : ℕ} def primitiveRoots (k : ℕ) (R : Type*) [CommRing R] [IsDomain R] : Finset R := (nthRoots k (1 : R)).toFinset.filter fun ζ => IsPrimitiveRoot ζ k #align primitive_roots primitiveRoots variable [CommRing R] [IsDomain R] @[simp] theorem mem_primitiveRoots {ζ : R} (h0 : 0 < k) : ζ ∈ primitiveRoots k R ↔ IsPrimitiveRoot ζ k := by rw [primitiveRoots, mem_filter, Multiset.mem_toFinset, mem_nthRoots h0, and_iff_right_iff_imp] exact IsPrimitiveRoot.pow_eq_one #align mem_primitive_roots mem_primitiveRoots @[simp]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
320
321
theorem primitiveRoots_zero : primitiveRoots 0 R = ∅ := by
rw [primitiveRoots, nthRoots_zero, Multiset.toFinset_zero, Finset.filter_empty]
1,954
import Mathlib.Algebra.CharP.Two import Mathlib.Algebra.CharP.Reduced import Mathlib.Algebra.NeZero import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.GroupTheory.SpecificGroups.Cyclic import Mathlib.NumberTheory.Divisors import Mathlib.RingTheory.IntegralDomain import Mathlib.Tactic.Zify #align_import ring_theory.roots_of_unity.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" open scoped Classical Polynomial noncomputable section open Polynomial open Finset variable {M N G R S F : Type*} variable [CommMonoid M] [CommMonoid N] [DivisionCommMonoid G] section rootsOfUnity variable {k l : ℕ+} def rootsOfUnity (k : ℕ+) (M : Type*) [CommMonoid M] : Subgroup Mˣ where carrier := {ζ | ζ ^ (k : ℕ) = 1} one_mem' := one_pow _ mul_mem' _ _ := by simp_all only [Set.mem_setOf_eq, mul_pow, one_mul] inv_mem' _ := by simp_all only [Set.mem_setOf_eq, inv_pow, inv_one] #align roots_of_unity rootsOfUnity @[simp] theorem mem_rootsOfUnity (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ (k : ℕ) = 1 := Iff.rfl #align mem_roots_of_unity mem_rootsOfUnity theorem mem_rootsOfUnity' (k : ℕ+) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ (k : ℕ) = 1 := by rw [mem_rootsOfUnity]; norm_cast #align mem_roots_of_unity' mem_rootsOfUnity' @[simp] theorem rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext; simp theorem rootsOfUnity.coe_injective {n : ℕ+} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.ext.comp fun _ _ => Subtype.eq #align roots_of_unity.coe_injective rootsOfUnity.coe_injective @[simps! coe_val] def rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h n.ne_zero, Units.pow_ofPowEqOne _ _⟩ #align roots_of_unity.mk_of_pow_eq rootsOfUnity.mkOfPowEq #align roots_of_unity.mk_of_pow_eq_coe_coe rootsOfUnity.val_mkOfPowEq_coe @[simp] theorem rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ+} (h : ζ ^ (n : ℕ) = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl #align roots_of_unity.coe_mk_of_pow_eq rootsOfUnity.coe_mkOfPowEq theorem rootsOfUnity_le_of_dvd (h : k ∣ l) : rootsOfUnity k M ≤ rootsOfUnity l M := by obtain ⟨d, rfl⟩ := h intro ζ h simp_all only [mem_rootsOfUnity, PNat.mul_coe, pow_mul, one_pow] #align roots_of_unity_le_of_dvd rootsOfUnity_le_of_dvd theorem map_rootsOfUnity (f : Mˣ →* Nˣ) (k : ℕ+) : (rootsOfUnity k M).map f ≤ rootsOfUnity k N := by rintro _ ⟨ζ, h, rfl⟩ simp_all only [← map_pow, mem_rootsOfUnity, SetLike.mem_coe, MonoidHom.map_one] #align map_roots_of_unity map_rootsOfUnity @[norm_cast] theorem rootsOfUnity.coe_pow [CommMonoid R] (ζ : rootsOfUnity k R) (m : ℕ) : (((ζ ^ m :) : Rˣ) : R) = ((ζ : Rˣ) : R) ^ m := by rw [Subgroup.coe_pow, Units.val_pow_eq_pow_val] #align roots_of_unity.coe_pow rootsOfUnity.coe_pow @[mk_iff IsPrimitiveRoot.iff_def] structure IsPrimitiveRoot (ζ : M) (k : ℕ) : Prop where pow_eq_one : ζ ^ (k : ℕ) = 1 dvd_of_pow_eq_one : ∀ l : ℕ, ζ ^ l = 1 → k ∣ l #align is_primitive_root IsPrimitiveRoot #align is_primitive_root.iff_def IsPrimitiveRoot.iff_def @[simps!] def IsPrimitiveRoot.toRootsOfUnity {μ : M} {n : ℕ+} (h : IsPrimitiveRoot μ n) : rootsOfUnity n M := rootsOfUnity.mkOfPowEq μ h.pow_eq_one #align is_primitive_root.to_roots_of_unity IsPrimitiveRoot.toRootsOfUnity #align is_primitive_root.coe_to_roots_of_unity_coe IsPrimitiveRoot.val_toRootsOfUnity_coe #align is_primitive_root.coe_inv_to_roots_of_unity_coe IsPrimitiveRoot.val_inv_toRootsOfUnity_coe namespace IsPrimitiveRoot variable {k l : ℕ}
Mathlib/RingTheory/RootsOfUnity/Basic.lean
335
342
theorem mk_of_lt (ζ : M) (hk : 0 < k) (h1 : ζ ^ k = 1) (h : ∀ l : ℕ, 0 < l → l < k → ζ ^ l ≠ 1) : IsPrimitiveRoot ζ k := by
refine ⟨h1, fun l hl => ?_⟩ suffices k.gcd l = k by exact this ▸ k.gcd_dvd_right l rw [eq_iff_le_not_lt] refine ⟨Nat.le_of_dvd hk (k.gcd_dvd_left l), ?_⟩ intro h'; apply h _ (Nat.gcd_pos_of_pos_left _ hk) h' exact pow_gcd_eq_one _ h1 hl
1,954
import Mathlib.LinearAlgebra.GeneralLinearGroup import Mathlib.LinearAlgebra.Matrix.Adjugate import Mathlib.LinearAlgebra.Matrix.Transvection import Mathlib.RingTheory.RootsOfUnity.Basic #align_import linear_algebra.matrix.special_linear_group from "leanprover-community/mathlib"@"f06058e64b7e8397234455038f3f8aec83aaba5a" namespace Matrix universe u v open Matrix open LinearMap section variable (n : Type u) [DecidableEq n] [Fintype n] (R : Type v) [CommRing R] def SpecialLinearGroup := { A : Matrix n n R // A.det = 1 } #align matrix.special_linear_group Matrix.SpecialLinearGroup end @[inherit_doc] scoped[MatrixGroups] notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R namespace SpecialLinearGroup variable {n : Type u} [DecidableEq n] [Fintype n] {R : Type v} [CommRing R] instance hasCoeToMatrix : Coe (SpecialLinearGroup n R) (Matrix n n R) := ⟨fun A => A.val⟩ #align matrix.special_linear_group.has_coe_to_matrix Matrix.SpecialLinearGroup.hasCoeToMatrix local notation:1024 "↑ₘ" A:1024 => ((A : SpecialLinearGroup n R) : Matrix n n R) -- Porting note: moved this section upwards because it used to be not simp-normal. -- Now it is, since coercion arrows are unfolded. theorem ext_iff (A B : SpecialLinearGroup n R) : A = B ↔ ∀ i j, ↑ₘA i j = ↑ₘB i j := Subtype.ext_iff.trans Matrix.ext_iff.symm #align matrix.special_linear_group.ext_iff Matrix.SpecialLinearGroup.ext_iff @[ext] theorem ext (A B : SpecialLinearGroup n R) : (∀ i j, ↑ₘA i j = ↑ₘB i j) → A = B := (SpecialLinearGroup.ext_iff A B).mpr #align matrix.special_linear_group.ext Matrix.SpecialLinearGroup.ext instance subsingleton_of_subsingleton [Subsingleton n] : Subsingleton (SpecialLinearGroup n R) := by refine ⟨fun ⟨A, hA⟩ ⟨B, hB⟩ ↦ ?_⟩ ext i j rcases isEmpty_or_nonempty n with hn | hn; · exfalso; exact IsEmpty.false i rw [det_eq_elem_of_subsingleton _ i] at hA hB simp only [Subsingleton.elim j i, hA, hB] instance hasInv : Inv (SpecialLinearGroup n R) := ⟨fun A => ⟨adjugate A, by rw [det_adjugate, A.prop, one_pow]⟩⟩ #align matrix.special_linear_group.has_inv Matrix.SpecialLinearGroup.hasInv instance hasMul : Mul (SpecialLinearGroup n R) := ⟨fun A B => ⟨↑ₘA * ↑ₘB, by rw [det_mul, A.prop, B.prop, one_mul]⟩⟩ #align matrix.special_linear_group.has_mul Matrix.SpecialLinearGroup.hasMul instance hasOne : One (SpecialLinearGroup n R) := ⟨⟨1, det_one⟩⟩ #align matrix.special_linear_group.has_one Matrix.SpecialLinearGroup.hasOne instance : Pow (SpecialLinearGroup n R) ℕ where pow x n := ⟨↑ₘx ^ n, (det_pow _ _).trans <| x.prop.symm ▸ one_pow _⟩ instance : Inhabited (SpecialLinearGroup n R) := ⟨1⟩ def transpose (A : SpecialLinearGroup n R) : SpecialLinearGroup n R := ⟨A.1.transpose, A.1.det_transpose ▸ A.2⟩ @[inherit_doc] scoped postfix:1024 "ᵀ" => SpecialLinearGroup.transpose section CoeLemmas variable (A B : SpecialLinearGroup n R) -- Porting note: shouldn't be `@[simp]` because cast+mk gets reduced anyway theorem coe_mk (A : Matrix n n R) (h : det A = 1) : ↑(⟨A, h⟩ : SpecialLinearGroup n R) = A := rfl #align matrix.special_linear_group.coe_mk Matrix.SpecialLinearGroup.coe_mk @[simp] theorem coe_inv : ↑ₘA⁻¹ = adjugate A := rfl #align matrix.special_linear_group.coe_inv Matrix.SpecialLinearGroup.coe_inv @[simp] theorem coe_mul : ↑ₘ(A * B) = ↑ₘA * ↑ₘB := rfl #align matrix.special_linear_group.coe_mul Matrix.SpecialLinearGroup.coe_mul @[simp] theorem coe_one : ↑ₘ(1 : SpecialLinearGroup n R) = (1 : Matrix n n R) := rfl #align matrix.special_linear_group.coe_one Matrix.SpecialLinearGroup.coe_one @[simp] theorem det_coe : det ↑ₘA = 1 := A.2 #align matrix.special_linear_group.det_coe Matrix.SpecialLinearGroup.det_coe @[simp] theorem coe_pow (m : ℕ) : ↑ₘ(A ^ m) = ↑ₘA ^ m := rfl #align matrix.special_linear_group.coe_pow Matrix.SpecialLinearGroup.coe_pow @[simp] lemma coe_transpose (A : SpecialLinearGroup n R) : ↑ₘAᵀ = (↑ₘA)ᵀ := rfl
Mathlib/LinearAlgebra/Matrix/SpecialLinearGroup.lean
181
183
theorem det_ne_zero [Nontrivial R] (g : SpecialLinearGroup n R) : det ↑ₘg ≠ 0 := by
rw [g.det_coe] norm_num
1,955
import Mathlib.Analysis.Complex.UpperHalfPlane.Basic import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup import Mathlib.Tactic.AdaptationNote #align_import number_theory.modular_forms.slash_actions from "leanprover-community/mathlib"@"738054fa93d43512da144ec45ce799d18fd44248" open Complex UpperHalfPlane ModularGroup open scoped UpperHalfPlane local notation "GL(" n ", " R ")" "⁺" => Matrix.GLPos (Fin n) R local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R local notation:1024 "↑ₘ" A:1024 => (((A : GL(2, ℝ)⁺) : GL (Fin 2) ℝ) : Matrix (Fin 2) (Fin 2) _) -- like `↑ₘ`, but allows the user to specify the ring `R`. Useful to help Lean elaborate. local notation:1024 "↑ₘ[" R "]" A:1024 => ((A : GL (Fin 2) R) : Matrix (Fin 2) (Fin 2) R) class SlashAction (β G α γ : Type*) [Group G] [AddMonoid α] [SMul γ α] where map : β → G → α → α zero_slash : ∀ (k : β) (g : G), map k g 0 = 0 slash_one : ∀ (k : β) (a : α), map k 1 a = a slash_mul : ∀ (k : β) (g h : G) (a : α), map k (g * h) a = map k h (map k g a) smul_slash : ∀ (k : β) (g : G) (a : α) (z : γ), map k g (z • a) = z • map k g a add_slash : ∀ (k : β) (g : G) (a b : α), map k g (a + b) = map k g a + map k g b #align slash_action SlashAction scoped[ModularForm] notation:100 f " ∣[" k ";" γ "] " a:100 => SlashAction.map γ k a f scoped[ModularForm] notation:100 f " ∣[" k "] " a:100 => SlashAction.map ℂ k a f open scoped ModularForm @[simp] theorem SlashAction.neg_slash {β G α γ : Type*} [Group G] [AddGroup α] [SMul γ α] [SlashAction β G α γ] (k : β) (g : G) (a : α) : (-a) ∣[k;γ] g = -a ∣[k;γ] g := eq_neg_of_add_eq_zero_left <| by rw [← SlashAction.add_slash, add_left_neg, SlashAction.zero_slash] #align slash_action.neg_slash SlashAction.neg_slash @[simp]
Mathlib/NumberTheory/ModularForms/SlashActions.lean
67
70
theorem SlashAction.smul_slash_of_tower {R β G α : Type*} (γ : Type*) [Group G] [AddGroup α] [Monoid γ] [MulAction γ α] [SMul R γ] [SMul R α] [IsScalarTower R γ α] [SlashAction β G α γ] (k : β) (g : G) (a : α) (r : R) : (r • a) ∣[k;γ] g = r • a ∣[k;γ] g := by
rw [← smul_one_smul γ r a, SlashAction.smul_slash, smul_one_smul]
1,956
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp]
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
56
66
theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by
rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2]
1,957
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
73
75
theorem Gamma_one_top : Gamma 1 = ⊤ := by
ext simp [eq_iff_true_of_subsingleton]
1,957
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal theorem Gamma_one_top : Gamma 1 = ⊤ := by ext simp [eq_iff_true_of_subsingleton] #align Gamma_one_top Gamma_one_top
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
78
88
theorem Gamma_zero_bot : Gamma 0 = ⊥ := by
ext simp only [Gamma_mem, coe_matrix_coe, Int.coe_castRingHom, map_apply, Int.cast_id, Subgroup.mem_bot] constructor · intro h ext i j fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] · intro h simp [h]
1,957
import Mathlib.Algebra.Group.Subgroup.Pointwise import Mathlib.Data.ZMod.Basic import Mathlib.GroupTheory.GroupAction.ConjAct import Mathlib.LinearAlgebra.Matrix.SpecialLinearGroup #align_import number_theory.modular_forms.congruence_subgroups from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5" local notation "SL(" n ", " R ")" => Matrix.SpecialLinearGroup (Fin n) R attribute [-instance] Matrix.SpecialLinearGroup.instCoeFun local notation:1024 "↑ₘ" A:1024 => ((A : SL(2, ℤ)) : Matrix (Fin 2) (Fin 2) ℤ) open Matrix.SpecialLinearGroup Matrix variable (N : ℕ) local notation "SLMOD(" N ")" => @Matrix.SpecialLinearGroup.map (Fin 2) _ _ _ _ _ _ (Int.castRingHom (ZMod N)) set_option linter.uppercaseLean3 false @[simp] theorem SL_reduction_mod_hom_val (N : ℕ) (γ : SL(2, ℤ)) : ∀ i j : Fin 2, (SLMOD(N) γ : Matrix (Fin 2) (Fin 2) (ZMod N)) i j = ((↑ₘγ i j : ℤ) : ZMod N) := fun _ _ => rfl #align SL_reduction_mod_hom_val SL_reduction_mod_hom_val def Gamma (N : ℕ) : Subgroup SL(2, ℤ) := SLMOD(N).ker #align Gamma Gamma theorem Gamma_mem' (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ SLMOD(N) γ = 1 := Iff.rfl #align Gamma_mem' Gamma_mem' @[simp] theorem Gamma_mem (N : ℕ) (γ : SL(2, ℤ)) : γ ∈ Gamma N ↔ ((↑ₘγ 0 0 : ℤ) : ZMod N) = 1 ∧ ((↑ₘγ 0 1 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 0 : ℤ) : ZMod N) = 0 ∧ ((↑ₘγ 1 1 : ℤ) : ZMod N) = 1 := by rw [Gamma_mem'] constructor · intro h simp [← SL_reduction_mod_hom_val N γ, h] · intro h ext i j rw [SL_reduction_mod_hom_val N γ] fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] #align Gamma_mem Gamma_mem theorem Gamma_normal (N : ℕ) : Subgroup.Normal (Gamma N) := SLMOD(N).normal_ker #align Gamma_normal Gamma_normal theorem Gamma_one_top : Gamma 1 = ⊤ := by ext simp [eq_iff_true_of_subsingleton] #align Gamma_one_top Gamma_one_top theorem Gamma_zero_bot : Gamma 0 = ⊥ := by ext simp only [Gamma_mem, coe_matrix_coe, Int.coe_castRingHom, map_apply, Int.cast_id, Subgroup.mem_bot] constructor · intro h ext i j fin_cases i <;> fin_cases j <;> simp only [h] exacts [h.1, h.2.1, h.2.2.1, h.2.2.2] · intro h simp [h] #align Gamma_zero_bot Gamma_zero_bot lemma ModularGroup_T_pow_mem_Gamma (N M : ℤ) (hNM : N ∣ M) : (ModularGroup.T ^ M) ∈ _root_.Gamma (Int.natAbs N) := by simp only [Gamma_mem, Fin.isValue, ModularGroup.coe_T_zpow, of_apply, cons_val', cons_val_zero, empty_val', cons_val_fin_one, Int.cast_one, cons_val_one, head_cons, head_fin_const, Int.cast_zero, and_self, and_true, true_and] refine Iff.mpr (ZMod.intCast_zmod_eq_zero_iff_dvd M (Int.natAbs N)) ?_ simp only [Int.natCast_natAbs, abs_dvd, hNM] def Gamma0 (N : ℕ) : Subgroup SL(2, ℤ) where carrier := { g : SL(2, ℤ) | ((↑ₘg 1 0 : ℤ) : ZMod N) = 0 } one_mem' := by simp mul_mem' := by intro a b ha hb simp only [Set.mem_setOf_eq] have h := (Matrix.two_mul_expl a.1 b.1).2.2.1 simp only [coe_matrix_coe, coe_mul, Int.coe_castRingHom, map_apply, Set.mem_setOf_eq] at * rw [h] simp [ha, hb] inv_mem' := by intro a ha simp only [Set.mem_setOf_eq] rw [SL2_inv_expl a] simp only [cons_val_zero, cons_val_one, head_cons, coe_matrix_coe, coe_mk, Int.coe_castRingHom, map_apply, Int.cast_neg, neg_eq_zero, Set.mem_setOf_eq] at * exact ha #align Gamma0 Gamma0 @[simp] theorem Gamma0_mem (N : ℕ) (A : SL(2, ℤ)) : A ∈ Gamma0 N ↔ ((↑ₘA 1 0 : ℤ) : ZMod N) = 0 := Iff.rfl #align Gamma0_mem Gamma0_mem
Mathlib/NumberTheory/ModularForms/CongruenceSubgroups.lean
125
125
theorem Gamma0_det (N : ℕ) (A : Gamma0 N) : (A.1.1.det : ZMod N) = 1 := by
simp [A.1.property]
1,957
import Mathlib.NumberTheory.ModularForms.SlashInvariantForms import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups noncomputable section open ModularForm UpperHalfPlane Complex Matrix open scoped MatrixGroups namespace EisensteinSeries variable (N : ℕ) (a : Fin 2 → ZMod N) variable {N a} section eisSummand def eisSummand (k : ℤ) (v : Fin 2 → ℤ) (z : ℍ) : ℂ := 1 / (v 0 * z.1 + v 1) ^ k
Mathlib/NumberTheory/ModularForms/EisensteinSeries/Basic.lean
92
100
theorem eisSummand_SL2_apply (k : ℤ) (i : (Fin 2 → ℤ)) (A : SL(2, ℤ)) (z : ℍ) : eisSummand k i (A • z) = (z.denom A) ^ k * eisSummand k (i ᵥ* A) z := by
simp only [eisSummand, specialLinearGroup_apply, algebraMap_int_eq, eq_intCast, ofReal_intCast, one_div, vecMul, vec2_dotProduct, Int.cast_add, Int.cast_mul] have h (a b c d u v : ℂ) (hc : c * z + d ≠ 0) : ((u * ((a * z + b) / (c * z + d)) + v) ^ k)⁻¹ = (c * z + d) ^ k * (((u * a + v * c) * z + (u * b + v * d)) ^ k)⁻¹ := by field_simp [hc] ring_nf apply h (hc := z.denom_ne_zero A)
1,958
import Mathlib.NumberTheory.ModularForms.SlashInvariantForms import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups noncomputable section open ModularForm UpperHalfPlane Matrix namespace SlashInvariantForm
Mathlib/NumberTheory/ModularForms/Identities.lean
22
32
theorem vAdd_width_periodic (N : ℕ) (k n : ℤ) (f : SlashInvariantForm (Gamma N) k) (z : ℍ) : f (((N * n) : ℝ) +ᵥ z) = f z := by
norm_cast rw [← modular_T_zpow_smul z (N * n)] have Hn := (ModularGroup_T_pow_mem_Gamma N (N * n) (by simp)) simp only [zpow_natCast, Int.natAbs_ofNat] at Hn convert (SlashInvariantForm.slash_action_eqn' k (Gamma N) f ⟨((ModularGroup.T ^ (N * n))), Hn⟩ z) unfold SpecialLinearGroup.coeToGL simp only [Fin.isValue, ModularGroup.coe_T_zpow (N * n), of_apply, cons_val', cons_val_zero, empty_val', cons_val_fin_one, cons_val_one, head_fin_const, Int.cast_zero, zero_mul, head_cons, Int.cast_one, zero_add, one_zpow, one_mul]
1,959
import Mathlib.NumberTheory.ModularForms.SlashInvariantForms import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups noncomputable section open ModularForm UpperHalfPlane Matrix namespace SlashInvariantForm theorem vAdd_width_periodic (N : ℕ) (k n : ℤ) (f : SlashInvariantForm (Gamma N) k) (z : ℍ) : f (((N * n) : ℝ) +ᵥ z) = f z := by norm_cast rw [← modular_T_zpow_smul z (N * n)] have Hn := (ModularGroup_T_pow_mem_Gamma N (N * n) (by simp)) simp only [zpow_natCast, Int.natAbs_ofNat] at Hn convert (SlashInvariantForm.slash_action_eqn' k (Gamma N) f ⟨((ModularGroup.T ^ (N * n))), Hn⟩ z) unfold SpecialLinearGroup.coeToGL simp only [Fin.isValue, ModularGroup.coe_T_zpow (N * n), of_apply, cons_val', cons_val_zero, empty_val', cons_val_fin_one, cons_val_one, head_fin_const, Int.cast_zero, zero_mul, head_cons, Int.cast_one, zero_add, one_zpow, one_mul]
Mathlib/NumberTheory/ModularForms/Identities.lean
34
37
theorem T_zpow_width_invariant (N : ℕ) (k n : ℤ) (f : SlashInvariantForm (Gamma N) k) (z : ℍ) : f (((ModularGroup.T ^ (N * n))) • z) = f z := by
rw [modular_T_zpow_smul z (N * n)] simpa only [Int.cast_mul, Int.cast_natCast] using vAdd_width_periodic N k n f z
1,959
import Mathlib.RingTheory.RootsOfUnity.Basic universe u variable {L : Type u} [CommRing L] [IsDomain L] variable (n : ℕ+)
Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean
72
75
theorem rootsOfUnity.integer_power_of_ringEquiv (g : L ≃+* L) : ∃ m : ℤ, ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by
obtain ⟨m, hm⟩ := MonoidHom.map_cyclic ((g : L ≃* L).restrictRootsOfUnity n).toMonoidHom exact ⟨m, fun t ↦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm t⟩
1,960
import Mathlib.RingTheory.RootsOfUnity.Basic universe u variable {L : Type u} [CommRing L] [IsDomain L] variable (n : ℕ+) theorem rootsOfUnity.integer_power_of_ringEquiv (g : L ≃+* L) : ∃ m : ℤ, ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by obtain ⟨m, hm⟩ := MonoidHom.map_cyclic ((g : L ≃* L).restrictRootsOfUnity n).toMonoidHom exact ⟨m, fun t ↦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm t⟩
Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean
77
79
theorem rootsOfUnity.integer_power_of_ringEquiv' (g : L ≃+* L) : ∃ m : ℤ, ∀ t ∈ rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by
simpa using rootsOfUnity.integer_power_of_ringEquiv n g
1,960
import Mathlib.RingTheory.RootsOfUnity.Basic universe u variable {L : Type u} [CommRing L] [IsDomain L] variable (n : ℕ+) theorem rootsOfUnity.integer_power_of_ringEquiv (g : L ≃+* L) : ∃ m : ℤ, ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by obtain ⟨m, hm⟩ := MonoidHom.map_cyclic ((g : L ≃* L).restrictRootsOfUnity n).toMonoidHom exact ⟨m, fun t ↦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm t⟩ theorem rootsOfUnity.integer_power_of_ringEquiv' (g : L ≃+* L) : ∃ m : ℤ, ∀ t ∈ rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by simpa using rootsOfUnity.integer_power_of_ringEquiv n g noncomputable def ModularCyclotomicCharacter_aux (g : L ≃+* L) (n : ℕ+) : ℤ := (rootsOfUnity.integer_power_of_ringEquiv n g).choose -- the only thing we know about `ModularCyclotomicCharacter_aux g n` theorem ModularCyclotomicCharacter_aux_spec (g : L ≃+* L) (n : ℕ+) : ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ (ModularCyclotomicCharacter_aux g n) : Lˣ) := (rootsOfUnity.integer_power_of_ringEquiv n g).choose_spec noncomputable def ModularCyclotomicCharacter.toFun (n : ℕ+) (g : L ≃+* L) : ZMod (Fintype.card (rootsOfUnity n L)) := ModularCyclotomicCharacter_aux g n namespace ModularCyclotomicCharacter local notation "χ₀" => ModularCyclotomicCharacter.toFun set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean
105
109
theorem toFun_spec (g : L ≃+* L) {n : ℕ+} (t : rootsOfUnity n L) : g (t : Lˣ) = (t ^ (χ₀ n g).val : Lˣ) := by
rw [ModularCyclotomicCharacter_aux_spec g n t, ← zpow_natCast, ModularCyclotomicCharacter.toFun, ZMod.val_intCast, ← Subgroup.coe_zpow] exact Units.ext_iff.1 <| SetCoe.ext_iff.2 <| zpow_eq_zpow_emod _ pow_card_eq_one
1,960
import Mathlib.RingTheory.RootsOfUnity.Basic universe u variable {L : Type u} [CommRing L] [IsDomain L] variable (n : ℕ+) theorem rootsOfUnity.integer_power_of_ringEquiv (g : L ≃+* L) : ∃ m : ℤ, ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by obtain ⟨m, hm⟩ := MonoidHom.map_cyclic ((g : L ≃* L).restrictRootsOfUnity n).toMonoidHom exact ⟨m, fun t ↦ Units.ext_iff.1 <| SetCoe.ext_iff.2 <| hm t⟩ theorem rootsOfUnity.integer_power_of_ringEquiv' (g : L ≃+* L) : ∃ m : ℤ, ∀ t ∈ rootsOfUnity n L, g (t : Lˣ) = (t ^ m : Lˣ) := by simpa using rootsOfUnity.integer_power_of_ringEquiv n g noncomputable def ModularCyclotomicCharacter_aux (g : L ≃+* L) (n : ℕ+) : ℤ := (rootsOfUnity.integer_power_of_ringEquiv n g).choose -- the only thing we know about `ModularCyclotomicCharacter_aux g n` theorem ModularCyclotomicCharacter_aux_spec (g : L ≃+* L) (n : ℕ+) : ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ (ModularCyclotomicCharacter_aux g n) : Lˣ) := (rootsOfUnity.integer_power_of_ringEquiv n g).choose_spec noncomputable def ModularCyclotomicCharacter.toFun (n : ℕ+) (g : L ≃+* L) : ZMod (Fintype.card (rootsOfUnity n L)) := ModularCyclotomicCharacter_aux g n namespace ModularCyclotomicCharacter local notation "χ₀" => ModularCyclotomicCharacter.toFun set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532 theorem toFun_spec (g : L ≃+* L) {n : ℕ+} (t : rootsOfUnity n L) : g (t : Lˣ) = (t ^ (χ₀ n g).val : Lˣ) := by rw [ModularCyclotomicCharacter_aux_spec g n t, ← zpow_natCast, ModularCyclotomicCharacter.toFun, ZMod.val_intCast, ← Subgroup.coe_zpow] exact Units.ext_iff.1 <| SetCoe.ext_iff.2 <| zpow_eq_zpow_emod _ pow_card_eq_one theorem toFun_spec' (g : L ≃+* L) {n : ℕ+} {t : Lˣ} (ht : t ∈ rootsOfUnity n L) : g t = t ^ (χ₀ n g).val := toFun_spec g ⟨t, ht⟩ theorem toFun_spec'' (g : L ≃+* L) {n : ℕ+} {t : L} (ht : IsPrimitiveRoot t n) : g t = t ^ (χ₀ n g).val := toFun_spec' g (SetLike.coe_mem ht.toRootsOfUnity)
Mathlib/NumberTheory/Cyclotomic/CyclotomicCharacter.lean
120
125
theorem toFun_unique (g : L ≃+* L) (c : ZMod (Fintype.card (rootsOfUnity n L))) (hc : ∀ t : rootsOfUnity n L, g (t : Lˣ) = (t ^ c.val : Lˣ)) : c = χ₀ n g := by
apply IsCyclic.ext rfl (fun ζ ↦ ?_) specialize hc ζ suffices ((ζ ^ c.val : Lˣ) : L) = (ζ ^ (χ₀ n g).val : Lˣ) by exact_mod_cast this rw [← toFun_spec g ζ, hc]
1,960
import Mathlib.Analysis.SpecialFunctions.Complex.Log import Mathlib.RingTheory.RootsOfUnity.Basic #align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" namespace Complex open Polynomial Real open scoped Nat Real
Mathlib/RingTheory/RootsOfUnity/Complex.lean
33
50
theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) : IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by
rw [IsPrimitiveRoot.iff_def] simp only [← exp_nat_mul, exp_eq_one_iff] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 constructor · use i field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)] · simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff, mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps] norm_cast rintro l k hk conv_rhs at hk => rw [mul_comm, ← mul_assoc] have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero] field_simp [hz] at hk norm_cast at hk have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left exact hi.symm.dvd_of_dvd_mul_left this
1,961
import Mathlib.Analysis.SpecialFunctions.Complex.Log import Mathlib.RingTheory.RootsOfUnity.Basic #align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" namespace Complex open Polynomial Real open scoped Nat Real theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) : IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by rw [IsPrimitiveRoot.iff_def] simp only [← exp_nat_mul, exp_eq_one_iff] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 constructor · use i field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)] · simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff, mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps] norm_cast rintro l k hk conv_rhs at hk => rw [mul_comm, ← mul_assoc] have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero] field_simp [hz] at hk norm_cast at hk have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left exact hi.symm.dvd_of_dvd_mul_left this #align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime
Mathlib/RingTheory/RootsOfUnity/Complex.lean
53
55
theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by
simpa only [Nat.cast_one, one_div] using isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left
1,961
import Mathlib.Analysis.SpecialFunctions.Complex.Log import Mathlib.RingTheory.RootsOfUnity.Basic #align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" namespace Complex open Polynomial Real open scoped Nat Real theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) : IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by rw [IsPrimitiveRoot.iff_def] simp only [← exp_nat_mul, exp_eq_one_iff] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 constructor · use i field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)] · simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff, mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps] norm_cast rintro l k hk conv_rhs at hk => rw [mul_comm, ← mul_assoc] have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero] field_simp [hz] at hk norm_cast at hk have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left exact hi.symm.dvd_of_dvd_mul_left this #align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by simpa only [Nat.cast_one, one_div] using isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left #align complex.is_primitive_root_exp Complex.isPrimitiveRoot_exp
Mathlib/RingTheory/RootsOfUnity/Complex.lean
58
69
theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) : IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ := by
have hn0 : (n : ℂ) ≠ 0 := mod_cast hn constructor; swap · rintro ⟨i, -, hi, rfl⟩; exact isPrimitiveRoot_exp_of_coprime i n hn hi intro h obtain ⟨i, hi, rfl⟩ := (isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one (Nat.pos_of_ne_zero hn) refine ⟨i, hi, ((isPrimitiveRoot_exp n hn).pow_iff_coprime (Nat.pos_of_ne_zero hn) i).mp h, ?_⟩ rw [← exp_nat_mul] congr 1 field_simp [hn0, mul_comm (i : ℂ)]
1,961
import Mathlib.Analysis.SpecialFunctions.Complex.Log import Mathlib.RingTheory.RootsOfUnity.Basic #align_import ring_theory.roots_of_unity.complex from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f" namespace Complex open Polynomial Real open scoped Nat Real theorem isPrimitiveRoot_exp_of_coprime (i n : ℕ) (h0 : n ≠ 0) (hi : i.Coprime n) : IsPrimitiveRoot (exp (2 * π * I * (i / n))) n := by rw [IsPrimitiveRoot.iff_def] simp only [← exp_nat_mul, exp_eq_one_iff] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 constructor · use i field_simp [hn0, mul_comm (i : ℂ), mul_comm (n : ℂ)] · simp only [hn0, mul_right_comm _ _ ↑n, mul_left_inj' two_pi_I_ne_zero, Ne, not_false_iff, mul_comm _ (i : ℂ), ← mul_assoc _ (i : ℂ), exists_imp, field_simps] norm_cast rintro l k hk conv_rhs at hk => rw [mul_comm, ← mul_assoc] have hz : 2 * ↑π * I ≠ 0 := by simp [pi_pos.ne.symm, I_ne_zero] field_simp [hz] at hk norm_cast at hk have : n ∣ i * l := by rw [← Int.natCast_dvd_natCast, hk, mul_comm]; apply dvd_mul_left exact hi.symm.dvd_of_dvd_mul_left this #align complex.is_primitive_root_exp_of_coprime Complex.isPrimitiveRoot_exp_of_coprime theorem isPrimitiveRoot_exp (n : ℕ) (h0 : n ≠ 0) : IsPrimitiveRoot (exp (2 * π * I / n)) n := by simpa only [Nat.cast_one, one_div] using isPrimitiveRoot_exp_of_coprime 1 n h0 n.coprime_one_left #align complex.is_primitive_root_exp Complex.isPrimitiveRoot_exp theorem isPrimitiveRoot_iff (ζ : ℂ) (n : ℕ) (hn : n ≠ 0) : IsPrimitiveRoot ζ n ↔ ∃ i < (n : ℕ), ∃ _ : i.Coprime n, exp (2 * π * I * (i / n)) = ζ := by have hn0 : (n : ℂ) ≠ 0 := mod_cast hn constructor; swap · rintro ⟨i, -, hi, rfl⟩; exact isPrimitiveRoot_exp_of_coprime i n hn hi intro h obtain ⟨i, hi, rfl⟩ := (isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one (Nat.pos_of_ne_zero hn) refine ⟨i, hi, ((isPrimitiveRoot_exp n hn).pow_iff_coprime (Nat.pos_of_ne_zero hn) i).mp h, ?_⟩ rw [← exp_nat_mul] congr 1 field_simp [hn0, mul_comm (i : ℂ)] #align complex.is_primitive_root_iff Complex.isPrimitiveRoot_iff nonrec theorem mem_rootsOfUnity (n : ℕ+) (x : Units ℂ) : x ∈ rootsOfUnity n ℂ ↔ ∃ i < (n : ℕ), exp (2 * π * I * (i / n)) = x := by rw [mem_rootsOfUnity, Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one] have hn0 : (n : ℂ) ≠ 0 := mod_cast n.ne_zero constructor · intro h obtain ⟨i, hi, H⟩ : ∃ i < (n : ℕ), exp (2 * π * I / n) ^ i = x := by simpa only using (isPrimitiveRoot_exp n n.ne_zero).eq_pow_of_pow_eq_one h n.pos refine ⟨i, hi, ?_⟩ rw [← H, ← exp_nat_mul] congr 1 field_simp [hn0, mul_comm (i : ℂ)] · rintro ⟨i, _, H⟩ rw [← H, ← exp_nat_mul, exp_eq_one_iff] use i field_simp [hn0, mul_comm ((n : ℕ) : ℂ), mul_comm (i : ℂ)] #align complex.mem_roots_of_unity Complex.mem_rootsOfUnity theorem card_rootsOfUnity (n : ℕ+) : Fintype.card (rootsOfUnity n ℂ) = n := (isPrimitiveRoot_exp n n.ne_zero).card_rootsOfUnity #align complex.card_roots_of_unity Complex.card_rootsOfUnity
Mathlib/RingTheory/RootsOfUnity/Complex.lean
96
99
theorem card_primitiveRoots (k : ℕ) : (primitiveRoots k ℂ).card = φ k := by
by_cases h : k = 0 · simp [h] exact (isPrimitiveRoot_exp k h).card_primitiveRoots
1,961
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
61
61
theorem ascPochhammer_one : ascPochhammer S 1 = X := by
simp [ascPochhammer]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one
Mathlib/RingTheory/Polynomial/Pochhammer.lean
64
66
theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by
rw [ascPochhammer]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left
Mathlib/RingTheory/Polynomial/Pochhammer.lean
69
76
theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by
induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
83
87
theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by
induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map
Mathlib/RingTheory/Polynomial/Pochhammer.lean
90
93
theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by
rw [← ascPochhammer_map f] exact eval_map f t
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t
Mathlib/RingTheory/Polynomial/Pochhammer.lean
95
99
theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by
rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
104
107
theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by
rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast
Mathlib/RingTheory/Polynomial/Pochhammer.lean
110
113
theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by
cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero
Mathlib/RingTheory/Polynomial/Pochhammer.lean
116
116
theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by
simp
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp #align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
120
121
theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by
simp [ascPochhammer_eval_zero, h]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp #align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero @[simp] theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by simp [ascPochhammer_eval_zero, h] #align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero
Mathlib/RingTheory/Polynomial/Pochhammer.lean
124
134
theorem ascPochhammer_succ_right (n : ℕ) : ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by
suffices h : ascPochhammer ℕ (n + 1) = ascPochhammer ℕ n * (X + (n : ℕ[X])) by apply_fun Polynomial.map (algebraMap ℕ S) at h simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_natCast] using h induction' n with n ih · simp · conv_lhs => rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp, X_comp, natCast_comp, add_assoc, add_comm (1 : ℕ[X]), ← Nat.cast_succ]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp #align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero @[simp] theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by simp [ascPochhammer_eval_zero, h] #align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero theorem ascPochhammer_succ_right (n : ℕ) : ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by suffices h : ascPochhammer ℕ (n + 1) = ascPochhammer ℕ n * (X + (n : ℕ[X])) by apply_fun Polynomial.map (algebraMap ℕ S) at h simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_natCast] using h induction' n with n ih · simp · conv_lhs => rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp, X_comp, natCast_comp, add_assoc, add_comm (1 : ℕ[X]), ← Nat.cast_succ] #align pochhammer_succ_right ascPochhammer_succ_right
Mathlib/RingTheory/Polynomial/Pochhammer.lean
137
140
theorem ascPochhammer_succ_eval {S : Type*} [Semiring S] (n : ℕ) (k : S) : (ascPochhammer S (n + 1)).eval k = (ascPochhammer S n).eval k * (k + n) := by
rw [ascPochhammer_succ_right, mul_add, eval_add, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast, eval_C_mul, Nat.cast_comm, ← mul_add]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Semiring variable (S : Type u) [Semiring S] noncomputable def ascPochhammer : ℕ → S[X] | 0 => 1 | n + 1 => X * (ascPochhammer n).comp (X + 1) #align pochhammer ascPochhammer @[simp] theorem ascPochhammer_zero : ascPochhammer S 0 = 1 := rfl #align pochhammer_zero ascPochhammer_zero @[simp] theorem ascPochhammer_one : ascPochhammer S 1 = X := by simp [ascPochhammer] #align pochhammer_one ascPochhammer_one theorem ascPochhammer_succ_left (n : ℕ) : ascPochhammer S (n + 1) = X * (ascPochhammer S n).comp (X + 1) := by rw [ascPochhammer] #align pochhammer_succ_left ascPochhammer_succ_left theorem monic_ascPochhammer (n : ℕ) [Nontrivial S] [NoZeroDivisors S] : Monic <| ascPochhammer S n := by induction' n with n hn · simp · have : leadingCoeff (X + 1 : S[X]) = 1 := leadingCoeff_X_add_C 1 rw [ascPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp (ne_zero_of_eq_one <| natDegree_X_add_C 1 : natDegree (X + 1) ≠ 0), hn, monic_X, one_mul, one_mul, this, one_pow] section variable {S} {T : Type v} [Semiring T] @[simp] theorem ascPochhammer_map (f : S →+* T) (n : ℕ) : (ascPochhammer S n).map f = ascPochhammer T n := by induction' n with n ih · simp · simp [ih, ascPochhammer_succ_left, map_comp] #align pochhammer_map ascPochhammer_map theorem ascPochhammer_eval₂ (f : S →+* T) (n : ℕ) (t : T) : (ascPochhammer T n).eval t = (ascPochhammer S n).eval₂ f t := by rw [← ascPochhammer_map f] exact eval_map f t theorem ascPochhammer_eval_comp {R : Type*} [CommSemiring R] (n : ℕ) (p : R[X]) [Algebra R S] (x : S) : ((ascPochhammer S n).comp (p.map (algebraMap R S))).eval x = (ascPochhammer S n).eval (p.eval₂ (algebraMap R S) x) := by rw [ascPochhammer_eval₂ (algebraMap R S), ← eval₂_comp', ← ascPochhammer_map (algebraMap R S), ← map_comp, eval_map] end @[simp, norm_cast] theorem ascPochhammer_eval_cast (n k : ℕ) : (((ascPochhammer ℕ n).eval k : ℕ) : S) = ((ascPochhammer S n).eval k : S) := by rw [← ascPochhammer_map (algebraMap ℕ S), eval_map, ← eq_natCast (algebraMap ℕ S), eval₂_at_natCast,Nat.cast_id] #align pochhammer_eval_cast ascPochhammer_eval_cast theorem ascPochhammer_eval_zero {n : ℕ} : (ascPochhammer S n).eval 0 = if n = 0 then 1 else 0 := by cases n · simp · simp [X_mul, Nat.succ_ne_zero, ascPochhammer_succ_left] #align pochhammer_eval_zero ascPochhammer_eval_zero theorem ascPochhammer_zero_eval_zero : (ascPochhammer S 0).eval 0 = 1 := by simp #align pochhammer_zero_eval_zero ascPochhammer_zero_eval_zero @[simp] theorem ascPochhammer_ne_zero_eval_zero {n : ℕ} (h : n ≠ 0) : (ascPochhammer S n).eval 0 = 0 := by simp [ascPochhammer_eval_zero, h] #align pochhammer_ne_zero_eval_zero ascPochhammer_ne_zero_eval_zero theorem ascPochhammer_succ_right (n : ℕ) : ascPochhammer S (n + 1) = ascPochhammer S n * (X + (n : S[X])) := by suffices h : ascPochhammer ℕ (n + 1) = ascPochhammer ℕ n * (X + (n : ℕ[X])) by apply_fun Polynomial.map (algebraMap ℕ S) at h simpa only [ascPochhammer_map, Polynomial.map_mul, Polynomial.map_add, map_X, Polynomial.map_natCast] using h induction' n with n ih · simp · conv_lhs => rw [ascPochhammer_succ_left, ih, mul_comp, ← mul_assoc, ← ascPochhammer_succ_left, add_comp, X_comp, natCast_comp, add_assoc, add_comm (1 : ℕ[X]), ← Nat.cast_succ] #align pochhammer_succ_right ascPochhammer_succ_right theorem ascPochhammer_succ_eval {S : Type*} [Semiring S] (n : ℕ) (k : S) : (ascPochhammer S (n + 1)).eval k = (ascPochhammer S n).eval k * (k + n) := by rw [ascPochhammer_succ_right, mul_add, eval_add, eval_mul_X, ← Nat.cast_comm, ← C_eq_natCast, eval_C_mul, Nat.cast_comm, ← mul_add] #align pochhammer_succ_eval ascPochhammer_succ_eval
Mathlib/RingTheory/Polynomial/Pochhammer.lean
143
152
theorem ascPochhammer_succ_comp_X_add_one (n : ℕ) : (ascPochhammer S (n + 1)).comp (X + 1) = ascPochhammer S (n + 1) + (n + 1) • (ascPochhammer S n).comp (X + 1) := by
suffices (ascPochhammer ℕ (n + 1)).comp (X + 1) = ascPochhammer ℕ (n + 1) + (n + 1) * (ascPochhammer ℕ n).comp (X + 1) by simpa [map_comp] using congr_arg (Polynomial.map (Nat.castRingHom S)) this nth_rw 2 [ascPochhammer_succ_left] rw [← add_mul, ascPochhammer_succ_right ℕ n, mul_comp, mul_comm, add_comp, X_comp, natCast_comp, add_comm, ← add_assoc] ring
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
256
256
theorem descPochhammer_one : descPochhammer R 1 = X := by
simp [descPochhammer]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
258
260
theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by
rw [descPochhammer]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
262
269
theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by
induction' n with n hn · simp · have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer] theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by induction' n with n hn · simp · have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow] section variable {R} {T : Type v} [Ring T] @[simp]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
276
280
theorem descPochhammer_map (f : R →+* T) (n : ℕ) : (descPochhammer R n).map f = descPochhammer T n := by
induction' n with n ih · simp · simp [ih, descPochhammer_succ_left, map_comp]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer] theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by induction' n with n hn · simp · have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow] section variable {R} {T : Type v} [Ring T] @[simp] theorem descPochhammer_map (f : R →+* T) (n : ℕ) : (descPochhammer R n).map f = descPochhammer T n := by induction' n with n ih · simp · simp [ih, descPochhammer_succ_left, map_comp] end @[simp, norm_cast]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
284
287
theorem descPochhammer_eval_cast (n : ℕ) (k : ℤ) : (((descPochhammer ℤ n).eval k : ℤ) : R) = ((descPochhammer R n).eval k : R) := by
rw [← descPochhammer_map (algebraMap ℤ R), eval_map, ← eq_intCast (algebraMap ℤ R)] simp only [algebraMap_int_eq, eq_intCast, eval₂_at_intCast, Nat.cast_id, eq_natCast, Int.cast_id]
1,962
import Mathlib.Algebra.Polynomial.Degree.Definitions import Mathlib.Algebra.Polynomial.Eval import Mathlib.Algebra.Polynomial.Monic import Mathlib.Algebra.Polynomial.RingDivision import Mathlib.Tactic.Abel #align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589" universe u v open Polynomial open Polynomial section Ring variable (R : Type u) [Ring R] noncomputable def descPochhammer : ℕ → R[X] | 0 => 1 | n + 1 => X * (descPochhammer n).comp (X - 1) @[simp] theorem descPochhammer_zero : descPochhammer R 0 = 1 := rfl @[simp] theorem descPochhammer_one : descPochhammer R 1 = X := by simp [descPochhammer] theorem descPochhammer_succ_left (n : ℕ) : descPochhammer R (n + 1) = X * (descPochhammer R n).comp (X - 1) := by rw [descPochhammer] theorem monic_descPochhammer (n : ℕ) [Nontrivial R] [NoZeroDivisors R] : Monic <| descPochhammer R n := by induction' n with n hn · simp · have h : leadingCoeff (X - 1 : R[X]) = 1 := leadingCoeff_X_sub_C 1 have : natDegree (X - (1 : R[X])) ≠ 0 := ne_zero_of_eq_one <| natDegree_X_sub_C (1 : R) rw [descPochhammer_succ_left, Monic.def, leadingCoeff_mul, leadingCoeff_comp this, hn, monic_X, one_mul, one_mul, h, one_pow] section variable {R} {T : Type v} [Ring T] @[simp] theorem descPochhammer_map (f : R →+* T) (n : ℕ) : (descPochhammer R n).map f = descPochhammer T n := by induction' n with n ih · simp · simp [ih, descPochhammer_succ_left, map_comp] end @[simp, norm_cast] theorem descPochhammer_eval_cast (n : ℕ) (k : ℤ) : (((descPochhammer ℤ n).eval k : ℤ) : R) = ((descPochhammer R n).eval k : R) := by rw [← descPochhammer_map (algebraMap ℤ R), eval_map, ← eq_intCast (algebraMap ℤ R)] simp only [algebraMap_int_eq, eq_intCast, eval₂_at_intCast, Nat.cast_id, eq_natCast, Int.cast_id]
Mathlib/RingTheory/Polynomial/Pochhammer.lean
289
293
theorem descPochhammer_eval_zero {n : ℕ} : (descPochhammer R n).eval 0 = if n = 0 then 1 else 0 := by
cases n · simp · simp [X_mul, Nat.succ_ne_zero, descPochhammer_succ_left]
1,962