Fiber of morphism homeomorphic to $f^{-1}(y)$ I want to solve exercise 3.10 (a) of Hartshorne's book, chapter II, which asks to prove the following:

Let $f\colon X\to Y$ be a morphism of schemes and let $y\in Y$, then $X_y=X\times_Y \operatorname{Spec}k(y)$ is homeomorphic to $f^{-1}(y)$ with the induced topology.  

The idea is clear to me and I proved the statement for affines. Now, choosing some open affine $V=\operatorname{Spec}A$ of $Y$ containing $y$, it follows that $X_y\cong f^{-1}(V) \times_V \operatorname{Spec}k(y)$. Thus, it suffices to prove that the projection of the latter one to $f^{-1}(V)$ induces a homeomorphism with $f^{-1}(y)$.   
Cover $f^{-1}(V)$ by open affines $U_i=\operatorname{Spec}B_i$. By the construction of the fiber product and in particular of the projection by gluing, the projection $p\colon f^{-1}(V) \times_V \operatorname{Spec}k(y) \to f^{-1}(V)$ is obtained by gluing the projections $p_i\colon \operatorname{Spec}(B_i \otimes_A k(y)) \to \operatorname{Spec}B_i \hookrightarrow f^{-1}(V)$.  
$\textbf{The problem is:}$ I don't see why $p$ should remain injective. Let $z,z'$ be two points of $f^{-1}(V) \times_V \operatorname{Spec}k(y)$, then $z \in \operatorname{Spec}B_i \otimes_A k(y)$ and $z'\in \operatorname{Spec}B_j \otimes_A k(y)$ for some $i,j$. Now, $p(z)=p(z')$ implies that $z \in p^{-1}(f^{-1}(y)\cap \operatorname{Spec}B_i \cap \operatorname{Spec}B_j)=p^{-1}(\operatorname{Spec}B_i \cap \operatorname{Spec}B_j)$. Thus, I $\textbf{need to prove}$ that $p^{-1}(\operatorname{Spec}B_i \cap \operatorname{Spec}B_j)= \operatorname{Spec}(B_i \otimes_A k(y)) \cap \operatorname{Spec}(B_j \otimes_A k(y))$, where I fail to see that "$\subseteq$" holds.
I appreciate any kind of help.
 A: The required equality $p^{-1}(\operatorname{Spec}B_i \cap \operatorname{Spec}B_j)=\operatorname{Spec}(B_i \otimes_A k(y)) \cap \operatorname{Spec}(B_j \otimes_A k(y))$ follows from the following:

Given a fiber product $(X\times_S Y,p_X, p_Y)$ of two schemes $X$ and $Y$ over $S$. Then for any open $U$ of $X,$ the fiber product $U\times_S Y$ of $U$ and $Y$ over $S$ is isomorphic to $p_X^{-1}(U)$.

Applying this to the above situation gives the desired result.
A: The numeration is refered to Bosch - Algebraic Geometry and Commutative Algebra.

Proposition 6.2.6. Let $\varphi:A\to A^{\prime}$ be a ring homomorphism such taht any element $f^{\prime}\in A^{\prime}$ is of type $\varphi(f)u$ where $f\in A$ and $u$ is a unit of $A^{\prime}$. The map $\varphi^{*}:SpecA^{\prime}\to SpecA$ is injective and defines a homeomorphism between $Spec A^{\prime}$ and $Im\varphi^{*}$, where the topological space are equipped with the Zariski topology.

Proof. Let $x,y\in Spec A\mid\varphi^{*}(x)=\varphi^{*}(y)$, that is $\varphi^{-1}(\mathfrak{p}_x)=\varphi^{-1}(\mathfrak{p}_y)$; by hipothesis for any $f^{\prime}\in\mathfrak{p}_x$ exist $f\in A,u\in A^{\prime\times}$ such that $f^{\prime}=\varphi(f)u$, in particular $\varphi(f)=f^{\prime}u^{-1}\in\mathfrak{p}_x\iff f\in\varphi^{-1}(\mathfrak{p}_x)=\varphi^{-1}(\mathfrak{p}_y)\iff\mathfrak{p}_y\ni\varphi(f)=f^{\prime}u^{-1}$ that is $f^{\prime}\in\mathfrak{p}_y$ and therefore $\mathfrak{p}_x\subseteq\mathfrak{p}_y$; and vice versa.
In other words, $\varphi^{*}$ is an bijective continuos map between $SpecA^{\prime}$ and $im\varphi^{*}$.
Let $Y^{\prime}$ be a closed subset of $SpecA^{\prime}$, by definition there exists a subset $E^{\prime}$ of $A^{\prime}$ such that $Y=V\left(E^{\prime}\right)$, by hypothesis, up to units of $A^{\prime}$, we can suppose that $E^{\prime}\subseteq\varphi(A)$; then there exists $E\subseteq A$ such that $\varphi(E)=E^{\prime}$, and from all this:
\begin{equation}
Y^{\prime}=V\left(E^{\prime}\right)=V(\varphi(E))=\left(\varphi^{*}\right)^{-1}(V(E))=\left(\varphi^{*}\right)^{-1}(Y)\Rightarrow\varphi^{*}\left(Y^{\prime}\right)=V(E)=Y
\end{equation}
that is $\varphi^{*}$ is a closed map and therefore it is a homeomorphism. $\Box$
Considering the canonical projection $p:X\times_YSpec\kappa(y)\to X$, we know that $p$ induces a surjection (see Stacks Project) $p^{\prime}:X\times_YSpec\kappa(y)\to f^{-1}(y)$; let $V=SpecB$ be an affine open neighbourhood of $y$, we know that $X\times_YSpec\kappa(y)$ is canonically isomorphic to $X\times_VSpec\kappa(y)$. Let $U=SpecA$ be an affine subset of $f^{-1}(V)$, in the same way we can consider the surjection $q^{\prime}=p^{\prime}_U:U\times_VSpec\kappa(y)\to f^{-1}_{|U}(y)$; by construction $q$ is obtained tensoring $B\to\kappa(y)$ with $A$ over $B$. Because the element of $A\otimes_B\kappa(y)$ are the type $i_1(a)u$, where $i_1$ is the canonical morphism of $A$ in $A\otimes_B\kappa(y)$ and $u$ is a unit of $A\otimes_B\kappa(y)$, by proposition 6.2.6 we can state that $q^{\prime}$ is a homeomorphism.
Gluing the $U\times_VSpec\kappa(y)$'s, $f^{-1}_{|U}(y)$'s and the $p^{\prime}_{|U}$'s, we prove that $p^{\prime}$ is a homeomorphism.
A: Essentially you have local homeomorphisms and you wish to show that these local homeomorphisms glue together to give a global homeomorphism. The only obstruction for such a construction in general, in case we have a set of local homeomorphisms that cover both spaces is indeed injectivity.
To see that the globally defined map is injective, assume towards contradiction that it isn't. In this case you have an $x_1$ and $x_2$ both mapping under the projection map $\pi_1$ to the same point in $f^{-1}(y)$. Where do the $x_i$ live? Clearly, in $X_y = X\otimes_Y \text{Spec}k(y)$. The fibred product has the property of being covered by opens $U_i\otimes_{V_j} W_k$ in general, where $U_i$ covers $X$, $V_j$ covers $Y$ and $W_k$ covers $\text{Spec}k(y)$. Since $\text{Spec}k(y)$ is just a point, and since we are computing the fiber, i.e. we only care about $x\in X$ mapping to $y\in Y$, to cover $X_y$ we may take any affine open neighborhood of $y\in Y$, and obtain a cover of $X_y$ in the form of a union of fibred products $U_i\otimes_V \text{Spec}k(y)$, where the $U_i$ cover $X$.
Now, if $x_i\in X_y$ has neighborhood $Z_i$, then the key point is that by choosing $U$ small enough, we can make sure that $U\otimes_V \text{Spec}k(y)$ is a subset of $Z_i$ for both $i = 1,2$. This shows, for example, that $Z_1$ and $Z_2$ intersect, and since the intersection contains a point which maps to $\pi_1(x_i)$, because $\pi_1$ is injective when restricted to $Z_i$ for each $i$, the point in $U\otimes_V \text{Spec}k(y)$ which maps to $\pi_1(x_i)$ must be equal to both $x_1$ and $x_2$, implying that $x_1 = x_2$ and the map is injective.
The subtlety here comes from the fact that although the points of the fibred product are not the product set of the sets of points, the products of open sets remain open, and although they don't form a basis for the topology of the fibred product, products of coverings are still coverings. See Lemma 26.17.4 in the stacks project for a proof.
