From Jech p 9 (Set Theory, 3rd edition ) if $X$ is a set then $Y=\bigcup X$ is a set which is stated in formulas as;
\begin{align*} \forall X\exists Y\forall u\in Y\leftrightarrow\exists z(z\in X\land u\in z) \end{align*}
I am struggling with this and would appreciate some thoughts. I have the following;
For $X=\{\{a\},\{a,b\}\}=\{1,2\}$ where $1=\{a\}$ and $2=\{a,b\}$, what does $Y:=\bigcup X$ "look like"? The above rule (I think) states $u\in Y$ implies and is implied by $u\in z$ for some $z\in X$. Given $1\not\in 1$ and $2\not\in 2$ this means only the elements of 1 or 2 rather than 1 or 2 themselves can be contained within $Y$. Thus conclude $a,b\in Y$ but $1,2\not\in Y$ and so $Y=\{a,b\}$?
Now suppose $X=\{a,b\}$. As before for the "first layer" of sets, and due to the axiom of regularity, we have $a\not\in a$ and $b\not\in b$. But now since $a$ and $b$ are atomic (contain no further sets), for any $z\in X$ there can be no $u\in Y$ satisfying $u\in z$. Thus $Y=\emptyset$?
I am using the "levels of containment" rule as described here, and applying the axiom of regularity. Whilst I feel I have been logical, the above results seem wrong? Any help would be greatly appreciated.
Update:
From the very useful comments below I realise I omitted a key assumption I am making that $a$ and $b$, whilst sets, themselves do not contain any sets. I was under the impression such an object existed in ZFC - i.e. a set that is not empty, but contains no further sets. If not then I do not see how the everyday objects we want set theory to describe can function - i.e. we cannot always work with sets that always contain further sets?
The example I give in the comments (of my thinking) is that $1$ and $2$ are boxes containing chocolates, and $a$ and $b$ are chocolates. Thus $X$ is a set containing two boxes of chocolates. Thus in the second example where $X=\{a,b\}$, since the axiom of regularity forbids $a\in a$ and $b\in b$ from being true, I am claiming $\bigcup X=\emptyset$. However some of the comments suggest $\bigcup X$ is ill-defined for the very reason $a$ and $b$ do not themselves contain sets, and so, perhaps, $\bigcup X$ is simply not defined?
Second update
It seems my question has exposed a fundamental flaw in my understanding of what a set is. The comments clearly state in ZFC a set must only contain other sets (objects that themselves contain elements). My problem is that I wish to work with objects I want to call elements, that is objects that contain no further sets (my definition). This seems perfectly reasonable: a box of chocolates (the box is the set, the chocolates are in-divisible in the sense that half a chocolate is not a chocolate); a car full of people (the car is the set, the people in-divisible) etc.
In one comment something called "urelement" was mentioned and I thought this a typo, but it seems this relates exactly to the desire to work with elements, i.e objects that do not contain sets (and hence are not sets in ZFC). This post here delves into this concept. The other method I see is classes since these do not have to obey the axioms and I am free to define a class of elements?
Finally (and getting back to the question) the answer in this post here seems to suggest it is "OK" to define $X=\{a,b,c\}$ where $a,b,c$ are elements when we are "not working in set theory" and write $\bigcup X:=\bigcup_{x\in X}x$ but only if we "define a notion similar to union" over those elements. By this I suppose $\bigcup X=\{x:\exists x\in X\}$ might do, where this gives $\bigcup X=X$?
But what is clear is if I want to be formal and work in ZFC with my set of elements as defined here, then I need to write $X=\{\{a\},\{b\},\{c\}\}$ so $a$ is represented by the set $\{a\}$ containing $a$ and so on, giving $\cup X=\{a,b,c\}=X$, or accept that $\bigcup X$ is not defined on this set (for the reason $X$ is not actually a set)?