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

r""" 

Ideals in Function Fields 

 

AUTHORS: 

 

- William Stein (2010): initial version 

 

- Maarten Derickx (2011-09-14): fixed ideal_with_gens_over_base() 

 

EXAMPLES: 

 

Ideals in the maximal order of a rational function field:: 

 

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

sage: O = K.maximal_order() 

sage: I = O.ideal(x^3+1); I 

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

sage: I^2 

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

sage: ~I 

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

sage: ~I * I 

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

 

Ideals in the equation order of an extension of a rational function field:: 

 

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

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

sage: O = L.equation_order() 

sage: I = O.ideal(y); I 

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

sage: I^2 

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

sage: ~I 

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

sage: ~I * I 

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

sage: I.intersection(~I) 

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

""" 

from __future__ import absolute_import 

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

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

# Copyright (C) 2011 Maarten Derickx <m.derickx.student@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.ideal import Ideal_generic 

from sage.structure.richcmp import richcmp 

 

 

class FunctionFieldIdeal(Ideal_generic): 

""" 

A fractional ideal of a function field. 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)) 

sage: O = K.maximal_order() 

sage: I = O.ideal(x^3+1) 

sage: isinstance(I, sage.rings.function_field.function_field_ideal.FunctionFieldIdeal) 

True 

""" 

pass 

 

class FunctionFieldIdeal_module(FunctionFieldIdeal): 

""" 

A fractional ideal specified by a finitely generated module over 

the integers of the base field. 

 

EXAMPLES: 

 

An ideal in an extension of a rational function field:: 

 

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

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

sage: O = L.equation_order() 

sage: I = O.ideal(y) 

sage: I 

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

sage: I^2 

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

""" 

def __init__(self, ring, module): 

""" 

INPUT: 

 

- ``ring`` -- an order in a function field 

- ``module`` -- a module 

 

EXAMPLES:: 

 

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

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

sage: O = L.equation_order() 

sage: I = O.ideal(y) 

sage: type(I) 

<class 'sage.rings.function_field.function_field_ideal.FunctionFieldIdeal_module'> 

""" 

self._ring = ring 

self._module = module 

self._structure = ring.fraction_field().vector_space() 

V, from_V, to_V = self._structure 

gens = tuple([from_V(a) for a in module.basis()]) 

Ideal_generic.__init__(self, ring, gens, coerce=False) 

 

def __contains__(self, x): 

""" 

Return True if x is in this ideal. 

 

EXAMPLES:: 

 

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([1, y]); I 

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

sage: y in I 

True 

sage: y/x in I 

False 

sage: y^2 - 2 in I 

True 

""" 

return self._structure[2](x) in self._module 

 

def module(self): 

""" 

Return module over the maximal order of the base field that 

underlies self. 

 

The formation of this module is compatible with the vector 

space corresponding to the function field. 

 

OUTPUT: 

 

- a module over the maximal order of the base field of self 

 

EXAMPLES:: 

 

sage: K.<x> = FunctionField(GF(7)) 

sage: O = K.maximal_order(); O 

Maximal order in Rational function field in x over Finite Field of size 7 

sage: K.polynomial_ring() 

Univariate Polynomial Ring in x over Rational function field in x over Finite Field of size 7 

sage: I = O.ideal_with_gens_over_base([x^2 + 1, x*(x^2+1)]) 

sage: I.gens() 

(x^2 + 1,) 

sage: I.module() 

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

User basis matrix: 

[x^2 + 1] 

sage: V, from_V, to_V = K.vector_space(); V 

Vector space of dimension 1 over Rational function field in x over Finite Field of size 7 

sage: I.module().is_submodule(V) 

True 

""" 

return self._module 

 

def __add__(self, other): 

""" 

Add self and ``other``. 

 

EXAMPLES:: 

 

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(y); J = O.ideal(y+1) 

sage: Z = I + J; Z 

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

sage: 1 in Z 

True 

sage: O.ideal(y^2) + O.ideal(y^3) == O.ideal(y^2,y^3) 

True 

""" 

if not isinstance(other, FunctionFieldIdeal_module): 

other = self.ring().ideal(other) 

return FunctionFieldIdeal_module(self.ring(), self.module() + other.module()) 

 

def intersection(self, other): 

""" 

Return the intersection of the ideals self and ``other``. 

 

EXAMPLES:: 

 

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(y^3); J = O.ideal(y^2) 

sage: Z = I.intersection(J); Z 

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

sage: y^2 in Z 

False 

sage: y^3 in Z 

True 

""" 

if not isinstance(other, FunctionFieldIdeal_module): 

other = self.ring().ideal(other) 

if self.ring() != other.ring(): 

raise ValueError("rings must be the same") 

return FunctionFieldIdeal_module(self.ring(), self.module().intersection(other.module())) 

 

def __richcmp__(self, other, op): 

""" 

Compare self and ``other``. 

 

EXAMPLES:: 

 

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(y*(y+1)); J = O.ideal((y^2-2)*(y+1)) 

sage: I+J == J+I # indirect test 

True 

sage: I == J 

False 

sage: I < J 

True 

sage: J < I 

False 

""" 

if not isinstance(other, FunctionFieldIdeal_module): 

other = self.ring().ideal(other) 

if self.ring() != other.ring(): 

raise ValueError("rings must be the same") 

return richcmp(self.module(), other.module(), op) 

 

def __invert__(self): 

""" 

Return the inverse of this fractional ideal. 

 

EXAMPLES:: 

 

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(y) 

sage: ~I 

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

sage: I^(-1) 

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

sage: ~I * I 

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

""" 

if len(self.gens()) == 0: 

raise ZeroDivisionError 

 

# NOTE: If I = (g0, ..., gn), then {x : x*I is in R} 

# is the intersection over i of {x : x*gi is in R} 

# Thus (I + J)^(-1) = I^(-1) intersect J^(-1). 

 

G = self.gens() 

R = self.ring() 

inv = R.ideal(~G[0]) 

for g in G[1:]: 

inv = inv.intersection(R.ideal(~g)) 

return inv 

 

def ideal_with_gens(R, gens): 

""" 

Return fractional ideal in the order ``R`` with generators ``gens`` 

over ``R``. 

 

EXAMPLES:: 

 

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

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

sage: O = L.equation_order() 

sage: sage.rings.function_field.function_field_ideal.ideal_with_gens(O, [y]) 

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

""" 

K = R.fraction_field() 

return ideal_with_gens_over_base(R, [b*K(g) for b in R.basis() for g in gens]) 

 

def ideal_with_gens_over_base(R, gens): 

""" 

Return fractional ideal in the order ``R`` with generators ``gens`` 

over the maximal order of the base field. 

 

EXAMPLES:: 

 

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

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

sage: O = L.equation_order() 

sage: sage.rings.function_field.function_field_ideal.ideal_with_gens_over_base(O, [x^3+1,-y]) 

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

 

TESTS:: 

 

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

sage: O = K.maximal_order() 

sage: I = O*x 

sage: ~I 

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

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

True 

sage: O.ideal([x,1/x]) 

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

sage: O.ideal([1/x,1/(x+1)]) 

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

""" 

K = R.fraction_field() 

V, from_V, to_V = K.vector_space() 

 

# We handle the case of a rational function field separately, 

# since this is the base case and is used, e.g,. internally 

# by the linear algebra Hermite form code. 

from . import function_field_order 

if isinstance(R, function_field_order.FunctionFieldOrder_rational): 

from sage.modules import free_module_element 

gens = free_module_element.vector(x.element() for x in gens) 

d = gens.denominator() 

gens *= d 

v = R._ring.ideal(gens.list()).gens_reduced() 

assert len(v) == 1 

basis = [to_V(v[0]/d)] 

M = V.span_of_basis(basis, check=False, already_echelonized=True, base_ring=R) 

else: 

# General case 

S = V.base_field().maximal_order() 

M = V.span([to_V(b) for b in gens], base_ring=S) 

 

return FunctionFieldIdeal_module(R, M)