-
Notifications
You must be signed in to change notification settings - Fork 163
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 a RedispatchOnCondition to SubdirectProductOp #3437
Conversation
Is this supposed to fix #3431? If so, please add |
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.
All in all, I am sceptical. Isn't the true problem that the mappings returned by IsomorphismPcGroup
do not have IsInjective
set? Wouldn't fixing that be much simpler resp. less invasive, and at the same time, possible benefit other things as well?
Wonder if @hulpke has some thoughts on this PR?
lib/gprd.gi
Outdated
# the ...Op is installed for `IsGroupHomomorphism'. So we have to enforce | ||
# the filter to be set. | ||
if not IsGroupHomomorphism(ghom) or not IsGroupHomomorphism(hhom) then | ||
Error("mappings are not homomorphisms"); |
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.
Hmm, doesn't this mean the user will get strictly worse error messages now in case ghom
and/or hhom
really isn't a homomorphism? I.e. there will be a "no method found" error instead of this very specific information.
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 don't actually understand why it is necessary and/or beneficial to remove this check here for the purpose of this PR?
lib/gprd.gi
Outdated
10); | ||
|
||
|
||
InstallMethod( SubdirectProductOp,"groups", SubdirectProductFamilyPredicate, |
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.
Hm. So invalid arguments for SubdirectProductOp
which this new family predicate will lead to "method not found" errors, instead of running into different (possibly more helpful) errors later on in the code (e.g. when the homomorphisms are applied and "notice" that they cannot actually be applied).
I guess one way out would be to add another method w/o family predicate, which checks if the family predicate is violated, and if so, prints a specific error message, and otherwise redispatches?
@fingolfin There is one point of principle here, which is that you shouldn't give "No Method Found" for an object which is entirely suitable for a Method except that it doesn't know some Properties which are in fact true. So one way or another, we should catch the case of mappings which are homomorphisms but don't know it. The independent fact that So adding the Fixing The remaining questions are to do with giving the most helpful possible error messages for actually invalid arguments. Here I have no strong feelings. The operation is expensive enough that the checks won't make any difference, so we could have a method with minimal requirements whose job is simply to give intelligible error messages for bad arguments and then |
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 don't have a problem with this PR -- it resolves an issue of a property not being set and adds a family predicate that (lazily) was ignored 20 years ago.
However, independent of this, the IsomorphismPcGroup
method for fp groups (respectively: EpimorphismSolvableQuotient
if the size is known) is missing a "SetIsInjective`. I will add that (which also will resolve the problem).
@hulpke The second commit in this PR fixes |
@stevelinton |
Something is wrong with this PR, there are some failed CI statuses, and some successful ones... @stevelinton perhaps you could rebase and force push this PR to trigger a fresh rebuild, hopefully resolving this? |
Codecov Report
@@ Coverage Diff @@
## master #3437 +/- ##
==========================================
+ Coverage 77.24% 84.54% +7.3%
==========================================
Files 692 698 +6
Lines 339572 345290 +5718
==========================================
+ Hits 262306 291942 +29636
+ Misses 77266 53348 -23918
|
Tests now seem to be fine. @fingolfin we could do more in terms of catching bad inputs and trying to give a more targeted error message, but there are lots of places where we could do that. |
@stevelinton I agree that many other places could / should have better error messages, and that alone wouldn't be a concern for me. What bothers me is that this PR makes error messages worse in certain situations, and IMHO for no good reason. To me, Wouldn't the minimally invasive solution here be to tweak the second call to Thing is, of course I want to get this bug fixed ASAP. And I also am happy and open to discuss tweaking the setup of things. I just don't like mixing the two needlessly. |
Also, I would like to point out that I have not "requested changes" or otherwise "vetoed" this PR. But I also don't feel like approving it. As explained by me in the past, that means that if others feel it should be merged, so be it, I'll live with it. I just don't want to be the one who makes that decision. |
@fingolfin this is a useful discussion. It's worth a modest amount of time to get the best code in place. I'm in no sense annoyed. Just wanted your input on what is the best thing to do. The test in If we believe that |
First off, I am glad to hear you are not annoyed, because I truly and honestly do not want to annoy you, and of course I want the bug fix (and after all, we can change any change this PR makes now at a later point again). Next point of order: I just checked, no deposited package ever calls Now, it only makes sense to call So one way to view it is that perhaps there should be a generalized way to handle this; a way to specify "the Nth argument of this operation must have property X; if property X is not known, compute it first, before dispatching to any other method; also, if X is One way to do this might perhaps be to write a function one can call to signal this, and that function would then do something similar to But there is another approach to this problem in general, which we use already in plenty places of the library: it is to split the operation in two: one front end function which performs all checks, and the dispatches to the actual function. Which is precisely what Now, the advantage of the first approach is that it avoids the problem where somebody calls the "internal" variant w/o really having ensured all prerequisites are satisfied (though I'd like to point out that in the case at hand, this should not have been necessary anyway, a function which is supposed to return an isomorphism can be expected to return an isomorphism, after all). A major drawback of the first approach is that it cannot actually perform all required checks! Namely, verifying that the images of the homomorphisms are equal cannot be done this way. Thus, the second approach has the advantage that all checks are bundled in one place, and it is arguably easier to understand what's going on (less "magic"). Given that we already are using the second approach here, and that using Finally, completely independent of everything else, I find it odd that |
@stevelinton: @fingolfin's #3485 has been merged, which contains a subset of this PR and fixes #3431. If you want your |
I took the liberty of rebasing this, and fixing typos in the commit message of the remaining commit (that message, however, still needs to be edited further). |
@stevelinton could you please let us know if you have any intention on getting this merged in? Else we can just close it. |
@stevelinton Poke. What should happen with this PR? |
@DominikBernhardt @fingolfin Missed the first poke, sorry. Will try and get to it before the end of this week |
Since some aspects of being a group homomorphism are Properties, not Categories, we need to allow for the chance that some mapping doesn't know it is a homomorphism, but is. This can't happen in a call from SubdirectProduct, but could happen if the operations is ever called from elsewhere.
I've reduced this PR to a very small one that just adds the |
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've read through this thread, and understood the conversation. You make good points @fingolfin, there's certainly many ways in which the whole system can be improved. But for this now-small PR, I'm happy to approve it and get it merged.
(And as you've mentioned before @fingolfin, if it turns out to be a bad idea, we can always make changes in the future).
Description
SubdirectProductOp
methods generally requireIsGroupHomomorphsm
of their third and fourtharguments, but this includes filters which are Properties rather than Categories and may not be known.
This PR Adds a
RedisptachOnCondition
to deal with this, and also adds some family predicates that should make code more robust, and a test.Text for release notes
Fix a bug with in calculating SubdirectProducts which could sometimes fail on valid input.
Further details
Bug was reported by Harry Braden.
Checklist for pull request reviewers
If your code contains kernel C code, run
clang-format
on it; thesimplest way is to use
git clang-format
, e.g. like this (don'tforget to commit the resulting changes):
usage of relevant labels
release notes: not needed
orrelease notes: to be added
bug
orenhancement
ornew feature
stable-4.X
add thebackport-to-4.X
labelbuild system
,documentation
,kernel
,library
,tests
runnable tests
adequate pull request title
well formulated text for release notes
relevant documentation updates
sensible comments in the code