TITLE: Existence of a strange function
QUESTION [5 upvotes]: Inspired by A discontinuous construction:
Does there exist a function $a \colon [0,1] \to (0,\infty)$ and a family $\{D_x \colon x \in [0,1]\}$ of countable, dense subsets of $[0,1]$ with $\bigcup_{x \in [0,1]} D_x = [0,1]$ and $\sum_{r \in D_x} a(r) < \infty$ for all $x \in [0,1]$,

REPLY [7 votes]: The relation
$$
x\sim y \quad \iff \quad x-y\in\mathbb{Q}
$$
is an equivalence relation that partitions $[0,1]$ into countable sets of the form $[t]=(t+\mathbb{Q})\cap [0,1]$.
The set of all equivalence classes of the relation $\{[t]:\,t\in [0,1]\}$ has the same cardinality as $[0,1]$. Consider a bijection 
$$
\psi:[0,1]\to\{[t]:\, t\in [0,1]\}.
$$
For $x\in [0,1]$ we define $D_x=\psi(x)$. Since the sets $D_x$ are precisely equivalence classes of $\sim$, we have that they are countable, dense and $\bigcup_{x\in [0,1]} D_x=[0,1]$.
Each of the sets $[t]=(t+\mathbb{Q})\cap [0,1]$ is countable infinite. Let 
$$
\phi_{[t]}:[t]\to\{n^{-2}:\, n\in\mathbb{N}\}
$$ be a bijection defined for each of the equivalence classes.
Finally we define
$$
a:[0,1]\to (0,\infty)
\quad\text{by}\quad
a(x)=\phi_{[x]}(x).
$$
It is easy to see that the function $a$ has the desired property since
$D_x=[t]$ for some $t$ and hence
$$
\sum_{r\in D_x} a(r)=
\sum_{r\in [t]}\phi_{[r]}(r)=
\sum_{r\in [t]}\phi_{[t]}(r)=
\sum_{n\in\mathbb{N}} n^{-2}=\frac{\pi^2}{6}.
$$
In the second equality we used the fact that $[r]=[t]$ for $r\in [t]$ which is a property of any equivalence relation.