Skip to content

Commit cb5b0e5

Browse files
feat: add Mathlib.RingTheory.RootsOfUnity.CyclotomicUnits (leanprover-community#30085)
We add basic results about cyclotomic units. From `flt-regular`.
1 parent a38ceed commit cb5b0e5

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5905,6 +5905,7 @@ import Mathlib.RingTheory.RingInvo
59055905
import Mathlib.RingTheory.RootsOfUnity.AlgebraicallyClosed
59065906
import Mathlib.RingTheory.RootsOfUnity.Basic
59075907
import Mathlib.RingTheory.RootsOfUnity.Complex
5908+
import Mathlib.RingTheory.RootsOfUnity.CyclotomicUnits
59085909
import Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity
59095910
import Mathlib.RingTheory.RootsOfUnity.Lemmas
59105911
import Mathlib.RingTheory.RootsOfUnity.Minpoly
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/-
2+
Copyright (c) 2021 Alex J. Best. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Alex J. Best, Riccardo Brasca
5+
-/
6+
import Mathlib.RingTheory.RootsOfUnity.PrimitiveRoots
7+
8+
/-!
9+
# Cyclotomic units.
10+
11+
We gather miscellaneous results about units given by sums of powers of roots of unit, the so-called
12+
*cyclotomic units*.
13+
14+
15+
## Main results
16+
17+
* `IsPrimitiveRoot.associated_sub_one_pow_sub_one_of_coprime` : given an `n`-th primitive root of
18+
unity `ζ`, we have that `ζ - 1` and `ζ ^ j - 1` are associated for all `j` coprime with `n`.
19+
* `IsPrimitiveRoot.associated_pow_sub_one_pow_of_coprime` : given an `n`-th primitive root of unity
20+
`ζ`, we have that `ζ ^ i - 1` and `ζ ^ j - 1` are associated for all `i` and `j` coprime with `n`.
21+
* `IsPrimitiveRoot.associated_pow_add_sub_sub_one` : given an `n`-th primitive root of unity `ζ`,
22+
where `2 ≤ n`, we have that `ζ - 1` and `ζ ^ (i + j) - ζ ^ i` are associated for all and `j`
23+
coprime with `n` and all `i`.
24+
25+
## Implementation details
26+
27+
We sometimes state series of results of the form `a = u * b`, `IsUnit u` and `Associated a b`.
28+
Often, `Associated a b` is everything one needs, and it is more convenient to use, we include the
29+
other version for completeness.
30+
-/
31+
32+
open Polynomial Finset Nat
33+
34+
variable {n i j p : ℕ} {A K : Type*} {ζ : A}
35+
36+
variable [CommRing A] [IsDomain A]
37+
38+
namespace IsPrimitiveRoot
39+
40+
/-- Given an `n`-th primitive root of unity `ζ,` we have that `ζ - 1` and `ζ ^ j - 1` are associated
41+
for all `j` coprime with `n`.
42+
`pow_sub_one_mul_geom_sum_eq_pow_sub_one_mul_geom_sum` gives an explicit formula for the unit. -/
43+
theorem associated_sub_one_pow_sub_one_of_coprime (hζ : IsPrimitiveRoot ζ n) (hj : j.Coprime n) :
44+
Associated (ζ - 1) (ζ ^ j - 1) := by
45+
refine associated_of_dvd_dvd ⟨∑ i ∈ range j, ζ ^ i, (mul_geom_sum _ _).symm⟩ ?_
46+
match n with
47+
| 0 => simp_all
48+
| 1 => simp_all
49+
| n + 2 =>
50+
obtain ⟨m, hm⟩ := exists_mul_emod_eq_one_of_coprime hj (by omega)
51+
use ∑ i ∈ range m, (ζ ^ j) ^ i
52+
rw [mul_geom_sum, ← pow_mul, ← pow_mod_orderOf, ← hζ.eq_orderOf, hm, pow_one]
53+
54+
/-- Given an `n`-th primitive root of unity `ζ`, we have that `ζ ^ j - 1` and `ζ ^ i - 1` are
55+
associated for all `i` and `j` coprime with `n`. -/
56+
theorem associated_pow_sub_one_pow_of_coprime (hζ : IsPrimitiveRoot ζ n)
57+
(hi : i.Coprime n) (hj : j.Coprime n) : Associated (ζ ^ j - 1) (ζ ^ i - 1) := by
58+
suffices ∀ {j}, (j.Coprime n) → Associated (ζ - 1) (ζ ^ j - 1) by
59+
grind [Associated.trans, Associated.symm]
60+
exact hζ.associated_sub_one_pow_sub_one_of_coprime
61+
62+
/-- Given an `n`-th primitive root of unity `ζ`, where `2 ≤ n`, we have that `∑ i ∈ range j, ζ ^ i`
63+
is a unit for all `j` coprime with `n`. This is the unit given by
64+
`associated_pow_sub_one_pow_of_coprime` (see
65+
`pow_sub_one_mul_geom_sum_eq_pow_sub_one_mul_geom_sum`). -/
66+
theorem geom_sum_isUnit (hζ : IsPrimitiveRoot ζ n) (hn : 2 ≤ n) (hj : j.Coprime n) :
67+
IsUnit (∑ i ∈ range j, ζ ^ i) := by
68+
obtain ⟨u, hu⟩ := hζ.associated_pow_sub_one_pow_of_coprime hj (coprime_one_left n)
69+
convert u.isUnit
70+
apply mul_right_injective₀ (show 1 - ζ ≠ 0 by grind [sub_one_ne_zero])
71+
grind [mul_neg_geom_sum]
72+
73+
/-- Similar to `geom_sum_isUnit`, but instead of assuming `2 ≤ n` we assume that `j` is a unit in
74+
`A`. -/
75+
theorem geom_sum_isUnit' (hζ : IsPrimitiveRoot ζ n) (hj : j.Coprime n) (hj_Unit : IsUnit (j : A)) :
76+
IsUnit (∑ i ∈ range j, ζ ^ i) := by
77+
match n with
78+
| 0 => simp_all
79+
| 1 => simp_all
80+
| n + 2 => exact geom_sum_isUnit hζ (by linarith) hj
81+
82+
/-- The explicit formula for the unit whose existence is the content of
83+
`associated_pow_sub_one_pow_of_coprime`. -/
84+
theorem pow_sub_one_mul_geom_sum_eq_pow_sub_one_mul_geom_sum (hζ : IsPrimitiveRoot ζ n)
85+
(hn : 2 ≤ n) : (ζ ^ j - 1) * ∑ k ∈ range i, ζ ^ k = (ζ ^ i - 1) * ∑ k ∈ range j, ζ ^ k := by
86+
apply mul_left_injective₀ (hζ.sub_one_ne_zero (by omega))
87+
grind [geom_sum_mul]
88+
89+
theorem pow_sub_one_eq_geom_sum_mul_geom_sum_inv_mul_pow_sub_one (hζ : IsPrimitiveRoot ζ n)
90+
(hn : 2 ≤ n) (hi : i.Coprime n) (hj : j.Coprime n) : (ζ ^ j - 1) =
91+
(hζ.geom_sum_isUnit hn hj).unit * (hζ.geom_sum_isUnit hn hi).unit⁻¹ * (ζ ^ i - 1) := by
92+
grind [IsUnit.mul_val_inv, pow_sub_one_mul_geom_sum_eq_pow_sub_one_mul_geom_sum, IsUnit.unit_spec]
93+
94+
/-- Given an `n`-th primitive root of unity `ζ`, where `2 ≤ n`, we have that `ζ - 1` and
95+
`ζ ^ (i + j) - ζ ^ i` are associated for all and `j` coprime with `n` and all `i`. See
96+
`pow_sub_one_eq_geom_sum_mul_geom_sum_inv_mul_pow_sub_one` for the explicit formula of the
97+
unit. -/
98+
theorem associated_pow_add_sub_sub_one (hζ : IsPrimitiveRoot ζ n) (hn : 2 ≤ n) (i : ℕ)
99+
(hjn : j.Coprime n) : Associated (ζ - 1) (ζ ^ (i + j) - ζ ^ i) := by
100+
use (hζ.isUnit (by omega)).unit ^ i * (hζ.geom_sum_isUnit hn hjn).unit
101+
suffices (ζ - 1) * ζ ^ i * ∑ i ∈ range j, ζ ^ i = (ζ ^ (i + j) - ζ ^ i) by
102+
simp [← this, mul_assoc]
103+
grind [mul_geom_sum]
104+
105+
/-- If `p` is prime and `ζ` is a `p`-th primitive root of unit, then `ζ - 1` and `η₁ - η₂` are
106+
associated for all distincts `p`-th root of unit `η₁` and `η₂`. -/
107+
lemma ntRootsFinset_pairwise_associated_sub_one_sub_of_prime (hζ : IsPrimitiveRoot ζ p)
108+
(hp : p.Prime) : Set.Pairwise
109+
(nthRootsFinset p (1 : A)) (fun η₁ η₂ ↦ Associated (ζ - 1) (η₁ - η₂)) := by
110+
intro η₁ hη₁ η₂ hη₂ e
111+
have : NeZero p := ⟨hp.ne_zero⟩
112+
obtain ⟨i, hi, rfl⟩ :=
113+
hζ.eq_pow_of_pow_eq_one ((Polynomial.mem_nthRootsFinset hp.pos 1).1 hη₁)
114+
obtain ⟨j, hj, rfl⟩ :=
115+
hζ.eq_pow_of_pow_eq_one ((Polynomial.mem_nthRootsFinset hp.pos 1).1 hη₂)
116+
wlog hij : j ≤ i
117+
· simpa using (this hζ ‹_› ‹_› _ hj ‹_› _ hi ‹_› e.symm (by omega)).neg_right
118+
have H : (i - j).Coprime p := (coprime_of_lt_prime (by grind) (by grind) hp).symm
119+
obtain ⟨u, h⟩ := hζ.associated_pow_add_sub_sub_one hp.two_le j H
120+
simp only [hij, add_tsub_cancel_of_le] at h
121+
rw [← h, associated_mul_unit_right_iff]
122+
123+
end IsPrimitiveRoot

0 commit comments

Comments
 (0)