Skip to content

Add dicyclic_group, is_dicyclic_group and have quaternion_group and is_quaternion_group be aliases of those #4661

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
merged 15 commits into from
Apr 30, 2025

Conversation

jamesnohilly
Copy link
Collaborator

@jamesnohilly jamesnohilly commented Feb 27, 2025

This PR adds a group constructor for Dicyclic Groups (dicyclic_group) and changes the constructor for Quaternion Groups to be an alias of dicyclic_group.

This PR closes #1630

@@ -827,6 +827,8 @@ as an instance of `T`,
where `n` is a power of 2 and `T` is in
Copy link
Collaborator

@thofma thofma Feb 27, 2025

Choose a reason for hiding this comment

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

Suggested change
where `n` is a power of 2 and `T` is in
where `n` is a multiple of 4 and `T` is in

Copy link
Member

Choose a reason for hiding this comment

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

I think "power of 2" is what we want here, as that is how (generalized) quaternion groups are defined. For the function that does the exact same construction for "multiple of 4", there is dicyclic_group below. In particular, this distinction in the docstring matches to how is_quaternion_group works

Copy link
Collaborator

@thofma thofma Feb 27, 2025

Choose a reason for hiding this comment

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

Hm, I think that the consensus in #1630 is that both should be the same. Here are some reasons why I think this is the case:

  1. The definition with 2-powers is unnecessarily restrictive. There are plenty of references that construct quaternion groups of order 4n.
  2. There is now already code out there that is using the most general definition (that the order is any number $4n$), because this is what people were being told in Dicyclic groups #1630
  3. Since we don't do any quaternion_group(k) -> group of order 2^k or 2^(k+2) shenanigans, there is no reason to restrict to 2-powers.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I decided to just treat both commands as exact equals, any artificial restriction benefits nobody but can cause frustration

Copy link
Member

Choose a reason for hiding this comment

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

Note that e.g. Wikipedia allows "generalized quaternion groups" to have order $4k$.

@@ -827,6 +827,8 @@ as an instance of `T`,
where `n` is a power of 2 and `T` is in
Copy link
Member

Choose a reason for hiding this comment

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

I think "power of 2" is what we want here, as that is how (generalized) quaternion groups are defined. For the function that does the exact same construction for "multiple of 4", there is dicyclic_group below. In particular, this distinction in the docstring matches to how is_quaternion_group works

@fingolfin fingolfin added the enhancement New feature or request label Feb 27, 2025
@jamesnohilly jamesnohilly marked this pull request as ready for review March 3, 2025 17:29
@lgoettgens lgoettgens requested review from fingolfin and thofma March 12, 2025 12:56
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 91.89189% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.77%. Comparing base (4bccbc1) to head (ca99ed5).
Report is 64 commits behind head on master.

Files with missing lines Patch % Lines
src/Groups/group_constructors.jl 91.89% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4661      +/-   ##
==========================================
+ Coverage   84.38%   84.77%   +0.39%     
==========================================
  Files         673      681       +8     
  Lines       90284    91838    +1554     
==========================================
+ Hits        76185    77859    +1674     
+ Misses      14099    13979     -120     
Files with missing lines Coverage Δ
src/Groups/group_constructors.jl 93.65% <91.89%> (+0.27%) ⬆️

... and 96 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@thofma thofma left a comment

Choose a reason for hiding this comment

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

Very nice, thanks. But some group theory person should have a look too.


Return the dicyclic group of order `n`, as an instance of `T`,
where `n` is a multiple of 4 and `T` is in
{`PcGroup`, `SubPcGroup`, `PermGroup`,`FPGroup`, `SubFPGroup`}.
Copy link
Member

Choose a reason for hiding this comment

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

Adjust this to fully mirror the quaternion_group docstring (including a @ref link in the other direction).

... or... perhaps we should instead really merge the two, like GAP does: show a single docstring that starts with

"""
    dicyclic_group(::Type{T} = PcGroup, n::IntegerUnion)
    quaternion_group(::Type{T} = PcGroup, n::IntegerUnion)

...

Then attach that to, say, quaternion_group, and turn dicyclic_group into a "true" alias by doing const dicyclic_group = quaternion_group (I think it'll then get the same docstring). Merge is_quaternion_group and is_dicyclic_group` similarly.

In the examples use only one (quaternion).

Then instead of This is an alias of dicyclic_group. write something more like this:

!!! note
    For historical reasons and backwards compatibility, `dicyclic_group` is an alias
    of `quaternion_group`. The two functions are fully identical. We recommend always
    using `quaternion_group`.

and then similar for the is_* function.

Thoughts @ThomasBreuer @thofma ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is just an alias, as a user I would not quite understand why you provide an alias that I am happy to find (because "dicyclic group" is the right name in my domain) and use, but then tell me not to use it.

But I don't have a strong opinion on this.

Copy link
Member

@ThomasBreuer ThomasBreuer Mar 21, 2025

Choose a reason for hiding this comment

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

My understanding of the discussion from issue #1630 is that it should be the other way round, that is, we recommend always using dicyclic_group.

And yes, I think it makes sense to have just one docstring for both names.

Copy link
Member

Choose a reason for hiding this comment

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

I am fine with not making a recommendation, my main concern is that I think it'd be nice to mention why we have two names.

true
```
"""
@gapattribute is_quaternion_group(G::GAPGroup) = GAP.Globals.IsQuaternionGroup(GapObj(G))::Bool
@gapattribute is_dicyclic_group(G::GAPGroup) =
GAP.Globals.IsQuaternionGroup(GapObj(G))::Bool
Copy link
Member

Choose a reason for hiding this comment

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

I am getting confused.
GAP does the following:

gap> G:= DicyclicGroup(24);;
gap> IsQuaternionGroup(G);
false
gap> G:= DicyclicGroup(32);;
gap> IsQuaternionGroup(G);
true

That is, both QuaternionGroup and DicyclicGroup can be used to create the groups in question,
but IsQuaternionGroup regards only the dicyclic groups of 2-power order as (generalized) quaternion groups.
In fact, GAP seems to have no function that checks whether a group is dicyclic.

Copy link
Member

Choose a reason for hiding this comment

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

As far as I see, the GAP function DoComputeGeneralisedQuaternionGenerators (which is called by IsQuaternionGroup) would work as an is_dicyclic check if one just omits the check for 2-power order.

@ThomasBreuer
Copy link
Member

How shall we proceed?
Meanwhile gap-system/gap/pull/5966 got merged, do we want to wait until Oscar can use it, or do we want to add Oscar code that provides the same functionality?

@jamesnohilly
Copy link
Collaborator Author

I have now merged the docstrings of dicyclic_group and quaternion_group, with main preference on dicyclic_group as in #1630.

As for the is_{dicyclic,quaternion}_group issue, we could wait for a new GAP.jl release to use these new methods, however I am unsure. Adding this functionality to OSCAR and then eventually replacing is an option aswell.

@thofma
Copy link
Collaborator

thofma commented Apr 4, 2025

Didn't we decide a while ago that dicyclic_group === quaternion_group and is_dicyclic_group === is_quaternion_group (#1630 and #4661 (comment))? I think now having

julia> is_quaternion_group(quaternion_group(12))
false

is not optimal.

@thofma thofma added the triage label Apr 9, 2025
@ThomasBreuer
Copy link
Member

Concerning @thofma's latest comment:
Yes, I think the solution is

  • to make also is_dicyclic_group and is_quaternion_group synonyms, in the same way as dicyclic_group and quaternion_group are,
  • to merge the docstrings of is_dicyclic_group and is_quaternion_group into one docstring, and
  • to change the N // 2 to div(N, 2).

(The current code wants is_dicyclic_group and is_quaternion_group to behave analogous to the corresponding functions in GAP, but the situation in GAP is different, since GAP.Globals.GeneralizedQuaternionGroup prints a warning if the argument is not a 2-power, and GAP.Globals.IsGeneralizedQuaternionGroup returns false if the order of the argument is not a 2-power. In gap-system/gap/pull/5966, I had just added the missing function GAP.Globals.IsDicyclicGroup, without changing the -perhaps inconsistent- behaviour of GAP.Globals.IsGeneralizedQuaternionGroup and GAP.Globals.GeneralizedQuaternionGroup.)

@jamesnohilly
Copy link
Collaborator Author

Regarding this issue, I believe I became confused regarding GAP's functionality vs. OSCAR functionality throughout the reimplementation of is_dicyclic_group. However, I will implement @ThomasBreuer's solution in the evening and clean up this issue.

Copy link
Member

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks.

@fingolfin fingolfin closed this Apr 23, 2025
@fingolfin fingolfin reopened this Apr 23, 2025
@fingolfin
Copy link
Member

Just to add another data point that convinces me we are doing the right thing merging the two notations: Keith Conrad also considers them as synonyms in https://kconrad.math.uconn.edu/blurbs/grouptheory/genquat.pdf

@fingolfin fingolfin enabled auto-merge (squash) April 30, 2025 08:35
@fingolfin fingolfin changed the title Add constructor for Dicyclic groups and alias for Quaternion groups Add dicyclic_group, is_dicyclic_group and have quaternion_group and is_quaternion_group be aliases of those Apr 30, 2025
@fingolfin fingolfin added the release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes label Apr 30, 2025
@fingolfin fingolfin merged commit 58afc01 into oscar-system:master Apr 30, 2025
31 of 32 checks passed
@jamesnohilly jamesnohilly deleted the jn/dicyclic branch June 11, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: groups
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dicyclic groups
5 participants