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

Disable NaturalHomomorphism for FactorGroup, as it has side effects (code using this should be rewritten to use NaturalHomomorphismByNormalSubgroup instead) #4697

Merged
merged 3 commits into from
Dec 10, 2021

Conversation

hulpke
Copy link
Contributor

@hulpke hulpke commented Nov 12, 2021

(Moved into obsoletes).
This resolves #4656

Also included the (trivial) fix for #4698

Text for release notes

The use of FactorGroup succeeded by NaturalHomomorphism has been made obsolete, as the implementation relied on side-effects.

@hulpke hulpke changed the title Disabled FactorGroup as it has side effects. Disabled NaturalHomomorphism for FactorGroup, as it has side effects. Nov 12, 2021
lib/grp.gi Outdated
@@ -2685,6 +2685,9 @@ end );
InstallMethod( NaturalHomomorphism, "for a group with natural homomorphism stored",
[ IsGroup ],
function(G)
Error("The use of `NaturalHomomorphism` for a `FactorGroup`\n",
"has been removed, as it caused side-effects.");
Copy link
Member

Choose a reason for hiding this comment

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

But won't that break existing user code that relies on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, should code rely onthis functionality. We could change it to add text "enter return; to continue, or change the error to a warning message.

Copy link
Member

Choose a reason for hiding this comment

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

Also we should perhaps quickly check if any distributed packages rely on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have checked through the packages in 4.11. Only XMod, laguna, primgrp, rds, wedderga and xgap call FactorGroup(. None of them uses NaturalHomomorphism(. I will change the error to a warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

XMod does use NaturalHomomorphism

Copy link
Contributor Author

@hulpke hulpke Nov 23, 2021

Choose a reason for hiding this comment

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

@cdwensley Where does it use NaturalHomomorphism? I found it only uses NaturalHomomorphismByNormalSubgroup (which is safe and well) in version 2.82.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy to change it if that is the sensible thing to do.
Christopher-Wensleys-iMac:lib christopherwensley$ grep -n NaturalHomomorphism *
catone.gi:575: nat:=NaturalHomomorphismByNormalSubgroup(G,N);
gp2map.gi:1764: nat1 := NaturalHomomorphism( KR1 );
gp2map.gi:1795: nat2 := NaturalHomomorphism( KQ );
gp2map.gi:1862: nat1 := NaturalHomomorphism( KR1 );
gp2map.gi:1891: natKQ := NaturalHomomorphism( KQ );
gp2map.gi:1897: natKR1 := NaturalHomomorphism( KR1 );
gp2map.gi:1902: natKQ := NaturalHomomorphism( KQ );

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this does appear to be a recent change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is a recent change (and thus possibly not even in a distributed version) I would urge to replace code of the form

F:=FactorGroup(G,N);
hom:=NaturalHomomorphism(F);

by

hom:=NaturalHomomorphismByNormalSubgroup(G,N);
F:=Image(hom,G);

The cost will be the same, but it does not rely on the side-effect of aching the homomorphism in the object.

Copy link
Contributor

Choose a reason for hiding this comment

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

It all happened when quasi-isomorphisms were introduced: PR #107 (17/2/21).
I'll try using NaturalHomomorphismByNormalSubgroup instead.

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.

Thank you

lib/obsolete.gi Outdated Show resolved Hide resolved
@cdwensley
Copy link
Contributor

cdwensley commented Nov 24, 2021 via email

(Moved the method into obsolete)
Subsequent demotion of `FactorGroup` and related library/manual changes

This resolves gap-system#4656
Criterion should only exclude small solvable group (which have something
better).
This resolves gap-system#4698
does not try primitivity for short orbits -- not worth doing and tedious
@fingolfin
Copy link
Member

Unfortunately something in here broke the test suite, specifically tst/teststandard/grpprmcs.tst:1813, which I didn't notice as there is this 32bit float CI error... sigh.

testing: /home/runner/work/gap/gap/tst/teststandard/grpprmcs.tst
########> Diff in /home/runner/work/gap/gap/tst/teststandard/grpprmcs.tst:1813
# Input is:
ImagesRepresentative(iso,Product(GeneratorsOfGroup(g)));
# Expected output:
F3*F4*F5*F2*F1^-1*F2^2*(F1*F2^-1)^2
# But found:
F3*F4*F5*(F1^-1*F2^-1)^2
########

@hulpke
Copy link
Contributor Author

hulpke commented Dec 13, 2021

Yes. This is a side-effect of a small improvement to `SmallGeneratingSet' which I had added since the PR was hanging anyhow (did not realize you would then override the merge).
The test is simply for evaluating the homomorphism on an element that is not a generator, but since the generating set changed, the image (entirely harmlessly) also changed. Do you want me to submit a PR for changing the test example?

@fingolfin fingolfin changed the title Disabled NaturalHomomorphism for FactorGroup, as it has side effects. Disable NaturalHomomorphism for FactorGroup, as it has side effects (code using this should be rewritten to use NaturalHomomorphismByNormalSubgroup instead) Aug 17, 2022
@fingolfin fingolfin added release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes kind: bug Issues describing general bugs, and PRs fixing them kind: removal or deprecation A feature was removed or deprecated / made obsolete and removed kind: bug Issues describing general bugs, and PRs fixing them labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: removal or deprecation A feature was removed or deprecated / made obsolete release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing behaviour in repeated calls of the same code
3 participants