-
Notifications
You must be signed in to change notification settings - Fork 64
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
Revise check_parent for ResElem and ResFieldElem #1741
Conversation
Also remove check_parent_type. Previously, we allowed binary operations involving two ResElem instances of *different type*, with the type of the result depending on the argument order. For example, this: julia> using Nemo julia> R = quo(ZZ, 2)[1] Integers modulo 2 julia> S = Nemo.AbstractAlgebra.EuclideanRingResidueRing{UInt}(UInt(2)) Residue ring of integers modulo 2 julia> typeof(R) zzModRing julia> typeof(S) EuclideanRingResidueRing{UInt64} julia> S(1) + R(1) 0 julia> typeof(S(1) + R(1)) EuclideanRingResidueRingElem{UInt64} julia> typeof(R(1) + S(1)) zzModRingElem But this seems questionable at best. I think we are better of forbidding this -- which this PR effectively does.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1741 +/- ##
==========================================
- Coverage 87.39% 87.39% -0.01%
==========================================
Files 117 117
Lines 29929 29927 -2
==========================================
- Hits 26157 26155 -2
Misses 3772 3772 ☔ View full report in Codecov by Sentry. |
The notebook works (errors in the expected way) with this pull request and then the Nemo one seems not necessary? |
I think the Nemo one still makes sense independently of this one here, which is why I submitted both. Also, for this one it is not quite clear to me why we treat residue rings different from other kinds of rings, where we insist on equality for parents. Why do we make an exception here? |
I agree that it should just be removed. |
P.S.: What is the difference of the proposed change and |
The difference is that if you now created two different (non-cached) but mathematically equal residue rings we still allow adding their elements. Unlike basically any other kind of ring, I think? If you know ask "but why do we want that?" then all I can say "I have no idea" -- personally I'd be happy to just require BTW I could see an argument for supporting this for parents that have same type but different modulus, if one modulus divides the other (but not the other way around) -- then there is a somewhat natural interpretation (the result is defined over the ring with the "smaller" modulus). Personally I am not a fan, I'd prefer explicit coercion in this case, too, but I could understand if someone would like this because they need it all the time shrug |
No clue why we did it back then. Ideally it is just |
Also remove check_parent_type.
Previously, we allowed binary operations involving two ResElem instances of different type, with the type of the result depending on the argument order. For example, this (requires Nemocas/Nemo.jl#1819):
But this seems questionable at best. I think we are better of forbidding this -- which this PR effectively does.
However, I am sure people had a reason to add the code I am modifying here in the first place. So this definitely shouldn't be merged before hearing from at least @fieker and @thofma who probably know more about the background of this than I do.
Like Nemocas/Nemo.jl#1819 this also fixes the "introduction" notebook of the OSCAR book.