Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
1
#################################################################################
2
#
3
# (c) Copyright 2010 William Stein
4
#
5
# This file is part of PSAGE
6
#
7
# PSAGE is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# PSAGE is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#
20
#################################################################################
21
22
23
"""
24
Orders in Function Fields
25
"""
26
27
from sage.structure.parent_gens import ParentWithGens
28
29
from sage.rings.ring import IntegralDomain, PrincipalIdealDomain
30
31
from sage.rings.ideal import is_Ideal
32
33
class FunctionFieldOrder(IntegralDomain):
34
def __init__(self, fraction_field):
35
"""
36
EXAMPLES::
37
38
sage: R = FunctionField(QQ,'y').maximal_order()
39
sage: isinstance(R, sage.rings.function_field.function_field_order.FunctionFieldOrder)
40
True
41
"""
42
self._fraction_field = fraction_field
43
44
def _repr_(self):
45
"""
46
EXAMPLES::
47
48
sage: FunctionField(QQ,'y').maximal_order()._repr_()
49
'Maximal order in Rational function field in y over Rational Field'
50
"""
51
return "Order in %s"%self.fraction_field()
52
53
def is_finite(self):
54
"""
55
EXAMPLES::
56
57
sage: FunctionField(QQ,'y').maximal_order().is_finite()
58
False
59
"""
60
return False
61
62
def is_field(self, proof=True):
63
"""
64
EXAMPLES::
65
66
sage: FunctionField(QQ,'y').maximal_order().is_field()
67
False
68
"""
69
return False
70
71
def is_noetherian(self):
72
"""
73
Return True, since orders in function fields are noetherian.
74
75
EXAMPLES::
76
77
sage: FunctionField(QQ,'y').maximal_order().is_noetherian()
78
True
79
"""
80
return True
81
82
def fraction_field(self):
83
"""
84
EXAMPLES::
85
86
sage: FunctionField(QQ,'y').maximal_order().fraction_field()
87
Rational function field in y over Rational Field
88
"""
89
return self._fraction_field
90
91
def ideal_with_gens_over_base(self, gens):
92
"""
93
Return the fractional ideal with given generators over the
94
maximal ideal of the base field. That this is really an ideal
95
is not checked.
96
97
INPUT:
98
99
- ``basis`` -- list of elements that are a basis for the
100
ideal over the maximal order of the base field
101
102
EXAMPLES::
103
104
We construct an ideal in a rational function field::
105
106
sage: R.<y> = FunctionField(QQ)
107
sage: S = R.maximal_order()
108
sage: I = S.ideal_with_gens_over_base([y]); I
109
Ideal (y) of Maximal order in Rational function field in y over Rational Field
110
sage: I*I
111
Ideal (y^2) of Maximal order in Rational function field in y over Rational Field
112
113
We construct some ideals in a nontrivial function field::
114
115
sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
116
sage: L.<y> = R.extension(y^2 - x^3 - 1)
117
sage: M = L.equation_order(); M
118
Order in Function field in y defined by y^2 + 6*x^3 + 6
119
sage: I = M.ideal_with_gens_over_base([1, y]); I
120
Ideal (1, y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
121
sage: I.module()
122
Free module of degree 2 and rank 2 over Maximal order in Rational function field in x over Finite Field of size 7
123
Echelon basis matrix:
124
[1 0]
125
[0 1]
126
"""
127
from function_field_ideal import ideal_with_gens_over_base
128
return ideal_with_gens_over_base(self, [self(a) for a in gens])
129
130
def ideal(self, *gens):
131
"""
132
Return the fractional ideal generated by the element gens or
133
the elements in gens if gens is a list.
134
135
EXAMPLES::
136
137
sage: R.<y> = FunctionField(QQ)
138
sage: S = R.maximal_order()
139
sage: S.ideal(y)
140
Ideal (y) of Maximal order in Rational function field in y over Rational Field
141
142
A fractional ideal of a nontrivial extension::
143
144
sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
145
sage: L.<y> = R.extension(y^2 - x^3 - 1)
146
sage: M = L.equation_order()
147
sage: M.ideal(1/y)
148
Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
149
"""
150
if len(gens) == 1:
151
gens = gens[0]
152
if not isinstance(gens, (list, tuple)):
153
gens = [gens]
154
from function_field_ideal import ideal_with_gens
155
return ideal_with_gens(self, gens)
156
157
158
159
160
161
class FunctionFieldOrder_basis(FunctionFieldOrder):
162
"""
163
An order given by a basis over the maximal order of the base
164
field.
165
"""
166
def __init__(self, basis, check=True):
167
"""
168
EXAMPLES::
169
170
sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
171
sage: S
172
Order in Function field in Y defined by y^4 + x*y + 4*x + 1
173
sage: type(S)
174
<class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis'>
175
"""
176
if len(basis) == 0:
177
raise ValueError, "basis must have positive length"
178
179
fraction_field = basis[0].parent()
180
if len(basis) != fraction_field.degree():
181
raise ValueError, "length of basis must equal degree of field"
182
183
FunctionFieldOrder.__init__(self, fraction_field)
184
185
self._basis = tuple(basis)
186
V, fr, to = fraction_field.vector_space()
187
R = fraction_field.base_field().maximal_order()
188
self._module = V.span([to(b) for b in basis], base_ring=R)
189
self._ring = fraction_field.polynomial_ring()
190
self._populate_coercion_lists_(coerce_list=[self._ring])
191
if check:
192
if self._module.rank() != fraction_field.degree():
193
raise ValueError, "basis is not a basis"
194
IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False)
195
196
def _element_constructor_(self, f):
197
"""
198
EXAMPLES::
199
200
sage: R.<y> = FunctionField(QQ)
201
sage: R.maximal_order()._element_constructor_(y)
202
y
203
"""
204
# HUGE TODO: have to check that f is really in self!!
205
if f.parent() is self.fraction_field():
206
f = f.element()
207
elif f.parent() is self._ring:
208
return function_field_element.FunctionFieldElement_rational(self, f)
209
return function_field_element.FunctionFieldElement_rational(self, self._ring(f))
210
211
def fraction_field(self):
212
"""
213
EXAMPLES::
214
215
sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
216
sage: S.fraction_field()
217
Function field in Y defined by y^4 + x*y + 4*x + 1
218
"""
219
return self._fraction_field
220
221
def basis(self):
222
"""
223
EXAMPLES::
224
225
sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
226
sage: S.basis()
227
(1, Y, Y^2, Y^3)
228
"""
229
return self._basis
230
231
def free_module(self):
232
"""
233
EXAMPLES::
234
235
sage: K.<x> = FunctionField(GF(7)); R.<y> = K[]; L.<Y> = K.extension(y^4 + x*y + 4*x + 1); S = L.equation_order()
236
sage: S.free_module()
237
Free module of degree 4 and rank 4 over Maximal order in Rational function field in x over Finite Field of size 7
238
Echelon basis matrix:
239
[1 0 0 0]
240
[0 1 0 0]
241
[0 0 1 0]
242
[0 0 0 1]
243
"""
244
return self._module
245
246
## def polynomial_quotient_ring(self):
247
## """
248
## Return a quotient of a (possibly multivariate) polynomial ring
249
## that is isomorphic to self, along with morphisms back and
250
## forth.
251
## """
252
## raise NotImplementedError
253
254
255
import function_field_element
256
257
class FunctionFieldOrder_rational(PrincipalIdealDomain, FunctionFieldOrder):
258
"""
259
The maximal order in a rational function field.
260
"""
261
def __init__(self, function_field):
262
"""
263
EXAMPLES::
264
265
sage: K.<t> = FunctionField(GF(19)); K
266
Rational function field in t over Finite Field of size 19
267
sage: R = K.maximal_order(); R
268
Maximal order in Rational function field in t over Finite Field of size 19
269
sage: type(R)
270
<class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_rational'>
271
"""
272
FunctionFieldOrder.__init__(self, function_field)
273
IntegralDomain.__init__(self, self, names = function_field.variable_names(), normalize = False)
274
self._ring = function_field._ring
275
self._populate_coercion_lists_(coerce_list=[self._ring])
276
self._gen = self(self._ring.gen())
277
self._basis = (self(1),)
278
279
def basis(self):
280
"""
281
Return basis (=1) for this order as a module over the polynomial ring.
282
283
EXAMPLES::
284
285
sage: K.<t> = FunctionField(GF(19))
286
sage: M = K.maximal_order()
287
sage: M.basis()
288
(1,)
289
sage: parent(M.basis()[0])
290
Maximal order in Rational function field in t over Finite Field of size 19
291
"""
292
return self._basis
293
294
def ideal(self, *gens):
295
"""
296
Return the fractional ideal generated by the element gens or
297
the elements in gens if gens is a list.
298
299
EXAMPLES::
300
301
sage: R.<y> = FunctionField(QQ)
302
sage: S = R.maximal_order()
303
sage: S.ideal(y)
304
Ideal (y) of Maximal order in Rational function field in y over Rational Field
305
306
A fractional ideal of a nontrivial extension::
307
308
sage: R.<x> = FunctionField(GF(7)); S.<y> = R[]
309
sage: L.<y> = R.extension(y^2 - x^3 - 1)
310
sage: M = L.equation_order()
311
sage: M.ideal(1/y)
312
Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6
313
314
A non-principal ideal::
315
316
sage: R.<x> = FunctionField(GF(7))
317
sage: S = R.maximal_order()
318
sage: S.ideal(x^3+1,x^3+6)
319
Ideal (1) of Maximal order in Rational function field in x over Finite Field of size 7
320
sage: S.ideal((x^2+1)*(x^3+1),(x^3+6)*(x^2+1))
321
Ideal (x^2 + 1) of Maximal order in Rational function field in x over Finite Field of size 7
322
"""
323
if len(gens) == 1:
324
gens = gens[0]
325
if not isinstance(gens, (list, tuple)):
326
if is_Ideal(gens):
327
gens = gens.gens()
328
else:
329
gens = [gens]
330
from function_field_ideal import ideal_with_gens
331
return ideal_with_gens(self, gens)
332
333
def _repr_(self):
334
"""
335
EXAMPLES::
336
337
sage: FunctionField(QQ,'y').maximal_order()._repr_()
338
'Maximal order in Rational function field in y over Rational Field'
339
"""
340
return "Maximal order in %s"%self.fraction_field()
341
342
def gen(self, n=0):
343
"""
344
EXAMPLES::
345
346
sage: R = FunctionField(QQ,'y').maximal_order(); R.gen()
347
y
348
sage: R.gen(1)
349
Traceback (most recent call last):
350
...
351
IndexError: Only one generator.
352
"""
353
if n != 0: raise IndexError, "Only one generator."
354
return self._gen
355
356
def ngens(self):
357
"""
358
EXAMPLES::
359
360
sage: R = FunctionField(QQ,'y').maximal_order(); R.ngens()
361
1
362
"""
363
return 1
364
365
def _element_constructor_(self, f):
366
"""
367
EXAMPLES::
368
369
sage: R.<y> = FunctionField(QQ)
370
sage: R.maximal_order()._element_constructor_(y)
371
y
372
"""
373
# HUGE TODO: have to check that f is really in self!!
374
375
if f.parent() is self.fraction_field():
376
f = f.element()
377
if f.parent() is self._ring:
378
return function_field_element.FunctionFieldElement_rational(self, f)
379
return function_field_element.FunctionFieldElement_rational(self, self._ring(f))
380
381
## def polynomial_quotient_ring(self):
382
## """
383
## Return a quotient of a (possibly multivariate) polynomial ring
384
## that is isomorphic to self, along with morphisms back and
385
## forth.
386
387
## EXAMPLES::
388
## """
389
## return self._ring
390
391
392
393
394
395