Artificial intelligent assistant

Getting the fundamental elements of a set of sets Let $A = \\{1, 2, 3\\}$, $B = \\{4, 5, 6\\}$, and $C = \\{A, B\\}$. Let's call the elements of $A \cup B$ the _fundamental elements_. It is easy enough to get the set of fundamental elements from $A$ and $B$ i.e. $\\{x \; | \; x \in A \lor x \in B\\}$ or even $A \cup B$. It doesn't seem as straight forward if we want to get the fundamental elements from $C$ though. Perhaps $\\{ x \; | \; y \in C \land x \in y \\}$? This requires knowing how many subsets you need to go down before you get to the fundamental elements though. What about if you have an abstract set of subsets where the depth of the subsets until you get to the _fundament_ elements is unknown/arbitrary?

The question assumes a set theory with _urelements_ (or _fundamental elements_ ). Given a set $\,S\,$ we want to find $\,{\scr U}(S),\,$ the set of all the urelements used in the construction of $\,S.\,$ The definition is recursive as follows. If $\,S\,$ is an urelement, then $\,{\scr U}(S) = S,\,$ or else, $\,{\scr U}(S) = \bigcup_{x\in S} {\scr U}(x).\,$ With a recursive definition you don't need to know the depth of recursion in advance.

Of course, you need some kind of axiom of foundation to ensure that the recursion "bottoms out". It is needed to eliminate the possibility of having "sets" such as $$S_0 := \\{S_1\\},\, S_1 := \\{S_2\\},\, \dots,\, S_n := \\{S_{n+1}\\},\, \dots. \tag{1}$$ Note the similarity to $$S_1 := \\{S_0\\},\, S_2 := \\{S_1\\},\, \dots,\, S_{n+1} := \\{S_n\\},\, \dots, \tag{2}$$ but they are very different cases when used with $\,{\scr U}(S_n).\,$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 70c47737643994b3ee454d50073bedbd