From 43e48f7eba72da929e9ef7a4daa524c718f34c5a Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Wed, 14 Feb 2024 20:34:14 +0000 Subject: [PATCH 1/3] `sage.schemes.generic`: fix docs --- src/sage/schemes/generic/glue.py | 41 ++++++++++++++++++++++++---- src/sage/schemes/generic/homset.py | 28 +++++++++---------- src/sage/schemes/generic/morphism.py | 14 +++++----- src/sage/schemes/generic/point.py | 25 ----------------- src/sage/schemes/generic/scheme.py | 6 ++-- 5 files changed, 60 insertions(+), 54 deletions(-) diff --git a/src/sage/schemes/generic/glue.py b/src/sage/schemes/generic/glue.py index 76bd9a1ab9e..8778800f8c2 100644 --- a/src/sage/schemes/generic/glue.py +++ b/src/sage/schemes/generic/glue.py @@ -16,19 +16,35 @@ class GluedScheme(scheme.Scheme): INPUT: - - ``f`` - open immersion from a scheme U to a scheme - X + - ``f`` - open immersion from a scheme `U` to a scheme + `X` - - ``g`` - open immersion from U to a scheme Y + - ``g`` - open immersion from `U` to a scheme `Y` - OUTPUT: The scheme obtained by gluing X and Y along the open set - U. + OUTPUT: The scheme obtained by gluing `X` and `Y` along the open set + `U`. .. note:: Checking that `f` and `g` are open immersions is not implemented. + + EXAMPLES:: + + sage: R. = QQ[] + sage: S. = R.quotient(x * y - 1) + sage: Rx = QQ["x"] + sage: Ry = QQ["y"] + sage: phi_x = Rx.hom([xbar]) + sage: phi_y = Ry.hom([ybar]) + sage: Sx = Schemes()(phi_x) + sage: Sy = Schemes()(phi_y) + sage: Sx.glue_along_domains(Sy) + Scheme obtained by gluing X and Y along U, where + 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) """ def __init__(self, f, g, check=True): if check: @@ -42,6 +58,21 @@ def __init__(self, f, g, check=True): self.__g = g def gluing_maps(self): + r""" + Return the gluing maps of this glued scheme, i.e. the maps `f` and `g`. + + EXAMPLES:: + sage: S. = R.quotient(x * y - 1) + sage: Rx = QQ["x"] + sage: Ry = QQ["y"] + sage: phi_x = Rx.hom([xbar]) + sage: phi_y = Ry.hom([ybar]) + sage: Sx = Schemes()(phi_x) + sage: Sy = Schemes()(phi_y) + sage: Sxy = Sx.glue_along_domains(Sy) + sage: Sxy.gluing_maps() == (Sx, Sy) + True + """ return self.__f, self.__g def _repr_(self): diff --git a/src/sage/schemes/generic/homset.py b/src/sage/schemes/generic/homset.py index a9a0f0735df..2b36411d3f2 100644 --- a/src/sage/schemes/generic/homset.py +++ b/src/sage/schemes/generic/homset.py @@ -2,13 +2,13 @@ Set of homomorphisms between two schemes For schemes `X` and `Y`, this module implements the set of morphisms -`Hom(X,Y)`. This is done by :class:`SchemeHomset_generic`. +`\mathrm{Hom}(X,Y)`. This is done by :class:`SchemeHomset_generic`. -As a special case, the Hom-sets can also represent the points of a -scheme. Recall that the `K`-rational points of a scheme `X` over `k` -can be identified with the set of morphisms `Spec(K) \to X`. In Sage -the rational points are implemented by such scheme morphisms. This is -done by :class:`SchemeHomset_points` and its subclasses. +As a special case, the Hom-sets can also represent the points of a scheme. +Recall that the `K`-rational points of a scheme `X` over `k` can be identified +with the set of morphisms `\mathrm{Spec}(K) \to X`. In Sage the rational points +are implemented by such scheme morphisms. This is done by +:class:`SchemeHomset_points` and its subclasses. .. note:: @@ -407,12 +407,12 @@ def _element_constructor_(self, x, check=True): # ******************************************************************* class SchemeHomset_points(SchemeHomset_generic): - """ + r""" Set of rational points of the scheme. - Recall that the `K`-rational points of a scheme `X` over `k` can - be identified with the set of morphisms `Spec(K) \to X`. In Sage, - the rational points are implemented by such scheme morphisms. + Recall that the `K`-rational points of a scheme `X` over `k` can be + identified with the set of morphisms `\mathrm{Spec}(K) \to X`. In Sage, the + rational points are implemented by such scheme morphisms. If a scheme has a finite number of points, then the homset is supposed to implement the Python iterator interface. See @@ -659,13 +659,13 @@ def _element_constructor_(self, *v, **kwds): return self.codomain()._point(self, v, **kwds) def extended_codomain(self): - """ + r""" Return the codomain with extended base, if necessary. OUTPUT: The codomain scheme, with its base ring extended to the - codomain. That is, the codomain is of the form `Spec(R)` and + codomain. That is, the codomain is of the form `\mathrm{Spec}(R)` and the base ring of the domain is extended to `R`. EXAMPLES:: @@ -710,8 +710,8 @@ def _repr_(self): return 'Set of rational points of '+str(self.extended_codomain()) def value_ring(self): - """ - Return `R` for a point Hom-set `X(Spec(R))`. + r""" + Return `R` for a point Hom-set `X(\mathrm{Spec}(R))`. OUTPUT: diff --git a/src/sage/schemes/generic/morphism.py b/src/sage/schemes/generic/morphism.py index 4405268fed6..3e4f310d3c8 100644 --- a/src/sage/schemes/generic/morphism.py +++ b/src/sage/schemes/generic/morphism.py @@ -28,12 +28,12 @@ new Hom-set class does not use ``MyScheme._morphism`` then you do not have to provide it. -Note that points on schemes are morphisms `Spec(K)\to X`, too. But we -typically use a different notation, so they are implemented in a -different derived class. For this, you should implement a method +Note that points on schemes are morphisms `\mathrm{Spec}(K)\to X`, too. But we +typically use a different notation, so they are implemented in a different +derived class. For this, you should implement a method -* ``MyScheme._point(*args, **kwds)`` returning a point, that is, - a morphism `Spec(K)\to X`. Your point class should derive from +* ``MyScheme._point(*args, **kwds)`` returning a point, that is, a morphism + `\mathrm{Spec}(K)\to X`. Your point class should derive from :class:`SchemeMorphism_point`. Optionally, you can also provide a special Hom-set for the points, for @@ -1790,11 +1790,11 @@ def __init__(self, X): ############################################################################ class SchemeMorphism_point(SchemeMorphism): - """ + r""" Base class for rational points on schemes. Recall that the `K`-rational points of a scheme `X` over `k` can - be identified with the set of morphisms `Spec(K) \to X`. In Sage, + be identified with the set of morphisms `\mathrm{Spec}(K) \to X`. In Sage, the rational points are implemented by such scheme morphisms. EXAMPLES:: diff --git a/src/sage/schemes/generic/point.py b/src/sage/schemes/generic/point.py index c65963e3eaa..e85d8218f0d 100644 --- a/src/sage/schemes/generic/point.py +++ b/src/sage/schemes/generic/point.py @@ -227,28 +227,3 @@ def _richcmp_(self, other, op): False """ return richcmp(self.__P, other.__P, op) - -######################################################## -# Points on a scheme defined by a morphism -######################################################## - -def is_SchemeRationalPoint(x): - return isinstance(x, SchemeRationalPoint) - -class SchemeRationalPoint(SchemePoint): - def __init__(self, f): - """ - INPUT: - - - - ``f`` - a morphism of schemes - """ - SchemePoint.__init__(self, f.codomain(), parent=f.parent()) - self.__f = f - - def _repr_(self): - return "Point on %s defined by the morphism %s" % (self.scheme(), - self.morphism()) - - def morphism(self): - return self.__f diff --git a/src/sage/schemes/generic/scheme.py b/src/sage/schemes/generic/scheme.py index 25a67a2c4c4..dc98baed5c7 100644 --- a/src/sage/schemes/generic/scheme.py +++ b/src/sage/schemes/generic/scheme.py @@ -77,7 +77,7 @@ class Scheme(Parent): sage: ProjectiveSpace(4, QQ).category() Category of schemes over Rational Field - There is a special and unique `Spec(\ZZ)` that is the default base + There is a special and unique `\mathrm{Spec}(\ZZ)` that is the default base scheme:: sage: Spec(ZZ).base_scheme() is Spec(QQ).base_scheme() @@ -267,7 +267,7 @@ def __call__(self, *args): @cached_method def point_homset(self, S=None): - """ + r""" Return the set of S-valued points of this scheme. INPUT: @@ -276,7 +276,7 @@ def point_homset(self, S=None): OUTPUT: - The set of morphisms `Spec(S)\to X`. + The set of morphisms `\mathrm{Spec}(S) \to X`. EXAMPLES:: From bacf72895e259398481a075ce0be223d23866846 Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Thu, 15 Feb 2024 08:46:59 +0000 Subject: [PATCH 2/3] =?UTF-8?q?apply=20review=20changes=20=F0=9F=93=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sage/schemes/generic/glue.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/generic/glue.py b/src/sage/schemes/generic/glue.py index 8778800f8c2..38a17c0d78b 100644 --- a/src/sage/schemes/generic/glue.py +++ b/src/sage/schemes/generic/glue.py @@ -16,16 +16,16 @@ class GluedScheme(scheme.Scheme): INPUT: - - ``f`` - open immersion from a scheme `U` to a scheme + - ``f`` -- open immersion from a scheme `U` to a scheme `X` - - ``g`` - open immersion from `U` to a scheme `Y` + - ``g`` -- open immersion from `U` to a scheme `Y` OUTPUT: The scheme obtained by gluing `X` and `Y` along the open set `U`. - .. note:: + .. NOTE:: Checking that `f` and `g` are open immersions is not implemented. @@ -62,6 +62,7 @@ def gluing_maps(self): Return the gluing maps of this glued scheme, i.e. the maps `f` and `g`. EXAMPLES:: + sage: S. = R.quotient(x * y - 1) sage: Rx = QQ["x"] sage: Ry = QQ["y"] From 4d248d9285030e8631bd532977f019b35a4ae4af Mon Sep 17 00:00:00 2001 From: Gareth Ma Date: Mon, 26 Feb 2024 04:28:51 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=8E=89=20fix=20failing=20doctests=20?= =?UTF-8?q?=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sage/schemes/generic/glue.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sage/schemes/generic/glue.py b/src/sage/schemes/generic/glue.py index 38a17c0d78b..e70aafa0507 100644 --- a/src/sage/schemes/generic/glue.py +++ b/src/sage/schemes/generic/glue.py @@ -63,6 +63,7 @@ def gluing_maps(self): EXAMPLES:: + sage: R. = QQ[] sage: S. = R.quotient(x * y - 1) sage: Rx = QQ["x"] sage: Ry = QQ["y"]