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

Catch some corner cases for trivial group #3192

Merged
merged 1 commit into from
Jan 18, 2019

Conversation

markuspf
Copy link
Member

In current master:

gap> G := Group(());;
gap> cc := ConjugacyClasses(G);;
gap> x := Representative(cc[1]);;
gap> C := Centralizer(G, x);;
gap> ConjugacyClassesSubgroups(C);
Error, usage: FreeGroup(<name1>,<name2>..) or FreeGroup(<rank>) at /home/mp397/git/gap/lib/grpfree.gi:467 called from
FreeGroup( deg - 1, nam ) at /home/mp397/git/gap/lib/gpprmsya.gi:1752 called from
IsomorphismFpGroup( G, Concatenation( "S_", String( Length( MovedPoints( G ) ) ), "." ) ) at /home/mp397/git/gap/lib/gpprmsya.gi:1728 called from
IsomorphismFpGroup( Image( hom ) ) at /home/mp397/git/gap/lib/grplatt.gi:890 called from
LatticeSubgroups( G ) at /home/mp397/git/gap/lib/grplatt.gi:208 called from
<function "unknown">( <arguments> )
 called from read-eval loop at *stdin*:5
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue

This happens because GAP istrying to create a free group of rank -1, which does not exist.

@markuspf markuspf added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them labels Jan 17, 2019
@markuspf markuspf requested a review from hulpke January 17, 2019 17:45
@markuspf
Copy link
Member Author

Looking again, only the last commit is really needed to fix the bug described in the pull request.

@codecov
Copy link

codecov bot commented Jan 17, 2019

Codecov Report

Merging #3192 into master will decrease coverage by <.01%.
The diff coverage is 91.66%.

@@            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
Impacted Files Coverage Δ
lib/gpprmsya.gi 74.33% <100%> (+0.07%) ⬆️
lib/grplatt.gi 73.5% <85.71%> (-0.1%) ⬇️

@coveralls
Copy link

coveralls commented Jan 17, 2019

Coverage Status

Coverage decreased (-0.0007%) to 84.636% when pulling 485b8e0 on markuspf:catch-corner-grplatt into d61ff81 on gap-system:master.

Copy link
Member

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

lib/gpprmsya.gi Outdated Show resolved Hide resolved
if Size(G) = 1 then
return GroupHomomorphismByFunction(G, TRIVIAL_FP_GROUP,
x->One(TRIVIAL_FP_GROUP),
x->One(G):noassert);
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

Huh, I guess you copied it from IsomorphismFpGroupByChiefSeriesFactor, where I am also surprised to see it. That line comes from 92bbca1 (where the noassert was added by @hulpke) and the rest before that from 2013.
Anyway, if it works like this, it works, it's just... ugly... :)

Copy link
Member Author

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...

Copy link
Member Author

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

Copy link
Member Author

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...)

Copy link
Member Author

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...

Copy link
Member

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.

lib/grplatt.gi Outdated Show resolved Hide resolved
Reported-By: Madeleine Whybrow <mlw10@ic.ac.uk>
@fingolfin fingolfin merged commit 6a512d7 into gap-system:master Jan 18, 2019
@PaulaHaehndel PaulaHaehndel added the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Apr 15, 2019
@DominikBernhardt DominikBernhardt added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Aug 22, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants