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

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

r""" 

Finite subgroups of modular abelian varieties 

 

Sage can compute with fairly general finite subgroups of modular 

abelian varieties. Elements of finite order are represented by 

equivalence classes of elements in `H_1(A,\QQ)` 

modulo `H_1(A,\ZZ)`. A finite subgroup can be 

defined by giving generators and via various other constructions. 

Given a finite subgroup, one can compute generators, as well as the 

structure as an abstract group. Arithmetic on subgroups is also 

supported, including adding two subgroups together, checking 

inclusion, etc. 

 

TODO: Intersection, action of Hecke operators. 

 

AUTHORS: 

 

- William Stein (2007-03) 

 

EXAMPLES:: 

 

sage: J = J0(33) 

sage: C = J.cuspidal_subgroup() 

sage: C 

Finite subgroup with invariants [10, 10] over QQ of Abelian variety J0(33) of dimension 3 

sage: C.order() 

100 

sage: C.gens() 

[[(1/10, 0, 1/10, 1/10, 1/10, 3/10)], [(0, 1/5, 1/10, 0, 1/10, 9/10)], [(0, 0, 1/2, 0, 1/2, 1/2)]] 

sage: C.0 + C.1 

[(1/10, 1/5, 1/5, 1/10, 1/5, 6/5)] 

sage: 10*(C.0 + C.1) 

[(0, 0, 0, 0, 0, 0)] 

sage: G = C.subgroup([C.0 + C.1]); G 

Finite subgroup with invariants [10] over QQbar of Abelian variety J0(33) of dimension 3 

sage: G.gens() 

[[(1/10, 1/5, 1/5, 1/10, 1/5, 1/5)]] 

sage: G.order() 

10 

sage: G <= C 

True 

sage: G >= C 

False 

 

We make a table of the order of the cuspidal subgroup for the first 

few levels:: 

 

sage: for N in range(11,40): 

....: print("{} {}".format(N, J0(N).cuspidal_subgroup().order())) 

11 5 

12 1 

13 1 

14 6 

15 8 

16 1 

17 4 

18 1 

19 3 

20 6 

21 8 

22 25 

23 11 

24 8 

25 1 

26 21 

27 9 

28 36 

29 7 

30 192 

31 5 

32 8 

33 100 

34 48 

35 48 

36 12 

37 3 

38 135 

39 56 

 

TESTS:: 

 

sage: G = J0(11).finite_subgroup([[1/3,0], [0,1/5]]); G 

Finite subgroup with invariants [15] over QQbar of Abelian variety J0(11) of dimension 1 

sage: loads(dumps(G)) == G 

True 

sage: loads(dumps(G.0)) == G.0 

True 

""" 

 

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

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

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License 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 __future__ import print_function 

from __future__ import absolute_import 

 

from sage.modular.abvar.torsion_point import TorsionPoint 

from sage.modules.module import Module 

from sage.modules.free_module import is_FreeModule 

from sage.structure.element import ModuleElement 

from sage.structure.gens_py import abelian_iterator 

from sage.structure.sequence import Sequence 

from sage.structure.richcmp import richcmp_method, richcmp 

from sage.rings.all import QQ, ZZ, QQbar, Integer 

from sage.arith.all import gcd, lcm 

from sage.misc.all import prod 

from sage.structure.element import coercion_model 

 

 

@richcmp_method 

class FiniteSubgroup(Module): 

r""" 

A finite subgroup of a modular abelian variety. 

 

INPUT: 

 

- ``abvar`` -- a modular abelian variety 

 

- ``field_of_definition`` -- a field over which this group is defined 

 

EXAMPLES: 

 

This is an abstract base class, so there are no instances of 

this class itself:: 

 

sage: A = J0(37) 

sage: G = A.torsion_subgroup(3); G 

Finite subgroup with invariants [3, 3, 3, 3] over QQ of Abelian variety J0(37) of dimension 2 

sage: type(G) 

<class 'sage.modular.abvar.finite_subgroup.FiniteSubgroup_lattice_with_category'> 

sage: from sage.modular.abvar.finite_subgroup import FiniteSubgroup 

sage: isinstance(G, FiniteSubgroup) 

True 

""" 

 

Element = TorsionPoint 

 

def __init__(self, abvar, field_of_definition=QQ): 

""" 

Initialize ``self``. 

 

TESTS:: 

 

sage: A = J0(11) 

sage: G = A.torsion_subgroup(2) 

sage: TestSuite(G).run() # long time 

""" 

from sage.categories.category import Category 

from sage.categories.fields import Fields 

from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets 

from sage.categories.modules import Modules 

from .abvar import is_ModularAbelianVariety 

if field_of_definition not in Fields(): 

raise TypeError("field_of_definition must be a field") 

if not is_ModularAbelianVariety(abvar): 

raise TypeError("abvar must be a modular abelian variety") 

category = Category.join((Modules(ZZ), FiniteEnumeratedSets())) 

Module.__init__(self, ZZ, category=category) 

self.__abvar = abvar 

self.__field_of_definition = field_of_definition 

 

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

# DERIVED CLASS MUST OVERRIDE THE lattice METHOD 

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

def lattice(self): 

""" 

Return the lattice corresponding to this subgroup in the rational 

homology of the modular Jacobian product. The elements of the 

subgroup are represented by vectors in the ambient vector space 

(the rational homology), and this returns the lattice they span. 

EXAMPLES:: 

 

sage: J = J0(33); C = J[0].cuspidal_subgroup(); C 

Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

sage: C.lattice() 

Free module of degree 6 and rank 2 over Integer Ring 

Echelon basis matrix: 

[ 1/5 13/5 -2 -4/5 2 -1/5] 

[ 0 3 -2 -1 2 0] 

""" 

raise NotImplementedError 

 

def _relative_basis_matrix(self): 

""" 

Return matrix of this finite subgroup, but relative to the homology 

of the parent abelian variety. 

 

EXAMPLES:: 

 

sage: A = J0(43)[1]; A 

Simple abelian subvariety 43b(1,43) of dimension 2 of J0(43) 

sage: C = A.cuspidal_subgroup(); C 

Finite subgroup with invariants [7] over QQ of Simple abelian subvariety 43b(1,43) of dimension 2 of J0(43) 

sage: C._relative_basis_matrix() 

[ 1 0 0 0] 

[ 0 1/7 6/7 5/7] 

[ 0 0 1 0] 

[ 0 0 0 1] 

""" 

try: 

return self.__relative_basis_matrix 

except AttributeError: 

M = self.__abvar.lattice().coordinate_module(self.lattice()).basis_matrix() 

self.__relative_basis_matrix = M 

return M 

 

# General functionality 

def __richcmp__(self, other, op): 

""" 

Compare ``self`` to ``other``. 

 

If ``other`` is not a :class:`FiniteSubgroup`, then 

``NotImplemented`` is returned. If ``other`` is a 

:class:`FiniteSubgroup` and the ambient abelian varieties are 

not equal, then the ambient abelian varieties are compared. 

If ``other`` is a :class:`FiniteSubgroup` and the ambient 

abelian varieties are equal, then the subgroups are compared 

via their corresponding lattices. 

 

EXAMPLES: 

 

We first compare two subgroups of `J_0(37)`:: 

 

sage: A = J0(37) 

sage: G = A.torsion_subgroup(3); G.order() 

81 

sage: H = A.cuspidal_subgroup(); H.order() 

3 

sage: H < G 

True 

sage: H.is_subgroup(G) 

True 

 

The ambient varieties are compared:: 

 

sage: A[0].cuspidal_subgroup() > J0(11).cuspidal_subgroup() 

True 

 

Comparing subgroups sitting in different abelian varieties:: 

 

sage: A[0].cuspidal_subgroup() < A[1].cuspidal_subgroup() 

True 

""" 

if not isinstance(other, FiniteSubgroup): 

return NotImplemented 

A = self.abelian_variety() 

B = other.abelian_variety() 

if not A.in_same_ambient_variety(B): 

return richcmp(A.ambient_variety(), B.ambient_variety(), op) 

L = A.lattice() + B.lattice() 

lx = other.lattice() + L 

rx = self.lattice() + L 

# order gets reversed in passing to lattices. 

return lx._echelon_matrix_richcmp(rx, op) 

 

def is_subgroup(self, other): 

""" 

Return True exactly if self is a subgroup of other, and both are 

defined as subgroups of the same ambient abelian variety. 

 

EXAMPLES:: 

 

sage: C = J0(22).cuspidal_subgroup() 

sage: H = C.subgroup([C.0]) 

sage: K = C.subgroup([C.1]) 

sage: H.is_subgroup(K) 

False 

sage: K.is_subgroup(H) 

False 

sage: K.is_subgroup(C) 

True 

sage: H.is_subgroup(C) 

True 

""" 

# We use that self is contained in other, whether other is 

# either a finite group or an abelian variety, if and only 

# if self doesn't shrink when intersected with other. 

try: 

return self.intersection(other).order() == self.order() 

except TypeError: 

return False 

 

def __add__(self, other): 

""" 

Return the sum of two subgroups. 

 

EXAMPLES:: 

 

sage: C = J0(22).cuspidal_subgroup() 

sage: C.gens() 

[[(1/5, 1/5, 4/5, 0)], [(0, 0, 0, 1/5)]] 

sage: A = C.subgroup([C.0]); B = C.subgroup([C.1]) 

sage: A + B == C 

True 

""" 

if not isinstance(other, FiniteSubgroup): 

raise TypeError("only addition of two finite subgroups is defined") 

A = self.abelian_variety() 

B = other.abelian_variety() 

if not A.in_same_ambient_variety(B): 

raise ValueError("self and other must be in the same ambient Jacobian") 

K = coercion_model.common_parent(self.field_of_definition(), other.field_of_definition()) 

lattice = self.lattice() + other.lattice() 

if A != B: 

lattice += C.lattice() 

 

return FiniteSubgroup_lattice(self.abelian_variety(), lattice, field_of_definition=K) 

 

def exponent(self): 

""" 

Return the exponent of this finite abelian group. 

 

OUTPUT: Integer 

 

EXAMPLES:: 

 

sage: t = J0(33).hecke_operator(7) 

sage: G = t.kernel()[0]; G 

Finite subgroup with invariants [2, 2, 2, 2, 4, 4] over QQ of Abelian variety J0(33) of dimension 3 

sage: G.exponent() 

4 

""" 

try: 

return self.__exponent 

except AttributeError: 

e = lcm(self.invariants()) 

self.__exponent = e 

return e 

 

def intersection(self, other): 

""" 

Return the intersection of the finite subgroups self and other. 

 

INPUT: 

 

 

- ``other`` - a finite group 

 

 

OUTPUT: a finite group 

 

EXAMPLES:: 

 

sage: E11a0, E11a1, B = J0(33) 

sage: G = E11a0.torsion_subgroup(6); H = E11a0.torsion_subgroup(9) 

sage: G.intersection(H) 

Finite subgroup with invariants [3, 3] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

sage: W = E11a1.torsion_subgroup(15) 

sage: G.intersection(W) 

Finite subgroup with invariants [] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

sage: E11a0.intersection(E11a1)[0] 

Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

 

We intersect subgroups of different abelian varieties. 

 

:: 

 

sage: E11a0, E11a1, B = J0(33) 

sage: G = E11a0.torsion_subgroup(5); H = E11a1.torsion_subgroup(5) 

sage: G.intersection(H) 

Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

sage: E11a0.intersection(E11a1)[0] 

Finite subgroup with invariants [5] over QQ of Simple abelian subvariety 11a(1,33) of dimension 1 of J0(33) 

 

We intersect abelian varieties with subgroups:: 

 

sage: t = J0(33).hecke_operator(7) 

sage: G = t.kernel()[0]; G 

Finite subgroup with invariants [2, 2, 2, 2, 4, 4] over QQ of Abelian variety J0(33) of dimension 3 

sage: A = J0(33).old_subvariety() 

sage: A.intersection(G) 

Finite subgroup with invariants [2, 2, 2, 2] over QQ of Abelian subvariety of dimension 2 of J0(33) 

sage: A.hecke_operator(7).kernel()[0] 

Finite subgroup with invariants [2, 2, 2, 2] over QQ of Abelian subvariety of dimension 2 of J0(33) 

sage: B = J0(33).new_subvariety() 

sage: B.intersection(G) 

Finite subgroup with invariants [4, 4] over QQ of Abelian subvariety of dimension 1 of J0(33) 

sage: B.hecke_operator(7).kernel()[0] 

Finite subgroup with invariants [4, 4] over QQ of Abelian subvariety of dimension 1 of J0(33) 

sage: A.intersection(B)[0] 

Finite subgroup with invariants [3, 3] over QQ of Abelian subvariety of dimension 2 of J0(33) 

""" 

from .abvar import is_ModularAbelianVariety 

A = self.abelian_variety() 

if is_ModularAbelianVariety(other): 

amb = other 

B = other 

M = B.lattice().scale(Integer(1)/self.exponent()) 

K = coercion_model.common_parent(self.field_of_definition(), other.base_field()) 

else: 

amb = A 

if not isinstance(other, FiniteSubgroup): 

raise TypeError("only intersection with a finite subgroup or " 

"modular abelian variety is defined") 

B = other.abelian_variety() 

if A.ambient_variety() != B.ambient_variety(): 

raise TypeError("finite subgroups must be in the same ambient product Jacobian") 

M = other.lattice() 

K = coercion_model.common_parent(self.field_of_definition(), other.field_of_definition()) 

 

L = self.lattice() 

if A != B: 

# TODO: This might be way slower than what we could do if 

# we think more carefully. 

C = A + B 

L = L + C.lattice() 

M = M + C.lattice() 

W = L.intersection(M).intersection(amb.vector_space()) 

return FiniteSubgroup_lattice(amb, W, field_of_definition=K) 

 

def __mul__(self, right): 

""" 

Multiply this subgroup by the rational number right. 

 

If right is an integer the result is a subgroup of self. If right 

is a rational number `n/m`, then this group is first 

divided by `m` then multiplied by `n`. 

 

INPUT: 

 

 

- ``right`` - a rational number 

 

 

OUTPUT: a subgroup 

 

EXAMPLES:: 

 

sage: J = J0(37) 

sage: H = J.cuspidal_subgroup(); H.order() 

3 

sage: G = H * 3; G.order() 

1 

sage: G = H * (1/2); G.order() 

48 

sage: J.torsion_subgroup(2) + H == G 

True 

sage: G = H*(3/2); G.order() 

16 

sage: J = J0(42) 

sage: G = J.cuspidal_subgroup(); factor(G.order()) 

2^8 * 3^2 

sage: (G * 3).order() 

256 

sage: (G * 0).order() 

1 

sage: (G * (1/5)).order() 

22500000000 

""" 

lattice = self.lattice().scale(right) 

return FiniteSubgroup_lattice(self.abelian_variety(), lattice, 

field_of_definition = self.field_of_definition()) 

 

def __rmul__(self, left): 

""" 

Multiply this finite subgroup on the left by an integer. 

 

EXAMPLES:: 

 

sage: J = J0(42) 

sage: G = J.cuspidal_subgroup(); factor(G.order()) 

2^8 * 3^2 

sage: H = G.__rmul__(2) 

sage: H.order().factor() 

2^4 * 3^2 

sage: 2*G 

Finite subgroup with invariants [6, 24] over QQ of Abelian variety J0(42) of dimension 5 

""" 

return self * left 

 

def abelian_variety(self): 

""" 

Return the abelian variety that this is a finite subgroup of. 

 

EXAMPLES:: 

 

sage: J = J0(42) 

sage: G = J.rational_torsion_subgroup(); G 

Torsion subgroup of Abelian variety J0(42) of dimension 5 

sage: G.abelian_variety() 

Abelian variety J0(42) of dimension 5 

""" 

return self.__abvar 

 

def field_of_definition(self): 

""" 

Return the field over which this finite modular abelian variety 

subgroup is defined. This is a field over which this subgroup is 

defined. 

 

EXAMPLES:: 

 

sage: J = J0(42) 

sage: G = J.rational_torsion_subgroup(); G 

Torsion subgroup of Abelian variety J0(42) of dimension 5 

sage: G.field_of_definition() 

Rational Field 

""" 

return self.__field_of_definition 

 

def _repr_(self): 

""" 

Return string representation of this finite subgroup. 

 

EXAMPLES:: 

 

sage: J = J0(42) 

sage: G = J.torsion_subgroup(3); G._repr_() 

'Finite subgroup with invariants [3, 3, 3, 3, 3, 3, 3, 3, 3, 3] over QQ of Abelian variety J0(42) of dimension 5' 

""" 

K = self.__field_of_definition 

if K == QQbar: 

field = "QQbar" 

elif K == QQ: 

field = "QQ" 

else: 

field = str(K) 

return "Finite subgroup %sover %s of %s"%(self._invariants_repr(), field, self.__abvar) 

 

def _invariants_repr(self): 

""" 

The string representation of the 'invariants' part of this group. 

 

We make this a separate function so it is possible to create finite 

subgroups that don't print their invariants, since printing them 

could be expensive. 

 

EXAMPLES:: 

 

sage: J0(42).cuspidal_subgroup()._invariants_repr() 

'with invariants [2, 2, 12, 48] ' 

""" 

return 'with invariants %s '%(self.invariants(), ) 

 

def order(self): 

""" 

Return the order (number of elements) of this finite subgroup. 

 

EXAMPLES:: 

 

sage: J = J0(42) 

sage: C = J.cuspidal_subgroup() 

sage: C.order() 

2304 

""" 

try: 

return self.__order 

except AttributeError: 

if self.__abvar.dimension() == 0: 

self.__order = ZZ(1) 

return self.__order 

o = prod(self.invariants()) 

self.__order = o 

return o 

 

def gens(self): 

""" 

Return generators for this finite subgroup. 

 

EXAMPLES: We list generators for several cuspidal subgroups:: 

 

sage: J0(11).cuspidal_subgroup().gens() 

[[(0, 1/5)]] 

sage: J0(37).cuspidal_subgroup().gens() 

[[(0, 0, 0, 1/3)]] 

sage: J0(43).cuspidal_subgroup().gens() 

[[(0, 1/7, 0, 6/7, 0, 5/7)]] 

sage: J1(13).cuspidal_subgroup().gens() 

[[(1/19, 0, 0, 9/19)], [(0, 1/19, 1/19, 18/19)]] 

sage: J0(22).torsion_subgroup(6).gens() 

[[(1/6, 0, 0, 0)], [(0, 1/6, 0, 0)], [(0, 0, 1/6, 0)], [(0, 0, 0, 1/6)]] 

""" 

try: 

return self.__gens 

except AttributeError: 

pass 

 

B = [self.element_class(self, v) for v in self.lattice().basis() if v.denominator() > 1] 

self.__gens = Sequence(B, immutable=True) 

return self.__gens 

 

def gen(self, n): 

r""" 

Return `n^{th}` generator of self. 

 

EXAMPLES:: 

 

sage: J = J0(23) 

sage: C = J.torsion_subgroup(3) 

sage: C.gens() 

[[(1/3, 0, 0, 0)], [(0, 1/3, 0, 0)], [(0, 0, 1/3, 0)], [(0, 0, 0, 1/3)]] 

sage: C.gen(0) 

[(1/3, 0, 0, 0)] 

sage: C.gen(3) 

[(0, 0, 0, 1/3)] 

sage: C.gen(4) 

Traceback (most recent call last): 

... 

IndexError: list index out of range 

 

Negative indices wrap around:: 

 

sage: C.gen(-1) 

[(0, 0, 0, 1/3)] 

""" 

return self.gens()[n] 

 

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

r""" 

Convert `x` into this finite subgroup. 

 

This works when the abelian varieties that contain `x` and 

``self`` are the same, or if `x` is convertible into the 

rational homology (viewed as an abstract `\QQ`-vector space). 

 

EXAMPLES: We first construct the `11`-torsion subgroup of 

`J_0(23)`:: 

 

sage: J = J0(23) 

sage: G = J.torsion_subgroup(11) 

sage: G.invariants() 

[11, 11, 11, 11] 

 

We also construct the cuspidal subgroup:: 

 

sage: C = J.cuspidal_subgroup() 

sage: C.invariants() 

[11] 

 

sage: G(G.0) is G.0 

True 

 

We convert an element from the cuspidal subgroup into the 

`11`-torsion subgroup:: 

 

sage: z = G(C.0); z 

[(1/11, 10/11, 0, 8/11)] 

sage: z.parent() == G 

True 

 

We convert a list, which defines an element of the underlying 

``full_module`` into `G`, and verify an equality:: 

 

sage: x = G([1/11, 1/11, 0, -1/11]) 

sage: x == G([1/11, 1/11, 0, 10/11]) 

True 

 

Finally we attempt to convert some elements that shouldn't 

work, since they are not in `G`:: 

 

sage: G(J.torsion_subgroup(3).0) 

Traceback (most recent call last): 

... 

TypeError: element [1/3, 0, 0, 0] is not in free module 

 

sage: G(J0(27).cuspidal_subgroup()(0)) 

Traceback (most recent call last): 

... 

ValueError: ambient abelian varieties are different 

 

""" 

if isinstance(x, TorsionPoint): 

if x.parent().abelian_variety() != self.abelian_variety(): 

raise ValueError('ambient abelian varieties are different') 

x = x.element() 

x = self.lattice()(x, check=check) 

return self.element_class(self, x, check=False) 

 

def __contains__(self, x): 

""" 

Return ``True`` if ``x`` is contained in this finite subgroup. 

 

EXAMPLES: 

 

We define two distinct finite subgroups of `J_0(27)`:: 

 

sage: G1 = J0(27).rational_cusp_subgroup(); G1 

Finite subgroup with invariants [3] over QQ of Abelian variety J0(27) of dimension 1 

sage: G1.0 

[(1/3, 0)] 

sage: G2 = J0(27).cuspidal_subgroup(); G2 

Finite subgroup with invariants [3, 3] over QQ of Abelian variety J0(27) of dimension 1 

sage: G2.gens() 

[[(1/3, 0)], [(0, 1/3)]] 

 

Now we check whether various elements are in `G_1` and `G_2`:: 

 

sage: G2.0 in G1 

True 

sage: G2.1 in G1 

False 

sage: G1.0 in G1 

True 

sage: G1.0 in G2 

True 

 

The integer `0` is in `G_1`:: 

 

sage: 0 in G1 

True 

 

Elements that have a completely different ambient product Jacobian 

are never in `G`:: 

 

sage: J0(23).cuspidal_subgroup().0 in G1 

False 

sage: J0(23).cuspidal_subgroup()(0) in G1 

False 

""" 

try: 

self(x) 

except (TypeError, ValueError): 

return False 

return True 

 

def subgroup(self, gens): 

""" 

Return the subgroup of ``self`` spanned by the given 

generators, which must all be elements of ``self``. 

 

EXAMPLES:: 

 

sage: J = J0(23) 

sage: G = J.torsion_subgroup(11); G 

Finite subgroup with invariants [11, 11, 11, 11] over QQ of Abelian variety J0(23) of dimension 2 

 

We create the subgroup of the 11-torsion subgroup of `J_0(23)` 

generated by the first `11`-torsion point:: 

 

sage: H = G.subgroup([G.0]); H 

Finite subgroup with invariants [11] over QQbar of Abelian variety J0(23) of dimension 2 

sage: H.invariants() 

[11] 

 

We can also create a subgroup from a list of objects that can 

be converted into the ambient rational homology:: 

 

sage: H == G.subgroup([[1/11,0,0,0]]) 

True 

""" 

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

raise TypeError("gens must be a list or tuple") 

A = self.abelian_variety() 

lattice = A._ambient_lattice().span([self(g).element() for g in gens]) 

return FiniteSubgroup_lattice(self.abelian_variety(), lattice, field_of_definition=QQbar) 

 

def invariants(self): 

r""" 

Return elementary invariants of this abelian group, by which we 

mean a nondecreasing (immutable) sequence of integers 

`n_i`, `1 \leq i \leq k`, with `n_i` 

dividing `n_{i+1}`, and such that this group is abstractly 

isomorphic to 

`\ZZ/n_1\ZZ \times\cdots\times \ZZ/n_k\ZZ.` 

 

EXAMPLES:: 

 

sage: J = J0(38) 

sage: C = J.cuspidal_subgroup(); C 

Finite subgroup with invariants [3, 45] over QQ of Abelian variety J0(38) of dimension 4 

sage: v = C.invariants(); v 

[3, 45] 

sage: v[0] = 5 

Traceback (most recent call last): 

... 

ValueError: object is immutable; please change a copy instead. 

sage: type(v[0]) 

<type 'sage.rings.integer.Integer'> 

 

:: 

 

sage: C * 3 

Finite subgroup with invariants [15] over QQ of Abelian variety J0(38) of dimension 4 

 

An example involving another cuspidal subgroup:: 

 

sage: C = J0(22).cuspidal_subgroup(); C 

Finite subgroup with invariants [5, 5] over QQ of Abelian variety J0(22) of dimension 2 

sage: C.lattice() 

Free module of degree 4 and rank 4 over Integer Ring 

Echelon basis matrix: 

[1/5 1/5 4/5 0] 

[ 0 1 0 0] 

[ 0 0 1 0] 

[ 0 0 0 1/5] 

sage: C.invariants() 

[5, 5] 

""" 

try: 

return self.__invariants 

except AttributeError: 

pass 

M = self.lattice().coordinate_module(self.abelian_variety().lattice()) 

E = M.basis_matrix().change_ring(ZZ).elementary_divisors() 

v = [Integer(x) for x in E if x != 1] 

I = Sequence(v) 

I.sort() 

I.set_immutable() 

self.__invariants = I 

return I 

 

__iter__ = abelian_iterator 

 

 

class FiniteSubgroup_lattice(FiniteSubgroup): 

def __init__(self, abvar, lattice, field_of_definition=QQbar, check=True): 

""" 

A finite subgroup of a modular abelian variety that is defined by a 

given lattice. 

 

INPUT: 

 

 

- ``abvar`` - a modular abelian variety 

 

- ``lattice`` - a lattice that contains the lattice of 

abvar 

 

- ``field_of_definition`` - the field of definition 

of this finite group scheme 

 

- ``check`` - bool (default: True) whether or not to 

check that lattice contains the abvar lattice. 

 

 

EXAMPLES:: 

 

sage: J = J0(11) 

sage: G = J.finite_subgroup([[1/3,0], [0,1/5]]); G 

Finite subgroup with invariants [15] over QQbar of Abelian variety J0(11) of dimension 1 

""" 

if check: 

from .abvar import is_ModularAbelianVariety 

if not is_FreeModule(lattice) or lattice.base_ring() != ZZ: 

raise TypeError("lattice must be a free module over ZZ") 

if not is_ModularAbelianVariety(abvar): 

raise TypeError("abvar must be a modular abelian variety") 

if not abvar.lattice().is_submodule(lattice): 

lattice += abvar.lattice() 

if lattice.rank() != abvar.lattice().rank(): 

raise ValueError("lattice must contain the lattice of abvar with finite index") 

FiniteSubgroup.__init__(self, abvar, field_of_definition) 

self.__lattice = lattice 

 

def lattice(self): 

r""" 

Return lattice that defines this finite subgroup. 

 

EXAMPLES:: 

 

sage: J = J0(11) 

sage: G = J.finite_subgroup([[1/3,0], [0,1/5]]); G 

Finite subgroup with invariants [15] over QQbar of Abelian variety J0(11) of dimension 1 

sage: G.lattice() 

Free module of degree 2 and rank 2 over Integer Ring 

Echelon basis matrix: 

[1/3 0] 

[ 0 1/5] 

""" 

return self.__lattice