# Congruence arithmetic subgroups of $${\rm SL}_2(\ZZ)$$¶

Sage can compute extensively with the standard congruence subgroups $$\Gamma_0(N)$$, $$\Gamma_1(N)$$, and $$\Gamma_H(N)$$.

AUTHORS:

• William Stein
• David Loeffler (2009, 10) – modifications to work with more general arithmetic subgroups
class sage.modular.arithgroup.congroup_generic.CongruenceSubgroup(*args, **kwds)¶

Bases: sage.modular.arithgroup.congroup_generic.CongruenceSubgroupFromGroup

One of the “standard” congruence subgroups $$\Gamma_0(N)$$, $$\Gamma_1(N)$$, $$\Gamma(N)$$, or $$\Gamma_H(N)$$ (for some $$H$$).

This class is not intended to be instantiated directly. Derived subclasses must override __call__, _repr_, and image_mod_n.

image_mod_n()¶

Raise an error: all derived subclasses should override this function.

EXAMPLE:

sage: sage.modular.arithgroup.congroup_generic.CongruenceSubgroup(5).image_mod_n() Traceback (most recent call last): ... NotImplementedError
modular_abelian_variety()¶

Return the modular abelian variety corresponding to the congruence subgroup self.

EXAMPLES:

```sage: Gamma0(11).modular_abelian_variety()
Abelian variety J0(11) of dimension 1
sage: Gamma1(11).modular_abelian_variety()
Abelian variety J1(11) of dimension 1
sage: GammaH(11,[3]).modular_abelian_variety()
Abelian variety JH(11,[3]) of dimension 1
```
modular_symbols(sign=0, weight=2, base_ring=Rational Field)¶

Return the space of modular symbols of the specified weight and sign on the congruence subgroup self.

EXAMPLES:

```sage: G = Gamma0(23)
sage: G.modular_symbols()
Modular Symbols space of dimension 5 for Gamma_0(23) of weight 2 with sign 0 over Rational Field
sage: G.modular_symbols(weight=4)
Modular Symbols space of dimension 12 for Gamma_0(23) of weight 4 with sign 0 over Rational Field
sage: G.modular_symbols(base_ring=GF(7))
Modular Symbols space of dimension 5 for Gamma_0(23) of weight 2 with sign 0 over Finite Field of size 7
sage: G.modular_symbols(sign=1)
Modular Symbols space of dimension 3 for Gamma_0(23) of weight 2 with sign 1 over Rational Field
```
class sage.modular.arithgroup.congroup_generic.CongruenceSubgroupBase(level)¶

Bases: sage.modular.arithgroup.arithgroup_generic.ArithmeticSubgroup

Create a congruence subgroup with given level.

EXAMPLES:

```sage: Gamma0(500)
Congruence Subgroup Gamma0(500)
```
is_congruence()¶

Return True, since this is a congruence subgroup.

EXAMPLE:

```sage: Gamma0(7).is_congruence()
True
```
level()¶

Return the level of this congruence subgroup.

EXAMPLES:

```sage: SL2Z.level()
1
sage: Gamma0(20).level()
20
sage: Gamma1(11).level()
11
sage: GammaH(14, [5]).level()
14
```
class sage.modular.arithgroup.congroup_generic.CongruenceSubgroupFromGroup(G)¶

Bases: sage.modular.arithgroup.congroup_generic.CongruenceSubgroupBase

A congruence subgroup, defined by the data of an integer $$N$$ and a subgroup $$G$$ of the finite group $$SL(2, \ZZ / N\ZZ)$$; the congruence subgroup consists of all the matrices in $$SL(2, \ZZ)$$ whose reduction modulo $$N$$ lies in $$G$$.

This class should not be instantiated directly, but created using the factory function CongruenceSubgroup_constructor(), which accepts much more flexible input, and checks the input to make sure it is valid.

TESTS:

```sage: G = CongruenceSubgroup(5, [[0,-1,1,0]]); G
Congruence subgroup of SL(2,Z) of level 5, preimage of:
 Matrix group over Ring of integers modulo 5 with 1 generators: 
 [[[0, 4], [1, 0]]]
sage: G == loads(dumps(G))
True
```
image_mod_n()¶

Return the subgroup of $$SL(2, \ZZ / N\ZZ)$$ of which this is the preimage, where $$N$$ is the level of self.

EXAMPLE:

```sage: G = MatrixGroup([matrix(Zmod(2), 2, [1,1,1,0])])
sage: H = sage.modular.arithgroup.congroup_generic.CongruenceSubgroupFromGroup(G); H.image_mod_n()
Matrix group over Ring of integers modulo 2 with 1 generators: 
 [[[1, 1], [1, 0]]]
sage: H.image_mod_n() == G
True
```
index()¶

Return the index of self in the full modular group. This is equal to the index in $$SL(2, \ZZ / N\ZZ)$$ of the image of this group modulo $$\Gamma(N)$$.

EXAMPLE:

```sage: sage.modular.arithgroup.congroup_generic.CongruenceSubgroupFromGroup(MatrixGroup([matrix(Zmod(2), 2, [1,1,1,0])])).index()
2
```
to_even_subgroup()¶

Return the smallest even subgroup of $$SL(2, \ZZ)$$ containing self.

EXAMPLE:

```sage: G = Gamma(3)
sage: G.to_even_subgroup()
Congruence subgroup of SL(2,Z) of level 3, preimage of:
 Matrix group over Ring of integers modulo 3 with 1 generators: 
 [[[2, 0], [0, 2]]]
```
sage.modular.arithgroup.congroup_generic.CongruenceSubgroup_constructor(*args)¶

Attempt to create a congruence subgroup from the given data.

The allowed inputs are as follows:

• A MatrixGroup object. This must be a group of matrices over $$\ZZ / N\ZZ$$ for some $$N$$, with determinant 1, in which case the function will return the group of matrices in $$SL(2, \ZZ)$$ whose reduction mod $$N$$ is in the given group.
• A list of matrices over $$\ZZ / N\ZZ$$ for some $$N$$. The function will then compute the subgroup of $$SL(2, \ZZ)$$ generated by these matrices, and proceed as above.
• An integer $$N$$ and a list of matrices (over any ring coercible to $$\ZZ / N\ZZ$$, e.g. over $$\ZZ$$). The matrices will then be coerced to $$\ZZ / N\ZZ$$.

The function checks that the input G is valid. It then tests to see if $$G$$ is the preimage mod $$N$$ of some group of matrices modulo a proper divisor $$M$$ of $$N$$, in which case it replaces $$G$$ with this group before continuing.

EXAMPLES:

```sage: from sage.modular.arithgroup.congroup_generic import CongruenceSubgroup_constructor as CS
sage: CS(2, [[1,1,0,1]])
Congruence subgroup of SL(2,Z) of level 2, preimage of:
 Matrix group over Ring of integers modulo 2 with 1 generators: 
 [[[1, 1], [0, 1]]]
sage: CS([matrix(Zmod(2), 2, [1,1,0,1])])
Congruence subgroup of SL(2,Z) of level 2, preimage of:
 Matrix group over Ring of integers modulo 2 with 1 generators: 
 [[[1, 1], [0, 1]]]
sage: CS(MatrixGroup([matrix(Zmod(2), 2, [1,1,0,1])]))
Congruence subgroup of SL(2,Z) of level 2, preimage of:
 Matrix group over Ring of integers modulo 2 with 1 generators: 
 [[[1, 1], [0, 1]]]
sage: CS(SL(2, 2))
Modular Group SL(2,Z)
```

Some invalid inputs:

```sage: CS(SU(2, 7))
Traceback (most recent call last):
...
TypeError: Ring of definition must be Z / NZ for some N
```
sage.modular.arithgroup.congroup_generic.is_CongruenceSubgroup(x)¶

Return True if x is of type CongruenceSubgroup.

Note that this may be False even if $$x$$ really is a congruence subgroup – it tests whether $$x$$ is “obviously” congruence, i.e.~whether it has a congruence subgroup datatype. To test whether or not an arithmetic subgroup of $$SL(2, \ZZ)$$ is congruence, use the is_congruence() method instead.

EXAMPLES:

```sage: from sage.modular.arithgroup.congroup_generic import is_CongruenceSubgroup
sage: is_CongruenceSubgroup(SL2Z)
True
sage: is_CongruenceSubgroup(Gamma0(13))
True
sage: is_CongruenceSubgroup(Gamma1(6))
True
sage: is_CongruenceSubgroup(GammaH(11, [3]))
True
sage: G = ArithmeticSubgroup_Permutation(L = "(1, 2)", R = "(1, 2)"); is_CongruenceSubgroup(G)
False
sage: G.is_congruence()
True
sage: is_CongruenceSubgroup(SymmetricGroup(3))
False
```

#### Previous topic

Elements of Arithmetic Subgroups

#### Next topic

Congruence Subgroup $$\Gamma_H(N)$$

### Quick search

Enter search terms or a module, class or function name.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 40, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.7048487663269043, "perplexity_flag": "middle"}