Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

r""" 

Schemes 

""" 

#***************************************************************************** 

# Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu> 

# William Stein <wstein@math.ucsd.edu> 

# 2008-2012 Nicolas M. Thiery <nthiery at users.sf.net> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#****************************************************************************** 

 

from sage.categories.category import Category 

from sage.categories.category_types import Category_over_base 

from sage.categories.homsets import HomsetsCategory 

from sage.categories.sets_cat import Sets 

 

class Schemes(Category): 

""" 

The category of all schemes. 

 

EXAMPLES:: 

 

sage: Schemes() 

Category of schemes 

 

``Schemes`` can also be used to construct the category of schemes 

over a given base:: 

 

sage: Schemes(Spec(ZZ)) 

Category of schemes over Integer Ring 

 

sage: Schemes(ZZ) 

Category of schemes over Integer Ring 

 

.. TODO:: 

 

Make ``Schemes()`` a singleton category (and remove 

:class:`Schemes` from the workaround in 

:meth:`.category_types.Category_over_base._test_category_over_bases`). 

 

This is currently incompatible with the dispatching below. 

 

TESTS:: 

 

sage: TestSuite(Schemes()).run() 

 

Check that Hom sets of schemes are in the correct category:: 

 

sage: Schemes().Homsets().super_categories() 

[Category of homsets] 

""" 

 

@staticmethod 

def __classcall_private__(cls, X = None): 

""" 

Implement the dispatching ``Schemes(ZZ)`` -> ``Schemes_over_base``. 

 

EXAMPLES:: 

 

sage: Schemes() 

Category of schemes 

 

sage: Schemes(Spec(ZZ)) 

Category of schemes over Integer Ring 

 

sage: Schemes(ZZ) 

Category of schemes over Integer Ring 

""" 

if X is not None: 

from sage.schemes.generic.scheme import is_Scheme 

if not is_Scheme(X): 

X = Schemes()(X) 

return Schemes_over_base(X) 

else: 

return super(Schemes, cls).__classcall__(cls) 

 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Schemes().super_categories() 

[Category of sets] 

""" 

return [Sets()] 

 

def _call_(self, x): 

""" 

Construct a scheme from the data in ``x`` 

 

EXAMPLES: 

 

Let us first construct the category of schemes:: 

 

sage: S = Schemes(); S 

Category of schemes 

 

We create a scheme from a ring:: 

 

sage: X = S(ZZ); X # indirect doctest 

Spectrum of Integer Ring 

 

We create a scheme from a scheme (do nothing):: 

 

sage: S(X) 

Spectrum of Integer Ring 

 

We create a scheme morphism from a ring homomorphism.x:: 

 

sage: phi = ZZ.hom(QQ); phi 

Natural morphism: 

From: Integer Ring 

To: Rational Field 

sage: f = S(phi); f # indirect doctest 

Affine Scheme morphism: 

From: Spectrum of Rational Field 

To: Spectrum of Integer Ring 

Defn: Natural morphism: 

From: Integer Ring 

To: Rational Field 

 

sage: f.domain() 

Spectrum of Rational Field 

sage: f.codomain() 

Spectrum of Integer Ring 

sage: S(f) # indirect doctest 

Affine Scheme morphism: 

From: Spectrum of Rational Field 

To: Spectrum of Integer Ring 

Defn: Natural morphism: 

From: Integer Ring 

To: Rational Field 

 

""" 

from sage.schemes.generic.scheme import is_Scheme 

if is_Scheme(x): 

return x 

from sage.schemes.generic.morphism import is_SchemeMorphism 

if is_SchemeMorphism(x): 

return x 

from sage.rings.ring import CommutativeRing 

from sage.schemes.generic.spec import Spec 

from sage.categories.map import Map 

from sage.categories.all import Rings 

if isinstance(x, CommutativeRing): 

return Spec(x) 

elif isinstance(x, Map) and x.category_for().is_subcategory(Rings()): 

# x is a morphism of Rings 

A = Spec(x.codomain()) 

return A.hom(x) 

else: 

raise TypeError("No way to create an object or morphism in %s from %s"%(self, x)) 

 

 

############################################################# 

# Schemes over a given base scheme. 

############################################################# 

class Schemes_over_base(Category_over_base): 

""" 

The category of schemes over a given base scheme. 

 

EXAMPLES:: 

 

sage: Schemes(Spec(ZZ)) 

Category of schemes over Integer Ring 

 

TESTS:: 

 

sage: C = Schemes(ZZ) 

sage: TestSuite(C).run() 

""" 

 

def base_scheme(self): 

""" 

EXAMPLES:: 

 

sage: Schemes(Spec(ZZ)).base_scheme() 

Spectrum of Integer Ring 

""" 

return self.base() 

 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Schemes(Spec(ZZ)).super_categories() 

[Category of schemes] 

""" 

return [Schemes()] 

 

def _repr_object_names(self): 

""" 

EXAMPLES:: 

 

sage: Schemes(Spec(ZZ)) # indirect doctest 

Category of schemes over Integer Ring 

""" 

# To work around the name of the class (schemes_over_base) 

from sage.schemes.generic.scheme import is_AffineScheme 

if is_AffineScheme(self.base_scheme()): 

return "schemes over %s" % self.base_scheme().coordinate_ring() 

else: 

return "schemes over %s" % self.base_scheme()