Let $S$ be a smooth projective surface over an
algebraically closed field $k$ and $C \subset S$ a singular curve. Let us denote by $K\_S$ the class of canonical divisor of $S$ and $\mathcal{O}(K\_S)$ the canonical sheaf. If $\Omega\_{S/k}$ is the sheaf of Kähler differentials, then smoothness of $S$ and $\mathcal{O}(K\_S)=\Omega\_{S/k}^2$ imply that $\mathcal{O}(K\_S)$ is generated *locally* by an the element $\frac{1}{f} dx \wedge dy$ where $dx, dy$ are local basis elements of $\Omega\_{S/k}$ and certain $f \in K(S)$. 


I found recently a statement (I forgot the source, I think it was Kollar's Resolutions of Singularities) that locally the *residue of* $\frac{1}{f} dx \wedge dy$ *gives a generator $r \vert \_C$ of restriction* $\mathcal{O}\_S(C+K\_S) \vert \_C$.


The *residue* $r$ is characterized by equation 


$$f^{-1}dx \wedge dy= \frac{df}{f} \wedge r $$


My questions are quite general: 


I'm looking for sources dealing with this residue construction and it's properties in detail. How far can this constrution be generalized? ie is it possible to construct for instead of a smooth surface for an arbitrary smooth projective variety $V$ of algeb closed field from the local generator of it's canonical sheaf $O\_V(K\_V)$ a *residue along a codimension one subscheme $D$*? And why gives this residue a local generator of $O\_V(D +K\_V) \vert \_D$?


It looks like a far generalization of the concept of residues from basic complex analysis but since I still have nowhere found any books treating this construction in detail I don't know which interesting properties the residue by this constructions obtains and why the construction can be considered as a *generalization* of the story from complex analysis.



Residue of the canonical sheaf along subvariety
I believe that what you wrote is not entirely correct and that might be the reason that it does not seem to work out. As a response to one of your comments, $K\_C$ actually makes sense in this case, because it is a Cartier divisor in $S$ and hence Gorenstein. I'll elaborate on this below. 


So, I don't think $\frac{1}{f} dx \wedge dy$ generates $\mathscr O(K\_S)$ (locally). If you think about it, essentially by definition $dx \wedge dy$ generates that sheaf (locally), so the additional $\frac 1f$ gives it a twist. My guess is that what you saw said that $f$ should be a local equation for $C$ and if it is that then $\frac{1}{f} dx \wedge dy$ generates $\mathscr O(K\_S+C)$ locally. If this is OK with you, then it is no surprise that its restriction to $C$ generates the restricted sheaf. 


And, indeed, there is a more general framework for this. Using your notation, let $V$ be a Cohen-Macaulay (CM) scheme (or variety, or complex analytic space) and let $D\subseteq V$ be an effective Cartier divisor (this can be weakened to $D$ being a pure codimension $1$ subscheme/subvariety, but in that case you have to be a bit more careful about the sheaves that appear, so I'll stick to this case for simplicity).
I will use the notation $\omega\_X=\mathscr O\_X(K\_X)$ for any $X$ for which this makes sense.


Then we have a short exact sequence:
$$
0\to \mathscr O\_V(-D)\to \mathscr O\_V\to \mathscr O\_D \to 0
$$
The long exact $\mathscr Ext$ sequence associated to the functor $\mathscr Hom\_V(\\_\_, \omega\_V)$ (and the fact that $V$ is CM) gives the 
short exact sequence:
$$
0\to \omega\_V\to \omega\_V(D)\to \omega\_D \to 0
$$
The map $\omega\_V(D)\to \omega\_D$ is essentially what you are looking for and can be interpreted so that $\omega\_V(D)|\_D\simeq \omega\_D$. 


If $V$ is Gorenstein and $D$ is a Cartier divisor (then $D$ is also Gorenstein), then all of these sheaves are locally free of rank $1$ on their support, so you can find local generators that look pretty much the ones you wrote down. If $V$ is smooth, then it is Gorenstein and then every codimension $1$ subvariety is a Cartier divisor, so this covers the case you were wondering about. 




---


A few explanations, mainly sparked by the questions in the comments:


**The canonical sheaf, Hom long exact sequence, and all that jazz**: I wasn't entirely sure how much to include and what generality to go to. The formula involving Ext and projective space and the codimension of V in that projective space is a special case of Grothendieck duality and it holds any time a Gorenstein scheme is contained in another. (The proper way to write this would be writing out the "usual" (total) derived functor format and then take cohomology of that). In any case, this implies that $\omega\_D\simeq \mathscr Ext^1\_V(\mathscr O\_D, \omega\_V)$ if you start writing out the Hom-Ext sequence, the first Hom will be zero, then you have two terms (the first two terms of that ses) and then this Ext. All other terms are zero, because if the first term is locally free, then all higher Exts are zero. This is how you get that short exact sequence. 


As far as using the Ext formula vis-a-vis the projective space, you can do that, you'll get the same thing. Grothendieck duality is nice in this regard, it is natural, so you can apply it consecutively for a composition. This is actually a nice exercise if you have never done it. 


**Being Gorenstein** is equivalent to being CM and the canonical sheaf being locally free of rank 1. The definition of CM implies that (local) hypersurfaces inherit being CM (essentially the definition of depth does this). And the above short exact sequence implies the local freeness of the canonical sheaf. 


