Zulip Chat Archive
Stream: Is there code for X?
Topic: order of one in zmod
Damiano Testa (Aug 27 2022 at 07:26):
Dear All,
is this lemma already in mathlib? I could not find it. Thanks!
import group_theory.order_of_element
lemma zmod.add_order_of_one {n : ℕ} (n0 : 0 < n) : add_order_of (1 : zmod n) = n := sorry
Damiano Testa (Aug 27 2022 at 07:28):
Maybe, because of the definitions it also holds for n = 0
.
Johan Commelin (Aug 27 2022 at 08:06):
I can't find it.
Damiano Testa (Aug 27 2022 at 08:11):
Johan, thanks for confirming! It seems that there is little API for (add_)order_of_element
in general, besides what is in the file where they are defined. In particular, even the relationship between additive order of 1 in a semiring and its interactions with the various char
s seems not in mathlib.
Damiano Testa (Aug 27 2022 at 08:19):
I do not dislike this proof, but can someone find a more direct argument?
lemma char_p_eq_add_order_of_one (R) [semiring R] : char_p R (add_order_of (1 : R)) :=
⟨λ n, by rw [← nat.smul_one_eq_coe, add_order_of_dvd_iff_nsmul_eq_zero]⟩
lemma zmod.add_order_of_one (n : ℕ) : add_order_of (1 : zmod n) = n :=
begin
cases zmod.char_p n with cp,
cases char_p_eq_add_order_of_one (zmod n) with co,
exact nat.dvd_right_iff_eq.mp (λ a, by rw [← cp, ← co]),
end
Yaël Dillies (Aug 27 2022 at 08:21):
Don't we have a lemma that if char_p R a
and char_p R b
then a = b
?
Damiano Testa (Aug 27 2022 at 08:22):
Good point, I do not know!
Damiano Testa (Aug 27 2022 at 08:22):
like char_p
injective, or something?
Yaël Dillies (Aug 27 2022 at 08:23):
char_p.unique
I'd say.
Damiano Testa (Aug 27 2022 at 08:23):
Damiano Testa (Aug 27 2022 at 08:28):
Thanks a lot!
Yaël Dillies (Aug 27 2022 at 08:33):
Also, you could generalize to anything coprime with n
, and then prove the general statement that add_order_of a = n/gcd a n
.
Damiano Testa (Aug 28 2022 at 06:32):
Last updated: Dec 20 2023 at 11:08 UTC