Set-builder notation for unique values in a set Assume a set which contains non-unique numbers. That is $X = \{A \mid (\exists i,j)[A_i=A_j] \}$. There is another set which contains the unique values from X with a weight associated with each unique value. For example, if $X=\{10,10,20\}$, then $U=\{(10,0.5),(20,0.5)\}$. I would like to use set-builder notation to write $U$. My initial thought is
$U = \left\{ (A^\prime,W) \mid (\forall i \neq j)[A^\prime_i \neq A^\prime_j] \right\}$ where $|U| \leq |X|$ (size of $U$ is definitely not larger than $X$) and $W_i=\Sigma(???)/\Sigma(A_i)$. I don't know how to write the nominator for $W_i$ to say "summation of those $A_i$s which are equal".
Any idea on how to properly express that? If you think $X$ and $U$ need corrections, fell free to propose that.
P.S: There is no "set-builder" tag and I can not add that.
 A: Here is one approach, using disjoint unions. Let's say you have some sets $X_1,X_2,X_3,\dots$ of numbers (say integers). While each set $X_i$ doesn't contain any repeated elements (by definition), we may certainly have $X_i \cap X_j \neq \emptyset$ for distinct $i$ and $j$. Then, consider the set:
$$
X = \bigsqcup_i X_i.
$$
The elements of $X$ look like $(x_i,i)$, where $x_i \in X_i$. Why is this useful? Well, for any $x \in \bigcup_i X_i$, we can determine its weight $w(x)$ by:
$$
w(x) := \#\{ i : (x,i) \in X\}
$$
Since you asked for the weights in set-builder notation, we can write it as:
$$
W := \Big\{(x,w(x)) : x \in \bigcup_i X\Big\}.
$$
Here is an example to be concrete. Let $X_1 = \{10,20\}$, $X_2 = \{10,20,25\}$, $X_3 = \{10,5\}$. Then, we have:
$$
X = X_1 \sqcup X_2 \sqcup X_3 = 
\big\{(10,1),(20,1),(10,2),(20,2),(25,2),(10,3),(5,3)\big\}.
$$
From here, we easily compute $w(10) = 3$, $w(20) = 2$, $w(25) = 1$, and $w(5) = 1$. In other words,
$$
W = \{(10,3),(20,2),(25,1),(5,1)\}
$$
Hope this helps. (And if you like the weights as percentages instead of numbers, you can of course divide $w(x)$ by $\sum_x w(x)$, where of course the sum is over $x \in \bigcup_i X_i$)
