Basis of meromorphic $1$-forms on compact Riemann surface. I am trying to solve the following exercise but I do not really know how to proceed.
For an integral divisor $D$ and any compact Riemann surface $M$, describe a basis of the space $\Omega(-D)$. 
Where $\Omega(-D) = \{\omega\in\mathcal{M}\Omega^1(M)\mid (\omega)\geq -D\}$. Since $D = \sum_v s_vp_v$ is integral i.e. $s_v>0$ for at least one $v$, the elements of $\Omega(-D)$ are meromorphic $1$-forms which have a pole of order at most $s_v$ at $p_v$. This clearly contains all holomorphic differentials and I know how to generate those, but I have no idea about any classification of the strictly meromorphic differentials in terms of their dimension. 
I have only seen proven the existence of such differentials with a single pole of higher order, or of differentials with two simple poles in the book of Wilhelm Schlag on A course in Complex Analysis and Riemann surfaces.
I also tried finding the dimension using the Riemann-Roch theorem, but for that I would need to find the dimension of $L(-D)$ the meromorphic functions on $M$ which only have poles at $p_v$ of order at most $s_v$. But I am not sure how to formally do this aswell. 
Does anyone know how to find this basis $\Omega(-D)$? 
 A: Riemann-Roch tells us that
$$
    L(D) = \deg(-D) - g + 1 + \dim \Omega(-D)
.$$ 
If  $M$ is compact and if $D \ge 0$ is not trivial, we have $L(D) = \{0\}$, so dimension is $0$.
Indeed, $L(D)$ contains holomorphic functions, and the only holomorphic functions from a compact Riemann surfaces are constant functions. However if $D$ is not trivial, it forces us to have a zero somewhere. Hence the function is constant $0$.
Using $\deg(-D) = - \deg (D)$, we have
$$
    \dim \Omega(-D) = g + \deg(D) - 1
.$$ 
As you've guessed, the $g$ comes from the dimension of holomorphic differentials on the surface. We are set out to find $\deg D - 1$ non-holomorphic meromorphic differentials which form a basis for $\Omega(-D)$.
Write $ D = \sum n_i p_i$, where the $p_i$ are $N$ distinct points and  $n_i \ge 0$. Then $\Omega(-D)$ contains meromorphic differentials which have poles $p_i$ of order at most $n_i$.
There are two types of meromorphic differentials we can construct:


*

*Denote with $\tau_{p_i, k}$ a meromorphic differential with pole of order $k\ge 2$ at $p_i$

*Denote with $\omega_{p_i, p_j}$ a meromorphic differential with simple poles at $p_i$ and $p_j$ and residues $1$ and $-1$.


We also know there is a basis of $g$ holomorphic forms, so 


*

*Denote with $\alpha_i$, $i \in \{1, \ldots, g\}$ a basis for holomorphic one forms.


Then we claim the following is a  basis for $ \Omega(-D)$:
$$
\{ \tau_{p_i, k_{i,j}} \mid 2 \le  k_{i,j} \le n_i \} 
\cup 
\{
\omega_{p_1, p_2},
\omega_{p_2, p_3},
\ldots,
\omega_{p_{N-1}, p_N}
\} 
\cup \{\alpha_i  \mid 1 \le i \le g\} 
.$$ 
So in total, the dimension is indeed $\deg(D) + g - 1$.
As an example, consider $D = 3 p_1 + 1 p_2 + 1 p_3 + 2 p_4 + 4p_5$.

How many differentials of the $\tau$-type can we construct? Only at points which occur multiple times. So we get the following, where I omitted the reference to the point in the notation for $\tau$, an only included the degree of the pole.

Now, couldn't  there be other meromorphic differentials we need to include in our basis which have the same singular behavior? Well, suppose $\tau$ and $\tau'$ have the same singular behaviour at a point. Then $\tau - \tau'$ is a holomorphic differential, which is already in our basis. So $\tau'$ is not independent.
What about the differentials of type $\omega$? You'd think we would need to include $\omega_{p_i, p_j}$ for all possible pairs. But this is not the case. For example $\omega_{p_1, p_3}$ is a linear combination of $\omega_{p_1, p_2} + \omega_{p_2, p_3}$ and some holomorphic differentials, by the same reasoning as above. So we only need to include adjacent pairs: $\omega_{p_1, p_2}, ... \omega_{p_{N-1}, p_N}$. Note that we don't even need to include the pair $\omega_{p_N, p_1}$. This way we end up with the following: 

Here an $\omega$ on a line denotes the differential form with poles at the endpoints. This makes it clear that the dimension is $g + \deg D - 1$.
