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
Default of Coxeter group methods is right but reflection group can be left #23299
Comments
This comment has been minimized.
This comment has been minimized.
comment:1
IMO, this is very subtle bug and could require some extra care to make sure we don't have it crop up again. I'm not sure what the best way forward is. Here are some thoughts:
We do not really want to do (2) because that would slow down the multiplication code for the reflection groups, which the whole point is basically to be fast on those operations. I'm somewhat in favor of (1) because it solves the problem at hand and basically everything else makes you choose a side. We might also want to consider implementing a more efficient |
comment:2
Thanks Travis for your comments. My perspective is roughly the same: To guarantee correct code, the behavior of all methods shall be consistent across all implementations. This implies:
That being said, it could indeed make sense to (eventually) introduce some attribute |
Author: Travis Scrimshaw |
Commit: |
comment:3
Here is a version that uses a default attribute New commits:
|
comment:4
Hi Travis! I haven't yet been through your patch. Just in case, see my comment above: I believe the default side should really be the same for all implementations. Cheers, |
comment:5
I am -1 because some implementations are designed to work on the left and some on the right. It would require much deeper changes in order to get that, and even still, I am not sure we should favor one side over the other. |
comment:6
I don't want this to happen for reflection groups. I indeed believe it is a big misinterpretation that sage structures should behave similarly! Let me elaborate this a little too much: As soon as you write a math paper that uses concepts from different areas (especially in combinatorics) you realize that it is super hard to get the different needed notions into a common framework and to choose notions and options in a consistent way. What I usually see is that for some aspects, one choice is better and for different aspects a different choice is better and that there is no "best global choice" for notions and options. And this is only a single math paper! Sage (or a big portion of the developers) now wants to streamline notions over much bigger parts of math -- I consider this an impossible task and indeed a false believe. For example, the reflection groups are implemented as permutations groups and now inherit everything from permutation groups. But most methods are just garbage in this context, completely useless or even provide wrong output (such as stuff that relates group elements to the permutation representation as a permutation group rather than the reflection representation of the reflection group). I think a reflection group is a reflection group and nothing else! Of course, as such it is closely linked to other objects, and one can even think of this one group as other structures. But intrinsically, it is nothing else and all the implicit connections that a human brain can simultaneously handle are doomed to fail if one makes them all explicit for a computer use. |
comment:7
Concretely in the present case, I prefer reflection groups to behave the way Jean Michel and others thought about it in chevie as this is the speed-wise best implementation we currently have. |
comment:8
Replying to @tscrim:
Enabling different defaults in the different implementations is adding one more burden to the writter of generic code: namely being careful to specify the side whenever this is relevant. If we decide to go this way, then we need to proeminently document that, plus prepare for backward compatibility issues (and take responsibility for them), plus check all the existing code for locations where the side is not specified. Unrelated issue: 3fc53c3 is a pain to review, because it mixes a few highly sensitive changes (that requires scrutinizing) to a lot of trivialities (that one can check by just glossing over them). |
comment:9
Replying to @stumpc5:
I can't agree more. Ever since I am touching Sage, I have been And yes, we want to have reflection groups implemented by left actions But here I believe the discussion is orthogonal. The motivation for the change is efficiency: sometimes left descents Having the default value (and therefore the API) depend on the
That is an independent question. The developers of reflections groups I can hear your frustration, but let's not mix all debates. Cheers, |
comment:10
Replying to @nthiery:
Huh? "Preferred" should be the same as "default" (for that implementation). The code is so diffuse that is makes it seem like a lot, but fundamentally only based on two methods: However, I do agree that there is a little more of a burden for someone writing generic code that needs to pass
There should be no backwards incompatibility issues. The default is still right and all methods go to that first. Besides, I really see this more as a bugfix. As I said above, this really only comes down to a few small places.
For some of them, yes. However, many of those changes were useful to me when doing this to simplify my greping and workflow. |
comment:11
Replying to @nthiery:
It is unfair to call this an implementation detail. Really, we are trying to pass (necessary IMO) information up to the generic code for it to use because it is not really generic code because of the default values (or extra assumptions that you would enforce on your concrete classes). While it may be subject to change, having the requirements with a clear idiom means that the person doing the implementation will not care (provided they follow the requirements). Also, as soon as you start talking about speed, you are not really talking about conventions in mathematics (well, for permutations/actions/etc.). So in order to have the code make any sense, we have to take into account the choice of convention. Moreover, it is usually something that cannot be easily changed without doing a large refactoring of the code. |
comment:12
Replying to @nthiery:
Well, it's not too bad :-) And yes, it is technically two debates. But both are under the common roof of how encapsulated/intertwined different but related structures in sage should be. I personally think we spend too much time on the intertwining part that we could instead spend on the quality and speed of individual modules. Let us build individual cutting edge modules (here: on reflection groups) and if this needs other modules, one can either type cast or use APIs. For this reason, I prefer not to streamline default behaviors, though I see that this might be hard to understand for new users. But either way, the behavior should be properly documented. |
comment:13
Argl, I wanted to give a proper answer before taking of for 3-4 days of vacations, but did not get to it. So in very short ... As far as I remember, for all the descent-related methods ( I see Christian's concern, and that's indeed something to keep in mind. Yet I also believe that having a @tscrim: I can see that writing the change all at once was the most practical. But this does not preclude splitting the commit in two, to not impose a burden on the reviewers, and anyone later that will want to investigate exactly what was done at the occasion of a sensitive change. I don't want to hold progress, so think it over, and do what you believe the right thing is. Alternatively, I could have a shot at the "fast_side" approach, but not before FPSAC. Being able to reuse a commit holding just the "trivial changes" would help. Cheers, |
comment:14
Stated otherwise: I prefer an idiom stating explicitly "yes, the side is irrelevant in my context; please use whichever is faster":
Rather than an idiom that implicitly changes semantic depending on W:
Off to canoeing! Cheers, |
comment:16
I hope you had a good time canoeing. Sounds like more fun than dealing with typhoons (well, that was last week for me.) Okay, here is the branch rebased with separate commits that should be correct individually but I didn't bother checking. Nicolas, I think you're being far too precious here. I really don't see any (reasonable) way how you could have something like a "fast"/"preferred" side without fundamentally having to change the default value. This part could be backwards incompatible for anyone who is using subclasses and overwriting some of these methods assuming the input is strictly
This is not true. The only place that explicitly mentioned the default was
This is also not true. The only time the default argument is used for |
comment:17
does not apply |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:20
many failing doctests (but not hopelessly many), see patchbot reports |
Branch pushed to git repo; I updated commit sha1. New commits:
|
The problem manifests itself when computing
bruhat_lower_covers
, wherehas_descent
is localized to use whichever side is better, butfirst_descent
is generic and defaults to the right.This was first noticed on #23297.
CC: @sagetrac-sage-combinat @stumpc5 @nthiery @jplab @darijgr @fchapoton
Component: combinatorics
Keywords: coxeter groups
Author: Travis Scrimshaw
Branch/Commit: public/combinat/left_right_default-23299 @
f25b4e1
Issue created by migration from https://trac.sagemath.org/ticket/23299
The text was updated successfully, but these errors were encountered: