# Congruence Subgroups

We denote by ${\operatorname{SL}}_2({\mathbb{Z}})$ the group of $2$ by $2$ matrices with integer coefficients and determinant $1$. The group ${\operatorname{PSL}}_2({\mathbb{Z}})$ is the projectivization of ${\operatorname{SL}}_2({\mathbb{Z}})$. For any integer $N$ we have groups

$$
\Gamma_0(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}* & *\\ 0 & *\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma_1(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & *\\ 0 & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & 0\\ 0 & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma^1(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}1 & 0\\ * & 1\end{pmatrix} \bmod N\right\}
$$

$$
\Gamma^0(N)=\left\{\begin{pmatrix}a & b\\ c & d\end{pmatrix}\in{\operatorname{SL}}_2({\mathbb{Z}}) \ \Big|
\begin{pmatrix}a & b\\ c & d\end{pmatrix} \equiv
\begin{pmatrix}* & 0\\ * & *\end{pmatrix} \bmod N\right\}
$$

A *congruence subgroup* is any discrete subgroup $\Gamma$ of ${\operatorname{SL}}_2({\mathbb{R}})$ which is commensurable with ${\operatorname{SL}}_2({\mathbb{Z}})$, that is, $\Gamma\cap{\operatorname{SL}}_2({\mathbb{Z}})$ has finite index in $\Gamma$ and in ${\operatorname{SL}}_2({\mathbb{Z}})$, and such that $\Gamma(N)$ is contained in $G$ for some $N$. The *level* $N$ of a congruence subgroup $G$ is the greatest integer $N$ such that $\Gamma(N)$ is contained in $\Gamma$. We will abuse notation and also refer to the projectivizations of these groups by the same names.

## Creation of Subgroups of ${\operatorname{PSL}}_2({\mathbb{R}})$

### `PSL2(R): Rng -> GrpPSL2`

Returns ${\operatorname{PSL}}_2(R)$, the projective linear group over the ring $R$.

### `Gamma0(N): RngIntElt -> GrpPSL2`

The group $\Gamma_0(N)$ for any positive integer $N$.

### `Gamma1(N): RngIntElt -> GrpPSL2`

The group $\Gamma_1(N)$ for any positive integer $N$.

### `GammaUpper0(N): RngIntElt -> GrpPSL2`

The group $\Gamma^0(N)$ for any positive integer $N$.

### `GammaUpper1(N): RngIntElt -> GrpPSL2`

The group $\Gamma^1(N)$ for any positive integer $N$.

### `CongruenceSubgroup(N): RngIntElt -> GrpPSL2`

The group $\Gamma(N)$ for any positive integer $N$.

### `CongruenceSubgroup(i, N): RngIntElt, RngIntElt -> GrpPSL2`

For a positive integer $N$ and $i=0,1,2,3,$ or $4$, this is the group $\Gamma_0(N)$, $\Gamma_1(N)$, $\Gamma(N)$, $\Gamma^1(N)$ or $\Gamma^0(N)$ respectively.

### `CongruenceSubgroup([N,M,P]): SeqEnum -> GrpPSL2`

This is the congruence subgroup consisting of 2 by 2 matrices with integer coefficients $[a,b,c,d]$ with $b = 0 \pmod P$, $c = 0 \pmod N$, and $a = d = 1 \pmod M$. It is required that $M$ divides $NP$.

### `Intersection(G, H): GrpPSL2, GrpPSL2 -> GrpPSL2`

### `G meet H: GrpPSL2, GrpPSL2 -> GrpPSL2`

The intersection of congruence subgroups $G$ and $H$.

### `Example: Creation (ex-5fb4fb)`

Examples of defining different congruence subgroups:

```magma
> G := PSL2(Integers());
> H := CongruenceSubgroup([2,3,6]);
> H;
Gamma_0(2) intersection Gamma^1(3) intersection Gamma^0(2)
> K := CongruenceSubgroup(0,5);
> K meet H;
Gamma_0(10) intersection Gamma^1(3) intersection Gamma^0(2)

```

## Relations

### `G eq H: GrpPSL2, GrpPSL2 -> BoolElt`

Returns `true` if and only if the congruence subgroups $G$ and $H$ are equal.

### `H subset G: GrpPSL2, GrpPSL2 -> BoolElt`

For congruence subgroups $G$ and $H$ contained in ${\operatorname{PSL}}_2({\mathbb{Z}})$, returns `true` if and only if $H$ is a subgroup of $G$.

### `Index(G, H): GrpPSL2, GrpPSL2 -> RngIntElt`

For congruence subgroups $G$ and $H$, returns the index of $G$ in $H$ provided $G$ is a subgroup of $H$.

### `Index(G): GrpPSL2 -> RngIntElt`

For $G$ a congruence subgroup in ${\operatorname{PSL}}_2({\mathbb{Z}})$, returns the index in ${\operatorname{PSL}}_2({\mathbb{Z}})$.

## Basic Attributes

### `Level(G): GrpPSL2 -> RngIntElt`

The level of a congruence subgroup $G$.

### `IsCongruence(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is a congruence subgroup.

### `IsGamma0(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is equal to $\Gamma_0(N)$ for some integer $N$.

### `IsGamma1(G): GrpPSL2 -> BoolElt`

Returns `true` if and only if $G$ is equal to $\Gamma_1(N)$ for some integer $N$.

### `BaseRing(G): GrpPSL2 -> Rng`

Returns the base ring over which matrices of the congruence subgroup $G$ are defined.

### `Identity(G): GrpPSL2 -> GrpPSL2Elt`

Returns the identity matrix in the congruence subgroup $G$.
