Skip to content
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 coercions and pushout for Laurent series #24431

Closed
videlec opened this issue Dec 26, 2017 · 35 comments
Closed

Fix coercions and pushout for Laurent series #24431

videlec opened this issue Dec 26, 2017 · 35 comments

Comments

@videlec
Copy link
Contributor

videlec commented Dec 26, 2017

There should be an automatic extension of scalars in the following situation

sage: R.<x> = LaurentSeriesRing(QQ)
sage: QQbar.gen() * x
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for *: 'Algebraic Field' and
'Laurent Series Ring in x over Rational Field'

To be compared with

sage: R.<x> = PowerSeriesRing(QQ)
sage: QQbar.gen() * x
I*x
sage: parent(_)
Power Series Ring in x over Algebraic Field

Currently, these pushouts are allowed:

sage: x = LaurentSeriesRing(QQ, 'x').gen()
sage: y = PolynomialRing(QQ, 'y').gen()
sage: x * y
x*y
sage: parent(x * y)
Univariate Polynomial Ring in y over
Laurent Series Ring in x over Rational Field

This is inconsistent with PowerSeriesRing.

By fixing these problems, we had to adapt some code in sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py that was using the aforementioned pushout.

Depends on #24420

Component: algebra

Author: Vincent Delecroix

Branch/Commit: 8abc33b

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/24431

@videlec videlec added this to the sage-8.2 milestone Dec 26, 2017
@videlec
Copy link
Contributor Author

videlec commented Dec 26, 2017

Branch: u/vdelecroix/24431

@videlec
Copy link
Contributor Author

videlec commented Dec 26, 2017

New commits:

f779b1024420: clean laurent series
eb2bba424431: pushout for Laurent series

@videlec
Copy link
Contributor Author

videlec commented Dec 26, 2017

Commit: eb2bba4

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 26, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1adb84c24420: clean laurent series
27f324e24431: pushout for Laurent series

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 26, 2017

Changed commit from eb2bba4 to 27f324e

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

cdf836a24420: clean laurent series
00deb2724431: pushout for Laurent series

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Changed commit from 27f324e to 00deb27

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Changed commit from 00deb27 to c905ee9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

f95f61e24413: make polynomial rings know that they are infinite
c905ee924413: base ring = 0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

cdf836a24420: clean laurent series
00deb2724431: pushout for Laurent series

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 28, 2017

Changed commit from c905ee9 to 00deb27

@videlec

This comment has been minimized.

@videlec videlec changed the title Pushout for Laurent series Fix coercions and pushout for Laurent series Dec 31, 2017
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2017

Changed commit from 00deb27 to 1b1bbbc

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2017

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1b1bbbc24431: Laurent series pushout and coercions

@videlec

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

34769e124420: clean laurent series
b3f11d924431: Laurent series pushout and coercions

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 2, 2018

Changed commit from 1b1bbbc to b3f11d9

@videlec
Copy link
Contributor Author

videlec commented Jan 2, 2018

comment:10

rebased on 8.2.beta2

@tscrim
Copy link
Collaborator

tscrim commented Jan 2, 2018

comment:11

LGTM except I don't understand the non-import changes in schemes/hyperelliptic_curves/hyperelliptic_generic.py. (Also, is LaurentPolynomialRing is not used in that file.)

@videlec
Copy link
Contributor Author

videlec commented Jan 3, 2018

comment:12

Replying to @tscrim:

LGTM except I don't understand the non-import changes in schemes/hyperelliptic_curves/hyperelliptic_generic.py. (Also, is LaurentPolynomialRing is not used in that file.)

I believe you refer to this line

-    L = PolynomialRing(self.base_ring(),'x')
+    L = PolynomialRing(K,'x')

This is the third point in the ticket description.

@tscrim
Copy link
Collaborator

tscrim commented Jan 3, 2018

comment:13

I understand now the reason why that change is needed. Thanks. (Although I don't quite understand why that pushout is no longer allowed, but that's okay.)

Just remove the unneeded import of LaurentPolynomialRing and the \'s here

@@ -410,7 +565,11 @@ class LaurentSeriesRing_generic(UniqueRepresentation, ring.CommutativeRing):
 
         from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
         from sage.rings.power_series_ring import is_PowerSeriesRing
-        if ((is_LaurentSeriesRing(P) or is_PowerSeriesRing(P) or is_PolynomialRing(P))
+        from sage.rings.polynomial.laurent_polynomial_ring import is_LaurentPolynomialRing
+        if ((is_LaurentSeriesRing(P) or \
+             is_LaurentPolynomialRing(P) or \
+             is_PowerSeriesRing(P) or \
+             is_PolynomialRing(P))
             and P.variable_name() == self.variable_name()
             and A.has_coerce_map_from(P.base_ring())):
             return True

and you can set a positive review on my behalf.

@tscrim

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented Jan 3, 2018

Reviewer: Travis Scrimshaw

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2018

Changed commit from b3f11d9 to de63301

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

de6330124431: unneeded '\' and more tests

@videlec
Copy link
Contributor Author

videlec commented Jan 3, 2018

comment:15

I did not find the import you were talking about in [comment:13].

@tscrim
Copy link
Collaborator

tscrim commented Jan 3, 2018

comment:16
diff --git a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py
index cdca282..9e9897a 100644
--- a/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py
+++ b/src/sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py
@@ -33,7 +33,11 @@ from __future__ import absolute_import
 #                  http://www.gnu.org/licenses/
 #*****************************************************************************
 
-from sage.rings.all import PolynomialRing, RR, PowerSeriesRing, LaurentSeriesRing, O
+from sage.rings.polynomial.all import PolynomialRing, LaurentPolynomialRing
+from sage.rings.big_oh import O
+from sage.rings.power_series_ring import PowerSeriesRing
+from sage.rings.laurent_series_ring import LaurentSeriesRing
+from sage.rings.real_mpfr import RR
 from sage.functions.all import log
 from sage.structure.category_object import normalize_names
 

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

cd4b48524431: remove unused import

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 3, 2018

Changed commit from de63301 to cd4b485

@mezzarobba
Copy link
Member

comment:18

Looks like there is a test failure since 8.2.beta3.

@tscrim
Copy link
Collaborator

tscrim commented Jan 30, 2018

comment:19

It is trivial due to the output of the functor. Once fixed, you can set a positive review on my behalf.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 30, 2018

Changed commit from cd4b485 to 8abc33b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 30, 2018

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

8abc33b24431: Laurent series pushout and coercions

@videlec
Copy link
Contributor Author

videlec commented Jan 30, 2018

comment:21

Rebased on beta4. Waiting for patchbots as an extra check.

@vbraun
Copy link
Member

vbraun commented Feb 2, 2018

Changed branch from u/vdelecroix/24431 to 8abc33b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants