# Functor construction for all spaces#

AUTHORS:

• Jonas Jermann (2013): initial version

This class is used to distinguish the construction of constant elements (modular forms of weight 0) over the given ring and the construction of `FormsRing` or `FormsSpace` based on the BaseFacade of the given ring.

If that distinction was not made then ring elements couldn’t be considered as constant modular forms in e.g. binary operations. Instead the coercion model would assume that the ring element lies in the common parent of the ring element and e.g. a `FormsSpace` which would give the `FormsSpace` over the ring. However this is not correct, the `FormsSpace` might (and probably will) not even contain the (constant) ring element. Hence we use the `BaseFacade` to distinguish the two cases.

Since the `BaseFacade` of a ring embeds into that ring, a common base (resp. a coercion) between the two (or even a more general ring) can be found, namely the ring (not the `BaseFacade` of it).

sage.modular.modform_hecketriangle.functors.ConstantFormsSpaceFunctor(group)#

Construction functor for the space of constant forms.

When determining a common parent between a ring and a forms ring or space this functor is first applied to the ring.

EXAMPLES:

```sage: from sage.modular.modform_hecketriangle.functors import (ConstantFormsSpaceFunctor, FormsSpaceFunctor)
sage: ConstantFormsSpaceFunctor(4) == FormsSpaceFunctor("holo", 4, 0, 1)
True
sage: ConstantFormsSpaceFunctor(4)
ModularFormsFunctor(n=4, k=0, ep=1)
```
class sage.modular.modform_hecketriangle.functors.FormsRingFunctor(analytic_type, group, red_hom)#

Construction functor for forms rings.

NOTE:

When the base ring is not a `BaseFacade` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions. (when trying to find a common parent between a forms ring and a ring which is not a `BaseFacade`).

AT = Analytic Type#
AnalyticType#

alias of `AnalyticType`

merge(other)#

Return the merged functor of `self` and `other`.

It is only possible to merge instances of `FormsSpaceFunctor` and `FormsRingFunctor`. Also only if they share the same group. An `FormsSubSpaceFunctors` is replaced by its ambient space functor.

The analytic type of the merged functor is the extension of the two analytic types of the functors. The `red_hom` parameter of the merged functor is the logical `and` of the two corresponding `red_hom` parameters (where a forms space is assumed to have it set to `True`).

Two `FormsSpaceFunctor` with different (k,ep) are merged to a corresponding `FormsRingFunctor`. Otherwise the corresponding (extended) `FormsSpaceFunctor` is returned.

A `FormsSpaceFunctor` and `FormsRingFunctor` are merged to a corresponding (extended) `FormsRingFunctor`.

Two `FormsRingFunctors` are merged to the corresponding (extended) `FormsRingFunctor`.

EXAMPLES:

```sage: from sage.modular.modform_hecketriangle.functors import (FormsSpaceFunctor, FormsRingFunctor)
sage: functor1 = FormsRingFunctor("mero", group=6, red_hom=True)
sage: functor2 = FormsRingFunctor(["quasi", "cusp"], group=6, red_hom=False)
sage: functor3 = FormsSpaceFunctor("weak", group=6, k=0, ep=1)
sage: functor4 = FormsRingFunctor("mero", group=5, red_hom=True)

sage: functor1.merge(functor1) is functor1
True
sage: functor1.merge(functor4) is None
True
sage: functor1.merge(functor2)
QuasiMeromorphicModularFormsRingFunctor(n=6)
sage: functor1.merge(functor3)
MeromorphicModularFormsRingFunctor(n=6, red_hom=True)
```
rank = 10#
class sage.modular.modform_hecketriangle.functors.FormsSpaceFunctor(analytic_type, group, k, ep)#

Construction functor for forms spaces.

NOTE:

When the base ring is not a `BaseFacade` the functor is first merged with the ConstantFormsSpaceFunctor. This case occurs in the pushout constructions (when trying to find a common parent between a forms space and a ring which is not a `BaseFacade`).

AT = Analytic Type#
AnalyticType#

alias of `AnalyticType`

merge(other)#

Return the merged functor of `self` and `other`.

It is only possible to merge instances of `FormsSpaceFunctor` and `FormsRingFunctor`. Also only if they share the same group. An `FormsSubSpaceFunctors` is replaced by its ambient space functor.

The analytic type of the merged functor is the extension of the two analytic types of the functors. The `red_hom` parameter of the merged functor is the logical `and` of the two corresponding `red_hom` parameters (where a forms space is assumed to have it set to `True`).

Two `FormsSpaceFunctor` with different (k,ep) are merged to a corresponding `FormsRingFunctor`. Otherwise the corresponding (extended) `FormsSpaceFunctor` is returned.

A `FormsSpaceFunctor` and `FormsRingFunctor` are merged to a corresponding (extended) `FormsRingFunctor`.

Two `FormsRingFunctors` are merged to the corresponding (extended) `FormsRingFunctor`.

EXAMPLES:

```sage: from sage.modular.modform_hecketriangle.functors import (FormsSpaceFunctor, FormsRingFunctor)
sage: functor1 = FormsSpaceFunctor("holo", group=5, k=0, ep=1)
sage: functor2 = FormsSpaceFunctor(["quasi", "cusp"], group=5, k=10/3, ep=-1)
sage: functor3 = FormsSpaceFunctor(["quasi", "mero"], group=5, k=0, ep=1)
sage: functor4 = FormsRingFunctor("cusp", group=5, red_hom=False)
sage: functor5 = FormsSpaceFunctor("holo", group=4, k=0, ep=1)

sage: functor1.merge(functor1) is functor1
True
sage: functor1.merge(functor5) is None
True
sage: functor1.merge(functor2)
QuasiModularFormsRingFunctor(n=5, red_hom=True)
sage: functor1.merge(functor3)
QuasiMeromorphicModularFormsFunctor(n=5, k=0, ep=1)
sage: functor1.merge(functor4)
ModularFormsRingFunctor(n=5)
```
rank = 10#
class sage.modular.modform_hecketriangle.functors.FormsSubSpaceFunctor(ambient_space_functor, generators)#

Construction functor for forms sub spaces.

merge(other)#

Return the merged functor of `self` and `other`.

If `other` is a `FormsSubSpaceFunctor` then first the common ambient space functor is constructed by merging the two corresponding functors.

If that ambient space functor is a FormsSpaceFunctor and the generators agree the corresponding `FormsSubSpaceFunctor` is returned.

If `other` is not a `FormsSubSpaceFunctor` then `self` is merged as if it was its ambient space functor.

EXAMPLES:

```sage: from sage.modular.modform_hecketriangle.functors import (FormsSpaceFunctor, FormsSubSpaceFunctor)
sage: from sage.modular.modform_hecketriangle.space import ModularForms
sage: ambient_space = ModularForms(n=4, k=12, ep=1)
sage: ambient_space_functor1 = FormsSpaceFunctor("holo", group=4, k=12, ep=1)
sage: ambient_space_functor2 = FormsSpaceFunctor("cusp", group=4, k=12, ep=1)
sage: ss_functor1 = FormsSubSpaceFunctor(ambient_space_functor1, [ambient_space.gen(0)])
sage: ss_functor2 = FormsSubSpaceFunctor(ambient_space_functor2, [ambient_space.gen(0)])
sage: ss_functor3 = FormsSubSpaceFunctor(ambient_space_functor2, [2*ambient_space.gen(0)])
sage: merged_ambient = ambient_space_functor1.merge(ambient_space_functor2)
sage: merged_ambient
ModularFormsFunctor(n=4, k=12, ep=1)
sage: functor4 = FormsSpaceFunctor(["quasi", "cusp"], group=4, k=10, ep=-1)

sage: ss_functor1.merge(ss_functor1) is ss_functor1
True
sage: ss_functor1.merge(ss_functor2)
FormsSubSpaceFunctor with 2 generators for the ModularFormsFunctor(n=4, k=12, ep=1)
sage: ss_functor1.merge(ss_functor2) == FormsSubSpaceFunctor(merged_ambient, [ambient_space.gen(0), ambient_space.gen(0)])
True
sage: ss_functor1.merge(ss_functor3) == FormsSubSpaceFunctor(merged_ambient, [ambient_space.gen(0), 2*ambient_space.gen(0)])
True
sage: ss_functor1.merge(ambient_space_functor2) == merged_ambient
True
sage: ss_functor1.merge(functor4)
QuasiModularFormsRingFunctor(n=4, red_hom=True)
```
rank = 10#