If $X$ is a topological space, $\mathcal{F},\mathcal{G}$ are sheaves on $X$ with values in an abelian category $\mathcal{C}$, and $f:\mathcal{F}\to\mathcal{G}$ is a morphism of sheaves, then we can define a sheaf $\operatorname{coker}f$ as the sheafification of the presheaf defined by $U\mapsto\operatorname{coker}f_U$, where $U\subseteq X$ is open and $f_U:\mathcal{F}(U)\to\mathcal{G}(U)$ is the map on sections over $U$. $f$ is then called surjective if $\operatorname{coker}f$ is the zero sheaf. It is known (see here e.g.) that $f$ being surjective does not mean that all the $f_U$ have to be surjective, although it is true for the maps on the stalks.
I recently stumbled upon the Stacks Project and just out of curiosity I had a look at one of the chapters, namely the chapter on Sites and Sheaves. A 'categorical' presheaf is defined as a functor $\mathcal{F}:\mathcal{C}^\circ\to\mathbf{Set}$ for some category $\mathcal{C}$, and morphisms between presheaves as natural transformations between such functors. They say that a morphism $f$ of presheaves is surjective if the corresponding maps on the sections are surjective (Def. 3.1).
My question is: how do these two definitions go together? I know they don't really overlap, since 'categorical' presheaves take values in $\mathbf{Set}$, but I feel like there must be some connection at least. I posted a similar question some days ago, but it was full of errors, hence I deleted it again. Some things to make my points of confusion a little clearer, hopefully:
In the first paragraph, does it even make sense to define surjectivity of presheaf morphisms via the cokernel presheaf, or is it only good for actual sheaves (since I never saw a definition for presheaves).
If we take $\mathcal{C}$ in the second paragraph to be the category of open subsets of some topological space $X$, $\mathbf{Top}(X)$, we could talk about presheaves on $X$ with values in $\mathbf{Set}$ (which is not abelian of course). An 'ordinary' (pre)sheaf of, say, $k$-algebras on $X$ could be considered as such a presheaf. Now if $f$ is a morphism of sheaves on a topological space $X$ which is surjective in the first sense needn't be surjective in the sense of 'categorical' presheaves on $\mathbf{Top}(X)$, or do I have an error in there anywhere?
I'd be glad if maybe someone could elaborate on the connection between the notions of presheaf and surjective presheaf morphism in those two different senses. Thank you very much! (Note: I will be away for some days, so I most likely won't be able to react to comments / answers immediately, but I should be back on monday).
There's a general notion of epimorphism that applies to any category. In an Abelian category, a morphism is epimorphic if and only if its cokernel is zero.
There is a similar characterization that works in any category: an arrow $f:A \to B$ is an epimorphism if and only if its pushout is isomorphic to $B$. More precisely, if and only if the following is a pushout diagram
$$ \begin{matrix} A &\to& B \\ \downarrow & & \downarrow \\ B &\to& B \end{matrix} $$
where the top and left arrows are both $f$ and the bottom and right arrows are both identities.
Pushouts and cokernels are both examples of colimits.
Okay, now let's consider the category of presheaves. What I am about to say applies equally well to sheaves of sets, of abelian groups, and of similar things.
(Note the topological case is a special case of the general one, so everything I'm about to say applies there too. The correspondence is that the relevant domain category is the poset of open sets, and there is an appropriate topology to turn this category into a site)
The main thing about presheaves are that they're "boring": e.g. limits and colimits of presheaves are both computed pointwise. i.e.
$$ \left( \text{colim}_j P_j \right)(U) = \text{colim}_j P_j(U) $$
This means the cokernel of a morphism of presheaves is the presheaf of cokernels that you describe above. Similarly, a pushout of presheaves is the prehseaf of pushouts.
The above characterization of epimorphisms in terms of colimits, then, tells us that a if a morphism of presheaves is epimorphic, then it is pointwise epimorphic (i.e. that all of your $f_U$ are epimorphisms). With care, we can argue that this is an if and only if.
Now, consider the category of sheaves. There are two important functors: the sheafification functor $a : \mathcal{PSh} \to \mathcal{Sh}$ and the forgetful functor $i : \mathcal{Sh} \to \mathcal{PSh}$ (you probably view $i$ as simply being the inclusion of a subcategory).
Of particular note is that $a \circ i$ is (isomorphic to) the identity functor (i.e. forgetting that a sheaf $F$ is a sheaf then sheafifying gives you $F$), and that $(a,i)$ forms an adjunction. The relevant property here is that $a$, being a left adjoint, preserves all colimits. ($a$ is special that it also preserves finite limits, but we won't need this)
Given these functors, we can compute colimits of sheaves:
$$ \text{colim}_j A_j = \text{colim}_j a(i(A_j)) = a\left(\text{colim}_j i(A_j) \right) $$
e.g. the pushout of sheaves is the sheafification of the corresponding pushout of presheaves. Or in the abelian case, the cokernel of a morphism of sheaves is the sheafification of the corresponding cokernel of presheaves. This last fact is the calculation you describe in your post.
Monomorphisms have similar characterizations, but are better behaved: it turns out limits of sheaves are always computed pointwise, so a morphism is monomorphic if and only if it is pointwise monomorphic.
One way to see this fact is
$$ \lim_j F_j(U) = \lim_j \hom(yU, F_j) = \hom(yU, \lim_j F_j) = (\lim_j F_j)(U) $$
where $yU$ is the sheafification of the presheaf $V \mapsto \hom(V, U)$. ($y$ is the "Yoneda embedding")
I'm out of practice, but I believe the following paragraph is true:
Stalks are similarly boring: the stalk of a finite limit or arbitrary colimit is the limit or colimit of the stalks. So an epimorphism of sheaves is also epimorphic on the stalks. If a site has "enough points", then the converse is true. The sites used in the topological case have enough points.