# Equivalence between categories of affine schemes over $X$ and representable functors $\operatorname{Points}(x) \to \operatorname{Sets}$

I am reading Strickland - Formal schemes and formal groups. For a functor $$X\colon \operatorname{Rings}\to \operatorname{Sets}$$, he defines (2.14) the category of $$\operatorname{Points}(X)$$ in the following way:
Objects: $$(R,x)$$ with $$x \in X(R)$$. Morphisms: ring morphisms $$f\colon R\to S$$ s.t $$X(f)(x)=y$$.

In remark 2.15 he claims that the category $$\mathcal{X}_X$$ of affine schemes $$Y$$ over an affine scheme $$X$$ and the category of representable functors $$Y'\colon \operatorname{Points}(X)\to \operatorname{Sets}$$ are equivalent using $$Y(S)= \coprod_{z \in X(S)} Y'(S,z)$$. I can't really understand how the equivalence follows. Would appreciate any help.

P.S. I understood the equivalence of (a) and (c)—this is usually referred to as the description of a scheme using its functor of points.

You want to see that the category $$\mathcal{X}_X$$ of affine schemes over $$X$$ (or affine $$X$$-schemes) is equivalent to the category of representable functors $$Y':\text{Points}(X)\to \text{Set}$$.
First, given an affine $$X$$-scheme $$f:Y\to X$$, and a point $$(x,R)$$ with $$x\in X(R)$$ and $$R$$ a ring, we associate the set $$f(R)^{-1}(\{x\})=\{ y\in Y(R) \ | \ f(R)(y)=x\},$$ where $$f(R):Y(R)\to X(R)$$ is the associated map on the $$R$$-points (usually called just $$f$$ by abuse of notation). So the functor say $$f'$$ (bad notation, by sure) we associate is on the objects of $$\text{Points}(X)$$ defined by $$f'((R,x)):=f(R)^{-1}(\{x\}).$$ (Note that an $$X$$-scheme is better defined by the morphism $$f$$ that by the scheme $$Y$$).
On the contrary, that a functor $$Y':\text{Points}(X)\to \text{Set}$$ is representable it means (my guess) that there exists a ring $$S$$ and a point $$y\in X(S)$$ such that $$Y'(R,x)=\{h:R\to S \ | \ X(h)(x)=y\}.$$ Note that a point $$y\in X(S)$$ is the same that a map $$y:\text{Spec}(S)\to X$$. We associate then to $$Y'$$ such affine $$X$$-scheme $$y$$.
Thank you @Xarles for the answer and the corrections and @Lspice for the editting. I think I got it now. For an affine $$X$$-scheme $$f:Y\to X$$ with $$Y=Spec(R)$$ for some ring R, we have the map $$f:Spec(R)\to X$$. Following the Yoneda lemma, the map $$f$$ corresponds to an $$x_f\in X(R)$$. We thus have a point $$(R,x_f)$$ and can hence associate to it the contravariant functor $$Hom_{Points(X)}(\_,(R,x_f)):= Y'$$, which is represented by this point. This is one direction $$Y\to Y'$$.
For the other direction, let $$Y': Points(X)\to Set$$ be a representable functor with $$Y'= Hom_{Points(X)}(\_,(S,y))$$ for some point $$(S,y)$$. We thus have an induced element $$y\in X(S)$$, which again by Yoneda, corresponds to a map $$f_y:Spec(S)\to X$$. Alltogether it gives the equivalence. The thing is, I don't fully understand how the identification $$Y(S)= \coprod_{z \in X(S)} Y'(S,z)$$ fits in my proof. Any ideas?