Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/schemes/generic/point.py
4057 views
1
"""
2
Points on schemes
3
"""
4
5
#*******************************************************************************
6
# Copyright (C) 2006 William Stein
7
# Distributed under the terms of the GNU General Public License (GPL)
8
# http://www.gnu.org/licenses/
9
#*******************************************************************************
10
11
from sage.structure.element import Element
12
13
########################################################
14
# Base class for points on a scheme, either topological
15
# or defined by a morphism.
16
########################################################
17
18
class SchemePoint(Element):
19
"""
20
Base class for points on a scheme, either topological or defined
21
by a morphism.
22
"""
23
def __init__(self, S):
24
"""
25
INPUT:
26
27
28
- ``S`` - a scheme
29
30
TESTS::
31
32
sage: from sage.schemes.generic.point import SchemePoint
33
sage: S = Spec(ZZ)
34
sage: P = SchemePoint(S); P
35
Point on Spectrum of Integer Ring
36
"""
37
Element.__init__(self, S.Hom(S))
38
self.__S = S
39
40
def scheme(self):
41
"""
42
Return the scheme on which self is a point.
43
44
EXAMPLES::
45
46
sage: from sage.schemes.generic.point import SchemePoint
47
sage: S = Spec(ZZ)
48
sage: P = SchemePoint(S)
49
sage: P.scheme()
50
Spectrum of Integer Ring
51
"""
52
return self.__S
53
54
def _repr_(self):
55
"""
56
Return a string representation of this generic scheme point.
57
58
TESTS::
59
60
sage: from sage.schemes.generic.point import SchemePoint
61
sage: S = Spec(ZZ)
62
sage: P = SchemePoint(S); P
63
Point on Spectrum of Integer Ring
64
sage: P._repr_()
65
'Point on Spectrum of Integer Ring'
66
"""
67
return "Point on %s"%self.__S
68
69
########################################################
70
# Topological points on a scheme
71
########################################################
72
73
def is_SchemeTopologicalPoint(x):
74
return isinstance(x, SchemeTopologicalPoint)
75
76
class SchemeTopologicalPoint(SchemePoint):
77
pass
78
79
class SchemeTopologicalPoint_affine_open(SchemeTopologicalPoint):
80
def __init__(self, u, x):
81
"""
82
INPUT:
83
84
85
- ``u`` - morphism with domain U an affine scheme
86
87
- ``x`` - point on U
88
"""
89
SchemePoint.__init__(self, u.codomain())
90
self.__u = u
91
self.__x = x
92
93
def _repr_(self):
94
return "Point on %s defined by x in U, where:\n U: %s\n x: %s"%(\
95
self.scheme(), self.embedding_of_affine_open().domain(),
96
self.point_on_affine())
97
98
def point_on_affine(self):
99
"""
100
Return the scheme point on the affine open U.
101
"""
102
return self.__x
103
104
def affine_open(self):
105
"""
106
Return the affine open subset U.
107
"""
108
return self.__u.domain()
109
110
def embedding_of_affine_open(self):
111
"""
112
Return the embedding from the affine open subset U into this
113
scheme.
114
"""
115
return self.__u
116
117
118
class SchemeTopologicalPoint_prime_ideal(SchemeTopologicalPoint):
119
def __init__(self, S, P, check=False):
120
"""
121
INPUT:
122
123
124
- ``S`` - an affine scheme
125
126
- ``P`` - a prime ideal of the coordinate ring of S
127
128
TESTS::
129
130
sage: from sage.schemes.generic.point import SchemeTopologicalPoint_prime_ideal
131
sage: S = Spec(ZZ)
132
sage: P = SchemeTopologicalPoint_prime_ideal(S, 3); P
133
Point on Spectrum of Integer Ring defined by the Principal ideal (3) of Integer Ring
134
sage: SchemeTopologicalPoint_prime_ideal(S, 6, check=True)
135
Traceback (most recent call last):
136
...
137
ValueError: The argument Principal ideal (6) of Integer Ring must be a prime ideal of Integer Ring
138
sage: SchemeTopologicalPoint_prime_ideal(S, ZZ.ideal(7))
139
Point on Spectrum of Integer Ring defined by the Principal ideal (7) of Integer Ring
140
141
We define a parabola in the projective plane as a point
142
corresponding to a prime ideal::
143
144
sage: P2.<x, y, z> = ProjectiveSpace(2, QQ)
145
sage: SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2)
146
Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field
147
"""
148
R = S.coordinate_ring()
149
from sage.rings.ideal import Ideal
150
P = Ideal(R, P)
151
# ideally we would have check=True by default, but
152
# unfortunately is_prime() is only implemented in a small
153
# number of cases
154
if check and not P.is_prime():
155
raise ValueError, "The argument %s must be a prime ideal of %s"%(P, R)
156
SchemeTopologicalPoint.__init__(self, S)
157
self.__P = P
158
159
def _repr_(self):
160
"""
161
Return a string representation of this scheme point.
162
163
TESTS::
164
165
sage: from sage.schemes.generic.point import SchemeTopologicalPoint_prime_ideal
166
sage: P2.<x, y, z> = ProjectiveSpace(2, QQ)
167
sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2); pt
168
Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field
169
sage: pt._repr_()
170
'Point on Projective Space of dimension 2 over Rational Field defined by the Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field'
171
"""
172
return "Point on %s defined by the %s"%(self.scheme(),
173
self.prime_ideal())
174
def prime_ideal(self):
175
"""
176
Return the prime ideal that defines this scheme point.
177
178
EXAMPLES::
179
180
sage: from sage.schemes.generic.point import SchemeTopologicalPoint_prime_ideal
181
sage: P2.<x, y, z> = ProjectiveSpace(2, QQ)
182
sage: pt = SchemeTopologicalPoint_prime_ideal(P2, y*z-x^2)
183
sage: pt.prime_ideal()
184
Ideal (-x^2 + y*z) of Multivariate Polynomial Ring in x, y, z over Rational Field
185
"""
186
return self.__P
187
188
########################################################
189
# Points on a scheme defined by a morphism
190
########################################################
191
192
def is_SchemeRationalPoint(x):
193
return isinstance(x, SchemeRationalPoint)
194
195
class SchemeRationalPoint(SchemePoint):
196
def __init__(self, f):
197
"""
198
INPUT:
199
200
201
- ``f`` - a morphism of schemes
202
"""
203
SchemePoint.__init__(self, f.codomain())
204
self.__f = f
205
206
def _repr_(self):
207
return "Point on %s defined by the morphism %s"%(self.scheme(),
208
self.morphism())
209
210
def morphism(self):
211
return self.__f
212
213