Skip to content
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

Closed
wants to merge 19 commits into from

Conversation

Julian-Kuelshammer
Copy link
Collaborator

This PR provides the definition and some very basic API for the exponent of a group/monoid.


Open in Gitpod

@Julian-Kuelshammer Julian-Kuelshammer changed the title Order lemma feat(group_theory/exponent): Define the exponent of a group Nov 9, 2021
@Julian-Kuelshammer Julian-Kuelshammer added the WIP Work in progress label Nov 9, 2021
@Julian-Kuelshammer Julian-Kuelshammer added awaiting-CI The author would like to see what CI has to say before doing more work. and removed WIP Work in progress labels Nov 13, 2021
Copy link
Collaborator

@ericrbg ericrbg left a 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`.
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

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

src/group_theory/exponent.lean Outdated Show resolved Hide resolved
src/group_theory/exponent.lean Outdated Show resolved Hide resolved
src/group_theory/exponent.lean Show resolved Hide resolved
src/algebra/gcd_monoid/finset.lean Outdated Show resolved Hide resolved
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric <37984851+ericrbg@users.noreply.github.com>
@Julian-Kuelshammer Julian-Kuelshammer added awaiting-review The author would like community review of the PR and removed awaiting-CI The author would like to see what CI has to say before doing more work. labels Nov 13, 2021
src/group_theory/exponent.lean Outdated Show resolved Hide resolved
src/group_theory/exponent.lean Outdated Show resolved Hide resolved
@jcommelin jcommelin added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels Nov 15, 2021
@Julian-Kuelshammer Julian-Kuelshammer added awaiting-review The author would like community review of the PR and removed awaiting-author A reviewer has asked the author a question or requested changes labels Nov 15, 2021
Copy link
Member

@jcommelin jcommelin left a 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...

@ericrbg
Copy link
Collaborator

ericrbg commented Nov 19, 2021

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 zpow and pow together, but anyways...) but I think the key thing is that I think a useful lemma is:

  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 nat.card because to unify the cases, but it's not imported in this file, but everything else is, so may be worth separating into an infinite and fintype case instead.)

@Julian-Kuelshammer
Copy link
Collaborator Author

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 order_of_lcm_commute (note that so far I only formalised the minimal_period version, from which the order_of version should follow almost immediately by definition.

Copy link
Member

@jcommelin jcommelin left a 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

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Nov 23, 2021
bors bot pushed a commit that referenced this pull request Nov 23, 2021
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>
@bors
Copy link

bors bot commented Nov 23, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Nov 23, 2021
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>
@bors
Copy link

bors bot commented Nov 23, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(group_theory/exponent): Define the exponent of a group [Merged by Bors] - feat(group_theory/exponent): Define the exponent of a group Nov 23, 2021
@bors bors bot closed this Nov 23, 2021
@bors bors bot deleted the order_lemma branch November 23, 2021 15:05
ericrbg pushed a commit that referenced this pull request Nov 24, 2021
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]
Copy link
Member

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!

Copy link
Collaborator

@ericrbg ericrbg Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@[to_additive exponent_dvd_of_forall_nsmul_eq_zero]
turns out I had already in those PRs :) that is the correct name right?

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants