I am doing an exercise from Hartshorne (II Ex 6.2) on divisors and I have come across an abuse of notation that I am not entire sure how to interpret.
Let $X \hookrightarrow \mathbb{P}_{k}^{n}$ be a projective variety (non-singular in codimension 1, but that shouldn't matter here). Let $H$ be an irreducible hypersurface of degree $d$ in $\mathbb{P}_{k}^{n}$ which does not contain $X$. Let $Y$ be an irreducible component of $H \cap X$.
The line I am confused about reads as follows (paraphrased slightly to reflect exactly what I am asking):
Let $U$ be some open set in $\mathbb{P}_{k}^{n}$ for which $Y \cap U \neq \emptyset$. Let $f$ be a local equation for $H$ on $U$. Define $\bar{f}$ to be the restriction of $f$ to $U \cap X$.
It is the idea of $\bar{f}$ being a restriction of $f$ to $U \cap X$ that has me confused. So $f$ cuts out $H$ on $U$, and so is a section $f \in \Gamma(U, \mathcal{O}(d))$. What precisely is meant by restricting this to the set $U \cap X$? The obvious interpretation is some combination of inverse image and subsheaf with supports, but I am not able to get the unit/counit to map the right way to give some interpretation of sending a section to its restriction.
When I have had trouble with this or other constructions in the past, I try to think about the affine case where things should be maybe a bit more understandable.
Suppose we have a closed immersion $f:X\to Y$. The idea is to mimic what happens with restriction of $f\in A$ from $\operatorname{Spec} A$ to $\operatorname{Spec} A/I$ via the natural map $A\to A/I$. The morphism $A\to A/I$ corresponds to the sheaf morphism $\mathcal{O}_Y \to f_*\mathcal{O}_X$ associated to the map of locally ringed spaces $f:X\to Y$. So if we have a section $s \in \mathcal{O}_Y(U)$, we can take it's image under the map $\mathcal{O}_Y(U) \to f_*\mathcal{O}_X(U)$ and then use the definition of the direct image sheaf which says that $f_*\mathcal{O}_X(U) = \mathcal{O}_X(f^{-1}(U)) = \mathcal{O}_X(U\cap X)$, where the last equality comes from the fact that $f$ is a closed immersion (and so it's image has the subspace topology).