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 construct homset of elliptic curve in Sets() #39051

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/sage/schemes/elliptic_curves/ell_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,12 +1150,23 @@ def _Hom_(self, other, category=None):
sage: E = EllipticCurve(GF(19), [1,0])
sage: type(E._Hom_(E))
<class 'sage.schemes.elliptic_curves.homset.EllipticCurveHomset_with_category'>

TESTS::

sage: E.Hom(E, Sets())
Set of Morphisms from Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 19 to Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 19 in Category of sets
sage: E.Hom(E, Sets())(lambda x: x + E(3, 7))(E(4, 7))
(12 : 12 : 1)
"""
if isinstance(other, ell_generic.EllipticCurve_generic) and self.base_ring() == other.base_ring():
from . import homset
return homset.EllipticCurveHomset(self, other, category=category)
from sage.schemes.generic.homset import SchemeHomset_generic
return SchemeHomset_generic(self, other, category=category)
from sage.categories.schemes import Schemes
if category is None or category.is_subcategory(Schemes()):
if isinstance(other, ell_generic.EllipticCurve_generic) and self.base_ring() == other.base_ring():
from . import homset
return homset.EllipticCurveHomset(self, other, category=category)
from sage.schemes.generic.homset import SchemeHomset_generic
return SchemeHomset_generic(self, other, category=category)
from sage.categories.homset import Homset
return Homset(self, other, category=category)

def isogeny(self, kernel, codomain=None, degree=None, model=None, check=True, algorithm=None, velu_sqrt_bound=None):
r"""
Expand Down
14 changes: 14 additions & 0 deletions src/sage/schemes/generic/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ class GluedScheme(Scheme):
X: Spectrum of Univariate Polynomial Ring in x over Rational Field
Y: Spectrum of Univariate Polynomial Ring in y over Rational Field
U: Spectrum of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x*y - 1)

TESTS::

sage: S = Sx.glue_along_domains(Sy)
sage: S.base_ring()
Integer Ring
sage: S.category()
Category of schemes
"""
def __init__(self, f, g, check=True):
if check:
Expand All @@ -55,6 +63,12 @@ def __init__(self, f, g, check=True):
raise ValueError("f (=%s) and g (=%s) must have the same domain" % (f,g))
self.__f = f
self.__g = g
category = f.codomain().category()._meet_(g.codomain().category())
from sage.structure.element import get_coercion_model
base_ring = get_coercion_model().common_parent(
f.codomain().base_ring(), g.codomain().base_ring())
Scheme.__init__(self, None, category)
self._base_ring = base_ring

def gluing_maps(self):
r"""
Expand Down
19 changes: 18 additions & 1 deletion src/sage/schemes/generic/homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,32 @@ class SchemeHomset_generic(HomsetWithBase):

sage: from sage.schemes.generic.homset import SchemeHomset_generic
sage: A2 = AffineSpace(QQ,2)
sage: Hom = SchemeHomset_generic(A2, A2); Hom
sage: Hom = A2.Hom(A2); Hom
Set of morphisms
From: Affine Space of dimension 2 over Rational Field
To: Affine Space of dimension 2 over Rational Field
sage: Hom.category()
Category of endsets of schemes over Rational Field

TESTS::

sage: Hom = SchemeHomset_generic(A2, A2); Hom
Set of morphisms
From: Affine Space of dimension 2 over Rational Field
To: Affine Space of dimension 2 over Rational Field
sage: Hom = SchemeHomset_generic(A2, A2, Sets())
Traceback (most recent call last):
...
ValueError: Cannot create SchemeHomset with category = Category of sets. Consider using Homset instead
"""
Element = SchemeMorphism

def __init__(self, X, Y, category=None, check=True, base=None):
super().__init__(X, Y, category, check, base)
from sage.categories.schemes import Schemes
if check and category is not None and not category.is_subcategory(Schemes()):
raise ValueError(f"Cannot create SchemeHomset with category = {category}. Consider using Homset instead")

def __reduce__(self):
"""
Used in pickling.
Expand Down
Loading