/
analytic_type.py
578 lines (458 loc) · 17.8 KB
/
analytic_type.py
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
r"""
Functor construction for all spaces (artificial to make the coercion framework work)
AUTHORS:
- Jonas Jermann (2013): initial version
"""
#*****************************************************************************
# Copyright (C) 2013-2014 Jonas Jermann <jjermann2@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.sets.set import Set
from sage.combinat.posets.posets import Poset, FinitePoset
from sage.combinat.posets.lattices import FiniteLatticePoset
from sage.combinat.posets.elements import LatticePosetElement
class AnalyticTypeElement(LatticePosetElement):
r"""
Analytic types of forms and/or spaces
The class derives from LatticePosetElement.
An analytic type element describes what basic analytic
properties are contained/included in it.
EXAMPLES::
sage: AT = AnalyticType()
sage: el = AT(["quasi", "cusp"])
sage: el
quasi cuspidal
sage: isinstance(el, AnalyticTypeElement)
True
sage: isinstance(el, LatticePosetElement)
True
sage: el.parent() == AT
True
sage: el.element
{cusp, quasi}
sage: from sage.sets.set import Set_object_enumerated
sage: isinstance(el.element, Set_object_enumerated)
True
sage: el.element[0]
cusp
sage: el.element[0].parent() == AT.base_poset()
True
sage: el2 = AT("holo")
sage: sum = el + el2
sage: sum
quasi modular
sage: sum.element
{holo, cusp, quasi}
sage: el * el2
cuspidal
"""
# We use the same constructor as LatticePosetElement
#def __init__(self, poset, element, vertex):
# super(AnalyticTypeElement, self).__init__(poset, element, vertex)
def _repr_(self):
r"""
Return the string representation of ``self``.
EXAMPLES::
sage: AnalyticType()(["quasi", "cusp"])
quasi cuspidal
"""
return self.analytic_name()
def _latex_(self):
r"""
Return the LaTeX representation of ``self``.
EXAMPLES::
sage: latex(AnalyticType()(["quasi", "cusp"]))
\text{\texttt{quasi{ }cuspidal}}
"""
from sage.misc.latex import latex
return latex(self.analytic_name())
def analytic_space_name(self):
r"""
Return the (analytic part of the) name of a space
with the analytic type of ``self``.
This is used for the string representation of such spaces.
EXAMPLES::
sage: AT = AnalyticType()
sage: AT(["quasi", "weak"]).analytic_space_name()
'QuasiWeakModular'
sage: AT(["quasi", "cusp"]).analytic_space_name()
'QuasiCusp'
sage: AT(["quasi"]).analytic_space_name()
'Zero'
sage: AT([]).analytic_space_name()
'Zero'
"""
name = ""
if self.parent()("quasi") <= self:
name += "Quasi"
if self.parent()("mero") <= self:
name += "MeromorphicModular"
elif self.parent()("weak") <= self:
name += "WeakModular"
elif self.parent()("holo") <= self:
name += "Modular"
elif self.parent()("cusp") <= self:
name += "Cusp"
else:
name = "Zero"
return name
def latex_space_name(self):
r"""
Return the short (analytic part of the) name of a space
with the analytic type of ``self`` for usage with latex.
This is used for the latex representation of such spaces.
EXAMPLES::
sage: AT = AnalyticType()
sage: AT("mero").latex_space_name()
'\\tilde{M}'
sage: AT("weak").latex_space_name()
'M^!'
sage: AT(["quasi", "cusp"]).latex_space_name()
'QC'
sage: AT([]).latex_space_name()
'Z'
"""
name = ""
if self.parent()("quasi") <= self:
name += "Q"
if self.parent()("mero") <= self:
name += "\\tilde{M}"
elif self.parent()("weak") <= self:
name += "M^!"
elif self.parent()("holo") <= self:
name += "M"
elif self.parent()("cusp") <= self:
name += "C"
else:
name = "Z"
return name
def analytic_name(self):
r"""
Return a string representation of the analytic type.
sage: AT = AnalyticType()
sage: AT(["quasi", "weak"]).analytic_name()
'quasi weakly holomorphic modular'
sage: AT(["quasi", "cusp"]).analytic_name()
'quasi cuspidal'
sage: AT(["quasi"]).analytic_name()
'zero'
sage: AT([]).analytic_name()
'zero'
"""
name = ""
if self.parent()("quasi") <= self:
name += "quasi "
if self.parent()("mero") <= self:
name += "meromorphic modular"
elif self.parent()("weak") <= self:
name += "weakly holomorphic modular"
elif self.parent()("holo") <= self:
name += "modular"
elif self.parent()("cusp") <= self:
name += "cuspidal"
else:
name = "zero"
return name
def reduce_to(self, reduce_type):
r"""
Return a new analytic type which contains only analytic properties
specified in both ``self`` and ``reduce_type``.
INPUT:
- ``reduce_type`` - An analytic type or something which is
convertable to an analytic type.
OUTPUT:
The new reduced analytic type.
EXAMPLES::
sage: AT = AnalyticType()
sage: el = AT(["quasi", "cusp"])
sage: el2 = AT("holo")
sage: el.reduce_to(el2)
cuspidal
sage: el.reduce_to(el2) == el * el2
True
"""
reduce_type = self.parent()(reduce_type)
return self * reduce_type
def extend_by(self, extend_type):
r"""
Return a new analytic type which contains all analytic properties
specified either in ``self`` or in ``extend_type``.
INPUT:
- ``extend_type`` - An analytic type or something which is
convertable to an analytic type.
OUTPUT:
The new extended analytic type.
EXAMPLES::
sage: AT = AnalyticType()
sage: el = AT(["quasi", "cusp"])
sage: el2 = AT("holo")
sage: el.extend_by(el2)
quasi modular
sage: el.extend_by(el2) == el + el2
True
"""
extend_type = self.parent()(extend_type)
return self + extend_type
# is it ok to define the iterator that way (strings on el.element for el in self.element)??
# alternatively: go through all x with x<=y of of the analytic type element y
# or return the Poset Element instead of the string
def __iter__(self):
r"""
Return an iterator of ``self`` which gives the basic analytic
properties contained in ``self`` as strings.
EXAMPLES::
sage: el = AnalyticType()(["quasi", "weak"])
sage: prop_list =[prop for prop in el]
sage: prop_list
['holo', 'cusp', 'quasi', 'weak']
sage: "mero" in el
False
sage: "cusp" in el
True
"""
return iter([el.element for el in self.element])
class AnalyticType(FiniteLatticePoset):
r"""
Container for all possible analytic types of forms and/or spaces
The ``analytic type`` of forms spaces or rings describes all possible
occuring basic ``analytic properties`` of elements in the space/ring
(or more).
For ambient spaces/rings this means that all elements with those properties
(and the restrictions of the space/ring) are contained in the space/ring.
The analytic type of an element is the analytic type of its minimal
ambient space/ring.
The basic ``analytic properties`` are:
- ``quasi`` - Whether the element is quasi modular (and not modular)
or modular.
- ``mero`` - ``meromorphic``: If the element is meromorphic
and meromorphic at infinity.
- ``weak`` - ``weakly holomorphic``: If the element is holomorphic
and meromorphic at infinity.
- ``holo`` - ``holomorphic``: If the element is holomorphic and
holomorphic at infinity.
- ``cusp`` - ``cuspidal``: If the element additionally has a positive
order at infinity.
The ``zero`` elements/property have no analytic properties (or only ``quasi``).
For ring elements the property describes whether one of its homogeneous
components satisfies that property and the "union" of those properties
is returned as the ``analytic type``.
Similarly for quasi forms the property describes whether one of its
quasi components satisfies that property.
There is a (natural) partial order between the basic properties
(and analytic types) given by "inclusion". We name the analytic type
according to its maximal analytic properties.
EXAMPLES::
For n=3 the quasi form ``el = E6 - E2^3`` has the quasi components ``E6``
which is ``holomorphic`` and ``E2^3`` which is ``quasi holomorphic``.
So the analytic type of ``el`` is ``quasi holomorphic`` despite the fact
that the sum (``el``) describes a function which is zero at infinity.
sage: from space import QModularForms
sage: x,y,z,d = var("x,y,z,d")
sage: el = QModularForms(group=3, k=6, ep=-1)(y-z^3)
sage: el.analytic_type()
quasi modular
Similarly the type of the ring element ``el2 = E4/Delta - E6/Delta`` is
``weakly holomorphic`` despite the fact that the sum (``el2``) describes
a function which is holomorphic at infinity.
sage: from graded_ring import WeakModularFormsRing
sage: x,y,z,d = var("x,y,z,d")
sage: el2 = WeakModularFormsRing(group=3)(x/(x^3-y^2)-y/(x^3-y^2))
sage: el2.analytic_type()
weakly holomorphic modular
"""
Element = AnalyticTypeElement
@staticmethod
def __classcall__(cls):
r"""
Directly return the classcall of UniqueRepresentation
(skipping the classcalls of the other superclasses).
That's because ``self`` is supposed to be used as a Singleton.
It initializes the FinitelatticePoset with the proper arguments
by itself in ``self.__init__()``.
EXAMPLES::
sage: AT = AnalyticType()
sage: AT2 = AnalyticType()
sage: AT == AT2
True
"""
return super(FinitePoset, cls).__classcall__(cls)
def __init__(self):
r"""
Container for all possible analytic types of forms and/or spaces.
This class is supposed to be used as a Singleton.
It first creates a ``Poset`` that contains all basic analytic
properties to be modeled by the AnalyticType. Then the order
ideals lattice of that Poset is taken as the underlying
FiniteLatticePoset of ``self``.
In particular elements of ``self`` describe what basic analytic
properties are contained/included in that element.
EXAMPLES::
sage: AT = AnalyticType()
sage: AT
Analytic Type
sage: isinstance(AT, FiniteLatticePoset)
True
sage: AT.is_lattice()
True
sage: AT.is_finite()
True
sage: AT.cardinality()
10
sage: AT.is_modular()
True
sage: AT.is_bounded()
True
sage: AT.is_distributive()
True
sage: AT.list()
[zero,
zero,
cuspidal,
modular,
weakly holomorphic modular,
quasi cuspidal,
quasi modular,
quasi weakly holomorphic modular,
meromorphic modular,
quasi meromorphic modular]
sage: len(AT.relations())
45
sage: AT.cover_relations()
[[zero, zero],
[zero, cuspidal],
[zero, quasi cuspidal],
[cuspidal, modular],
[cuspidal, quasi cuspidal],
[modular, weakly holomorphic modular],
[modular, quasi modular],
[weakly holomorphic modular, quasi weakly holomorphic modular],
[weakly holomorphic modular, meromorphic modular],
[quasi cuspidal, quasi modular],
[quasi modular, quasi weakly holomorphic modular],
[quasi weakly holomorphic modular, quasi meromorphic modular],
[meromorphic modular, quasi meromorphic modular]]
sage: AT.has_top()
True
sage: AT.has_bottom()
True
sage: AT.top()
quasi meromorphic modular
sage: AT.bottom()
zero
"""
# We (arbitrarily) choose to model by inclusion instead of restriction
P_elements = [ "cusp", "holo", "weak", "mero", "quasi"]
P_relations = [["cusp", "holo"], ["holo", "weak"], ["weak", "mero"]]
self._base_poset = Poset([P_elements, P_relations], cover_relations=True, facade=False)
L = self._base_poset.order_ideals_lattice()
L = FiniteLatticePoset(L, facade=False)
FiniteLatticePoset.__init__(self, hasse_diagram=L._hasse_diagram, elements=L._elements, category=L.category(), facade=L._is_facade, key=None)
def _repr_(self):
r"""
Return the string representation of ``self``.
EXAMPLES::
sage: AnalyticType()
Analytic Type
"""
return "Analytic Type"
def __call__(self, *args, **kwargs):
r"""
Return the result of the corresponding call function
of ``FiniteLatticePoset``.
If more than one argument is given it is called with
the list of those arguments instead.
EXAMPLES::
sage: AT = AnalyticType()
sage: AT("holo", "quasi") == AT(["holo", "quasi"])
True
"""
if len(args)>1:
return super(AnalyticType,self).__call__([arg for arg in args], **kwargs)
else:
return super(AnalyticType,self).__call__(*args, **kwargs)
def _element_constructor_(self, element):
r"""
Return ``element`` coerced into an element of ``self``.
INPUT:
- ``element`` - Either something which coerces in the
``FiniteLatticePoset`` of ``self`` or
a string or a list of strings of basic
properties that should be contained in
the new element.
OUTPUT:
An element of ``self`` corresponding to ``element``
(resp. containing all specified basic analytic properties).
EXAMPLES::
sage: AT = AnalyticType()
sage: AT("holo") == AT(["holo"])
True
sage: el = AT(["quasi", "holo"])
sage: el
quasi modular
sage: el == AT(("holo", "quasi"))
True
sage: el.parent() == AT
True
sage: isinstance(el, AnalyticTypeElement)
True
sage: el.element
{holo, cusp, quasi}
"""
if type(element)==str:
element=[element]
if isinstance(element,list) or isinstance(element,tuple):
element = Set(self._base_poset.order_ideal([self._base_poset(s) for s in element]))
return super(AnalyticType, self)._element_constructor_(element)
#res = self.first()
#for element in args:
# if type(element)==str:
# element=[element]
# if isinstance(element,list) or isinstance(element,tuple):
# element = Set(self._base_poset.order_ideal([self._base_poset(s) for s in element]))
# element = super(AnalyticType,self)._element_constructor_(element)
# res += element
#return res
def base_poset(self):
r"""
Return the base poset from which everything of ``self``
was constructed. Elements of the base poset correspond
to the basic ``analytic properties``.
EXAMPLES::
sage: AT = AnalyticType()
sage: P = AT.base_poset()
sage: P
Finite poset containing 5 elements
sage: isinstance(P, FinitePoset)
True
sage: P.is_lattice()
False
sage: P.is_finite()
True
sage: P.cardinality()
5
sage: P.is_bounded()
False
sage: P.list()
[quasi, cusp, holo, weak, mero]
sage: len(P.relations())
11
sage: P.cover_relations()
[[cusp, holo], [holo, weak], [weak, mero]]
sage: P.has_top()
False
sage: P.has_bottom()
False
"""
return self._base_poset
def lattice_poset(self):
r"""
Return the underlying lattice poset of ``self``.
EXAMPLES::
sage: AnalyticType().lattice_poset()
Finite lattice containing 10 elements
"""
return FiniteLatticePoset(self._base_poset.order_ideals_lattice(), facade=False)