fact
stringlengths
6
3.84k
type
stringclasses
11 values
library
stringclasses
32 values
imports
listlengths
1
14
filename
stringlengths
20
95
symbolic_name
stringlengths
1
90
docstring
stringlengths
7
20k
ofLocalizationPrime : OfLocalizationPrime FormallyUnramified := by intro R S _ _ f H algebraize [f] rw [FormallyUnramified, ← Algebra.unramifiedLocus_eq_univ_iff, Set.eq_univ_iff_forall] intro x let Rₓ := Localization.AtPrime (x.asIdeal.comap f) let Sₓ := Localization.AtPrime x.asIdeal have := Algebra.FormallyUnramified.of_isLocalization (Rₘ := Rₓ) (x.asIdeal.comap f).primeCompl letI : Algebra Rₓ Sₓ := (Localization.localRingHom _ _ _ rfl).toAlgebra have : IsScalarTower R Rₓ Sₓ := .of_algebraMap_eq fun x ↦ (Localization.localRingHom_to_map _ _ _ rfl x).symm have : Algebra.FormallyUnramified Rₓ Sₓ := H _ _ exact Algebra.FormallyUnramified.comp R Rₓ Sₓ
lemma
RingTheory
[ "Mathlib.RingTheory.Unramified.Locus", "Mathlib.RingTheory.LocalProperties.Basic" ]
Mathlib/RingTheory/RingHom/Unramified.lean
ofLocalizationPrime
null
ofLocalizationSpanTarget : OfLocalizationSpanTarget FormallyUnramified := by intro R S _ _ f s hs H algebraize [f] rw [FormallyUnramified, ← Algebra.unramifiedLocus_eq_univ_iff, Set.eq_univ_iff_forall] intro x obtain ⟨r, hr, hrx⟩ : ∃ r ∈ s, x ∈ PrimeSpectrum.basicOpen r := by simpa using (PrimeSpectrum.iSup_basicOpen_eq_top_iff'.mpr hs).ge (TopologicalSpace.Opens.mem_top x) refine Algebra.basicOpen_subset_unramifiedLocus_iff.mpr ?_ hrx convert H ⟨r, hr⟩ dsimp rw [← algebraMap_toAlgebra f, ← IsScalarTower.algebraMap_eq, formallyUnramified_algebraMap]
lemma
RingTheory
[ "Mathlib.RingTheory.Unramified.Locus", "Mathlib.RingTheory.LocalProperties.Basic" ]
Mathlib/RingTheory/RingHom/Unramified.lean
ofLocalizationSpanTarget
null
propertyIsLocal : PropertyIsLocal FormallyUnramified := by constructor · intro R S _ _ f r R' S' _ _ _ _ _ _ H algebraize [f, (algebraMap S S').comp f, IsLocalization.Away.map R' S' f r] have := Algebra.FormallyUnramified.of_isLocalization (Rₘ := S') (.powers (f r)) have := Algebra.FormallyUnramified.comp R S S' have H : Submonoid.powers r ≤ (Submonoid.powers (f r)).comap f := by rintro x ⟨n, rfl⟩; exact ⟨n, by simp⟩ have : IsScalarTower R R' S' := .of_algebraMap_eq' (IsLocalization.map_comp H).symm exact Algebra.FormallyUnramified.of_comp R R' S' · exact ofLocalizationSpanTarget · exact ofLocalizationSpanTarget.ofLocalizationSpan (stableUnderComposition.stableUnderCompositionWithLocalizationAway holdsForLocalizationAway).1 · exact (stableUnderComposition.stableUnderCompositionWithLocalizationAway holdsForLocalizationAway).2
lemma
RingTheory
[ "Mathlib.RingTheory.Unramified.Locus", "Mathlib.RingTheory.LocalProperties.Basic" ]
Mathlib/RingTheory/RingHom/Unramified.lean
propertyIsLocal
null
hasEnoughRootsOfUnity : HasEnoughRootsOfUnity F n where prim := by have : NeZero n := .of_neZero_natCast F have := isCyclotomicExtension {n} F fun _ h _ ↦ Set.mem_singleton_iff.mp h ▸ ‹NeZero (n : F)› exact IsCyclotomicExtension.exists_isPrimitiveRoot (S := {n}) F _ rfl (NeZero.ne _) cyc := have : NeZero n := .of_neZero_natCast F rootsOfUnity.isCyclic F n
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity
A separably closed field `F` satisfies `HasEnoughRootsOfUnity F n` for all `n` that are not divisible by the characteristic of `F`.
hasEnoughRootsOfUnity_pow : HasEnoughRootsOfUnity F (n ^ k) := have : NeZero ((n ^ k : ℕ) : F) := by exact_mod_cast ‹NeZero (n : F)›.pow inferInstance
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity_pow
null
hasEnoughRootsOfUnity : HasEnoughRootsOfUnity (AlgebraicClosure F) n := have : NeZero (n : AlgebraicClosure F) := ‹NeZero (n : F)›.of_injective (algebraMap F (AlgebraicClosure F)).injective inferInstance
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity
null
hasEnoughRootsOfUnity_pow : HasEnoughRootsOfUnity (AlgebraicClosure F) (n ^ k) := have : NeZero (n : AlgebraicClosure F) := ‹NeZero (n : F)›.of_injective (algebraMap F (AlgebraicClosure F)).injective inferInstance
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity_pow
null
hasEnoughRootsOfUnity : HasEnoughRootsOfUnity (SeparableClosure F) n := have : NeZero (n : SeparableClosure F) := ‹NeZero (n : F)›.of_injective (algebraMap F (SeparableClosure F)).injective inferInstance
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity
null
hasEnoughRootsOfUnity_pow : HasEnoughRootsOfUnity (SeparableClosure F) (n ^ k) := have : NeZero (n : SeparableClosure F) := ‹NeZero (n : F)›.of_injective (algebraMap F (SeparableClosure F)).injective inferInstance
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity", "Mathlib.NumberTheory.Cyclotomic.Basic" ]
Mathlib/RingTheory/RootsOfUnity/AlgebraicallyClosed.lean
hasEnoughRootsOfUnity_pow
null
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] @[simp]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity
`rootsOfUnity k M` is the subgroup of elements `m : Mˣ` that satisfy `m ^ k = 1`.
mem_rootsOfUnity (k : ℕ) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ ζ ^ k = 1 := Iff.rfl
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
mem_rootsOfUnity
null
mem_rootsOfUnity' (k : ℕ) (ζ : Mˣ) : ζ ∈ rootsOfUnity k M ↔ (ζ : M) ^ k = 1 := by rw [mem_rootsOfUnity]; norm_cast @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
mem_rootsOfUnity'
A variant of `mem_rootsOfUnity` using `ζ : Mˣ`.
rootsOfUnity_one (M : Type*) [CommMonoid M] : rootsOfUnity 1 M = ⊥ := by ext1 simp only [mem_rootsOfUnity, pow_one, Subgroup.mem_bot] @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity_one
null
rootsOfUnity_zero (M : Type*) [CommMonoid M] : rootsOfUnity 0 M = ⊤ := by ext1 simp only [mem_rootsOfUnity, pow_zero, Subgroup.mem_top]
lemma
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity_zero
null
rootsOfUnity.coe_injective {n : ℕ} : Function.Injective (fun x : rootsOfUnity n M ↦ x.val.val) := Units.val_injective.comp Subtype.val_injective
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.coe_injective
null
@[simps! coe_val] rootsOfUnity.mkOfPowEq (ζ : M) {n : ℕ} [NeZero n] (h : ζ ^ n = 1) : rootsOfUnity n M := ⟨Units.ofPowEqOne ζ n h <| NeZero.ne n, Units.pow_ofPowEqOne _ _⟩ @[simp]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.mkOfPowEq
Make an element of `rootsOfUnity` from a member of the base ring, and a proof that it has a positive power equal to one.
rootsOfUnity.coe_mkOfPowEq {ζ : M} {n : ℕ} [NeZero n] (h : ζ ^ n = 1) : ((rootsOfUnity.mkOfPowEq _ h : Mˣ) : M) = ζ := rfl
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.coe_mkOfPowEq
null
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, pow_mul, one_pow]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity_le_of_dvd
null
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]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
map_rootsOfUnity
null
@[norm_cast] 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]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.coe_pow
null
rootsOfUnityUnitsMulEquiv (M : Type*) [CommMonoid M] (n : ℕ) : rootsOfUnity n Mˣ ≃* rootsOfUnity n M where toFun ζ := ⟨ζ.val, (mem_rootsOfUnity ..).mpr <| (mem_rootsOfUnity' ..).mp ζ.prop⟩ invFun ζ := ⟨toUnits ζ.val, by simp only [mem_rootsOfUnity, ← map_pow, EmbeddingLike.map_eq_one_iff] exact (mem_rootsOfUnity ..).mp ζ.prop⟩ left_inv ζ := by simp only [toUnits_val_apply, Subtype.coe_eta] right_inv ζ := by simp only [val_toUnits_apply, Subtype.coe_eta] map_mul' ζ ζ' := by simp only [Subgroup.coe_mul, Units.val_mul, MulMemClass.mk_mul_mk]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnityUnitsMulEquiv
The canonical isomorphism from the `n`th roots of unity in `Mˣ` to the `n`th roots of unity in `M`.
restrictRootsOfUnity [MonoidHomClass F R S] (σ : F) (n : ℕ) : rootsOfUnity n R →* rootsOfUnity n S := { toFun := fun ξ ↦ ⟨Units.map σ (ξ : Rˣ), by rw [mem_rootsOfUnity, ← map_pow, Units.ext_iff, Units.coe_map, ξ.prop] exact map_one σ⟩ map_one' := by ext1; simp only [OneMemClass.coe_one, map_one] map_mul' := fun ξ₁ ξ₂ ↦ by ext1; simp only [Subgroup.coe_mul, map_mul, MulMemClass.mk_mul_mk] } @[simp]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
restrictRootsOfUnity
Restrict a ring homomorphism to the nth roots of unity.
restrictRootsOfUnity_coe_apply [MonoidHomClass F R S] (σ : F) (ζ : rootsOfUnity k R) : (restrictRootsOfUnity σ k ζ : Sˣ) = σ (ζ : Rˣ) := rfl
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
restrictRootsOfUnity_coe_apply
null
rootsOfUnityEquivNthRoots : rootsOfUnity k R ≃ { x // x ∈ nthRoots k (1 : R) } where toFun x := ⟨(x : Rˣ), mem_rootsOfUnity_iff_mem_nthRoots.mp x.2⟩ invFun x := by refine ⟨⟨x, ↑x ^ (k - 1 : ℕ), ?_, ?_⟩, ?_⟩ all_goals rcases x with ⟨x, hx⟩; rw [mem_nthRoots <| NeZero.pos k] at hx simp only [← pow_succ, ← pow_succ', hx, tsub_add_cancel_of_le NeZero.one_le] simp only [mem_rootsOfUnity, Units.ext_iff, Units.val_pow_eq_pow_val, hx, Units.val_one] variable {k R} @[simp]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnityEquivNthRoots
Restrict a monoid isomorphism to the nth roots of unity. -/ nonrec def MulEquiv.restrictRootsOfUnity (σ : R ≃* S) (n : ℕ) : rootsOfUnity n R ≃* rootsOfUnity n S where toFun := restrictRootsOfUnity σ n invFun := restrictRootsOfUnity σ.symm n left_inv ξ := by ext; exact σ.symm_apply_apply _ right_inv ξ := by ext; exact σ.apply_symm_apply _ map_mul' := (restrictRootsOfUnity _ n).map_mul @[simp] theorem MulEquiv.restrictRootsOfUnity_coe_apply (σ : R ≃* S) (ζ : rootsOfUnity k R) : (σ.restrictRootsOfUnity k ζ : Sˣ) = σ (ζ : Rˣ) := rfl @[simp] theorem MulEquiv.restrictRootsOfUnity_symm (σ : R ≃* S) : (σ.restrictRootsOfUnity k).symm = σ.symm.restrictRootsOfUnity k := rfl @[simp] theorem Units.val_set_image_rootsOfUnity [NeZero k] : ((↑) : Rˣ → _) '' (rootsOfUnity k R) = {z : R | z^k = 1} := by ext x exact ⟨fun ⟨y,hy1,hy2⟩ => by rw [← hy2]; exact (mem_rootsOfUnity' k y).mp hy1, fun h ↦ ⟨(rootsOfUnity.mkOfPowEq x h), ⟨Subtype.coe_prop (rootsOfUnity.mkOfPowEq x h), rfl⟩⟩⟩ theorem Units.val_set_image_rootsOfUnity_one : ((↑) : Rˣ → R) '' (rootsOfUnity 1 R) = {1} := by ext x simp end CommMonoid open Set in theorem Units.val_set_image_rootsOfUnity_two [CommRing R] [NoZeroDivisors R] : ((↑) : Rˣ → R) '' (rootsOfUnity 2 R) = {1, -1} := by ext x simp section IsDomain -- The following results need `k` to be nonzero. variable [NeZero k] [CommRing R] [IsDomain R] theorem mem_rootsOfUnity_iff_mem_nthRoots {ζ : Rˣ} : ζ ∈ rootsOfUnity k R ↔ (ζ : R) ∈ nthRoots k (1 : R) := by simp only [mem_rootsOfUnity, mem_nthRoots (NeZero.pos k), Units.ext_iff, Units.val_one, Units.val_pow_eq_pow_val] variable (k R) /-- Equivalence between the `k`-th roots of unity in `R` and the `k`-th roots of `1`. This is implemented as equivalence of subtypes, because `rootsOfUnity` is a subgroup of the group of units, whereas `nthRoots` is a multiset.
rootsOfUnityEquivNthRoots_apply (x : rootsOfUnity k R) : (rootsOfUnityEquivNthRoots R k x : R) = ((x : Rˣ) : R) := rfl @[simp]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnityEquivNthRoots_apply
null
rootsOfUnityEquivNthRoots_symm_apply (x : { x // x ∈ nthRoots k (1 : R) }) : (((rootsOfUnityEquivNthRoots R k).symm x : Rˣ) : R) = (x : R) := rfl variable (k R)
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnityEquivNthRoots_symm_apply
null
rootsOfUnity.fintype : Fintype (rootsOfUnity k R) := by classical exact Fintype.ofEquiv { x // x ∈ nthRoots k (1 : R) } (rootsOfUnityEquivNthRoots R k).symm
instance
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.fintype
null
rootsOfUnity.isCyclic : IsCyclic (rootsOfUnity k R) := isCyclic_of_subgroup_isDomain ((Units.coeHom R).comp (rootsOfUnity k R).subtype) coe_injective
instance
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
rootsOfUnity.isCyclic
null
card_rootsOfUnity : Fintype.card (rootsOfUnity k R) ≤ k := by classical calc Fintype.card (rootsOfUnity k R) = Fintype.card { x // x ∈ nthRoots k (1 : R) } := Fintype.card_congr (rootsOfUnityEquivNthRoots R k) _ ≤ Multiset.card (nthRoots k (1 : R)).attach := Multiset.card_le_card (Multiset.dedup_le _) _ = Multiset.card (nthRoots k (1 : R)) := Multiset.card_attach _ ≤ k := card_nthRoots k 1 variable {k R}
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
card_rootsOfUnity
null
map_rootsOfUnity_eq_pow_self [FunLike F R R] [MonoidHomClass F R R] (σ : F) (ζ : rootsOfUnity k R) : ∃ m : ℕ, σ (ζ : Rˣ) = ((ζ : Rˣ) : R) ^ m := by obtain ⟨m, hm⟩ := MonoidHom.map_cyclic (restrictRootsOfUnity σ k) rw [← restrictRootsOfUnity_coe_apply, hm, ← zpow_mod_orderOf, ← Int.toNat_of_nonneg (m.emod_nonneg (Int.natCast_ne_zero.mpr (pos_iff_ne_zero.mp (orderOf_pos ζ)))), zpow_natCast, rootsOfUnity.coe_pow] exact ⟨(m % orderOf ζ).toNat, rfl⟩
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
map_rootsOfUnity_eq_pow_self
null
mem_rootsOfUnity_prime_pow_mul_iff (p k : ℕ) (m : ℕ) [ExpChar R p] {ζ : Rˣ} : ζ ∈ rootsOfUnity (p ^ k * m) R ↔ ζ ∈ rootsOfUnity m R := by simp only [mem_rootsOfUnity', ExpChar.pow_prime_pow_mul_eq_one_iff]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
mem_rootsOfUnity_prime_pow_mul_iff
null
@[simp] mem_rootsOfUnity_prime_pow_mul_iff' (p k : ℕ) (m : ℕ) [ExpChar R p] {ζ : Rˣ} : ζ ^ (p ^ k * m) = 1 ↔ ζ ∈ rootsOfUnity m R := by rw [← mem_rootsOfUnity, mem_rootsOfUnity_prime_pow_mul_iff]
theorem
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
mem_rootsOfUnity_prime_pow_mul_iff'
A variant of `mem_rootsOfUnity_prime_pow_mul_iff` in terms of `ζ ^ _`
noncomputable monoidHomMulEquivRootsOfUnityOfGenerator {G : Type*} [CommGroup G] {g : G} (hg : ∀ (x : G), x ∈ Subgroup.zpowers g) (G' : Type*) [CommGroup G'] : (G →* G') ≃* rootsOfUnity (Nat.card G) G' where toFun φ := ⟨(IsUnit.map φ <| Group.isUnit g).unit, by simp only [mem_rootsOfUnity, Units.ext_iff, Units.val_pow_eq_pow_val, IsUnit.unit_spec, ← map_pow, pow_card_eq_one', map_one, Units.val_one]⟩ invFun ζ := monoidHomOfForallMemZpowers hg (g' := (ζ.val : G')) <| by simpa only [orderOf_eq_card_of_forall_mem_zpowers hg, orderOf_dvd_iff_pow_eq_one, ← Units.val_pow_eq_pow_val, Units.val_eq_one] using ζ.prop left_inv φ := (MonoidHom.eq_iff_eq_on_generator hg _ φ).mpr <| by simp only [IsUnit.unit_spec, monoidHomOfForallMemZpowers_apply_gen] right_inv φ := Subtype.ext <| by simp only [monoidHomOfForallMemZpowers_apply_gen, IsUnit.unit_of_val_units] map_mul' x y := by simp only [MonoidHom.mul_apply, MulMemClass.mk_mul_mk, Subtype.mk.injEq, Units.ext_iff, IsUnit.unit_spec, Units.val_mul]
def
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
monoidHomMulEquivRootsOfUnityOfGenerator
The isomorphism from the group of group homomorphisms from a finite cyclic group `G` of order `n` into another group `G'` to the group of `n`th roots of unity in `G'` determined by a generator `g` of `G`. It sends `φ : G →* G'` to `φ g`.
monoidHom_mulEquiv_rootsOfUnity (G : Type*) [CommGroup G] [IsCyclic G] (G' : Type*) [CommGroup G'] : Nonempty <| (G →* G') ≃* rootsOfUnity (Nat.card G) G' := by obtain ⟨g, hg⟩ := IsCyclic.exists_generator (α := G) exact ⟨monoidHomMulEquivRootsOfUnityOfGenerator hg G'⟩
lemma
RingTheory
[ "Mathlib.Algebra.CharP.Reduced", "Mathlib.RingTheory.IntegralDomain" ]
Mathlib/RingTheory/RootsOfUnity/Basic.lean
monoidHom_mulEquiv_rootsOfUnity
The group of group homomorphisms from a finite cyclic group `G` of order `n` into another group `G'` is (noncanonically) isomorphic to the group of `n`th roots of unity in `G'`.
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] constructor · use i simp (discharger := norm_cast) [field] · simp only [forall_exists_index] have hn0 : (n : ℂ) ≠ 0 := mod_cast h0 rintro l k hk field_simp at hk norm_cast at hk have : n ∣ l * i := by rw [← Int.natCast_dvd_natCast, hk]; apply dvd_mul_right exact hi.symm.dvd_of_dvd_mul_right this
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
isPrimitiveRoot_exp_of_coprime
null
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
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
isPrimitiveRoot_exp
null
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 have : NeZero n := ⟨hn⟩ obtain ⟨i, hi, rfl⟩ := (isPrimitiveRoot_exp n hn).eq_pow_of_pow_eq_one h.pow_eq_one 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
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
isPrimitiveRoot_iff
null
card_rootsOfUnity (n : ℕ) [NeZero n] : Fintype.card (rootsOfUnity n ℂ) = n := (isPrimitiveRoot_exp n NeZero.out).card_rootsOfUnity
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
card_rootsOfUnity
null
card_primitiveRoots (k : ℕ) : (primitiveRoots k ℂ).card = φ k := by by_cases h : k = 0 · simp [h] exact (isPrimitiveRoot_exp k h).card_primitiveRoots
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
card_primitiveRoots
null
IsPrimitiveRoot.norm'_eq_one {ζ : ℂ} {n : ℕ} (h : IsPrimitiveRoot ζ n) (hn : n ≠ 0) : ‖ζ‖ = 1 := Complex.norm_eq_one_of_pow_eq_one h.pow_eq_one hn
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.norm'_eq_one
null
IsPrimitiveRoot.nnnorm_eq_one {ζ : ℂ} {n : ℕ} (h : IsPrimitiveRoot ζ n) (hn : n ≠ 0) : ‖ζ‖₊ = 1 := Subtype.ext <| h.norm'_eq_one hn
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.nnnorm_eq_one
null
IsPrimitiveRoot.arg_ext {n m : ℕ} {ζ μ : ℂ} (hζ : IsPrimitiveRoot ζ n) (hμ : IsPrimitiveRoot μ m) (hn : n ≠ 0) (hm : m ≠ 0) (h : ζ.arg = μ.arg) : ζ = μ := Complex.ext_norm_arg ((hζ.norm'_eq_one hn).trans (hμ.norm'_eq_one hm).symm) h
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.arg_ext
null
IsPrimitiveRoot.arg_eq_zero_iff {n : ℕ} {ζ : ℂ} (hζ : IsPrimitiveRoot ζ n) (hn : n ≠ 0) : ζ.arg = 0 ↔ ζ = 1 := ⟨fun h => hζ.arg_ext IsPrimitiveRoot.one hn one_ne_zero (h.trans Complex.arg_one.symm), fun h => h.symm ▸ Complex.arg_one⟩
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.arg_eq_zero_iff
null
IsPrimitiveRoot.arg_eq_pi_iff {n : ℕ} {ζ : ℂ} (hζ : IsPrimitiveRoot ζ n) (hn : n ≠ 0) : ζ.arg = Real.pi ↔ ζ = -1 := ⟨fun h => hζ.arg_ext (IsPrimitiveRoot.neg_one 0 two_ne_zero.symm) hn two_ne_zero (h.trans Complex.arg_neg_one.symm), fun h => h.symm ▸ Complex.arg_neg_one⟩
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.arg_eq_pi_iff
null
IsPrimitiveRoot.arg {n : ℕ} {ζ : ℂ} (h : IsPrimitiveRoot ζ n) (hn : n ≠ 0) : ∃ i : ℤ, ζ.arg = i / n * (2 * Real.pi) ∧ IsCoprime i n ∧ i.natAbs < n := by rw [Complex.isPrimitiveRoot_iff _ _ hn] at h obtain ⟨i, h, hin, rfl⟩ := h rw [mul_comm, ← mul_assoc, Complex.exp_mul_I] refine ⟨if i * 2 ≤ n then i else i - n, ?_, ?isCoprime, by cutsat⟩ case isCoprime => replace hin := Nat.isCoprime_iff_coprime.mpr hin split_ifs · exact hin · convert hin.add_mul_left_left (-1) using 1 rw [mul_neg_one, sub_eq_add_neg] split_ifs with h₂ · convert Complex.arg_cos_add_sin_mul_I _ · push_cast; rfl · push_cast; rfl simp only [Int.cast_natCast, Set.mem_Ioc] refine ⟨(neg_lt_neg Real.pi_pos).trans_le ?_, ?_⟩ · rw [neg_zero] positivity refine Eq.trans_le (b := Real.pi * (i * 2 / n)) (by ring) ?_ rw [← mul_one n] at h₂ exact mul_le_of_le_one_right Real.pi_pos.le ((div_le_iff₀' <| mod_cast pos_of_gt h).mpr <| mod_cast h₂) rw [← Complex.cos_sub_two_pi, ← Complex.sin_sub_two_pi] convert Complex.arg_cos_add_sin_mul_I _ · push_cast rw [← sub_one_mul, sub_div, div_self] exact mod_cast hn · push_cast rw [← sub_one_mul, sub_div, div_self] exact mod_cast hn simp only [Int.cast_sub, Int.cast_natCast, Set.mem_Ioc] field_simp constructor · push_neg at h₂ rify at h₂ linear_combination h₂ · rify at h linear_combination 2 * h + (n:ℝ) * one_pos (α := ℝ)
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
IsPrimitiveRoot.arg
null
Complex.norm_eq_one_of_mem_rootsOfUnity {ζ : ℂˣ} {n : ℕ} [NeZero n] (hζ : ζ ∈ rootsOfUnity n ℂ) : ‖(ζ : ℂ)‖ = 1 := by refine norm_eq_one_of_pow_eq_one ?_ <| NeZero.ne n norm_cast rw [_root_.mem_rootsOfUnity] at hζ rw [hζ, Units.val_one]
lemma
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
Complex.norm_eq_one_of_mem_rootsOfUnity
null
Complex.conj_rootsOfUnity {ζ : ℂˣ} {n : ℕ} [NeZero n] (hζ : ζ ∈ rootsOfUnity n ℂ) : (starRingEnd ℂ) ζ = ζ⁻¹ := by rw [← Units.mul_eq_one_iff_eq_inv, conj_mul', norm_eq_one_of_mem_rootsOfUnity hζ, ofReal_one, one_pow]
theorem
RingTheory
[ "Mathlib.Analysis.SpecialFunctions.Complex.Log", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.Tactic.Rify" ]
Mathlib/RingTheory/RootsOfUnity/Complex.lean
Complex.conj_rootsOfUnity
null
HasEnoughRootsOfUnity (M : Type*) [CommMonoid M] (n : ℕ) where prim : ∃ m : M, IsPrimitiveRoot m n cyc : IsCyclic <| rootsOfUnity n M
class
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
HasEnoughRootsOfUnity
This is a type class recording that a commutative monoid `M` contains primitive `n`th roots of unity and such that the group of `n`th roots of unity is cyclic. Such monoids are suitable targets in the context of duality statements for groups of exponent `n`.
exists_primitiveRoot (M : Type*) [CommMonoid M] (n : ℕ) [HasEnoughRootsOfUnity M n] : ∃ ζ : M, IsPrimitiveRoot ζ n := HasEnoughRootsOfUnity.prim
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
exists_primitiveRoot
null
rootsOfUnity_isCyclic (M : Type*) [CommMonoid M] (n : ℕ) [HasEnoughRootsOfUnity M n] : IsCyclic (rootsOfUnity n M) := HasEnoughRootsOfUnity.cyc
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
rootsOfUnity_isCyclic
null
of_dvd (M : Type*) [CommMonoid M] {m n : ℕ} [NeZero n] (hmn : m ∣ n) [HasEnoughRootsOfUnity M n] : HasEnoughRootsOfUnity M m where prim := have ⟨ζ, hζ⟩ := exists_primitiveRoot M n have ⟨k, hk⟩ := hmn ⟨ζ ^ k, IsPrimitiveRoot.pow (NeZero.pos n) hζ (mul_comm m k ▸ hk)⟩ cyc := Subgroup.isCyclic_of_le <| rootsOfUnity_le_of_dvd hmn
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
of_dvd
If `HasEnoughRootsOfUnity M n` and `m ∣ n`, then also `HasEnoughRootsOfUnity M m`.
finite_rootsOfUnity (M : Type*) [CommMonoid M] (n : ℕ) [NeZero n] [HasEnoughRootsOfUnity M n] : Finite <| rootsOfUnity n M := by have := rootsOfUnity_isCyclic M n obtain ⟨g, hg⟩ := IsCyclic.exists_generator (α := rootsOfUnity n M) have hg' : g ^ n = 1 := OneMemClass.coe_eq_one.mp g.prop let f (j : ZMod n) : rootsOfUnity n M := g ^ (j.val : ℤ) refine Finite.of_surjective f fun x ↦ ?_ obtain ⟨k, hk⟩ := Subgroup.mem_zpowers_iff.mp <| hg x refine ⟨k, ?_⟩ simpa only [ZMod.natCast_val, ← hk, f, ZMod.coe_intCast] using (zpow_eq_zpow_emod' k hg').symm
instance
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
finite_rootsOfUnity
If `M` satisfies `HasEnoughRootsOfUnity`, then the group of `n`th roots of unity in `M` is finite.
natCard_rootsOfUnity (M : Type*) [CommMonoid M] (n : ℕ) [NeZero n] [HasEnoughRootsOfUnity M n] : Nat.card (rootsOfUnity n M) = n := by obtain ⟨ζ, h⟩ := exists_primitiveRoot M n rw [← IsCyclic.exponent_eq_card] refine dvd_antisymm ?_ ?_ · exact Monoid.exponent_dvd_of_forall_pow_eq_one fun g ↦ OneMemClass.coe_eq_one.mp g.prop · nth_rewrite 1 [h.eq_orderOf] rw [← (h.isUnit <| NeZero.pos n).unit_spec, orderOf_units] let ζ' : rootsOfUnity n M := ⟨(h.isUnit <| NeZero.pos n).unit, ?_⟩ · rw [← Subgroup.orderOf_mk] exact Monoid.order_dvd_exponent ζ' simp only [mem_rootsOfUnity] rw [← Units.val_inj, Units.val_pow_eq_pow_val, IsUnit.unit_spec, h.pow_eq_one, Units.val_one]
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
natCard_rootsOfUnity
If `M` satisfies `HasEnoughRootsOfUnity`, then the group of `n`th roots of unity in `M` (is cyclic and) has order `n`.
of_card_le {R : Type*} [CommRing R] [IsDomain R] {n : ℕ} [NeZero n] (h : n ≤ Fintype.card (rootsOfUnity n R)) : HasEnoughRootsOfUnity R n where prim := card_rootsOfUnity_eq_iff_exists_isPrimitiveRoot.mp (le_antisymm (card_rootsOfUnity R n) h) cyc := rootsOfUnity.isCyclic R n
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
of_card_le
null
MulEquiv.hasEnoughRootsOfUnity {n : ℕ} [NeZero n] {M N : Type*} [CommMonoid M] [CommMonoid N] [hm : HasEnoughRootsOfUnity M n] (e : rootsOfUnity n M ≃* rootsOfUnity n N) : HasEnoughRootsOfUnity N n where prim := by obtain ⟨m, hm⟩ := hm.prim use (e hm.toRootsOfUnity).val.val rw [IsPrimitiveRoot.coe_units_iff, IsPrimitiveRoot.coe_submonoidClass_iff] refine .map_of_injective ?_ e.injective rwa [← IsPrimitiveRoot.coe_submonoidClass_iff, ← IsPrimitiveRoot.coe_units_iff] cyc := isCyclic_of_surjective e e.surjective
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
MulEquiv.hasEnoughRootsOfUnity
null
IsCyclic.monoidHom_equiv_self (G M : Type*) [CommGroup G] [Finite G] [IsCyclic G] [CommMonoid M] [HasEnoughRootsOfUnity M (Nat.card G)] : Nonempty ((G →* Mˣ) ≃* G) := by have : NeZero (Nat.card G) := ⟨Nat.card_pos.ne'⟩ have hord := HasEnoughRootsOfUnity.natCard_rootsOfUnity M (Nat.card G) let e := (IsCyclic.monoidHom_mulEquiv_rootsOfUnity G Mˣ).some exact ⟨e.trans (rootsOfUnityUnitsMulEquiv M (Nat.card G)) |>.trans (mulEquivOfCyclicCardEq hord)⟩
lemma
RingTheory
[ "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots" ]
Mathlib/RingTheory/RootsOfUnity/EnoughRootsOfUnity.lean
IsCyclic.monoidHom_equiv_self
The group of group homomorphisms from a finite cyclic group `G` of order `n` into the group of units of a ring `M` with all roots of unity is isomorphic to `G`
prod_one_sub_pow_eq_order {n : ℕ} {μ : R} (hμ : IsPrimitiveRoot μ (n + 1)) : ∏ k ∈ range n, (1 - μ ^ (k + 1)) = n + 1 := by have := X_pow_sub_C_eq_prod hμ n.zero_lt_succ (one_pow (n + 1)) rw [C_1, ← mul_geom_sum, prod_range_succ', pow_zero, mul_one, mul_comm, eq_comm] at this replace this := mul_right_cancel₀ (Polynomial.X_sub_C_ne_zero 1) this apply_fun Polynomial.eval 1 at this simpa only [mul_one, map_pow, eval_prod, eval_sub, eval_X, eval_pow, eval_C, eval_geom_sum, one_pow, sum_const, card_range, nsmul_eq_mul, Nat.cast_add, Nat.cast_one] using this
lemma
RingTheory
[ "Mathlib.FieldTheory.KummerExtension" ]
Mathlib/RingTheory/RootsOfUnity/Lemmas.lean
prod_one_sub_pow_eq_order
If `μ` is a primitive `n`th root of unity in `R`, then `∏(1≤k<n) (1-μ^k) = n`. (Stated with `n+1` in place of `n` to avoid the condition `n ≠ 0`.)
prod_pow_sub_one_eq_order {n : ℕ} {μ : R} (hμ : IsPrimitiveRoot μ (n + 1)) : (-1) ^ n * ∏ k ∈ range n, (μ ^ (k + 1) - 1) = n + 1 := by have : (-1 : R) ^ n = ∏ k ∈ range n, -1 := by rw [prod_const, card_range] simp only [this, ← prod_mul_distrib, neg_one_mul, neg_sub, ← prod_one_sub_pow_eq_order hμ] open Algebra in
lemma
RingTheory
[ "Mathlib.FieldTheory.KummerExtension" ]
Mathlib/RingTheory/RootsOfUnity/Lemmas.lean
prod_pow_sub_one_eq_order
If `μ` is a primitive `n`th root of unity in `R`, then `(-1)^(n-1) * ∏(1≤k<n) (μ^k-1) = n`. (Stated with `n+1` in place of `n` to avoid the condition `n ≠ 0`.)
self_sub_one_pow_dvd_order {k n : ℕ} (hn : k < n) {μ : R} (hμ : IsPrimitiveRoot μ n) : ∃ z ∈ adjoin ℤ {μ}, n = z * (μ - 1) ^ k := by let n' + 1 := n obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le' (Nat.le_of_lt_succ hn) have hdvd k : ∃ z ∈ adjoin ℤ {μ}, μ ^ k - 1 = z * (μ - 1) := by refine ⟨(Finset.range k).sum (μ ^ ·), ?_, (geom_sum_mul μ k).symm⟩ exact Subalgebra.sum_mem _ fun m _ ↦ Subalgebra.pow_mem _ (self_mem_adjoin_singleton _ μ) _ let Z k := Classical.choose <| hdvd k have Zdef k : Z k ∈ adjoin ℤ {μ} ∧ μ ^ k - 1 = Z k * (μ - 1) := Classical.choose_spec <| hdvd k refine ⟨(-1) ^ (m + k) * (∏ j ∈ range k, Z (j + 1)) * ∏ j ∈ Ico k (m + k), (μ ^ (j + 1) - 1), ?_, ?_⟩ · apply Subalgebra.mul_mem · apply Subalgebra.mul_mem · exact Subalgebra.pow_mem _ (Subalgebra.neg_mem _ <| Subalgebra.one_mem _) _ · exact Subalgebra.prod_mem _ fun _ _ ↦ (Zdef _).1 · refine Subalgebra.prod_mem _ fun _ _ ↦ ?_ apply Subalgebra.sub_mem · exact Subalgebra.pow_mem _ (self_mem_adjoin_singleton ℤ μ) _ · exact Subalgebra.one_mem _ · push_cast have := Nat.cast_add (R := R) m k ▸ hμ.prod_pow_sub_one_eq_order rw [← this, mul_assoc, mul_assoc] congr 1 conv => enter [2, 2, 2]; rw [← card_range k] rw [← prod_range_mul_prod_Ico _ (Nat.le_add_left k m), mul_comm _ (_ ^ #_), ← mul_assoc, prod_mul_pow_card] conv => enter [2, 1, 2, j]; rw [← (Zdef _).2]
lemma
RingTheory
[ "Mathlib.FieldTheory.KummerExtension" ]
Mathlib/RingTheory/RootsOfUnity/Lemmas.lean
self_sub_one_pow_dvd_order
If `μ` is a primitive `n`th root of unity in `R` and `k < n`, then `n` is divisible by `(μ-1)^k` in `ℤ[μ] ⊆ R`.
isIntegral (hpos : 0 < n) : IsIntegral ℤ μ := by use X ^ n - 1 constructor · exact monic_X_pow_sub_C 1 (ne_of_lt hpos).symm · simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, eval₂_one, eval₂_X_pow, eval₂_sub, sub_self]
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
isIntegral
`μ` is integral over `ℤ`.
minpoly_dvd_x_pow_sub_one : minpoly ℤ μ ∣ X ^ n - 1 := by rcases n.eq_zero_or_pos with (rfl | h0) · simp apply minpoly.isIntegrallyClosed_dvd (isIntegral h h0) simp only [((IsPrimitiveRoot.iff_def μ n).mp h).left, aeval_X_pow, aeval_one, map_sub, sub_self]
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_dvd_x_pow_sub_one
The minimal polynomial of a root of unity `μ` divides `X ^ n - 1`.
separable_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) : Separable (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) := by have hdvd : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ X ^ n - 1 := by convert _root_.map_dvd (mapRingHom (Int.castRingHom (ZMod p))) (minpoly_dvd_x_pow_sub_one h) simp only [map_sub, map_pow, coe_mapRingHom, map_X, map_one] refine Separable.of_dvd (separable_X_pow_sub_C 1 ?_ one_ne_zero) hdvd by_contra hzero exact hdiv ((ZMod.natCast_eq_zero_iff n p).1 hzero)
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
separable_minpoly_mod
The reduction modulo `p` of the minimal polynomial of a root of unity `μ` is separable.
squarefree_minpoly_mod {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) : Squarefree (map (Int.castRingHom (ZMod p)) (minpoly ℤ μ)) := (separable_minpoly_mod h hdiv).squarefree
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
squarefree_minpoly_mod
The reduction modulo `p` of the minimal polynomial of a root of unity `μ` is squarefree.
minpoly_dvd_expand {p : ℕ} (hdiv : ¬p ∣ n) : minpoly ℤ μ ∣ expand ℤ p (minpoly ℤ (μ ^ p)) := by rcases n.eq_zero_or_pos with (rfl | hpos) · simp_all letI : IsIntegrallyClosed ℤ := GCDMonoid.toIsIntegrallyClosed refine minpoly.isIntegrallyClosed_dvd (h.isIntegral hpos) ?_ rw [aeval_def, coe_expand, ← comp, eval₂_eq_eval_map, map_comp, Polynomial.map_pow, map_X, eval_comp, eval_pow, eval_X, ← eval₂_eq_eval_map, ← aeval_def] exact minpoly.aeval _ _
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_dvd_expand
Let `P` be the minimal polynomial of a root of unity `μ` and `Q` be the minimal polynomial of `μ ^ p`, where `p` is a natural number that does not divide `n`. Then `P` divides `expand ℤ p Q`.
minpoly_dvd_pow_mod {p : ℕ} [hprime : Fact p.Prime] (hdiv : ¬p ∣ n) : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ map (Int.castRingHom (ZMod p)) (minpoly ℤ (μ ^ p)) ^ p := by set Q := minpoly ℤ (μ ^ p) have hfrob : map (Int.castRingHom (ZMod p)) Q ^ p = map (Int.castRingHom (ZMod p)) (expand ℤ p Q) := by rw [← ZMod.expand_card, map_expand] rw [hfrob] apply _root_.map_dvd (mapRingHom (Int.castRingHom (ZMod p))) exact minpoly_dvd_expand h hdiv
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_dvd_pow_mod
Let `P` be the minimal polynomial of a root of unity `μ` and `Q` be the minimal polynomial of `μ ^ p`, where `p` is a prime that does not divide `n`. Then `P` divides `Q ^ p` modulo `p`.
minpoly_dvd_mod_p {p : ℕ} [Fact p.Prime] (hdiv : ¬p ∣ n) : map (Int.castRingHom (ZMod p)) (minpoly ℤ μ) ∣ map (Int.castRingHom (ZMod p)) (minpoly ℤ (μ ^ p)) := (squarefree_minpoly_mod h hdiv).isRadical _ _ (minpoly_dvd_pow_mod h hdiv)
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_dvd_mod_p
Let `P` be the minimal polynomial of a root of unity `μ` and `Q` be the minimal polynomial of `μ ^ p`, where `p` is a prime that does not divide `n`. Then `P` divides `Q` modulo `p`.
minpoly_eq_pow {p : ℕ} [hprime : Fact p.Prime] (hdiv : ¬p ∣ n) : minpoly ℤ μ = minpoly ℤ (μ ^ p) := by classical by_cases hn : n = 0 · simp_all have hpos := Nat.pos_of_ne_zero hn by_contra hdiff set P := minpoly ℤ μ set Q := minpoly ℤ (μ ^ p) have Pmonic : P.Monic := minpoly.monic (h.isIntegral hpos) have Qmonic : Q.Monic := minpoly.monic ((h.pow_of_prime hprime.1 hdiv).isIntegral hpos) have Pirr : Irreducible P := minpoly.irreducible (h.isIntegral hpos) have Qirr : Irreducible Q := minpoly.irreducible ((h.pow_of_prime hprime.1 hdiv).isIntegral hpos) have PQprim : IsPrimitive (P * Q) := Pmonic.isPrimitive.mul Qmonic.isPrimitive have prod : P * Q ∣ X ^ n - 1 := by rw [IsPrimitive.Int.dvd_iff_map_cast_dvd_map_cast (P * Q) (X ^ n - 1) PQprim (monic_X_pow_sub_C (1 : ℤ) (ne_of_gt hpos)).isPrimitive, Polynomial.map_mul] refine IsCoprime.mul_dvd ?_ ?_ ?_ · have aux := IsPrimitive.Int.irreducible_iff_irreducible_map_cast Pmonic.isPrimitive refine (dvd_or_isCoprime _ _ (aux.1 Pirr)).resolve_left ?_ rw [map_dvd_map (Int.castRingHom ℚ) Int.cast_injective Pmonic] intro hdiv refine hdiff (eq_of_monic_of_associated Pmonic Qmonic ?_) exact associated_of_dvd_dvd hdiv (Pirr.dvd_symm Qirr hdiv) · apply (map_dvd_map (Int.castRingHom ℚ) Int.cast_injective Pmonic).2 exact minpoly_dvd_x_pow_sub_one h · apply (map_dvd_map (Int.castRingHom ℚ) Int.cast_injective Qmonic).2 exact minpoly_dvd_x_pow_sub_one (pow_of_prime h hprime.1 hdiv) replace prod := _root_.map_dvd (mapRingHom (Int.castRingHom (ZMod p))) prod rw [coe_mapRingHom, Polynomial.map_mul, Polynomial.map_sub, Polynomial.map_one, Polynomial.map_pow, map_X] at prod obtain ⟨R, hR⟩ := minpoly_dvd_mod_p h hdiv rw [hR, ← mul_assoc, ← Polynomial.map_mul, ← sq, Polynomial.map_pow] at prod have habs : map (Int.castRingHom (ZMod p)) P ^ 2 ∣ map (Int.castRingHom (ZMod p)) P ^ 2 * R := by use R replace habs := lt_of_lt_of_le (Nat.cast_lt.2 one_lt_two) (le_emultiplicity_of_pow_dvd (dvd_trans habs prod)) have hfree : Squarefree (X ^ n - 1 : (ZMod p)[X]) := (separable_X_pow_sub_C 1 (fun h => hdiv <| (ZMod.natCast_eq_zero_iff n p).1 h) one_ne_zero).squarefree rcases (squarefree_iff_emultiplicity_le_one (X ^ n - 1)).1 hfree (map (Int.castRingHom (ZMod p)) P) with hle | hunit · rw [Nat.cast_one] at habs; exact hle.not_gt habs · replace hunit := degree_eq_zero_of_isUnit hunit rw [degree_map_eq_of_leadingCoeff_ne_zero (Int.castRingHom (ZMod p)) _] at hunit · exact (minpoly.degree_pos (isIntegral h hpos)).ne' hunit simp only [Pmonic, eq_intCast, Monic.leadingCoeff, Int.cast_one, Ne, not_false_iff, one_ne_zero]
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_eq_pow
If `p` is a prime that does not divide `n`, then the minimal polynomials of a primitive `n`-th root of unity `μ` and of `μ ^ p` are the same.
minpoly_eq_pow_coprime {m : ℕ} (hcop : Nat.Coprime m n) : minpoly ℤ μ = minpoly ℤ (μ ^ m) := by revert n hcop refine UniqueFactorizationMonoid.induction_on_prime m ?_ ?_ ?_ · intro h hn congr simpa [(Nat.coprime_zero_left _).mp hn] using h · intro u hunit _ _ congr simp [Nat.isUnit_iff.mp hunit] · intro a p _ hprime hind h hcop rw [hind h (Nat.Coprime.coprime_mul_left hcop)]; clear hind replace hprime := hprime.nat_prime have hdiv := (Nat.Prime.coprime_iff_not_dvd hprime).1 (Nat.Coprime.coprime_mul_right hcop) haveI := Fact.mk hprime rw [minpoly_eq_pow (h.pow_of_coprime a (Nat.Coprime.coprime_mul_left hcop)) hdiv] congr 1 ring
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
minpoly_eq_pow_coprime
If `m : ℕ` is coprime with `n`, then the minimal polynomials of a primitive `n`-th root of unity `μ` and of `μ ^ m` are the same.
pow_isRoot_minpoly {m : ℕ} (hcop : Nat.Coprime m n) : IsRoot (map (Int.castRingHom K) (minpoly ℤ μ)) (μ ^ m) := by simp only [minpoly_eq_pow_coprime h hcop, IsRoot.def, eval_map] exact minpoly.aeval ℤ (μ ^ m)
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
pow_isRoot_minpoly
If `m : ℕ` is coprime with `n`, then the minimal polynomial of a primitive `n`-th root of unity `μ` has `μ ^ m` as root.
is_roots_of_minpoly [DecidableEq K] : primitiveRoots n K ⊆ (map (Int.castRingHom K) (minpoly ℤ μ)).roots.toFinset := by by_cases hn : n = 0; · simp_all have : NeZero n := ⟨hn⟩ have hpos := Nat.pos_of_ne_zero hn intro x hx obtain ⟨m, _, hcop, rfl⟩ := (isPrimitiveRoot_iff h).1 ((mem_primitiveRoots hpos).1 hx) simp only [Multiset.mem_toFinset] convert pow_isRoot_minpoly h hcop using 0 rw [← mem_roots] exact map_monic_ne_zero <| minpoly.monic <| isIntegral h hpos
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
is_roots_of_minpoly
`primitiveRoots n K` is a subset of the roots of the minimal polynomial of a primitive `n`-th root of unity `μ`.
totient_le_degree_minpoly : Nat.totient n ≤ (minpoly ℤ μ).natDegree := by classical let P : ℤ[X] := minpoly ℤ μ let P_K : K[X] := map (Int.castRingHom K) P calc n.totient = (primitiveRoots n K).card := h.card_primitiveRoots.symm _ ≤ P_K.roots.toFinset.card := Finset.card_le_card (is_roots_of_minpoly h) _ ≤ Multiset.card P_K.roots := Multiset.toFinset_card_le _ _ ≤ P_K.natDegree := card_roots' _ _ ≤ P.natDegree := natDegree_map_le
theorem
RingTheory
[ "Mathlib.Algebra.GCDMonoid.IntegrallyClosed", "Mathlib.FieldTheory.Finite.Basic", "Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed", "Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots", "Mathlib.RingTheory.UniqueFactorizationDomain.Nat" ]
Mathlib/RingTheory/RootsOfUnity/Minpoly.lean
totient_le_degree_minpoly
The degree of the minimal polynomial of `μ` is at least `totient n`.
@[mk_iff IsPrimitiveRoot.iff_def] IsPrimitiveRoot (ζ : M) (k : ℕ) : Prop where pow_eq_one : ζ ^ k = 1 dvd_of_pow_eq_one : ∀ l : ℕ, ζ ^ l = 1 → k ∣ l
structure
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
IsPrimitiveRoot
An element `ζ` is a primitive `k`-th root of unity if `ζ ^ k = 1`, and if `l` satisfies `ζ ^ l = 1` then `k ∣ l`.
@[simps!] IsPrimitiveRoot.toRootsOfUnity {μ : M} {n : ℕ} [NeZero n] (h : IsPrimitiveRoot μ n) : rootsOfUnity n M := rootsOfUnity.mkOfPowEq μ h.pow_eq_one
def
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
IsPrimitiveRoot.toRootsOfUnity
Turn a primitive root μ into a member of the `rootsOfUnity` subgroup.
primitiveRoots (k : ℕ) (R : Type*) [CommRing R] [IsDomain R] : Finset R := {ζ ∈ (nthRoots k (1 : R)).toFinset | IsPrimitiveRoot ζ k} variable [CommRing R] [IsDomain R] @[simp]
def
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
primitiveRoots
`primitiveRoots k R` is the finset of primitive `k`-th roots of unity in the integral domain `R`.
mem_primitiveRoots {ζ : R} (h0 : 0 < k) : ζ ∈ primitiveRoots k R ↔ IsPrimitiveRoot ζ k := by classical rw [primitiveRoots, mem_filter, Multiset.mem_toFinset, mem_nthRoots h0, and_iff_right_iff_imp] exact IsPrimitiveRoot.pow_eq_one @[simp]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
mem_primitiveRoots
null
primitiveRoots_zero : primitiveRoots 0 R = ∅ := by classical rw [primitiveRoots, nthRoots_zero, Multiset.toFinset_zero, Finset.filter_empty]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
primitiveRoots_zero
null
isPrimitiveRoot_of_mem_primitiveRoots {ζ : R} (h : ζ ∈ primitiveRoots k R) : IsPrimitiveRoot ζ k := k.eq_zero_or_pos.elim (fun hk ↦ by simp [hk] at h) fun hk ↦ (mem_primitiveRoots hk).1 h
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
isPrimitiveRoot_of_mem_primitiveRoots
null
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
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
mk_of_lt
null
@[nontriviality] of_subsingleton [Subsingleton M] (x : M) : IsPrimitiveRoot x 1 := ⟨Subsingleton.elim _ _, fun _ _ ↦ one_dvd _⟩
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
of_subsingleton
null
pow_eq_one_iff_dvd (h : IsPrimitiveRoot ζ k) (l : ℕ) : ζ ^ l = 1 ↔ k ∣ l := ⟨h.dvd_of_pow_eq_one l, by rintro ⟨i, rfl⟩; simp only [pow_mul, h.pow_eq_one, one_pow]⟩
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_eq_one_iff_dvd
null
isUnit (h : IsPrimitiveRoot ζ k) (h0 : 0 < k) : IsUnit ζ := by apply isUnit_of_mul_eq_one ζ (ζ ^ (k - 1)) rw [← pow_succ', tsub_add_cancel_of_le h0.nat_succ_le, h.pow_eq_one]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
isUnit
null
pow_ne_one_of_pos_of_lt (h : IsPrimitiveRoot ζ k) (h0 : 0 < l) (hl : l < k) : ζ ^ l ≠ 1 := mt (Nat.le_of_dvd h0 ∘ h.dvd_of_pow_eq_one _) <| not_le_of_gt hl
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_ne_one_of_pos_of_lt
null
ne_one (h : IsPrimitiveRoot ζ k) (hk : 1 < k) : ζ ≠ 1 := h.pow_ne_one_of_pos_of_lt zero_lt_one hk ∘ (pow_one ζ).trans
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
ne_one
null
pow_inj (h : IsPrimitiveRoot ζ k) ⦃i j : ℕ⦄ (hi : i < k) (hj : j < k) (H : ζ ^ i = ζ ^ j) : i = j := by wlog hij : i ≤ j generalizing i j · exact (this hj hi H.symm (le_of_not_ge hij)).symm apply le_antisymm hij rw [← tsub_eq_zero_iff_le] apply Nat.eq_zero_of_dvd_of_lt _ (lt_of_le_of_lt tsub_le_self hj) apply h.dvd_of_pow_eq_one rw [← ((h.isUnit (lt_of_le_of_lt (Nat.zero_le _) hi)).pow i).mul_left_inj, ← pow_add, tsub_add_cancel_of_le hij, H, one_mul]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_inj
null
one : IsPrimitiveRoot (1 : M) 1 := { pow_eq_one := pow_one _ dvd_of_pow_eq_one := fun _ _ ↦ one_dvd _ } @[simp]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
one
null
one_right_iff : IsPrimitiveRoot ζ 1 ↔ ζ = 1 := by constructor · intro h; rw [← pow_one ζ, h.pow_eq_one] · rintro rfl; exact one @[simp]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
one_right_iff
null
coe_submonoidClass_iff {M B : Type*} [CommMonoid M] [SetLike B M] [SubmonoidClass B M] {N : B} {ζ : N} : IsPrimitiveRoot (ζ : M) k ↔ IsPrimitiveRoot ζ k := by simp_rw [iff_def] norm_cast @[simp]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
coe_submonoidClass_iff
null
coe_units_iff {ζ : Mˣ} : IsPrimitiveRoot (ζ : M) k ↔ IsPrimitiveRoot ζ k := by simp only [iff_def, Units.ext_iff, Units.val_pow_eq_pow_val, Units.val_one]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
coe_units_iff
null
isUnit_unit {ζ : M} {n} (hn) (hζ : IsPrimitiveRoot ζ n) : IsPrimitiveRoot (hζ.isUnit hn).unit n := coe_units_iff.mp hζ
lemma
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
isUnit_unit
null
isUnit_unit' {ζ : G} {n} (hn) (hζ : IsPrimitiveRoot ζ n) : IsPrimitiveRoot (hζ.isUnit hn).unit' n := coe_units_iff.mp hζ
lemma
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
isUnit_unit'
null
pow_of_coprime (h : IsPrimitiveRoot ζ k) (i : ℕ) (hi : i.Coprime k) : IsPrimitiveRoot (ζ ^ i) k := by by_cases h0 : k = 0 · subst k; simp_all only [pow_one, Nat.coprime_zero_right] rcases h.isUnit (Nat.pos_of_ne_zero h0) with ⟨ζ, rfl⟩ rw [← Units.val_pow_eq_pow_val] rw [coe_units_iff] at h ⊢ refine { pow_eq_one := by rw [← pow_mul', pow_mul, h.pow_eq_one, one_pow] dvd_of_pow_eq_one := fun l hl ↦ h.dvd_of_pow_eq_one l ?_ } rw [← pow_one ζ, ← zpow_natCast ζ, ← hi.gcd_eq_one, Nat.gcd_eq_gcd_ab, zpow_add, mul_pow, ← zpow_natCast, ← zpow_mul, mul_right_comm] simp only [zpow_mul, hl, h.pow_eq_one, one_zpow, one_pow, one_mul, zpow_natCast]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_of_coprime
null
pow_of_prime (h : IsPrimitiveRoot ζ k) {p : ℕ} (hprime : Nat.Prime p) (hdiv : ¬p ∣ k) : IsPrimitiveRoot (ζ ^ p) k := h.pow_of_coprime p (hprime.coprime_iff_not_dvd.2 hdiv)
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_of_prime
null
pow_iff_coprime (h : IsPrimitiveRoot ζ k) (h0 : 0 < k) (i : ℕ) : IsPrimitiveRoot (ζ ^ i) k ↔ i.Coprime k := by refine ⟨fun hi ↦ ?_, h.pow_of_coprime i⟩ obtain ⟨a, ha⟩ := i.gcd_dvd_left k obtain ⟨b, hb⟩ := i.gcd_dvd_right k suffices b = k by rwa [this, eq_comm, Nat.mul_eq_right h0.ne', ← Nat.coprime_iff_gcd_eq_one] at hb rw [ha] at hi rw [mul_comm] at hb apply Nat.dvd_antisymm ⟨i.gcd k, hb⟩ (hi.dvd_of_pow_eq_one b _) rw [← pow_mul', ← mul_assoc, ← hb, pow_mul, h.pow_eq_one, one_pow]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_iff_coprime
null
protected orderOf (ζ : M) : IsPrimitiveRoot ζ (orderOf ζ) := ⟨pow_orderOf_eq_one ζ, fun _ ↦ orderOf_dvd_of_pow_eq_one⟩
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
orderOf
null
unique {ζ : M} (hk : IsPrimitiveRoot ζ k) (hl : IsPrimitiveRoot ζ l) : k = l := Nat.dvd_antisymm (hk.2 _ hl.1) (hl.2 _ hk.1)
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
unique
null
eq_orderOf (h : IsPrimitiveRoot ζ k) : k = orderOf ζ := h.unique (IsPrimitiveRoot.orderOf ζ)
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
eq_orderOf
null
protected iff (hk : 0 < k) : IsPrimitiveRoot ζ k ↔ ζ ^ k = 1 ∧ ∀ l : ℕ, 0 < l → l < k → ζ ^ l ≠ 1 := by refine ⟨fun h ↦ ⟨h.pow_eq_one, fun l hl' hl ↦ ?_⟩, fun ⟨hζ, hl⟩ ↦ IsPrimitiveRoot.mk_of_lt ζ hk hζ hl⟩ rw [h.eq_orderOf] at hl exact pow_ne_one_of_lt_orderOf hl'.ne' hl
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
iff
null
protected not_iff : ¬IsPrimitiveRoot ζ k ↔ orderOf ζ ≠ k := ⟨fun h hk ↦ h <| hk ▸ IsPrimitiveRoot.orderOf ζ, fun h hk ↦ h.symm <| hk.unique <| IsPrimitiveRoot.orderOf ζ⟩
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
not_iff
null
protected iff_orderOf : IsPrimitiveRoot ζ k ↔ orderOf ζ = k := not_iff_not.mp IsPrimitiveRoot.not_iff
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
iff_orderOf
null
pow_mul_pow_lcm {ζ' : M} {k' : ℕ} (hζ : IsPrimitiveRoot ζ k) (hζ' : IsPrimitiveRoot ζ' k') (hk : k ≠ 0) (hk' : k' ≠ 0) : IsPrimitiveRoot (ζ ^ (k / Nat.factorizationLCMLeft k k') * ζ' ^ (k' / Nat.factorizationLCMRight k k')) (Nat.lcm k k') := by convert IsPrimitiveRoot.orderOf _ convert ((Commute.all ζ ζ').orderOf_mul_pow_eq_lcm (by simpa [← hζ.eq_orderOf]) (by simpa [← hζ'.eq_orderOf])).symm using 2 all_goals simp [hζ.eq_orderOf, hζ'.eq_orderOf]
theorem
RingTheory
[ "Mathlib.Data.Nat.Factorization.LCM", "Mathlib.Algebra.Group.TypeTags.Finite", "Mathlib.RingTheory.RootsOfUnity.Basic" ]
Mathlib/RingTheory/RootsOfUnity/PrimitiveRoots.lean
pow_mul_pow_lcm
null