Opened 9 years ago
Last modified 5 weeks ago
#15248 needs_work defect
Calling a lazy power series ring twice summons demons from hell
Reported by: | Darij Grinberg | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | coercion | Keywords: | coercion, LazyPowerSeries |
Cc: | Simon King, Martin Rubey | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
sage: R = LazyPowerSeriesRing(QQ) sage: x = R.gen() sage: x x sage: M = Matrix(R, [[x, x], [1, x]]) sage: M.det() Uninitialized lazy power series
Sounds good so far. Now let's do this all again, in the same session:
sage: R = LazyPowerSeriesRing(QQ) sage: x = R.gen() sage: x x sage: M = Matrix(R, [[x, x], [1, x]]) sage: M.det() --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-10-90e0c7c30c91> in <module>() ----> 1 M.det() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.det (sage/matrix/matrix2.c:10774)() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.determinant (sage/matrix/matrix2.c:8701)() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.RingElement.__mul__ (sage/structure/element.c:14531)() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7330)() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.canonical_coercion (sage/structure/coerce.c:8800)() /home/darij/sage-5.12.beta5/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps._coercion_error (sage/structure/coerce.c:14607)() RuntimeError: There is a bug in the coercion code in Sage. Both x (=1) and y (=x) are supposed to have identical parents but they don't. In fact, x has parent 'Lazy Power Series Ring over Rational Field' whereas y has parent 'Lazy Power Series Ring over Rational Field' Original elements 1 (parent Lazy Power Series Ring over Rational Field) and x (parent Lazy Power Series Ring over Rational Field) and maps <type 'NoneType'> None <type 'sage.categories.morphism.CallMorphism'> Call morphism: From: Lazy Power Series Ring over Rational Field To: Lazy Power Series Ring over Rational Field
This error does not persist if I set M to be Matrix(R, [[x, x], [x, x]])
instead, so the coercion of 1 from integers to lazy power series seems to trigger the issue.
Change History (13)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 9 years ago by
comment:4 Changed 9 years ago by
Just saw this ticket by chance: funniest title ever :-) I should try that to my own tickets too...
comment:5 Changed 9 years ago by
Cc: | Martin Rubey added |
---|---|
Keywords: | LazyPowerSeries added; lazy-power-series removed |
comment:6 Changed 9 years ago by
This can be fixed by moving LazyPowerSeriesRing? over to the new parent framework. I'll do this this evening.
comment:8 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:9 Changed 9 years ago by
Milestone: | sage-6.2 → sage-6.3 |
---|
comment:10 Changed 8 years ago by
Milestone: | sage-6.3 → sage-6.4 |
---|
comment:11 Changed 2 months ago by
Milestone: | sage-6.4 → sage-duplicate/invalid/wontfix |
---|---|
Status: | new → needs_review |
This works now, since #32367.
comment:13 Changed 5 weeks ago by
Status: | needs_review → needs_work |
---|
This isn't something specific to lazy power series, it is an issue for any ring where we can have equal-but-not-identical instances as per Nil's comment:2. We just need to find another instance of this with a different base ring.
Classic example of constructing "unique" objects over "non-identical-but-equal" bases. Excellent find! It's well-known this is bound to give problems, but I'm not sure we had such a clear example yet.
Since
R==S
, the construction ofMS
will return MR again. SoMS
hasR
as a base, notS
:After this it's unavoidable:
and you're hitting a more insidious form with