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

866

867

868

869

870

871

# -*- coding: utf-8 -*- 

""" 

Spaces of Distributions for Pollack-Stevens modular symbols 

 

The Pollack-Stevens version of modular symbols take values on a 

`\Sigma_0(N)`-module which can be either a symmetric power of the standard 

representation of GL2, or a finite approximation module to the module of 

overconvergent distributions. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import Symk 

sage: S = Symk(6); S 

Sym^6 Q^2 

sage: v = S(list(range(7))); v 

(0, 1, 2, 3, 4, 5, 6) 

sage: v.act_right([1,2,3,4]) 

(18432, 27136, 39936, 58752, 86400, 127008, 186624) 

 

sage: S = Symk(4,Zp(5)); S 

Sym^4 Z_5^2 

sage: S([1,2,3,4,5]) 

(1 + O(5^20), 2 + O(5^20), 3 + O(5^20), 4 + O(5^20), 5 + O(5^21)) 

 

:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(3, 11, 5); D 

Space of 11-adic distributions with k=3 action and precision cap 5 

sage: D([1,2,3,4,5]) 

(1 + O(11^5), 2 + O(11^4), 3 + O(11^3), 4 + O(11^2), 5 + O(11)) 

 

""" 

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

# Copyright (C) 2012 Robert Pollack <rpollack@math.bu.edu> 

# 

# 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 __future__ import print_function 

from __future__ import absolute_import 

from six.moves import range 

 

from sage.modules.module import Module 

from sage.structure.parent import Parent 

from sage.rings.padics.factory import ZpCA, QpCR 

from sage.rings.padics.padic_generic import pAdicGeneric 

from sage.rings.rational_field import QQ 

from sage.rings.integer_ring import ZZ 

from sage.misc.cachefunc import cached_method 

from sage.categories.modules import Modules 

from sage.modular.pollack_stevens.dist import get_dist_classes # , Dist_long 

from sage.structure.factory import UniqueFactory 

 

import sage.rings.ring as ring 

 

from .sigma0 import _default_adjuster 

 

 

class OverconvergentDistributions_factory(UniqueFactory): 

""" 

Create a space of distributions. 

 

INPUT: 

 

- ``k`` -- nonnegative integer 

- ``p`` -- prime number or None 

- ``prec_cap`` -- positive integer or None 

- ``base`` -- ring or None 

- ``character`` -- a dirichlet character or None 

- ``adjuster`` -- None or callable that turns 2 x 2 matrices into a 4-tuple 

- ``act_on_left`` -- bool (default: False) 

- ``dettwist`` -- integer or None (interpreted as 0) 

- ``act_padic`` -- whether monoid should allow `p`-adic coefficients 

- ``implementation`` -- string (default: None). 

Either None (for automatic), 'long', or 'vector' 

 

EXAMPLES:: 

 

sage: D = OverconvergentDistributions(3, 11, 20) 

sage: D 

Space of 11-adic distributions with k=3 action and precision cap 20 

sage: v = D([1,0,0,0,0]) 

sage: v.act_right([2,1,0,1]) 

(8 + O(11^5), 4 + O(11^4), 2 + O(11^3), 1 + O(11^2), 6 + O(11)) 

 

:: 

 

sage: D = OverconvergentDistributions(3, 11, 20, dettwist=1) 

sage: v = D([1,0,0,0,0]) 

sage: v.act_right([2,1,0,1]) 

(5 + 11 + O(11^5), 8 + O(11^4), 4 + O(11^3), 2 + O(11^2), 1 + O(11)) 

""" 

def create_key(self, k, p=None, prec_cap=None, base=None, character=None, 

adjuster=None, act_on_left=False, dettwist=None, 

act_padic=False, implementation=None): 

""" 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: OverconvergentDistributions(20, 3, 10) # indirect doctest 

Space of 3-adic distributions with k=20 action and precision cap 10 

sage: TestSuite(OverconvergentDistributions).run() 

""" 

k = ZZ(k) 

 

if p is None: 

try: 

p = base.prime() 

except AttributeError: 

raise ValueError("You must specify a prime") 

else: 

p = ZZ(p) 

 

if base is None: 

if prec_cap is None: 

base = ZpCA(p) 

else: 

base = ZpCA(p, prec_cap) 

 

if prec_cap is None: 

try: 

prec_cap = base.precision_cap() 

except AttributeError: 

raise ValueError("You must specify a base or precision cap") 

 

if adjuster is None: 

adjuster = _default_adjuster() 

 

if dettwist is not None: 

dettwist = ZZ(dettwist) 

if dettwist == 0: 

dettwist = None 

 

return (k, p, prec_cap, base, character, adjuster, act_on_left, 

dettwist, act_padic, implementation) 

 

def create_object(self, version, key): 

""" 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: OverconvergentDistributions(0, 7, 5) # indirect doctest 

Space of 7-adic distributions with k=0 action and precision cap 5 

""" 

return OverconvergentDistributions_class(*key) 

 

 

class Symk_factory(UniqueFactory): 

r""" 

Create the space of polynomial distributions of degree `k` 

(stored as a sequence of `k + 1` moments). 

 

INPUT: 

 

- ``k`` - (integer): the degree (degree `k` corresponds to weight `k + 2` modular forms) 

- ``base`` - (ring, default None): the base ring (None is interpreted as `\QQ`) 

- ``character`` - (Dirichlet character or None, default None) the character 

- ``adjuster`` - (None or a callable that turns 

`2 \times 2` matrices into a 4-tuple, default None) 

- ``act_on_left`` - (boolean, default False) whether to have the group acting 

on the left rather than the right. 

- ``dettwist`` (integer or None) -- power of determinant to twist by 

 

EXAMPLES:: 

 

sage: D = Symk(4) 

sage: loads(dumps(D)) is D 

True 

sage: loads(dumps(D)) == D 

True 

sage: from sage.modular.pollack_stevens.distributions import Symk 

sage: Symk(5) 

Sym^5 Q^2 

sage: Symk(5, RR) 

Sym^5 (Real Field with 53 bits of precision)^2 

sage: Symk(5, oo.parent()) # don't do this 

Sym^5 (The Infinity Ring)^2 

sage: Symk(5, act_on_left = True) 

Sym^5 Q^2 

 

The ``dettwist`` attribute:: 

 

sage: V = Symk(6) 

sage: v = V([1,0,0,0,0,0,0]) 

sage: v.act_right([2,1,0,1]) 

(64, 32, 16, 8, 4, 2, 1) 

sage: V = Symk(6, dettwist=-1) 

sage: v = V([1,0,0,0,0,0,0]) 

sage: v.act_right([2,1,0,1]) 

(32, 16, 8, 4, 2, 1, 1/2) 

""" 

def create_key(self, k, base=None, character=None, adjuster=None, 

act_on_left=False, dettwist=None, act_padic=False, 

implementation=None): 

r""" 

Sanitize input. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import Symk 

sage: Symk(6) # indirect doctest 

Sym^6 Q^2 

 

sage: V = Symk(6, Qp(7)) 

sage: TestSuite(V).run() 

""" 

k = ZZ(k) 

if adjuster is None: 

adjuster = _default_adjuster() 

if base is None: 

base = QQ 

return (k, base, character, adjuster, act_on_left, dettwist, 

act_padic, implementation) 

 

def create_object(self, version, key): 

r""" 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import Symk 

sage: Symk(6) # indirect doctest 

Sym^6 Q^2 

""" 

return Symk_class(*key) 

 

OverconvergentDistributions = OverconvergentDistributions_factory('OverconvergentDistributions') 

Symk = Symk_factory('Symk') 

 

 

class OverconvergentDistributions_abstract(Module): 

""" 

Parent object for distributions. Not to be used directly, see derived 

classes :class:`Symk_class` and :class:`OverconvergentDistributions_class`. 

 

INPUT: 

 

- ``k`` -- integer; `k` is the usual modular forms weight minus 2 

- ``p`` -- None or prime 

- ``prec_cap`` -- None or positive integer 

- ``base`` -- None or the base ring over which to construct the distributions 

- ``character`` -- None or Dirichlet character 

- ``adjuster`` -- None or a way to specify the action among different conventions 

- ``act_on_left`` -- bool (default: False) 

- ``dettwist`` -- None or integer (twist by determinant). Ignored for Symk spaces 

- ``act_padic`` -- bool (default: False) If true, will allow 

action by `p`-adic matrices. 

- ``implementation`` -- string (default: None) Either automatic (if None), 

'vector' or 'long'. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: OverconvergentDistributions(2, 17, 100) 

Space of 17-adic distributions with k=2 action and precision cap 100 

 

sage: D = OverconvergentDistributions(2, 3, 5); D 

Space of 3-adic distributions with k=2 action and precision cap 5 

sage: type(D) 

<class 'sage.modular.pollack_stevens.distributions.OverconvergentDistributions_class_with_category'> 

""" 

def __init__(self, k, p=None, prec_cap=None, base=None, character=None, 

adjuster=None, act_on_left=False, dettwist=None, 

act_padic=False, implementation=None): 

""" 

See ``OverconvergentDistributions_abstract`` for full documentation. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(2, 3, 5); D 

Space of 3-adic distributions with k=2 action and precision cap 5 

sage: type(D) 

<class 'sage.modular.pollack_stevens.distributions.OverconvergentDistributions_class_with_category'> 

 

`p` must be a prime, but `p=6` below, which is not prime:: 

 

sage: OverconvergentDistributions(k=0, p=6, prec_cap=10) 

Traceback (most recent call last): 

... 

ValueError: p must be prime 

""" 

if not isinstance(base, ring.Ring): 

raise TypeError("base must be a ring") 

from sage.rings.padics.pow_computer import PowComputer 

# should eventually be the PowComputer on ZpCA once that uses longs. 

Dist, WeightKAction = get_dist_classes(p, prec_cap, base, 

self.is_symk(), implementation) 

self.Element = Dist 

# if Dist is Dist_long: 

# self.prime_pow = PowComputer(p, prec_cap, prec_cap, prec_cap) 

Parent.__init__(self, base, category=Modules(base)) 

self._k = k 

self._p = p 

self._prec_cap = prec_cap 

self._character = character 

self._adjuster = adjuster 

self._dettwist = dettwist 

 

if self.is_symk() or character is not None: 

self._act = WeightKAction(self, character, adjuster, act_on_left, 

dettwist, padic=act_padic) 

else: 

self._act = WeightKAction(self, character, adjuster, act_on_left, 

dettwist, padic=True) 

 

self._populate_coercion_lists_(action_list=[self._act]) 

 

def _element_constructor_(self, val, **kwargs): 

""" 

Construct a distribution from data in ``val`` 

 

EXAMPLES:: 

 

sage: V = Symk(6) 

sage: v = V([1,2,3,4,5,6,7]); v 

(1, 2, 3, 4, 5, 6, 7) 

""" 

ordp = kwargs.get('ord',0) 

check = kwargs.get('check',True) 

normalize= kwargs.get('normalize',True) 

return self.Element(val, self, ordp, check, normalize) 

 

def _coerce_map_from_(self, other): 

""" 

Determine if ``self`` has a coerce map from other. 

 

EXAMPLES:: 

 

sage: V = Symk(4) 

sage: W = V.base_extend(QQ[i]) 

sage: W.has_coerce_map_from(V) # indirect doctest 

True 

 

Test some coercions:: 

 

sage: v = V.an_element() 

sage: w = W.an_element() 

sage: v + w 

(0, 2, 4, 6, 8) 

sage: v == w 

True 

""" 

return (isinstance(other, OverconvergentDistributions_abstract) 

and other._k == self._k 

and self._character == other._character 

and self.base_ring().has_coerce_map_from(other.base_ring()) 

and (self.is_symk() or not other.is_symk())) 

 

def acting_matrix(self, g, M): 

r""" 

Return the matrix for the action of `g` on ``self``, truncated to 

the first `M` moments. 

 

EXAMPLES:: 

 

sage: V = Symk(3) 

sage: from sage.modular.pollack_stevens.sigma0 import Sigma0 

sage: V.acting_matrix(Sigma0(1)([3,4,0,1]), 4) 

[27 36 48 64] 

[ 0 9 24 48] 

[ 0 0 3 12] 

[ 0 0 0 1] 

 

sage: from sage.modular.btquotients.pautomorphicform import _btquot_adjuster 

sage: V = Symk(3, adjuster = _btquot_adjuster()) 

sage: from sage.modular.pollack_stevens.sigma0 import Sigma0 

sage: V.acting_matrix(Sigma0(1)([3,4,0,1]), 4) 

[ 1 4 16 64] 

[ 0 3 24 144] 

[ 0 0 9 108] 

[ 0 0 0 27] 

""" 

return self._act.acting_matrix(g, M) 

 

def prime(self): 

""" 

Return prime `p` such that this is a space of `p`-adic distributions. 

 

In case this space is Symk of a non-padic field, we return 0. 

 

OUTPUT: 

 

- a prime or 0 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7); D 

Space of 7-adic distributions with k=0 action and precision cap 20 

sage: D.prime() 

7 

sage: D = Symk(4, base=GF(7)); D 

Sym^4 (Finite Field of size 7)^2 

sage: D.prime() 

0 

 

But Symk of a `p`-adic field does work:: 

 

sage: D = Symk(4, base=Qp(7)); D 

Sym^4 Q_7^2 

sage: D.prime() 

7 

sage: D.is_symk() 

True 

""" 

return self._p 

 

def weight(self): 

""" 

Return the weight of this distribution space. The standard 

caveat applies, namely that the weight of `Sym^k` is 

defined to be `k`, not `k+2`. 

 

OUTPUT: 

 

- nonnegative integer 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7); D 

Space of 7-adic distributions with k=0 action and precision cap 20 

sage: D.weight() 

0 

sage: OverconvergentDistributions(389, 7).weight() 

389 

""" 

return self._k 

 

def precision_cap(self): 

""" 

Return the precision cap on distributions. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 10); D 

Space of 7-adic distributions with k=0 action and precision cap 10 

sage: D.precision_cap() 

10 

sage: D = Symk(389, base=QQ); D 

Sym^389 Q^2 

sage: D.precision_cap() 

390 

""" 

return self._prec_cap 

 

def lift(self, p=None, M=None, new_base_ring=None): 

""" 

Return distribution space that contains lifts with given ``p``, 

precision cap ``M``, and base ring ``new_base_ring``. 

 

INPUT: 

 

- ``p`` -- prime or None 

- ``M`` -- nonnegative integer or None 

- ``new_base_ring`` -- ring or None 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = Symk(0, Qp(7)); D 

Sym^0 Q_7^2 

sage: D.lift(M=20) 

Space of 7-adic distributions with k=0 action and precision cap 20 

sage: D.lift(p=7, M=10) 

Space of 7-adic distributions with k=0 action and precision cap 10 

sage: D.lift(p=7, M=10, new_base_ring=QpCR(7,15)).base_ring() 

7-adic Field with capped relative precision 15 

""" 

if self._character is not None: 

if self._character.base_ring() != QQ: 

# need to change coefficient ring for character 

raise NotImplementedError 

if M is None: 

M = self._prec_cap + 1 

 

# sanitize new_base_ring. Don't want it to end up being QQ! 

if new_base_ring is None: 

new_base_ring = self.base_ring() 

try: 

pp = new_base_ring.prime() 

except AttributeError: 

pp = None 

 

if p is None and pp is None: 

raise ValueError("You must specify a prime") 

elif pp is None: 

new_base_ring = QpCR(p, M) 

elif p is None: 

p = pp 

elif p != pp: 

raise ValueError("Inconsistent primes") 

return OverconvergentDistributions(k=self._k, p=p, prec_cap=M, base=new_base_ring, character=self._character, adjuster=self._adjuster, act_on_left=self._act.is_left()) 

 

@cached_method 

def approx_module(self, M=None): 

""" 

Return the `M`-th approximation module, or if `M` is not specified, 

return the largest approximation module. 

 

INPUT: 

 

- ``M`` -- None or nonnegative integer that is at most the precision cap 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(0, 5, 10) 

sage: D.approx_module() 

Ambient free module of rank 10 over the principal ideal domain 5-adic Ring with capped absolute precision 10 

sage: D.approx_module(1) 

Ambient free module of rank 1 over the principal ideal domain 5-adic Ring with capped absolute precision 10 

sage: D.approx_module(0) 

Ambient free module of rank 0 over the principal ideal domain 5-adic Ring with capped absolute precision 10 

 

Note that ``M`` must be at most the precision cap, and must be nonnegative:: 

 

sage: D.approx_module(11) 

Traceback (most recent call last): 

... 

ValueError: M (=11) must be less than or equal to the precision cap (=10) 

sage: D.approx_module(-1) 

Traceback (most recent call last): 

... 

ValueError: rank (=-1) must be nonnegative 

""" 

 

# print("Calling approx_module with self = ",self," and M = ",M) 

if M is None: 

M = self._prec_cap 

elif M > self._prec_cap: 

raise ValueError("M (=%s) must be less than or equal to the precision cap (=%s)" % (M, self._prec_cap)) 

elif M < self._prec_cap and self.is_symk(): 

raise ValueError("Sym^k objects do not support approximation " 

"modules") 

return self.base_ring() ** M 

 

def random_element(self, M=None, **args): 

""" 

Return a random element of the `M`-th approximation module with 

non-negative valuation. 

 

INPUT: 

 

- ``M`` -- None or a nonnegative integer 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(0, 5, 10) 

sage: D.random_element() 

(..., ..., ..., ..., ..., ..., ..., ..., ..., ...) 

sage: D.random_element(0) 

() 

sage: D.random_element(5) 

(..., ..., ..., ..., ...) 

sage: D.random_element(-1) 

Traceback (most recent call last): 

... 

ValueError: rank (=-1) must be nonnegative 

sage: D.random_element(11) 

Traceback (most recent call last): 

... 

ValueError: M (=11) must be less than or equal to the precision cap (=10) 

""" 

if M is None: 

M = self.precision_cap() 

R = self.base_ring() 

return self((R ** M).random_element(**args)) 

## return self(self.approx_module(M).random_element()) 

 

def clear_cache(self): 

""" 

Clear some caches that are created only for speed purposes. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 10) 

sage: D.clear_cache() 

""" 

self.approx_module.clear_cache() 

self._act.clear_cache() 

 

@cached_method 

def basis(self, M=None): 

""" 

Return a basis for this space of distributions. 

 

INPUT: 

 

- ``M`` -- (Default: None) If not None, specifies the ``M``-th approximation module, 

in case that this makes sense. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 4); D 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D.basis() 

[(1 + O(7^4), O(7^3), O(7^2), O(7)), 

(O(7^4), 1 + O(7^3), O(7^2), O(7)), 

(O(7^4), O(7^3), 1 + O(7^2), O(7)), 

(O(7^4), O(7^3), O(7^2), 1 + O(7))] 

sage: D.basis(2) 

[(1 + O(7^2), O(7)), (O(7^2), 1 + O(7))] 

sage: D = Symk(3, base=QQ); D 

Sym^3 Q^2 

sage: D.basis() 

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

sage: D.basis(2) 

Traceback (most recent call last): 

... 

ValueError: Sym^k objects do not support approximation modules 

""" 

V = self.approx_module(M) 

return [self(v) for v in V.basis()] 

 

def _an_element_(self): 

""" 

Return a typical element of self. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(0, 7, 4); D 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D.an_element() # indirect doctest 

(2 + O(7^2), 1 + O(7)) 

""" 

if self._prec_cap > 1: 

return self([2, 1]) 

else: 

return self([1]) 

 

 

class Symk_class(OverconvergentDistributions_abstract): 

 

def __init__(self, k, base, character, adjuster, act_on_left, dettwist, 

act_padic, implementation): 

r""" 

EXAMPLES:: 

 

sage: D = sage.modular.pollack_stevens.distributions.Symk(4); D 

Sym^4 Q^2 

sage: TestSuite(D).run() # indirect doctest 

""" 

if hasattr(base, 'prime'): 

p = base.prime() 

else: 

p = ZZ(0) 

OverconvergentDistributions_abstract.__init__(self, k, p, k + 1, base, character, 

adjuster, act_on_left, dettwist, 

act_padic, implementation) 

 

def _an_element_(self): 

r""" 

Return a representative element of ``self``. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import Symk 

sage: D = Symk(3, base=QQ); D 

Sym^3 Q^2 

sage: D.an_element() # indirect doctest 

(0, 1, 2, 3) 

""" 

return self(list(range(self.weight() + 1))) 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: Symk(6) 

Sym^6 Q^2 

sage: Symk(6,dettwist=3) 

Sym^6 Q^2 * det^3 

sage: Symk(6,character=DirichletGroup(7,QQ).0) 

Sym^6 Q^2 twisted by Dirichlet character modulo 7 of conductor 7 mapping 3 |--> -1 

sage: Symk(6,character=DirichletGroup(7,QQ).0,dettwist=3) 

Sym^6 Q^2 * det^3 twisted by Dirichlet character modulo 7 of conductor 7 mapping 3 |--> -1 

 

""" 

if self.base_ring() is QQ: 

V = 'Q^2' 

elif self.base_ring() is ZZ: 

V = 'Z^2' 

elif isinstance(self.base_ring(), pAdicGeneric) and self.base_ring().degree() == 1: 

if self.base_ring().is_field(): 

V = 'Q_%s^2' % self._p 

else: 

V = 'Z_%s^2' % self._p 

else: 

V = '(%s)^2' % self.base_ring() 

s = "Sym^%s %s" % (self._k, V) 

if self._dettwist is not None and self._dettwist != 0: 

s += " * det^%s" % self._dettwist 

if self._character is not None: 

s += " twisted by %s" % self._character 

return s 

 

def is_symk(self): 

""" 

Whether or not this distributions space is `Sym^k(R)` for some ring `R`. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(4, 17, 10); D 

Space of 17-adic distributions with k=4 action and precision cap 10 

sage: D.is_symk() 

False 

sage: D = Symk(4); D 

Sym^4 Q^2 

sage: D.is_symk() 

True 

sage: D = Symk(4, base=GF(7)); D 

Sym^4 (Finite Field of size 7)^2 

sage: D.is_symk() 

True 

""" 

return True 

 

def change_ring(self, new_base_ring): 

""" 

Return a Symk with the same `k` but a different base ring. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 4); D 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D.base_ring() 

7-adic Ring with capped absolute precision 4 

sage: D2 = D.change_ring(QpCR(7)); D2 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D2.base_ring() 

7-adic Field with capped relative precision 20 

""" 

return Symk(k=self._k, base=new_base_ring, character=self._character, adjuster=self._adjuster, act_on_left=self._act.is_left()) 

 

def base_extend(self, new_base_ring): 

r""" 

Extend scalars to a new base ring. 

 

EXAMPLES:: 

 

sage: Symk(3).base_extend(Qp(3)) 

Sym^3 Q_3^2 

""" 

if not new_base_ring.has_coerce_map_from(self.base_ring()): 

raise ValueError("New base ring (%s) does not have a coercion from %s" % (new_base_ring, self.base_ring())) 

return self.change_ring(new_base_ring) 

 

 

class OverconvergentDistributions_class(OverconvergentDistributions_abstract): 

r""" 

The class of overconvergent distributions 

 

This class represents the module of finite approximation modules, which are finite-dimensional 

spaces with a `\Sigma_0(N)` action which approximate the module of overconvergent distributions. 

There is a specialization map to the finite-dimensional Symk module as well. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions 

sage: D = OverconvergentDistributions(0, 5, 10) 

sage: TestSuite(D).run() 

""" 

 

def _repr_(self): 

""" 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: OverconvergentDistributions(0, 5, 10)._repr_() 

'Space of 5-adic distributions with k=0 action and precision cap 10' 

sage: OverconvergentDistributions(0, 5, 10) 

Space of 5-adic distributions with k=0 action and precision cap 10 

 

Examples with twists:: 

 

sage: OverconvergentDistributions(0,3,4) 

Space of 3-adic distributions with k=0 action and precision cap 4 

sage: OverconvergentDistributions(0,3,4,dettwist=-1) 

Space of 3-adic distributions with k=0 action and precision cap 4 twistted by det^-1 

sage: OverconvergentDistributions(0,3,4,character=DirichletGroup(3).0) 

Space of 3-adic distributions with k=0 action and precision cap 4 twistted by (Dirichlet character modulo 3 of conductor 3 mapping 2 |--> -1) 

sage: OverconvergentDistributions(0,3,4,character=DirichletGroup(3).0,dettwist=-1) 

Space of 3-adic distributions with k=0 action and precision cap 4 twistted by det^-1 * (Dirichlet character modulo 3 of conductor 3 mapping 2 |--> -1) 

""" 

s = "Space of %s-adic distributions with k=%s action and precision cap %s" % (self._p, self._k, self._prec_cap) 

twiststuff = [] 

if self._dettwist is not None: 

twiststuff.append("det^%s" % self._dettwist) 

if self._character is not None: 

twiststuff.append("(%s)" % self._character) 

if twiststuff: 

s += " twistted by " + " * ".join(twiststuff) 

return s 

 

def is_symk(self): 

""" 

Whether or not this distributions space is `Sym^k(R)` for some ring `R`. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(4, 17, 10); D 

Space of 17-adic distributions with k=4 action and precision cap 10 

sage: D.is_symk() 

False 

sage: D = Symk(4); D 

Sym^4 Q^2 

sage: D.is_symk() 

True 

sage: D = Symk(4, base=GF(7)); D 

Sym^4 (Finite Field of size 7)^2 

sage: D.is_symk() 

True 

""" 

return False 

 

def change_ring(self, new_base_ring): 

""" 

Return space of distributions like this one, but with the base ring changed. 

 

INPUT: a ring over which the distribution can be coerced. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 4); D 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D.base_ring() 

7-adic Ring with capped absolute precision 4 

sage: D2 = D.change_ring(QpCR(7)); D2 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D2.base_ring() 

7-adic Field with capped relative precision 20 

""" 

return OverconvergentDistributions(k=self._k, p=self._p, prec_cap=self._prec_cap, base=new_base_ring, character=self._character, adjuster=self._adjuster, act_on_left=self._act.is_left()) 

 

def specialize(self, new_base_ring=None): 

""" 

Return distribution space got by specializing to `Sym^k`, over 

the ``new_base_ring``. If ``new_base_ring`` is not given, use current 

``base_ring``. 

 

EXAMPLES:: 

 

sage: from sage.modular.pollack_stevens.distributions import OverconvergentDistributions, Symk 

sage: D = OverconvergentDistributions(0, 7, 4); D 

Space of 7-adic distributions with k=0 action and precision cap 4 

sage: D.is_symk() 

False 

sage: D2 = D.specialize(); D2 

Sym^0 Z_7^2 

sage: D2.is_symk() 

True 

sage: D2 = D.specialize(QQ); D2 

Sym^0 Q^2 

""" 

if self._character is not None: 

raise NotImplementedError 

if new_base_ring is None: 

new_base_ring = self.base_ring() 

return Symk(k=self._k, base=new_base_ring, adjuster=self._adjuster, act_on_left=self._act.is_left())