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 has_right/left_descents in Weyl group code #15456
Comments
comment:1
Hi Mike! This is not a bug but a feature :-) When implementing a Coxeter group one can choose to either implement has_right_descent or has_left_descent (or both), and the Coxeter group category provides a default implementation for the other, if needed. Granted, it would be nice if there was a nicer error message mentionning that at least one of has_left_descent or has_right_descent should be implemented. However, at this point, we have not generic infrastructure for this kind of situation, and it would be a bit tedious to do it by hand (but ideas on how to handle this are welcome!). Cheers, |
comment:2
Hi Nicolas, This can't be a feature. In In |
comment:3
BTW, in |
comment:4
Right. The proper specification is:
This definitely should be put in the doc if not yet there. |
comment:5
I take the part about it being correct in I assume that you are right in that "Coxeter group category provides a default implementation for the other" but no one has implemented Is the correct solution then that (1) someone needs to implement them for each of the types (2) that the default implementation should be (3) the default implementation of (4) something else? |
comment:7
Here is a possible solution. Please review. New commits:
|
Commit: |
Branch: u/chapoton/15456 |
Author: Frédéric Chapoton |
comment:8
I think what we should do is have |
comment:9
Indeed ? well, please do that if you think this is the thing to do. |
comment:10
tscrim: That's what WAS happening, but if you instantiate an abstract Weyl Group or Coxeter Group it leads to an infinite loop, which is a bug. What we need is a NotImplemented error if neither side is implemented, and the appropriate call to the implemented 'side' if one side or the other is concretely implemented but not the other. I see two possible ways forward:
Option 2 seems doable but introduces an Obscure Thing for the implementers of Coxeter groups to keep track of. As such, I would advocate for Option 1. |
comment:11
It's also worth noting that sometimes one 'side' or the other is simply faster for computing descents. This is clearly true for simple permutations: one can check in constant time if there's a right descent, but it takes O(n) to check for a left descent. So then it would be bad news bears to have a default implementation of the right descent that calls the left decent. But in other cases, it's maybe the left descent that's faster to compute, so you wouldn't want the reverse situation, either... So I think I would advocate against breaking symmetry at the Category level, and just raise NotImplemented errors for both sides. |
comment:12
I do not understand why my solution is not good enough. From my point of view, the function |
comment:13
Hey Tom, If we made both left/right
would be satisfied in my proposal. Although I think we could do a modified version of your proposal 1) by implementing some kind of modification to
where if |
comment:14
Replying to @fchapoton:
The |
comment:15
I couldn't find an indication that the documentation specifies that at least one of has_descent / has_right_descent / has_left_descent should be implemented. Instead it seems to be that the default implementation of Maybe we should throw checks in |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:17
Here is new (better) proposal: The main idea is "please never override has_descent" and "please implement either has_left_descent or has_right_descent" in every instance (if only as a place holder raising In
In instances of Coxeter group, one implements either has_left_descent or has_right_descent or both. Even in a minimalistic way, raising a What do you think ? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:19
I think this is a good solution and probably what was intended to happen when the |
Changed branch from u/chapoton/15456 to public/15456 |
New commits:
|
comment:33
Replying to @zabrocki:
I am ok with Federic's solution. All tests pass, so I think this should go in. |
comment:34
Anne looked at the code as well. We both approve and I am setting to positive review. |
Reviewer: Anne Schilling, Mike Zabrocki |
comment:35
This will conflict will #18610 and is probably a duplicate. The review is coming too late. This need to be checked, nevertheless. |
Changed keywords from coxeter to coxeter, sd65 |
comment:39
ok, let us consider that this has been solved by #18610 |
comment:40
Replying to @fchapoton:
Why are you setting it to positive review then and not leave it at sage-duplicate? |
comment:41
This is 'positive review as a duplicate', the usual standard procedure, so that it can be closed! |
The
has_right_descents
method inWeylGroup
element methods callshas_left_descents
and vice versa. This causes an error in the following example.The doc tests for this method make calls to
CoxeterGroup
code to test it and so all tests pass.CC: @sdenton4 @anneschilling @nthiery @sagetrac-sage-combinat
Component: combinatorics
Keywords: coxeter, sd65
Author: Frédéric Chapoton
Branch/Commit: public/15456 @
45ff0e3
Reviewer: Anne Schilling, Mike Zabrocki
Issue created by migration from https://trac.sagemath.org/ticket/15456
The text was updated successfully, but these errors were encountered: