-
Notifications
You must be signed in to change notification settings - Fork 297
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(group_theory/exponent): Define the exponent of a group #10249
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks generally good to me :)
such that `g ^ n = 1` for all `g ∈ G`. | ||
* `monoid.exponent` defines the exponent of a monoid `G` as the minimal positive `n` such that | ||
`g ^ n = 1` for all `g ∈ G`, by convention it is `0` if no such `n` exists. | ||
* `add_monoid.exponent_exists` the additive version of `monoid.exponent_exists`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the convention on docs of to_additive
things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure, but I remember being told that additive versions should be in the documentation, but I might be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raised this on zulip here
Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Eric <37984851+ericrbg@users.noreply.github.com>
Co-authored-by: Johan Commelin <johan@commelin.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is looking good now. We just need to decide what to do about the additive things in the module docstring. I don't have a strong opinion, and I wouldn't mind merging now. We can easily fix it later.
One thing, maybe for a future PR: computing exponents of explicit examples: cyclic groups, zmod n
, dihedral groups, units of zmod p
...
So I decided to play with this a little, to see how the API felt, and proved the exponent of a cyclic group: Code:import group_theory.exponent
import set_theory.fincard
lemma exponent_eq_zero_iff {M} [monoid M] : monoid.exponent M = 0 ↔ ¬ monoid.exponent_exists M :=
begin
rw [monoid.exponent],
split_ifs,
{ classical,
have := (nat.find_spec h).1.ne',
simpa },
tauto
end
lemma mem_powers_iff_mem_range_order_of' {G} [left_cancel_monoid G] [decidable_eq G]
(x y : G) (hx : 0 < order_of x):
y ∈ submonoid.powers x ↔ y ∈ (finset.range (order_of x)).image ((^) x : ℕ → G) :=
finset.mem_range_iff_mem_finset_range_of_mod_eq' hx (λ i, pow_eq_mod_order_of.symm)
example {G} [group G] [is_cyclic G] : monoid.exponent G = nat.card G :=
begin
obtain ⟨g, hg⟩ := is_cyclic.exists_generator G,
classical,
casesI fintype_or_infinite G,
{ rw [nat.card_eq_fintype_card, ←monoid.lcm_order_eq_exponent],
apply nat.dvd_antisymm,
{ rw finset.lcm_dvd_iff,
rintros b -,
exact order_of_dvd_card_univ },
rw ←order_of_eq_card_of_forall_mem_zpowers hg,
exact finset.dvd_lcm (finset.mem_univ g) },
rw [nat.card_eq_zero_of_infinite, exponent_eq_zero_iff, monoid.exponent_exists],
push_neg,
refine λ n hn, ⟨g, λ hgn, _⟩,
have ho := order_of_pos' ((is_of_fin_order_iff_pow_eq_one g).mpr ⟨n, hn, hgn⟩),
obtain ⟨x, hx⟩ := infinite.exists_not_mem_finset
(finset.image (pow g) $ finset.range $ order_of g),
apply hx,
rw [←mem_powers_iff_mem_range_order_of' g x ho, submonoid.mem_powers_iff],
obtain ⟨k, hk⟩ := hg x,
obtain ⟨k, rfl | rfl⟩ := k.eq_coe_or_neg,
{ exact ⟨k, by exact_mod_cast hk⟩ },
let t : ℤ := -k % (order_of g),
rw zpow_eq_mod_order_of at hk,
have : 0 ≤ t := int.mod_nonneg (-k) (by exact_mod_cast ho.ne'),
refine ⟨t.to_nat, _⟩,
rwa [←zpow_coe_nat, int.to_nat_of_nonneg this]
end Now, this is nice and all (and honestly was a massive pain to figure out how to work with lemma exponent_eq_zero_iff {M} [monoid M] : monoid.exponent M = 0 ↔ ¬ monoid.exponent_exists M :=
begin
rw [monoid.exponent],
split_ifs,
{ classical,
have := (nat.find_spec h).1.ne',
simpa },
tauto
end If you want to add the rest of the stuff to the PR, too, feel free, but I don't want to scope-creep so I'm happy to PR it separately. (also, I used |
Maybe it is better in another PR where one also proves the converse that a finite abelian group whose order is equal to the exponent must be cyclic? I formalised some lemma that in some textbooks is used to prove these results, namely that if x and y are commuting elements of coprime order, then their product has order the product of the orders. It seems that you wouldn't benefit from that, right? You can see the progress in the branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Julian-Kuelshammer for the PR.
Thanks @ericrbg for the reviews.
Let's leave the remaining stuff for a future PR.
bors merge
This PR provides the definition and some very basic API for the exponent of a group/monoid. Co-authored-by: Julian-Kuelshammer <68201724+Julian-Kuelshammer@users.noreply.github.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
Build failed (retrying...): |
This PR provides the definition and some very basic API for the exponent of a group/monoid. Co-authored-by: Julian-Kuelshammer <68201724+Julian-Kuelshammer@users.noreply.github.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
Pull request successfully merged into master. Build succeeded: |
This PR provides the definition and some very basic API for the exponent of a group/monoid. Co-authored-by: Julian-Kuelshammer <68201724+Julian-Kuelshammer@users.noreply.github.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>
lemma order_dvd_exponent (g : G) : (order_of g) ∣ exponent G := | ||
order_of_dvd_of_pow_eq_one (pow_exponent_eq_one G g) | ||
|
||
@[to_additive] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like to additive gives this the name exponent_dvd_of_forall_pow_eq_zero
which doesn't quite match the statement, not a big issue but if you are adding more to this file it would be nice to fix this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mathlib/src/group_theory/exponent.lean
Line 138 in c99a719
@[to_additive exponent_dvd_of_forall_nsmul_eq_zero] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, great minds think alike lol! Looks perfect :D
This PR provides the definition and some very basic API for the exponent of a group/monoid.