Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: characterize roots of unity in cyclotomic extensions #10710

Closed
wants to merge 97 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
0b6b8e5
add totient_le_one_dvd_two
riccardobrasca Feb 18, 2024
3494373
add _root_.IsPrimitiveRoot.lcm_totient_le_finrank
riccardobrasca Feb 18, 2024
1d02e3b
implicit variable
riccardobrasca Feb 19, 2024
def4d7b
add IsPrimitiveRoot._dvd_of_isCyclotomicExtension
riccardobrasca Feb 19, 2024
f1088ca
name
riccardobrasca Feb 19, 2024
1c78183
make n explicit
riccardobrasca Feb 19, 2024
96344d8
add _root_.IsPrimitiveRoot.exists_neg_pow_mul_pow_of_pow_eq_one
riccardobrasca Feb 19, 2024
7abcfcd
add doc
riccardobrasca Feb 19, 2024
ac6a98b
fix doc
riccardobrasca Feb 19, 2024
c08aee2
Update Mathlib/Data/Nat/Totient.lean
riccardobrasca Feb 19, 2024
fe52dab
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Feb 19, 2024
613f6a6
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Feb 19, 2024
e1f833f
fix build
riccardobrasca Feb 19, 2024
279ead4
golf
riccardobrasca Feb 19, 2024
daa19f0
minigolf
riccardobrasca Feb 19, 2024
1d4e778
Update Mathlib/Data/Nat/Totient.lean
riccardobrasca Mar 3, 2024
bb17b9b
IsCyclic.exists_ofOrder_eq_natCard
riccardobrasca Mar 3, 2024
864af71
better
riccardobrasca Mar 3, 2024
8e1e6e9
golf
riccardobrasca Mar 3, 2024
0990214
golf
riccardobrasca Mar 4, 2024
c41cd21
Merge remote-tracking branch 'origin/master' into RB/cycl_ex
riccardobrasca Mar 4, 2024
05b056b
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 4, 2024
1bf4484
add IsPrimitiveRoot.exists_pow_or_neg_mul_pow_of_pow_eq_one
riccardobrasca Mar 4, 2024
63023ba
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 4, 2024
71aa862
add factorization_lcm_left and factorization_lcm_right
riccardobrasca Mar 8, 2024
7861e9c
add factorization_lcm_left_ne_zero
riccardobrasca Mar 8, 2024
ea3fa27
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 8, 2024
7c57c7c
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 8, 2024
94c9655
start of _root_.Commute.orderOf_mul_pow_eq_lcm
riccardobrasca Mar 8, 2024
81ee12e
better
riccardobrasca Mar 8, 2024
c5cb3de
better
riccardobrasca Mar 8, 2024
1f79c40
add _root_.Commute.orderOf_mul_pow_eq_lcm
riccardobrasca Mar 8, 2024
fc5a1bd
doc
riccardobrasca Mar 8, 2024
6ae3c53
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 8, 2024
cf08508
better
riccardobrasca Mar 8, 2024
4ec6d53
better
riccardobrasca Mar 8, 2024
8d47508
add pow_mul_pow_lcm
riccardobrasca Mar 8, 2024
a531198
Update Mathlib/RingTheory/RootsOfUnity/Basic.lean
riccardobrasca Mar 8, 2024
4ba922c
golf
riccardobrasca Mar 8, 2024
99e67f8
fix doc
riccardobrasca Mar 8, 2024
69a5446
indendation
riccardobrasca Mar 8, 2024
d64a3bb
use 0 <
riccardobrasca Mar 8, 2024
b79c901
fix build
riccardobrasca Mar 8, 2024
78db2fb
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 8, 2024
4690978
move declaration
riccardobrasca Mar 8, 2024
6c281ce
add to_additive
riccardobrasca Mar 8, 2024
b4dfb46
add _root_.Commute.exists_orderOf_eq_lcm
riccardobrasca Mar 8, 2024
d8a47cd
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 8, 2024
998e078
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 8, 2024
351a918
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 8, 2024
dec70ee
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 8, 2024
500f2c3
fix build
riccardobrasca Mar 8, 2024
95dc9f5
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 8, 2024
93009d4
add div_gcd_mul_div_gcd_eq_mul
riccardobrasca Mar 8, 2024
106eed9
add orderOf_pow_orderOf_div
riccardobrasca Mar 8, 2024
69e95c2
Update Mathlib/Data/Nat/GCD/Basic.lean
riccardobrasca Mar 8, 2024
812e241
golf
riccardobrasca Mar 8, 2024
6e850dd
useless
riccardobrasca Mar 8, 2024
05b6cfe
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 8, 2024
91bb29f
clarify doc
riccardobrasca Mar 11, 2024
8fe737a
typo
riccardobrasca Mar 11, 2024
186acbd
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 11, 2024
ec0d295
better indentation
riccardobrasca Mar 11, 2024
2bcccd9
ops
riccardobrasca Mar 11, 2024
c6b9954
names
riccardobrasca Mar 11, 2024
6ea43b0
fix build
riccardobrasca Mar 11, 2024
d861621
Merge branch 'RB/lcm' into RB/cycl_ex
riccardobrasca Mar 11, 2024
ba9977e
fix build
riccardobrasca Mar 11, 2024
8a4a0e8
Merge branch 'master' into RB/cycl_ex
riccardobrasca Mar 11, 2024
c146973
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 11, 2024
22b929b
Update Mathlib/Data/Nat/Factorization/Basic.lean
riccardobrasca Mar 11, 2024
e08e64e
better name
riccardobrasca Mar 11, 2024
e009a5a
Update Mathlib/GroupTheory/Exponent.lean
riccardobrasca Mar 11, 2024
7a9b4ae
add trivialities
riccardobrasca Mar 11, 2024
0934e0c
better theorem
riccardobrasca Mar 11, 2024
892c4c0
fix build
riccardobrasca Mar 11, 2024
a247a5b
Merge remote-tracking branch 'origin/master' into RB/cycl_ex
riccardobrasca Mar 11, 2024
01cc420
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 11, 2024
45bf28d
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 11, 2024
8db621d
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 11, 2024
8c72a6b
long line
riccardobrasca Mar 11, 2024
e41a49d
again long line
riccardobrasca Mar 11, 2024
7b6e348
golf
riccardobrasca Mar 13, 2024
8427931
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 13, 2024
a9f3aed
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 13, 2024
fe9386f
Update Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
riccardobrasca Mar 13, 2024
528a60b
Update Mathlib/RingTheory/RootsOfUnity/Basic.lean
riccardobrasca Mar 13, 2024
539365d
better
riccardobrasca Mar 13, 2024
a427b85
better name
riccardobrasca Mar 13, 2024
55e11ed
fix build
riccardobrasca Mar 13, 2024
abae7d6
better
riccardobrasca Mar 13, 2024
823b5ae
move stuff
riccardobrasca Mar 13, 2024
0e63ef6
add IsCyclic.iff_exists_ofOrder_eq_natCard_of_Fintype
riccardobrasca Mar 14, 2024
f892c7e
fix doc
riccardobrasca Mar 14, 2024
bde57c3
use isOfFinOrder
riccardobrasca Mar 14, 2024
e993311
long line
riccardobrasca Mar 14, 2024
961768f
Merge remote-tracking branch 'origin/master' into RB/cycl_ex
riccardobrasca Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Mathlib/Data/Nat/Totient.lean
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ theorem totient_eq_one_iff : ∀ {n : ℕ}, n.totient = 1 ↔ n = 1 ∨ n = 2
exact ⟨fun h => not_even_one.elim <| h ▸ totient_even this, by rintro ⟨⟩⟩
#align nat.totient_eq_one_iff Nat.totient_eq_one_iff

theorem totient_le_one_dvd_two {a : ℕ} (han : 0 < a) (ha : a.totient ≤ 1) : a ∣ 2 := by
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
have : a.totient = 1 := by linarith [Nat.totient_pos han]
cases' Nat.totient_eq_one_iff.1 this with h h <;> simp [h]
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved

/-! ### Euler's product formula for the totient function

We prove several different statements of this formula. -/
Expand Down
95 changes: 95 additions & 0 deletions Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,101 @@ theorem finrank (hirr : Irreducible (cyclotomic n K)) : finrank K L = (n : ℕ).
(zeta_spec n K L).minpoly_eq_cyclotomic_of_irreducible hirr, natDegree_cyclotomic]
#align is_cyclotomic_extension.finrank IsCyclotomicExtension.finrank

variable {L} in
/-- If `L` contains both a primitive `p`-th root of unity and `q`-th root of unity, and
`Irreducible (cyclotomic (lcm p q) K)` (in particular for `K = ℚ`), then the `finrank K L` is at
least `(lcm p q).totient`. -/
theorem _root_.IsPrimitiveRoot.lcm_totient_le_finrank [FiniteDimensional K L] {p q : ℕ} {x y : L}
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
(hx : IsPrimitiveRoot x p) (hy : IsPrimitiveRoot y q)
(hirr : Irreducible (cyclotomic (Nat.lcm p q) K)) :
(Nat.lcm p q).totient ≤ FiniteDimensional.finrank K L := by
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
rcases Nat.eq_zero_or_pos p with (rfl | hppos)
· simp
rcases Nat.eq_zero_or_pos q with (rfl | hqpos)
· simp
let k := PNat.lcm ⟨p, hppos⟩ ⟨q, hqpos⟩
obtain ⟨xu, rfl⟩ := hx.isUnit hppos
let yu := (hy.isUnit hqpos).unit
have hxmem : xu ∈ rootsOfUnity k L := by
rw [mem_rootsOfUnity, ← Units.val_eq_one, Units.val_pow_eq_pow_val]
exact (hx.pow_eq_one_iff_dvd _).2 (Nat.dvd_lcm_left _ _)
have hymem : yu ∈ rootsOfUnity k L := by
rw [mem_rootsOfUnity, ← Units.val_eq_one, Units.val_pow_eq_pow_val, IsUnit.unit_spec]
exact (hy.pow_eq_one_iff_dvd _).2 (Nat.dvd_lcm_right _ _)
have hxuord : orderOf (⟨xu, hxmem⟩ : rootsOfUnity k L) = p := by
rw [← orderOf_injective (rootsOfUnity k L).subtype Subtype.coe_injective,
Subgroup.coeSubtype, Subgroup.coe_mk, ← orderOf_units]
exact hx.eq_orderOf.symm
have hyuord : orderOf (⟨yu, hymem⟩ : rootsOfUnity k L) = q := by
rw [← orderOf_injective (rootsOfUnity k L).subtype Subtype.coe_injective,
Subgroup.coeSubtype, Subgroup.coe_mk, ← orderOf_units, IsUnit.unit_spec]
exact hy.eq_orderOf.symm
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
obtain ⟨g : rootsOfUnity k L, hg⟩ := IsCyclic.exists_monoid_generator (α := rootsOfUnity k L)
obtain ⟨nx, hnx⟩ := hg ⟨xu, hxmem⟩
obtain ⟨ny, hny⟩ := hg ⟨yu, hymem⟩
have H : orderOf g = k := by
MichaelStollBayreuth marked this conversation as resolved.
Show resolved Hide resolved
refine' Nat.dvd_antisymm (orderOf_dvd_of_pow_eq_one _) (Nat.lcm_dvd _ _)
· have := (mem_rootsOfUnity _ _).1 g.2
simp only [PNat.mk_coe] at this
exact_mod_cast this
· simp_rw [← hxuord, ← hnx, orderOf_pow]
exact Nat.div_dvd_of_dvd ((orderOf g).gcd_dvd_left nx)
· simp_rw [← hyuord, ← hny, orderOf_pow]
exact Nat.div_dvd_of_dvd ((orderOf g).gcd_dvd_left ny)
have hroot := IsPrimitiveRoot.orderOf g
rw [H, ← IsPrimitiveRoot.coe_submonoidClass_iff, ← IsPrimitiveRoot.coe_units_iff] at hroot
haveI := IsPrimitiveRoot.adjoin_isCyclotomicExtension K hroot
convert Submodule.finrank_le (Subalgebra.toSubmodule (Algebra.adjoin K ({g.1.1} : Set L)))
replace hirr : Irreducible (cyclotomic k K) := hirr
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
simpa using (IsCyclotomicExtension.finrank (Algebra.adjoin K ({g.1.1} : Set L)) hirr).symm

variable (n) in
/-- If a `n`-th cyclotomic extension of `ℚ` contains a primitive `l`-th root of unity, then
`l ∣ 2 * n`. -/
theorem _root_.IsPrimitiveRoot.dvd_of_isCyclotomicExtension [NumberField K]
[IsCyclotomicExtension {n} ℚ K] {ζ : K} {l : ℕ} (hζ : IsPrimitiveRoot ζ l) (hl : l ≠ 0) :
l ∣ 2 * n := by
have hl : NeZero l := ⟨hl⟩
have hroot := IsCyclotomicExtension.zeta_spec n ℚ K
have key := IsPrimitiveRoot.lcm_totient_le_finrank hζ hroot (cyclotomic.irreducible_rat
<| Nat.lcm_pos (Nat.pos_of_ne_zero hl.1) n.2)
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
rw [IsCyclotomicExtension.finrank K (cyclotomic.irreducible_rat n.2)] at key
rcases _root_.dvd_lcm_right l n with ⟨r, hr⟩
have ineq := Nat.totient_super_multiplicative n r
rw [← hr] at ineq
replace key := (mul_le_iff_le_one_right (Nat.totient_pos n.2)).mp (le_trans ineq key)
have rpos : 0 < r := by
refine Nat.pos_of_ne_zero (fun h ↦ ?_)
simp only [h, mul_zero, _root_.lcm_eq_zero_iff, PNat.ne_zero, or_false] at hr
exact hl.1 hr
replace key := (Nat.dvd_prime Nat.prime_two).1 (Nat.totient_le_one_dvd_two rpos key)
rcases key with (key | key)
· rw [key, mul_one] at hr
rw [← hr]
exact dvd_mul_of_dvd_right (_root_.dvd_lcm_left l ↑n) 2
· rw [key, mul_comm] at hr
simpa [← hr] using _root_.dvd_lcm_left _ _

/-- If `x` is a `k`-th root of unity in an `n`-th cyclotomic extension, where `n` is odd, and `ζ`
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
is a primitive `n`-th root of unity, then there exist `r` such that `x = (-1)^r * ζ^r`. -/
theorem _root_.IsPrimitiveRoot.exists_neg_pow_mul_pow_of_pow_eq_one [NumberField K]
[IsCyclotomicExtension {n} ℚ K] (hno : Odd (n : ℕ)) {ζ x : K} {k : ℕ+}
(hζ : IsPrimitiveRoot ζ n) (hx : x ^ (k : ℕ) = 1) : ∃ (r : ℕ), x = (-1) ^ r * ζ ^ r := by
riccardobrasca marked this conversation as resolved.
Show resolved Hide resolved
have hnegζ : IsPrimitiveRoot (-ζ) (2 * n) := by
convert IsPrimitiveRoot.orderOf (-ζ)
rw [neg_eq_neg_one_mul, (Commute.all _ _).orderOf_mul_eq_mul_orderOf_of_coprime]
· simp [hζ.eq_orderOf]
· simp [← hζ.eq_orderOf, Nat.odd_iff_not_even.1 hno]
obtain ⟨l, hl, hlroot⟩ := (isRoot_of_unity_iff k.2 _).1 hx
have hlzero : NeZero l := ⟨fun h ↦ by simp [h] at hl⟩
have : NeZero (l : K) := ⟨NeZero.natCast_ne l K⟩
rw [isRoot_cyclotomic_iff] at hlroot
obtain ⟨a, ha⟩ := hlroot.dvd_of_isCyclotomicExtension n hlzero.1
replace hlroot : x ^ (2 * (n : ℕ)) = 1 := by rw [ha, pow_mul, hlroot.pow_eq_one, one_pow]
obtain ⟨s, -, hs⟩ := hnegζ.eq_pow_of_pow_eq_one hlroot (by simp)
rw [neg_pow] at hs
exact ⟨s, hs.symm⟩

end IsCyclotomicExtension

end NoOrder
Expand Down