-
-
Notifications
You must be signed in to change notification settings - Fork 565
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
Creating a polynomial ring over a number field results in a non-unique polynomial ring over the rationals #11780
Comments
comment:1
I suggest to call the polynomial ring constructor (which might actually be a little faster, since it is cached) and to catch the |
comment:2
I did not run tests yet, and I am not able to provide a doc test that shows that the bug is fixed. But it turns out that the patch that I just attached solves the problem I met while working at #10667, and thus I change it into "needs review". The problem was as follows. Let
|
Author: Simon King |
comment:3
Why would |
comment:4
Replying to @malb:
The I was thinking about future developments. Imaging that someone plays with the polynomial ring constructor, such that a completely different class of polynomial rings would be returned. In that case, the attempt to assign the ring to the cdef variable k of type |
comment:5
Ah, got it. Thanks, that makes sense. The patch reads good, I haven't applied & tested it though. |
comment:6
Doctests pass. However, I gave the TypeError thing another thought. If somebody changes the class for polynomials over the base field (prime field or rational field), couldn't that again lead to problems with non-identical parents? I.e. should we cause the TypeError such that future developers will note there's a potential problem? |
comment:7
I fixed another bug caused by a rogue creation of a polynomial ring: It was in the numerator() method of libsingular polynomials. The patch, that I updated a few seconds ago, contains a new doctest:
The last answer was |
comment:8
Replying to @malb:
Sorry, I saw your answer only now. Yes, on second thought, it seems reasonable to not catch the type error. I am sorry that our messages crossed (I have updated my patch, it now contains a second fix and one doctest). I will remove catching the type error in a minute. |
comment:9
Also, small typo at the end of this line:
:) |
comment:10
I removed the typo (actually it is not a typo but a mark, in order to more easily find the spot that I was working on). I am still catching the type error, but am re-raising it with an error message that is hopefully clear enough. Well, hopefully nobody will ever see it... |
comment:11
The patchbot does not find actual errors (even though the blob is yellow). Review, anyone? |
comment:12
Martin, do you think you find the time to complete your review? |
Dependencies: #11339 |
comment:13
I'll have to rebase, because #11339 (which is merged) creates a conflict. |
Work Issues: rebase |
Attachment: trac11780_unique_auxiliar_polyring.patch.gz Avoid the creation of a non-unique auxiliary polynomial ring in singular_ring_new and in MPolynomial_libsingular.numerator |
Changed work issues from rebase to none |
comment:15
Done! |
comment:16
This looks fine to me, and all tests pass under 4.8.alpha5. |
Reviewer: Martin Albrecht, David Loeffler |
Merged: sage-5.0.beta1 |
The problem is the following code in
sage.libs.singular.ring.singular_ring_new
:Hence, a multivariate libsingular polynomial ring is constructed without using the (cached) polynomial ring constructor. The comment should rather not be "This is lazy,..." but "This is dangerous, it should only call polynomial ring constructor stuff, not MPolynomial stuff".
I am trying to find an example in unpatched Sage where this is actually a problem. However, while working at #10667, the non-unique parents led to several hundred doctest errors in elliptic curves.
Depends on #11339
CC: @malb
Component: coercion
Keywords: non-unique polynomial ring number field
Author: Simon King
Reviewer: Martin Albrecht, David Loeffler
Merged: sage-5.0.beta1
Issue created by migration from https://trac.sagemath.org/ticket/11780
The text was updated successfully, but these errors were encountered: