Replacement holds in $L$ In Chapter 13 of Jech's Set Theory, he proves that $L$ is a model of ZF. For Replacement, he writes the following:

If a class $F$ is a function in $L$ then for every $X\in L$ there exists an $\alpha$ such that $F(X)=\{F(x):x\in X\}\subseteq L_\alpha$. Since $L_\alpha\in L$, this suffices.

(Here he is invoking a previous exercise that states that in order to have Replacement, it suffices to have the weaker assertion "If a class $F$ is a function, then $\forall X\,\exists Y \, F(X)\subseteq Y$")
To make sure I'm understanding, we first note that by (metamathematical) Replacement and the fact that $F$ is a function in $L$ that $F(X)$ is a set and in particular a subset of $L$. By some sort of Hartogs' argument this means it must in fact be contained in $L_\alpha$ for some $\alpha$ (although I'd appreciate some help in fleshing out this argument).
The part where I'm getting stuck is understanding how this exercise applies, given that it was framed in terms of $V$. Just because $F(X)$ is a subset of some element of $L$, I don't immediately see why it has to be definable. Does it work to say that we can further pick some $\beta$ such that $X\subseteq L_\beta$ and $F(X)\subseteq L_\beta$, and then say that $F(X)$ is definable over $L_\beta$ via $F(X)=\{y\in L_\beta : \exists x\in L_\beta \,(x\in X\land y=F(x))\}$? Something feels sketchy about this but I'm not sure what.
 A: You have stated one form of the axiom of replacement. In order to eliminate confusion, I will rephrase the proof to eliminate references to classes. I will also assume that you have proved that the axiom scheme of separation holds in $L$.
Consider a proposition $\phi(w_1, \ldots, w_n, x, y)$. Then the axiom of replacement for $\phi$ is the universal closure of
$$\forall x \in S \exists! y (\phi(w_1, \ldots, w_n, x, y)) \to \exists z \forall y (y \in z \iff \exists x \in S (\phi(w_1, \ldots, w_n, x, y)))$$
Relativising to $L$, we assume that $w_1, \ldots, w_n, S \in L$. The relativisation of the above axiom instance is thus
$$\forall x \in S \exists! y \in L (\phi^L(w_1, \ldots, w_n)) \to \exists z \in L \forall y \in L (y \in z \iff \exists x \in S (\phi^L(w_1, \ldots, w_n, x, y)))$$
Define $\psi(w_1, \ldots, w_n, x, y) :\equiv \phi^L(w_1, \ldots, w_n, x, y) \land y \in L$. Then we see that the above is equivalent to
$$\forall x \in S \exists! y (\psi(w_1, \ldots, w_n, x, y)) \to \exists z \in L \forall y (y \in z \iff \exists x \in S (\psi(w_1, \ldots, w_n, x, y)))$$
Now suppose that we indeed have $\forall x \in S \exists! y (\psi(w_1, \ldots, w_n, x, y))$. By the axiom of replacement for $\psi$, there is some $z$ such that $\forall y (y \in z \iff \exists x \in S (\psi(w_1, \ldots, w_n, x, y)))$. It suffices to show that $z \in L$.
Now for each $x \in S$, define $\alpha_x$ to be the smallest ordinal such that $\exists y \in L_{\alpha_x} (\psi(w_1, \ldots, w_n, x, y))$. Define $\beta = \sup\limits_{x \in S} \alpha_x$. Then we see that $z \subseteq \bigcup\limits_{x \in S} L_{\alpha_x} \subseteq L_\beta$.
Finally, we note that $L^{\beta} \in L$. We therefore have $z = \{y \in L_\beta \mid \exists x \in S \phi(w_1, \ldots, w_n, x, y)\}^L$. Thus, $z \in L$ by the fact that separation holds in $L$.
