-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger CI for leanprover-community/batteries#1028
- Loading branch information
Showing
13 changed files
with
185 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/- | ||
Copyright (c) 2024 Michael Stoll. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Michael Stoll | ||
-/ | ||
import Mathlib.GroupTheory.FiniteAbelian.Basic | ||
import Mathlib.RingTheory.RootsOfUnity.EnoughRootsOfUnity | ||
|
||
/-! | ||
# Duality for finite abelian groups | ||
Let `G` be a finite abelian group and let `M` be a commutative monoid that has enough `n`th roots | ||
of unity, where `n` is the exponent of `G`. The main results in this file are | ||
* `CommGroup.exists_apply_ne_one_of_hasEnoughRootsOfUnity`: Homomorphisms `G →* Mˣ` separate | ||
elements of `G`. | ||
* `CommGroup.monoidHom_mulEquiv_self_of_hasEnoughRootsOfUnity`: `G` is isomorphic to `G →* Mˣ`. | ||
-/ | ||
|
||
namespace CommGroup | ||
|
||
open MonoidHom | ||
|
||
private | ||
lemma dvd_exponent {ι G : Type*} [Finite ι] [CommGroup G] {n : ι → ℕ} | ||
(e : G ≃* ((i : ι) → Multiplicative (ZMod (n i)))) (i : ι) : | ||
n i ∣ Monoid.exponent G := by | ||
classical -- to get `DecidableEq ι` | ||
have : n i = orderOf (e.symm <| Pi.mulSingle i <| .ofAdd 1) := by | ||
simpa only [MulEquiv.orderOf_eq, orderOf_piMulSingle, orderOf_ofAdd_eq_addOrderOf] | ||
using (ZMod.addOrderOf_one (n i)).symm | ||
exact this ▸ Monoid.order_dvd_exponent _ | ||
|
||
variable (G M : Type*) [CommGroup G] [Finite G] [CommMonoid M] | ||
|
||
private | ||
lemma exists_apply_ne_one_aux (H : ∀ n : ℕ, n ∣ Monoid.exponent G → ∀ a : ZMod n, a ≠ 0 → | ||
∃ φ : Multiplicative (ZMod n) →* M, φ (.ofAdd a) ≠ 1) | ||
{a : G} (ha : a ≠ 1) : | ||
∃ φ : G →* M, φ a ≠ 1 := by | ||
obtain ⟨ι, _, n, _, h⟩ := CommGroup.equiv_prod_multiplicative_zmod_of_finite G | ||
let e := h.some | ||
obtain ⟨i, hi⟩ : ∃ i : ι, e a i ≠ 1 := by | ||
contrapose! ha | ||
exact (MulEquiv.map_eq_one_iff e).mp <| funext ha | ||
have hi : Multiplicative.toAdd (e a i) ≠ 0 := by | ||
simp only [ne_eq, toAdd_eq_zero, hi, not_false_eq_true] | ||
obtain ⟨φi, hφi⟩ := H (n i) (dvd_exponent e i) (Multiplicative.toAdd <| e a i) hi | ||
use (φi.comp (Pi.evalMonoidHom (fun (i : ι) ↦ Multiplicative (ZMod (n i))) i)).comp e | ||
simpa only [coe_comp, coe_coe, Function.comp_apply, Pi.evalMonoidHom_apply, ne_eq] using hφi | ||
|
||
variable [HasEnoughRootsOfUnity M (Monoid.exponent G)] | ||
|
||
/-- If `G` is a finite commutative group of exponent `n` and `M` is a commutative monoid | ||
with enough `n`th roots of unity, then for each `a ≠ 1` in `G`, there exists a | ||
group homomorphism `φ : G → Mˣ` such that `φ a ≠ 1`. -/ | ||
theorem exists_apply_ne_one_of_hasEnoughRootsOfUnity {a : G} (ha : a ≠ 1) : | ||
∃ φ : G →* Mˣ, φ a ≠ 1 := by | ||
refine exists_apply_ne_one_aux G Mˣ (fun n hn a ha₀ ↦ ?_) ha | ||
have : NeZero n := ⟨fun H ↦ NeZero.ne _ <| Nat.eq_zero_of_zero_dvd (H ▸ hn)⟩ | ||
have := HasEnoughRootsOfUnity.of_dvd M hn | ||
exact ZMod.exists_monoidHom_apply_ne_one (HasEnoughRootsOfUnity.exists_primitiveRoot M n) ha₀ | ||
|
||
/-- A finite commutative group `G` is (noncanonically) isomorphic to the group `G →* Mˣ` | ||
when `M` is a commutative monoid with enough `n`th roots of unity, where `n` is the exponent | ||
of `G`. -/ | ||
theorem mulEquiv_monoidHom_of_hasEnoughRootsOfUnity : Nonempty (G ≃* (G →* Mˣ)) := by | ||
classical -- to get `DecidableEq ι` | ||
obtain ⟨ι, _, n, ⟨h₁, h₂⟩⟩ := equiv_prod_multiplicative_zmod_of_finite G | ||
let e := h₂.some | ||
let e' := Pi.monoidHomMulEquiv (fun i ↦ Multiplicative (ZMod (n i))) Mˣ | ||
let e'' := MulEquiv.monoidHomCongr e (.refl Mˣ) | ||
have : ∀ i, NeZero (n i) := fun i ↦ NeZero.of_gt (h₁ i) | ||
have inst i : HasEnoughRootsOfUnity M <| Nat.card <| Multiplicative <| ZMod (n i) := by | ||
have hdvd : Nat.card (Multiplicative (ZMod (n i))) ∣ Monoid.exponent G := by | ||
simpa only [Nat.card_eq_fintype_card, Fintype.card_multiplicative, ZMod.card] | ||
using dvd_exponent e i | ||
exact HasEnoughRootsOfUnity.of_dvd M hdvd | ||
let E i := (IsCyclic.monoidHom_equiv_self (Multiplicative (ZMod (n i))) M).some | ||
exact ⟨e.trans (MulEquiv.piCongrRight E).symm|>.trans e'.symm|>.trans e''.symm⟩ | ||
|
||
end CommGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/- | ||
Copyright (c) 2018 Chris Hughes. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Anne Baanen | ||
-/ | ||
import Mathlib.RingTheory.Ideal.Colon | ||
import Mathlib.RingTheory.PrincipalIdealDomain | ||
|
||
/-! | ||
# Principal ideal domains and prime ideals | ||
# Main results | ||
- `IsPrincipalIdeal.of_prime`: a ring where all prime ideals are principal is a principal ideal ring | ||
-/ | ||
|
||
open Ideal | ||
|
||
variable {R : Type*} [CommRing R] | ||
|
||
/-- If all prime ideals in a commutative ring are principal, so are all other ideals. -/ | ||
theorem IsPrincipalIdealRing.of_prime (H : ∀ P : Ideal R, P.IsPrime → P.IsPrincipal) : | ||
IsPrincipalIdealRing R := by | ||
-- Suppose the set of `nonPrincipals` is not empty. | ||
rw [← nonPrincipals_eq_empty_iff, Set.eq_empty_iff_forall_not_mem] | ||
intro J hJ | ||
-- We will show a maximal element `I ∈ nonPrincipals R` (which exists by Zorn) is prime. | ||
obtain ⟨I, hJI, hI⟩ := zorn_le_nonempty₀ (nonPrincipals R) nonPrincipals_zorn _ hJ | ||
|
||
have Imax' : ∀ {J}, I < J → J.IsPrincipal := by | ||
intro K hK | ||
simpa [nonPrincipals] using hI.not_prop_of_gt hK | ||
|
||
by_cases hI1 : I = ⊤ | ||
· subst hI1 | ||
exact hI.prop top_isPrincipal | ||
-- Let `x y : R` with `x * y ∈ I` and suppose WLOG `y ∉ I`. | ||
refine hI.prop (H I ⟨hI1, fun {x y} hxy => or_iff_not_imp_right.mpr fun hy => ?_⟩) | ||
obtain ⟨a, ha⟩ : (I ⊔ span {y}).IsPrincipal := | ||
Imax' (left_lt_sup.mpr (mt I.span_singleton_le_iff_mem.mp hy)) | ||
-- Then `x ∈ I.colon (span {y})`, which is equal to `I` if it's not principal. | ||
suffices He : ¬(I.colon (span {y})).IsPrincipal by | ||
rw [hI.eq_of_le ((nonPrincipals_def R).2 He) fun a ha ↦ | ||
Ideal.mem_colon_singleton.2 (mul_mem_right _ _ ha)] | ||
exact Ideal.mem_colon_singleton.2 hxy | ||
-- So suppose for the sake of contradiction that both `I ⊔ span {y}` and `I.colon (span {y})` | ||
-- are principal. | ||
rintro ⟨b, hb⟩ | ||
-- We will show `I` is generated by `a * b`. | ||
refine (nonPrincipals_def _).1 hI.prop ⟨a * b, ?_⟩ | ||
refine | ||
le_antisymm (α := Ideal R) (fun i hi => ?_) <| | ||
(span_singleton_mul_span_singleton a b).ge.trans ?_ | ||
· have hisup : i ∈ I ⊔ span {y} := Ideal.mem_sup_left hi | ||
have : y ∈ I ⊔ span {y} := Ideal.mem_sup_right (Ideal.mem_span_singleton_self y) | ||
erw [ha, mem_span_singleton'] at hisup this | ||
obtain ⟨v, rfl⟩ := this | ||
obtain ⟨u, rfl⟩ := hisup | ||
have hucolon : u ∈ I.colon (span {v * a}) := by | ||
rw [Ideal.mem_colon_singleton, mul_comm v, ← mul_assoc] | ||
exact mul_mem_right _ _ hi | ||
erw [hb, mem_span_singleton'] at hucolon | ||
obtain ⟨z, rfl⟩ := hucolon | ||
exact mem_span_singleton'.2 ⟨z, by ring⟩ | ||
· rw [← Ideal.submodule_span_eq, ← ha, Ideal.sup_mul, sup_le_iff, | ||
span_singleton_mul_span_singleton, mul_comm y, Ideal.span_singleton_le_iff_mem] | ||
exact ⟨mul_le_right, Ideal.mem_colon_singleton.1 <| hb.symm ▸ Ideal.mem_span_singleton_self b⟩ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.