-
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
Fix two bugs related to empty magmas #2452
Conversation
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 is o.k.
My only idea for turning the wrong implication into a correct one would be
InstallTrueMethod( IsMagmaWithInverses, IsFiniteOrderElementCollection and IsMagmaWithOne )
,
but probably this is not worth the effort.
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.
I agree that this will also fix the issue at hand (and indeed then should override #2429)
However before merging we should make sure that we don't end up with bona-fide groups that do not know so.
Would it be possible to temporarily (just for tests) make this an immediate method that will trigger an error for groups? (I would hope it never gets triggered which would be proof that this indeed harmless.)
If that was the case one should add to have this flag set in the appropriate creator methods.
@hulpke you wrote:
I don't understand what you mean here: |
@fingolfin
Yes, this is a method that should never trigger, but if it does something is wrong. Thus my request:
|
OK. I've now added a commit with such an immediate method (so you can check if that's what you had in mind). Let's see what the Travis tests report (locally, I got no errors with |
Codecov Report
@@ Coverage Diff @@
## master #2452 +/- ##
==========================================
+ Coverage 74.01% 74.01% +<.01%
==========================================
Files 484 484
Lines 245371 245371
==========================================
+ Hits 181615 181622 +7
+ Misses 63756 63749 -7
|
Actually, Hence adding this error does not have the desired effect. There is one example in the tests were removing the implication had an effect, though:
This could of course easily be "fixed" by teaching Also, GAP distinguishes between ring and rings-with-one -- and if a ring has a one, it is not automatically "upgraded" to a ring-with-one. Why do we do that for magmas and semigroups? I guess I am with @mohamed-barakat here: I wish that if I told GAP that I want to create e.g. a magma or a semigroup, it'd give me one. If it turns out to be a group, too, let me us But that still leaves me wondering what a "correct" solution for the "problem" (???) at hand is... |
@fingolfin OTOH your example is weird, in particular because I think the only clean solution is to abolish the automatic upgrades to groups, i.e. declaring your example as compliant. Who creates a magma shall get a magma and has no reason to expect a group suddenly. In this case we need do make |
9d62a31
to
6f56213
Compare
I updated the tests to work (we'll see if Travis confirms). At this point I am not quite sure what if anything remains to be done in this PR. Sure, we may want to overhaul |
First, SubadditiveMagma(a,[]) computes an empty magma, but we erroneously set IsTrivial for it, which implies size 1. This was changed to IsEmpty. Secondly, there was an implication from "IsFiniteOrderElementCollection and IsMagma" to IsMagmaWithInverses. But such a collection may be empty, hence the implication is invalid as given. Fixes gap-system#2400
@fingolfin My (hypothetical) concern is that code that used to produce SubGroups now produces submagmas and that leads to calculations moving on the generic track. It would be good to test not only the standard test suite, but also testextra and the test benchmarks (which are inherently longer calculations. I can look at that once #2387 (which also still is waiting for an approval) has been merged. |
First, SubadditiveMagma(a,[]) computes an empty magma, but we erroneously set
IsTrivial for it, which implies size 1. This was changed to IsEmpty.
Secondly, there was an implication from "IsFiniteOrderElementCollection and
IsMagma" to IsMagmaWithInverses. But such a collection may be empty, hence the
implication is invalid as given. This PR just removes it (instead of trying to do something clever),
which seems to have no negative consequences -- if anybody is aware of any, please let me know.
Fixes #2400
Closes #2429