Recursive Definition of the Closure of a Set in a Family of Functions For the sake of consistency, I will define some terms below the question, however, if you are familiar with the terms, that section can be skipped.
I am attempting to prove this lemma, for my text provides none.  I have some questions of which direction I should take my proof in.

Let $\theta$ be a regular infinite cardinal, and let $\mathcal{F}$ be a family of $<\theta$-ary functions on $B$.  Fix $S \subseteq B$, and define $S_\xi$ recursively by:
$$1. \,\,S_0 = S. \hspace{3.27in}\\ 2. \,\,S_\eta = \bigcup_{\xi<\eta}S_\xi \,\, \text{when } \eta \text{ is a limit ordinal.} \hspace{1.2in}\\ 3. \,\,S_{\xi +1} = S_\xi \cup\{f(\vec{x}): f \in \mathcal{F}\wedge f \text{ is } \alpha\text{-ary} \wedge \vec{x} \in (S_\xi)^\alpha\}.$$
Then $S_\theta$ is the closure of $S$ under $\mathcal{F}$.

In other words, to get $S_{\xi+1}$, we are taking $S_\xi$ and are adding to it all the values of every $f$ at every vector from $S_\xi$.  It is clear that if $\vec{x} \in (S_\xi)^\alpha$ then $f(\vec{x}) \in S_{\xi + 1}.$  My question is how do we go about proving this from here?  Why is it important that $\theta$ must be regular?  Why do we terminate the recursion at $\theta$?  How is the ordinal we terminate at related to the arity of the functions i.e. why are they both $\theta$?

TERM DEFINITONS:
A $<\theta \text{-ary}$ function on $B$ is an function $f$ such that $f:B^\alpha \rightarrow B$ where $\alpha < \theta$.  Because functions can have an infinite arity, the input is not a tuple, instead it is itself a function from the arity $\alpha$ into $B$. We say $\vec{x} \in B^\alpha$ but $\vec{x}$ is not a vector it is a function.  So $f$ maps functions in $B^\alpha$ to elements of $B$.
A set $A \subseteq B$ is closed under $f$ if $f(A^\alpha) \subseteq A$ i.e. $f$ maps "vectors" in $A^\alpha$ to $A$.  Let $\mathcal{F}$ be a family of $<\theta$-ary functions on $B$, then $A$ is closed under $\mathcal{F}$ if $A$ is closed under every $f \in \mathcal{F}$.  And lastly, the term which we are going to be focusing on, the closure of $S \subseteq B$ under $\mathcal{F}$ is defined as
$$A = \bigcap\{X:S \subseteq X \subseteq B \wedge X \text{ is closed under } \mathcal{F}\}.$$
In other words, $A$ is the smallest closed set under $\mathcal{F}$ which contains all of $S$.
 A: Let $f\in\mathscr{F}$, and let $\alpha$ be the arity of $f$. Let $\vec x\in S_\theta^\alpha$; for each $\xi<\alpha$ there is a $\beta_\xi<\theta$ such that $x_\xi\in S_{\beta_\xi}$. Let $\beta=\sup_{\xi<\alpha}\beta_\xi$; then $\beta<\theta$, since $\alpha<\theta=\operatorname{cf}\theta$. (This is where we use the fact that $\theta$ is regular and that $\alpha<\theta$.) Thus, $\vec x\in S_\beta^\alpha$, and $f(\vec x)\in S_{\beta+1}\subseteq S_\theta$. Since $f\in\mathscr{F}$ was arbitrary, we’ve shown that $S_\theta$ is closed under $\mathscr{F}$.
Let $\overline S$ be the closure of $S$ under $\mathscr{F}$; we’ve shown that $\overline S\subseteq S_\theta$. Suppose that $S_\theta\setminus\overline S\ne\varnothing$. For each $y\in\overline S\subseteq S_\theta$ there is a minimal $\xi(y)<\theta$ such that $y\in S_{\xi(y)}$; fix $y\in\overline S\subseteq S_\theta$ for which $\xi(y)$ is minimal. The minimality of $\xi(y)$ implies that $\xi(y)$ is not a limit ordinal, so let $\xi(y)=\eta+1$. Then $y\in S_{\xi(y)}\setminus S_\eta$, so there must be an $f\in\mathscr{F}$ of some arity $\alpha$ and an $\vec x\in S_\eta^\alpha$ such that $y=f(\vec x)$. But $S_\eta\subseteq\overline S$ by the choice of $y$, so $y\in f[S_\eta^\alpha]\subseteq\overline S$, contradicting the choice of $y$. It follows that $S_\theta\setminus\overline S=\varnothing$ and hence that $S_\theta=\overline S$.
