-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
add is_trivial method for groups #36873
Conversation
Return ``True`` if this group is the trivial group. | ||
|
||
A permutation group is trivial, if it consists only of the | ||
identity element, that is, if it has no generators. |
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.
This method is a very welcome addition, thanks. The code is good as far as I understand. A small complaint about the docstring: In Sage a trivial group may in fact have a (trivial) generator. To my surprise, here we specify no generators but end up having one generator anyway:
sage: PermutationGroup([],domain=[1,2]).gens()
((),)
If the docstring mentions generators (and I think it is a good idea, since it clarifies to the user what the code will actually be checking), it should mention this surprising possibility.
(I believe/hope it is not possible to make a group with several trivial generators, at least not easily. If that is a possibility, we would need to check that all generators are trivial.)
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.
It is, actually.
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.
Oh well, it is possible and not that difficult...
sage: P=PermutationGroup([(),()], canonicalize=False)
sage: P.gens()
((), ())
sage: P.order()
1
A human would likely not create such a group on purpose, but I imagine some code might. Anyway it is possible. Mathematically of course this is a trivial group, so Sage should recognize it as one.
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.
crossed.
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.
Looks good now!
Why is this new method restricted to permutation groups and not made available for groups in general? To my mind, such code would better be in the |
We certainly need finitely generated for this code, although, we can certainly use It seems that the same code might work well for I don't know the category code well enough to add generic code, but if you help me, I'd do it. |
Interestingly,
(Should probably file an issue on this.) |
yes, this is definitely a bug (it should return NotImplementedError I think). Please file an issue |
|
I am not sure what to do in the case of finitely presented group. Being trivial is undecidable (https://en.wikipedia.org/wiki/Adian%E2%80%93Rabin_theorem), but of course we can (and should) attempt to decide it. Computing the cardinality seems to be wasteful, however. |
Throw NotImplementedError ? |
Isn't that worse to checking cardinality? |
Done, please review. |
It appears that automatic actions triggering is working for you. So it is possible that you not seeing the "Approve and run" button on other PRs is due to your browser/auth, not the setup on GitHub. |
unless someone pushed "Approve and run" button here. It was not me, anyone else? |
6455956
to
1ef1380
Compare
For solvable groups the world problem is decidable. OK, we can talk about this somewhere later |
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.
lgtm
sagemathgh-36814: Fast cardinality method for IntegerVectorsModPermutationGroup # Fast cardinality method for IntegerVectorsModPermutationGroup This patch fixes sagemath#36787 by implementing a `cardinality` method for `IntegerVectorsModPermutationGroup_with_constraints`. The method calculates the cardinality using the the [Polya enumeration theorem](https://en.wikipedia.org/wiki/P%C3%B3lya_enumeration_theorem) (also known as the cycle index theorem). It is faster than the the default implementation, which iterates through the full set to find the cardinality. Incidentally this PR fixes also sagemath#36681 so that cardinality and iter no longer crash in empty-domain situations. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies - sagemath#36873: we can use `is_trivial` from that PR <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36814 Reported by: Jukka Kohonen Reviewer(s): Dima Pasechnik, Jukka Kohonen, Martin Rubey, Travis Scrimshaw
sorry, I pressed the wrong button |
Documentation preview for this PR (built with commit 1ef1380; changes) is ready! 🎉 |
We add a method to check whether a permutation group is trivial, that is, consists only of the identity element.