Skip to content

Commit a6c8a98

Browse files
committed
feat: primality criteria for Monoid.exponent (#8723)
This PR shows a few facts related to `Monoid.exponent`, especially when it is prime: 1. A nontrivial finite cancellative monoid has exponent greater than 1. 2. A nontrivial monoid has prime exponent `p` if and only if every non-identity element has order `p`. 3. A group of order `p ^ 2` with `p` prime is not cyclic if and only if it has exponent `p`.
1 parent 3cfc8ef commit a6c8a98

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

Mathlib/Algebra/GroupPower/Basic.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ theorem dvd_pow_self (a : M) {n : ℕ} (hn : n ≠ 0) : a ∣ a ^ n :=
245245

246246
end Monoid
247247

248+
lemma eq_zero_or_one_of_sq_eq_self [CancelMonoidWithZero M] {x : M} (hx : x ^ 2 = x) :
249+
x = 0 ∨ x = 1 :=
250+
or_iff_not_imp_left.mpr (mul_left_injective₀ · <| by simpa [sq] using hx)
251+
248252
/-!
249253
### Commutative (additive) monoid
250254
-/

Mathlib/GroupTheory/Exponent.lean

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,21 @@ theorem _root_.Nat.Prime.exists_orderOf_eq_pow_factorization_exponent {p : ℕ}
236236
#align nat.prime.exists_order_of_eq_pow_factorization_exponent Nat.Prime.exists_orderOf_eq_pow_factorization_exponent
237237
#align nat.prime.exists_order_of_eq_pow_padic_val_nat_add_exponent Nat.Prime.exists_addOrderOf_eq_pow_padic_val_nat_add_exponent
238238

239+
/-- A nontrivial monoid has prime exponent `p` if and only if every non-identity element has
240+
order `p`. -/
241+
@[to_additive]
242+
lemma exponent_eq_prime_iff {G : Type*} [Monoid G] [Nontrivial G] {p : ℕ} (hp : p.Prime) :
243+
Monoid.exponent G = p ↔ ∀ g : G, g ≠ 1 → orderOf g = p := by
244+
refine ⟨fun hG g hg ↦ ?_, fun h ↦ dvd_antisymm ?_ ?_⟩
245+
· rw [Ne.def, ← orderOf_eq_one_iff] at hg
246+
exact Eq.symm <| (hp.dvd_iff_eq hg).mp <| hG ▸ Monoid.order_dvd_exponent g
247+
· apply Monoid.exponent_dvd_of_forall_pow_eq_one G p fun g ↦ ?_
248+
by_cases hg : g = 1
249+
· simp [hg]
250+
· simpa [h g hg] using pow_orderOf_eq_one g
251+
· obtain ⟨g, hg⟩ := exists_ne (1 : G)
252+
simpa [h g hg] using Monoid.order_dvd_exponent g
253+
239254
variable {G}
240255

241256
@[to_additive]
@@ -374,6 +389,23 @@ end CancelCommMonoid
374389

375390
end Monoid
376391

392+
section Group
393+
394+
@[to_additive AddGroup.one_lt_exponent]
395+
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
396+
1 < Monoid.exponent G := by
397+
let _inst := Fintype.ofFinite G
398+
obtain ⟨g, hg⟩ := exists_ne (1 : G)
399+
rw [← Monoid.lcm_order_eq_exponent]
400+
have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
401+
simpa [eq_comm, orderOf_eq_one_iff] using hg
402+
refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by simp)
403+
rw [Nat.pos_iff_ne_zero, Ne.def, Finset.lcm_eq_zero_iff]
404+
rintro ⟨x, -, hx⟩
405+
exact (orderOf_pos x).ne' hx
406+
407+
end Group
408+
377409
section CommGroup
378410

379411
open Subgroup

Mathlib/GroupTheory/SpecificGroups/Cyclic.lean

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,4 +651,32 @@ protected theorem ZMod.exponent (n : ℕ) : AddMonoid.exponent (ZMod n) = n := b
651651
· rw [IsAddCyclic.exponent_eq_zero_of_infinite]
652652
· rw [IsAddCyclic.exponent_eq_card, card]
653653

654+
/-- A group of order `p ^ 2` is not cyclic if and only if its exponent is `p`. -/
655+
@[to_additive]
656+
lemma not_isCyclic_iff_exponent_eq_prime [Group α] {p : ℕ} (hp : p.Prime)
657+
(hα : Nat.card α = p ^ 2) : ¬ IsCyclic α ↔ Monoid.exponent α = p := by
658+
-- G is a nontrivial fintype of cardinality `p ^ 2`
659+
let _inst : Fintype α := @Fintype.ofFinite α <| Nat.finite_of_card_ne_zero <| by aesop
660+
have hα' : Fintype.card α = p ^ 2 := by simpa using hα
661+
have := (Fintype.one_lt_card_iff_nontrivial (α := α)).mp <|
662+
hα' ▸ one_lt_pow hp.one_lt two_ne_zero
663+
/- in the forward direction, we apply `exponent_eq_prime_iff`, and the reverse direction follows
664+
immediately because if `α` has exponent `p`, it has no element of order `p ^ 2`. -/
665+
refine ⟨fun h_cyc ↦ (Monoid.exponent_eq_prime_iff hp).mpr fun g hg ↦ ?_, fun h_exp h_cyc ↦ by
666+
obtain (rfl|rfl) := eq_zero_or_one_of_sq_eq_self <| hα' ▸ h_exp ▸ (h_cyc.exponent_eq_card).symm
667+
· exact Nat.not_prime_zero hp
668+
· exact Nat.not_prime_one hp⟩
669+
/- we must show every non-identity element has order `p`. By Lagrange's theorem, the only possible
670+
orders of `g` are `1`, `p`, or `p ^ 2`. It can't be the former because `g ≠ 1`, and it can't
671+
the latter because the group isn't cyclic. -/
672+
have := (Nat.mem_divisors (m := p ^ 2)).mpr ⟨hα' ▸ orderOf_dvd_card (x := g), by aesop⟩
673+
simp? [Nat.divisors_prime_pow hp 2] at this says
674+
simp only [Nat.divisors_prime_pow hp 2, Finset.mem_map, Finset.mem_range,
675+
Function.Embedding.coeFn_mk] at this
676+
obtain ⟨a, ha, ha'⟩ := this
677+
interval_cases a
678+
· exact False.elim <| hg <| orderOf_eq_one_iff.mp <| by aesop
679+
· aesop
680+
· exact False.elim <| h_cyc <| isCyclic_of_orderOf_eq_card g <| by aesop
681+
654682
end Exponent

0 commit comments

Comments
 (0)