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

Fix bug in IrrConlon leading to unexpected errors #3763

Merged
merged 1 commit into from
Dec 1, 2019

Conversation

fingolfin
Copy link
Member

Reported by Benjamin Sambale

Please use the following template to submit a pull request, filling
in at least the "Text for release notes" and/or "Further details".
Thank You!

Description

Text for release notes

If this pull request should be mentioned in the release notes,
please provide a short description matching the style of the GAP
Changes manual.

Further details

If necessary, please provide further details here.

Checklist for pull request reviewers

  • proper formatting

If your code contains kernel C code, run clang-format on it; the
simplest way is to use git clang-format, e.g. like this (don't
forget to commit the resulting changes):

git clang-format $(git merge-base HEAD master)
  • usage of relevant labels

    1. either release notes: not needed or release notes: to be added
    2. at least one of the labels bug or enhancement or new feature
    3. for changes meant to be backported to stable-4.X add the backport-to-4.X label
    4. consider adding any of the labels build system, documentation, kernel, library, tests
  • runnable tests

  • lines changed in commits are sufficiently covered by the tests

  • adequate pull request title

  • well formulated text for release notes

  • relevant documentation updates

  • sensible comments in the code

@fingolfin fingolfin 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 topic: library release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes backport-to-4.11 labels Nov 28, 2019
@ChrisJefferson
Copy link
Contributor

Out of interest, what is the change of behaviour here? Perhaps put a little more in the commit message. I'm assuming a bug was fixed, which is good :)

@fingolfin
Copy link
Member Author

The bug was that certain calls to IrrConlon (e.g. IrrConlon(SmallGroup(8,2));, see test file) lead to unexpected errors, which is now fixed.

That's pretty much the title of the PR, the only thing missing is the concrete example. Do you mean you'd like me to add something like this to the body of the message:

For example, calling IrrConlon(SmallGroup(8,2)); used to run into an error, and now succeeds.

@ChrisJefferson
Copy link
Contributor

I didn't understand why SubgroupNC broke things, when changing to SetParent did, as I thought that setting parent was basically all SubgroupNC did.

@fingolfin
Copy link
Member Author

Ahh! Well, SubgroupNC expects a parent plus a list of generators of the subgroup. Now we give it the full subgroup as "generators". Which is bad by itself, but it also means that Length( gens ) fails. This used to work in GAP 4.9, by the way, but probably never was a good idea, so overall I think it's a good idea to make this change anyway. It also ensures that we retain other known properties and attributes of the subgroup, such as its size.

@fingolfin
Copy link
Member Author

Note SubgroupNC does not just set the parent; it creates a completely new group object.

@ChrisJefferson
Copy link
Contributor

Ah, now I understand, this isn't some kind of subtle maths bug, just giving a function the completely wrong things :)

@fingolfin
Copy link
Member Author

Good :-). I'll update the commit message nevertheless.

@ChrisJefferson
Copy link
Contributor

I've approved. You could if you want add to the commit message something like As SubgroupNC takes a list of generators, not a group, just to guide some future reader, but it's not required.

@fingolfin
Copy link
Member Author

Updated. BTW, in practice the SetParent call has no effect, because t is created as a stabilizer in G and thus normally already has G as parent (I verified this by inserting some assertions). But I think it doesn't hurt to set the parent explicitly either.

Copy link
Contributor

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

Thanks for this fix.
(It is not the first instance of this problem.)
Concerning the changes, I would perhaps suppress showing the test output; changes in GAP's output format (which happened in the past) will make updates necessary, and the output itself is unimportant here.
As you wrote, StabilizerOfExternalSet sets already a parent; I would omit the SetParent call then, note that it could be misleading if StabilizerOfExternalSet would set a different parent object.

@fingolfin
Copy link
Member Author

@ThomasBreuer both fine by me; perhaps I should replace the SetParent call by an assertion which verifies the parent...

And I'll grep through the code for calls to SubgroupNC to see if I can spot some other similar issues (I don't promise to perform a thorough search, just a quick look if I see "obvious" related cases).

@fingolfin
Copy link
Member Author

I saw no obvious similar issues in SubgroupNC calls (but again, I make no claims there are none). Updated the PR again.

SubgroupNC expects a parent plus a list of generators of the subgroup.
However, the old code actually passed a subgroup as "list of generators".
Which is bad by itself, but it also means that later `Length( gens )` failed.
This is resolved by the new code, which also ensures that known attributes of
the subgroups, such as its size, are retained.

This used to work in GAP 4.9, but in GAP 4.10 we changed the code which
creates subgroups, which introduced this regression in behavior.

Reported by Benjamin Sambale.
@ThomasBreuer
Copy link
Contributor

@fingolfin Thanks for the changes.

The current documentation of Subgroup and SubgroupNC does actually not specify that the second argument must be a list. It says

‣ Subgroup( G, gens ) ───────────────────────────────────────── function
‣ SubgroupNC( G, gens ) ─────────────────────────────────────── function
‣ Subgroup( G ) ───────────────────────────────────────────── function

creates the subgroup U of G generated by gens. The Parent (31.7-1) value of
U will be G. The NC version does not check, whether the elements in gens
actually lie in G.
[...]

A better description would be something like the following.

returns the subgroup U of G generated by the elements in the list gens.
The Parent (31.7-1) value of U will be G.
The NC version does not check, whether the elements in gens actually lie in G.

Should I create a new pull request for such a change of the documentation?
And should the documentation of other Subsomething and SomethingByGenerators operations also be made precise in the sense that the generators must be given as a list, not as an arbitrary collection, even if one does not (yet) get an error if a domain is given instead of a list?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.009%) to 84.686% when pulling 783e572 on fingolfin:mh/IrrConlon into 46dcecd on gap-system:master.

@fingolfin fingolfin merged commit d766ec4 into gap-system:master Dec 1, 2019
@fingolfin
Copy link
Member Author

@ThomasBreuer that sounds useful. Of course we could also decide that we want to allow collections, and change the code to allow for that (again). But then in Group, Magma, MagmaWithOne, etc., we explicitly say gens should be a list, so it seems sensible to require the same for Subgroup etc. as well.

@fingolfin fingolfin deleted the mh/IrrConlon branch December 1, 2019 20:47
@fingolfin
Copy link
Member Author

Backported to stable-4.11 in commit 4de3c19

@fingolfin fingolfin added backport-to-4.11-DONE release notes: added PRs introducing changes that have since been mentioned in the release notes and removed backport-to-4.11 release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Dec 5, 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
backport-to-4.11-DONE 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 topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants