-
Notifications
You must be signed in to change notification settings - Fork 129
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
compose(f,g)
is inconsistent
#690
Comments
Discussed with @fieker and I think we agree that |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
... such that `compose(f, g)` maps `x` to `g(f(x))`. As is stated in the discussion of issue #690, the definition from [the AbstractAlgebra manual section for the Map interface](https://oscar-system.github.io/Oscar.jl/dev/AbstractAlgebra/map_interface/#Composition-of-maps) should be used consistently.
This is now fixed for (GAP) groups, by PR #1038. |
... such that `compose(f, g)` maps `x` to `g(f(x))`. As is stated in the discussion of issue oscar-system#690, the definition from [the AbstractAlgebra manual section for the Map interface](https://oscar-system.github.io/Oscar.jl/dev/AbstractAlgebra/map_interface/#Composition-of-maps) should be used consistently.
citing @fieker from slack:
|
Nemocas/Nemo.jl#1521 implements the changes proposed here for all remaining Nemo types. But it still has the same seriousness of breaking a lot of stuff as Nemocas/AbstractAlgebra.jl#1025 for PolyElem and RelSeriesElem. How to proceed here?
|
Since it is called polynomial composition, I would prefer to keep One option to go forward would be to
This is the only thing I could come up with. |
After the discussions we had a while ago, the following is the best I can come up with:
We have dallied over this quite a bit, so unfortunately 2. would not finish before 1.0. On ther other hand, we can also just promote Any comments @fingolfin @fieker? |
On Sat, Dec 30, 2023 at 10:49:04AM -0800, Tommy Hofmann wrote:
After the discussions we had a while ago, the following is the best I can come up with:
1. Turn `compose(f::PolyElem, g::PolyElem)` into `compose(f::PolyElem, g::PolyElem; side)` with a *mandatory* keyword argument. Similar for the other problematic method. Maybe we could also introduce a `_compose` with the right behaviour that we can use internally (or whatever name we settle on. I don't care too much).
2. Wait a few years.
3. Add the default keyword.
4. Profit.
We have dallied over this quite a bit, so unfortunately 2. would not finish before 1.0. On ther other hand, we can also just promote `f(g)` resp. `g(f)` over `compose` both in our code as well as in the documentation.
I don't like compose, but I guess it is a fixture in the literature. I'm
in favour of
f(g)
evaluate(f, g)
but also: polynomials are not maps, hence bahaviour can be different
from maps.
I'd go with 1 and the f(g) overload
…
Any comments @fingolfin @fieker?
--
Reply to this email directly or view it on GitHub:
#690 (comment)
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
- First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking]
- First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking]
- First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword `inner = :first/:second` argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking]
- First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword `inner = :first/:second` argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking]
* fix: make compose do what it says - First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword `inner = :first/:second` argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking] * chore: bump to 0.39.0
* fix: make compose do what it says - First step at resolving oscar-system/Oscar.jl#690 - Introduce a mandatory keyword `inner = :first/:second` argument for compose(f, g) and add a hint for f(g)/g(f) syntax. [breaking] * chore: bump to 0.39.0
We need to settle what that means, ensure it is implemented consistently everywhere, and documented clearly.
There are two choices how to interpret it, both are natural in some settings but not in others:
compose(f,g)(x) = f(g(x))
is compatible with left application of functions and matches Julia's\circ
operator, which satisfies(f ∘ g)(x) = f(g(x))
; this is what textbooks use nowadayscompose(f,g)(x) = g(f(x))
is compatible with right application of functions (sof(x) = x^f
and thenx^{compose(f,g)} = (x^f)^g
); for this composition I have often seen the convention to denote it byf g
(juxtaposition), sometimes alsof \cdot g
orf * g
) -- this is by the way historically the older notation, and e.g. group theorists still use it a lotBut in Oscar, what
compose
does differs by type, which is bad. We need to settle on one and implement it uniformly. I'll try to sum up the state below; I only looked at the written documentation for this, though; what is actually implemented might differ yet again...Places that say
compose(f,g) = g(f(x) = (x^f)^g
:f*g
as a shorthand for that (remember thatf\circ g
already exists as shorthand for "the other order" in Julia, at least for functions; IMHO it would make sense to also implement it for OSCAR stuff, for consistency, but that's a separate issue)compose
forAlgHom{T}
compose
forAbsSpaceMor
in Hecke.jlPlaces that say
compose(f,g) = f(g(x) = (x^g)^f
:compose
forPolyElem
in AAcompose
forRelSeriesElem
in AA(now fixed via PR changedcompose
for (GAP) groups in Oscarcompose
insrc/Groups
... #1038)Since the AA documentation is quite explicit on this, I tend to say we should follow it; what worries me is that some docstrings in AA claim to do it the other way around; but perhaps the doc strings are wrong?
Besides settling this, I think it'd be a great thing to have a conformance test for, though I am not sure how to best to arrange for it.
CC @wbhart @thofma @fieker
The text was updated successfully, but these errors were encountered: