Let $X$ be a topological space and $U\subset X$ an open subset. Let's work in the category of sheaves of abelian groups on $X$. Consider the constant sheaf on $U$, $\mathbb{Z}\_U$, given by $\mathbb{Z}\_U(V)=\{\text{continuous maps }U\cap V\rightarrow \mathbb Z\}$, where $\mathbb Z$ is given the discrete topology. I've been struggling to derive from Yoneda's lemma the formula $\hom(\mathbb{Z}\_U,F)=F(U)$. Is this a consequence of Yoneda? If so, how? If it doesn't follow from Yoneda, is it true at all? If not, how can one compute $\hom(\mathbb{Z}\_U,\mathbb{Z}\_V)?$



Constants sheaves on an open subset
This is not true; for example, take $X = \mathbb R^2$, $U = \mathbb R^2 \smallsetminus \{(0,0)\}$. Then your $\mathbb Z\_U$ coincides with $\mathbb Z\_X$, and $Hom(\mathbb Z\_U, F)$ is $F(X)$, not $F(U)$.


For the formula to hold you have to take as $\mathbb Z\_U$ the extension of the constant sheaf by $0$, which is a very different animal.


