Problem: "Show the intersection of a class and a set is a set;" and it comes from material covering the axiom schema of comprehension.
I'm using the axiom schema of comprehension as it's listed on Wikipedia and my class notes; that is,
$$\forall w_{1},...,w_{n} \forall A \exists B \forall x (x \in B \iff [x \in A \land \varphi(x,w_{1},...,w_{n})]),$$ or in words, "Given any set $A$, there is a set $B \subseteq A$ such that, given any set $x$, $x \in B$ if and only if $x \in A$ and $\varphi$ holds for $x$."
My attempt at a solution:
Let $S$ be a set. Let $C= \{ x| \varphi(x,y_{1},...,y_{n}) \}$ be the class containing all sets $x$ such that the formula $\varphi(x,y_{1},...,y_{n})$ holds. By the axiom schema of comprehension, for our formula $\varphi$ and our arbitrary set $S$, there exists a set $T \subseteq S$ such that for all sets $z$, $$z \in T \; \text{ iff } \; z \in S \text{ and } \varphi(z,y_{1},...,y_{n}).$$ Define $T= \{s \in S | \varphi(s,y_{1},...,y_{n}) \}$. If $T= \emptyset$, then $T$ is a set. If $T$ is nonempty, then there exists some $t \in T$. Since $t \in T$, we have $t \in S$. Note also that we have $t \in C$ by definition of $C$ (that is, $t$ is some set fulfilling our formula $\varphi$). Hence $t \in T$ if and only if $t \in S$ and $t \in C$. Therefore the set $T \subseteq S$ is the intersection of the arbitrary set $S$ and arbitrary class $C$.
My problem is that while understanding the axiom schema of replacement is one thing... using it absolutely correctly is something else (unfortunately, most advanced math books don't come overly equipped with examples on these sorts of things.)
A main concern is that I properly employed the formula $\varphi$. Was I correct in assigning it to some arbitrary class $C$, and then saying 'for any set $S$, there must also be a subset $T$ for which $\varphi$ holds true for every member of $T$'?
To any set theory minded folks, what improvements would you make? How you would grade such a solution? Thanks!