Let $E \subseteq \mathcal{P}(X)$ be a family of sets, then there exists a smallest toplogy containing $E$, i.e. $$ O_E := \bigcap_{E \subseteq O, O \textrm{ is topology}} O. $$ And now I read about a construction of this smallest topology. Let $E \subseteq \mathcal{P}(X)$ arbitrary. Let $\mathcal{S} \subseteq \mathcal{P(x)}$ be the system of all sets $$ A_1 \cap \ldots \cap A_n, $$ with $A_1, \ldots, A_n \in E$. Now let $T'$ be the system of all sets of the form $$ \bigcup_{i \in I} S_i, $$ with $S_i \in \mathcal{S}$ for every $i \in I$. Now set $T := T' \cup \{ \emptyset, X \}$. Then $O_E = T$.
The proof starts like this:
1) $\emptyset, X \in T$ from the Definition.
2) Arbitrary unions of elements from $T$ are elements of $T$ again.
and so on.
Ok, I understand the point, but I want to make point 2) as formal and precise as possible. So I have to show that $$ M := \bigcup_{i \in I} T_i $$ with $T_i \in T$ could be written as $M = \bigcup_{k \in K} S_k$ with sets $S_k \in \mathcal{S}$. With the definition $$ \bigcup_{i \in I} T_i := \{ x ~|~ \exists i \in I: x \in T_i \} $$ I know that every $T_i = \bigcup_{j \in J_i} S_j$ with $S_j \in \mathcal{S}$. Now \begin{align*} \bigcup_{i \in I} T_i & = \{ x ~|~ \exists i \in I: x \in T_i \} \\ & = \{ x ~|~ \exists i \in I: x \in \bigcup_{j \in J_i} S_j \} \\ & = \{ x ~|~ \exists i \in I: x \in \{ y ~|~ \exists j \in J_i: y \in S_j \} \} \\ & = \{ x ~|~ \exists i \in I: \exists j \in J_i: x \in S_j \}. \end{align*} Now I run into language issues and trouble regarding the interchangability of quantifierts and rewritting sets, and I don't know how to make a formal derivation to "flatten" this unions, i.e write them as $$ \bigcup_{i \in I} T_i = \bigcup_{k \in K} S_k $$ with appropriate choosen Indexset $K$? I thought about choosing $K = \bigcup_{i \in I} ( \{ i \} \times J_i )$, this makes sense to me, but then in $S_k$, the index $k$ has the wrong type (it should be an Element of an $J_i$, and not an Tupel, and I guess it could not be fixed by a projection on second coordinate, because the $J_i$ are not disjoint) and I am not sure how to show that $$ \{ x ~|~ \exists i \in I: \exists j \in J_i: x \in S_j \} = \{ x ~|~ \exists k \in K: x \in S_k \} $$ with $K = \bigcup_{i \in I} ( \{ i \} \times J_i )$. Any suggestions for me?