-
Notifications
You must be signed in to change notification settings - Fork 160
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
Catch some corner cases for trivial group #3192
Conversation
Looking again, only the last commit is really needed to fix the bug described in the pull request. |
Codecov Report
@@ Coverage Diff @@
## master #3192 +/- ##
==========================================
- Coverage 84.75% 84.75% -0.01%
==========================================
Files 688 688
Lines 335874 335886 +12
==========================================
+ Hits 284677 284685 +8
- Misses 51197 51201 +4
|
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.
Seems fine to me, and can be merged as-is from my POV, although I still left a few remarks.
if Size(G) = 1 then | ||
return GroupHomomorphismByFunction(G, TRIVIAL_FP_GROUP, | ||
x->One(TRIVIAL_FP_GROUP), | ||
x->One(G):noassert); |
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.
Why not just return GroupHomomorphismByImagesNC(G, TRIVIAL_FP_GROUP);
? Is there some problem with that I am missing?
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.
Also, perhaps add a test case for this as well? For me, IsomorphismFpGroup(SymmetricGroup(1));
and also IsomorphismFpGroup(SymmetricGroup(1), "F");
both trigger it
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.
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.
Yes, I just copied it from IsomorphismFpGroupByChiefSeriesFactor
; happy to change it to the more compact version if that works too...
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.
gap> GroupHomomorphismByImagesNC(Group(()), TRIVIAL_FP_GROUP);
Error, <gens> and <imgs> must be lists of same length at /home/mp397/git/gap/lib/ghom.gi:300 called from
GroupGeneralMappingByImagesNC( G, H, gens, imgs ) at /home/mp397/git/gap/lib/ghom.gi:437 called from
GroupHomomorphismByImagesNC( G, H, GeneratorsOfGroup( G ), GeneratorsOfGroup( H ) ) at /home/mp397/git/gap/lib/ghom.gi:472
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.
(because the trivial group Group(())
has a generator...)
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.
And this:
GroupHomomorphismByImagesNC(Group(()), TRIVIAL_FP_GROUP, [()], [One(TRIVIAL_FP_GROUP)]);
is not much prettier...
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.
Just leave it as-is -- I am sure @hulpke had good reasons for writing the code like that. Perhaps one day we should add a TrivialHomorphism(G,H)
helper operation for the constant homomorphism from G to H, which does whatever the "most efficient" thing is, but for now, there is no point in wasting time on overthinking this. Sorry for dragging you in that direction.
4400ad4
to
8062967
Compare
Reported-By: Madeleine Whybrow <mlw10@ic.ac.uk>
8062967
to
485b8e0
Compare
In current master:
This happens because GAP istrying to create a free group of rank
-1
, which does not exist.