Every well-ordered set is isomorphic to a unique ordinal [duplicate]

I'm following a proof in Jech's book that every well ordered set is isomorphic to a unique ordinal and hitting a point where I'm not sure why a certain move is justified. He writes

Proof. The uniqueness follows from Lemma 2.7. Given a well-ordered set $W$, we find an isomorphic ordinal as follows: Define $F(x) = \alpha$ if $\alpha$ is isomorphic to the initial segment of $W$ given by $x$. If such an $\alpha$ exists, then it is unique. By the Replacement Axioms, $F(W)$ is a set. For each $x \in W$, such an $\alpha$ exists (otherwise consider the least $x$ for which such an $\alpha$ does not exist). If $\gamma$ is the least $\gamma \not\in F(W)$ then $F(W) =\gamma$ and we have an isomorphism of $W$ onto $\gamma$.

I've filled in all the details of this proof for myself up to the point where he assumes the class of ordinals not in the image of the function has a least element. Since this isn't a set, I'm not sure what can justify this. I could try to prove that every nonempty class of ordinals has a least element but that seems so substantial that it's hard to imagine it was a detail intentionally omitted. Am I missing something simple?

marked as duplicate by Ross Millikan, Rohan, Claude Leibovici, user91500, Alex M.Dec 31 '16 at 11:21

• If $F(W)$ has no largest member then $\gamma=\cup F(W).$ If $\max (F(W))$ exists then $\gamma=\max(F(W))+1.$ – DanielWainfleet Nov 22 '16 at 3:21
Suppose $C$ is a nonempty class of ordinals, and pick some $\alpha\in C$. Either $\alpha$ is the least element of $C$, or it isn't. If it is, we're done. Otherwise, think about $$\alpha\cap C.$$ This is a set of ordinals, and nonempty by assumption on $\alpha$, so it has a least element $\beta$. Now do you see how to argue that $\beta$ is in fact the least element of $C$?