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

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

r""" 

Orders in Function Fields 

 

AUTHORS: 

 

- William Stein (2010): initial version 

 

- Maarten Derickx (2011-09-14): fixed ideal_with_gens_over_base() for rational function fields 

 

- Julian Rueth (2011-09-14): added check in _element_constructor_ 

 

EXAMPLES: 

 

Maximal orders in rational function fields:: 

 

sage: K.<x> = FunctionField(QQ) 

sage: O = K.maximal_order() 

sage: I = O.ideal(1/x); I 

Ideal (1/x) of Maximal order in Rational function field in x over Rational Field 

sage: 1/x in O 

False 

 

Equation orders in extensions of rational function fields:: 

 

sage: K.<x> = FunctionField(GF(3)); R.<y> = K[] 

sage: L.<y> = K.extension(y^3-y-x) 

sage: O = L.equation_order() 

sage: 1/y in O 

False 

sage: x/y in O 

True 

""" 

from __future__ import absolute_import 

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

# Copyright (C) 2010 William Stein <wstein@gmail.com> 

# Copyright (C) 2011 Maarten Derickx <m.derickx.student@gmail.com> 

# Copyright (C) 2011 Julian Rueth <julian.rueth@gmail.com> 

# 

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

# as published by the Free Software Foundation; either version 2 of 

# the License, or (at your option) any later version. 

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

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

 

from sage.rings.ring import IntegralDomain, PrincipalIdealDomain 

from sage.rings.ideal import is_Ideal 

 

class FunctionFieldOrder(IntegralDomain): 

""" 

Base class for orders in function fields. 

""" 

def __init__(self, fraction_field): 

""" 

INPUT: 

 

- ``fraction_field`` -- the function field in which this is an order. 

 

EXAMPLES:: 

 

sage: R = FunctionField(QQ,'y').maximal_order() 

sage: isinstance(R, sage.rings.function_field.function_field_order.FunctionFieldOrder) 

True 

""" 

IntegralDomain.__init__(self, self) 

self._fraction_field = fraction_field 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order()._repr_() 

'Maximal order in Rational function field in y over Rational Field' 

""" 

return "Order in %s"%self.fraction_field() 

 

def is_finite(self): 

""" 

Returns False since orders are never finite. 

 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order().is_finite() 

False 

""" 

return False 

 

def is_field(self, proof=True): 

""" 

Returns False since orders are never fields. 

 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order().is_field() 

False 

""" 

return False 

 

def is_noetherian(self): 

""" 

Returns True since orders in function fields are noetherian. 

 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order().is_noetherian() 

True 

""" 

return True 

 

def fraction_field(self): 

""" 

Returns the function field in which this is an order. 

 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order().fraction_field() 

Rational function field in y over Rational Field 

""" 

return self._fraction_field 

 

function_field = fraction_field 

 

def ideal_with_gens_over_base(self, gens): 

""" 

Returns the fractional ideal with basis ``gens`` over the 

maximal order of the base field. That this is really an ideal 

is not checked. 

 

INPUT: 

 

- ``gens`` -- list of elements that are a basis for the 

ideal over the maximal order of the base field 

 

EXAMPLES: 

 

We construct an ideal in a rational function field:: 

 

sage: K.<y> = FunctionField(QQ) 

sage: O = K.maximal_order() 

sage: I = O.ideal_with_gens_over_base([y]); I 

Ideal (y) of Maximal order in Rational function field in y over Rational Field 

sage: I*I 

Ideal (y^2) of Maximal order in Rational function field in y over Rational Field 

 

We construct some ideals in a nontrivial function field:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^2 - x^3 - 1) 

sage: O = L.equation_order(); O 

Order in Function field in y defined by y^2 + 6*x^3 + 6 

sage: I = O.ideal_with_gens_over_base([1, y]); I 

Ideal (1, y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 

sage: I.module() 

Free module of degree 2 and rank 2 over Maximal order in Rational function field in x over Finite Field of size 7 

Echelon basis matrix: 

[1 0] 

[0 1] 

 

There is no check if the resulting object is really an ideal:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^2 - x^3 - 1) 

sage: O = L.equation_order() 

sage: I = O.ideal_with_gens_over_base([y]); I 

Ideal (y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 

sage: y in I 

True 

sage: y^2 in I 

False 

""" 

from .function_field_ideal import ideal_with_gens_over_base 

return ideal_with_gens_over_base(self, [self(a) for a in gens]) 

 

def ideal(self, *gens): 

""" 

Returns the fractional ideal generated by the elements in ``gens``. 

 

INPUT: 

 

- ``gens`` -- a list of generators or an ideal in a ring which 

coerces to this order. 

 

EXAMPLES:: 

 

sage: K.<y> = FunctionField(QQ) 

sage: O = K.maximal_order() 

sage: O.ideal(y) 

Ideal (y) of Maximal order in Rational function field in y over Rational Field 

sage: O.ideal([y,1/y]) == O.ideal(y,1/y) # multiple generators may be given as a list 

True 

 

A fractional ideal of a nontrivial extension:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: O = K.maximal_order() 

sage: I = O.ideal(x^2-4) 

sage: L.<y> = K.extension(y^2 - x^3 - 1) 

sage: S = L.equation_order() 

sage: S.ideal(1/y) 

Ideal (1, (6/(x^3 + 1))*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 

sage: I2 = S.ideal(x^2-4); I2 

Ideal (x^2 + 3, (x^2 + 3)*y) of Order in Function field in y defined by y^2 + 6*x^3 + 6 

sage: I2 == S.ideal(I) 

True 

""" 

if len(gens) == 1: 

gens = gens[0] 

if not isinstance(gens, (list, tuple)): 

if is_Ideal(gens): 

gens = gens.gens() 

else: 

gens = [gens] 

from .function_field_ideal import ideal_with_gens 

return ideal_with_gens(self, gens) 

 

class FunctionFieldOrder_basis(FunctionFieldOrder): 

""" 

An order given by a basis over the maximal order of the base 

field. 

""" 

def __init__(self, basis, check=True): 

""" 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1) 

sage: O = L.equation_order(); O 

Order in Function field in y defined by y^4 + x*y + 4*x + 1 

sage: type(O) 

<class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_basis_with_category'> 

 

The basis only defines an order if the module it generates is closed under multiplication 

and contains the identity element (only checked when ``check`` is True):: 

 

sage: K.<x> = FunctionField(QQ) 

sage: R.<y> = K[] 

sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); 

sage: y.is_integral() 

False 

sage: L.order(y) 

Traceback (most recent call last): 

... 

ValueError: The module generated by basis [1, y, y^2, y^3, y^4] must be closed under multiplication 

 

The basis also has to be linearly independent and of the same rank as the degree of the function field of its elements (only checked when ``check`` is True):: 

 

sage: L.order(L(x)) 

Traceback (most recent call last): 

... 

ValueError: Basis [1, x, x^2, x^3, x^4] is not linearly independent 

sage: sage.rings.function_field.function_field_order.FunctionFieldOrder_basis([y,y,y^3,y^4,y^5]) 

Traceback (most recent call last): 

... 

ValueError: Basis [y, y, y^3, y^4, 2*x*y + (x^4 + 1)/x] is not linearly independent 

""" 

if len(basis) == 0: 

raise ValueError("basis must have positive length") 

 

fraction_field = basis[0].parent() 

if len(basis) != fraction_field.degree(): 

raise ValueError("length of basis must equal degree of field") 

 

FunctionFieldOrder.__init__(self, fraction_field) 

 

self._basis = tuple(basis) 

V, fr, to = fraction_field.vector_space() 

R = fraction_field.base_field().maximal_order() 

self._module = V.span([to(b) for b in basis], base_ring=R) 

self._ring = fraction_field.polynomial_ring() 

self._populate_coercion_lists_(coerce_list=[self._ring]) 

if check: 

if self._module.rank() != fraction_field.degree(): 

raise ValueError("Basis %s is not linearly independent"%(basis)) 

if not to(fraction_field(1)) in self._module: 

raise ValueError("The identity element must be in the module spanned by basis %s"%(basis)) 

if not all(to(a*b) in self._module for a in basis for b in basis): 

raise ValueError("The module generated by basis %s must be closed under multiplication"%(basis)) 

IntegralDomain.__init__(self, self, names = fraction_field.variable_names(), normalize = False) 

 

def _element_constructor_(self, f, check=True): 

""" 

Make ``f`` into an element of this order. 

 

INPUT: 

 

- ``f`` -- the element 

- ``check`` -- check if the element is in the order 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(QQ) 

sage: K.maximal_order()._element_constructor_(x) 

x 

""" 

fraction_field=self.fraction_field() 

 

if f.parent() is fraction_field: 

f = f.element() 

f = self._ring(f) 

if check: 

V, fr, to = fraction_field.vector_space() 

f_vector = to(fraction_field(f)) 

if not f_vector in self._module: 

raise TypeError("%r is not an element of %r"%(f_vector,self)) 

return fraction_field._element_class(self, f) 

 

def fraction_field(self): 

""" 

Returns the function field in which this is an order. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1) 

sage: O = L.equation_order() 

sage: O.fraction_field() 

Function field in y defined by y^4 + x*y + 4*x + 1 

""" 

return self._fraction_field 

 

def polynomial(self): 

""" 

Returns the defining polynomial of the function field of which this is an order. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1) 

sage: O = L.equation_order() 

sage: O.polynomial() 

y^4 + x*y + 4*x + 1 

""" 

return self._fraction_field.polynomial() 

 

def basis(self): 

""" 

Returns a basis of self over the maximal order of the base field. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1) 

sage: O = L.equation_order() 

sage: O.basis() 

(1, y, y^2, y^3) 

""" 

return self._basis 

 

def free_module(self): 

""" 

Returns the free module formed by the basis over the maximal order of the base field. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)); R.<y> = K[] 

sage: L.<y> = K.extension(y^4 + x*y + 4*x + 1) 

sage: O = L.equation_order() 

sage: O.free_module() 

Free module of degree 4 and rank 4 over Maximal order in Rational function field in x over Finite Field of size 7 

Echelon basis matrix: 

[1 0 0 0] 

[0 1 0 0] 

[0 0 1 0] 

[0 0 0 1] 

""" 

return self._module 

 

class FunctionFieldOrder_rational(PrincipalIdealDomain, FunctionFieldOrder): 

""" 

The maximal order in a rational function field. 

""" 

def __init__(self, function_field): 

""" 

EXAMPLES:: 

 

sage: K.<t> = FunctionField(GF(19)); K 

Rational function field in t over Finite Field of size 19 

sage: R = K.maximal_order(); R 

Maximal order in Rational function field in t over Finite Field of size 19 

sage: type(R) 

<class 'sage.rings.function_field.function_field_order.FunctionFieldOrder_rational_with_category'> 

""" 

FunctionFieldOrder.__init__(self, function_field) 

PrincipalIdealDomain.__init__(self, self, names = function_field.variable_names(), normalize = False) 

self._ring = function_field._ring 

self._populate_coercion_lists_(coerce_list=[self._ring]) 

self._gen = self(self._ring.gen()) 

self._basis = (self(1),) 

 

def basis(self): 

""" 

Returns the basis (=1) for this order as a module over the polynomial ring. 

 

EXAMPLES:: 

 

sage: K.<t> = FunctionField(GF(19)) 

sage: O = K.maximal_order() 

sage: O.basis() 

(1,) 

sage: parent(O.basis()[0]) 

Maximal order in Rational function field in t over Finite Field of size 19 

""" 

return self._basis 

 

def ideal(self, *gens): 

""" 

Returns the fractional ideal generated by ``gens``. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(QQ) 

sage: O = K.maximal_order() 

sage: O.ideal(x) 

Ideal (x) of Maximal order in Rational function field in x over Rational Field 

sage: O.ideal([x,1/x]) == O.ideal(x,1/x) # multiple generators may be given as a list 

True 

sage: O.ideal(x^3+1,x^3+6) 

Ideal (1) of Maximal order in Rational function field in x over Rational Field 

sage: I = O.ideal((x^2+1)*(x^3+1),(x^3+6)*(x^2+1)); I 

Ideal (x^2 + 1) of Maximal order in Rational function field in x over Rational Field 

sage: O.ideal(I) 

Ideal (x^2 + 1) of Maximal order in Rational function field in x over Rational Field 

""" 

if len(gens) == 1: 

gens = gens[0] 

if not isinstance(gens, (list, tuple)): 

if is_Ideal(gens): 

gens = gens.gens() 

else: 

gens = (gens,) 

from .function_field_ideal import ideal_with_gens 

return ideal_with_gens(self, gens) 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order()._repr_() 

'Maximal order in Rational function field in y over Rational Field' 

""" 

return "Maximal order in %s"%self.fraction_field() 

 

def gen(self, n=0): 

""" 

Returns the ``n``-th generator of self. Since there is only one generator ``n`` must be 0. 

 

EXAMPLES:: 

 

sage: O = FunctionField(QQ,'y').maximal_order() 

sage: O.gen() 

y 

sage: O.gen(1) 

Traceback (most recent call last): 

... 

IndexError: Only one generator. 

""" 

if n != 0: raise IndexError("Only one generator.") 

return self._gen 

 

def ngens(self): 

""" 

Returns 1, the number of generators of self. 

 

EXAMPLES:: 

 

sage: FunctionField(QQ,'y').maximal_order().ngens() 

1 

""" 

return 1 

 

def _element_constructor_(self, f): 

""" 

Make ``f`` into an element of this order. 

 

EXAMPLES:: 

 

sage: K.<y> = FunctionField(QQ) 

sage: O = K.maximal_order() 

sage: O._element_constructor_(y) 

y 

sage: O._element_constructor_(1/y) 

Traceback (most recent call last): 

... 

TypeError: 1/y is not an element of Maximal order in Rational function field in y over Rational Field 

""" 

if f.parent() is self.fraction_field(): 

if not f.denominator() in self.fraction_field().constant_base_field(): 

raise TypeError("%r is not an element of %r"%(f,self)) 

f = f.element() 

from .function_field_element import FunctionFieldElement_rational 

return FunctionFieldElement_rational(self, self._ring(f))