function on $\Bbb R$ such that the pre-image of any open set is $\mathfrak c$-dense

We say $$A\subset\Bbb R$$ is $$\mathfrak c$$-dense if $$|A\cap (a,b)|=\mathfrak c,$$ for all $$a where $$||$$ denotes to the cardinality of the set and $$\mathfrak c$$ denotes to the cardinality of $$\Bbb R.$$ Let $$\{A_y\colon y\in\Bbb Q\}$$ be a family of pairwise disjoint $$\mathfrak c$$-dense subsets of $$\Bbb R$$. Define $$f\colon\Bbb R\to\Bbb R$$ as follows $$f:=\sum_{y\in\Bbb Q} y\, \chi_{A_y},$$ where $$\chi_{A_y}$$ is the characteristic function.

Question: Show that $$f^{-1}(U)$$ is $$\mathfrak c$$-dense for every nonempty open set $$U$$?

My proof: For this, let $$U$$ be a nonempty open set and $$I$$ be an open interval, then we will show that there is a set with cardinality $$\mathfrak c$$ contained in $$f^{-1}(U)\cap I.$$

Indeed, there exists a $$y\in U\cap\Bbb Q$$ and a set $$P$$ with cardinality $$\mathfrak c$$ contained in $$I\cap A_y,$$ since $$A_y$$ is $$\mathfrak c$$-dense, such that $$f(x)\in U$$ for all $$x\in P.$$ Then, $$P\subset f^{-1}(U)\cap I.$$ So, $$f^{-1}(U)$$ is $$\mathfrak c$$-dense.

Is that right? Any hint, comments, or different proof will be appreciated greatly.

• In your definition of $\mathfrak c$-dense, you should mention what $a$ and $b$ are. Do you mean that $|A \cap (a, b)| = \mathfrak c$ for all $a < b$? Or that there exist some $a, b \in \Bbb R$ such that $|A \cap (a, b)| = \mathfrak c$? Jul 8 '21 at 12:15
• @AryamanMaithani, I fixed it. I meant for all $a<b$
– 00GB
Jul 8 '21 at 12:18
• Is $f$ constant? It looks like $y$ is a dummy variable.
– Joe
Jul 8 '21 at 12:30
• @Joe, $y\in\Bbb Q$, and $f$ is not constant on $\Bbb R$ but it would be constant on each $A_y.$
– 00GB
Jul 8 '21 at 12:35
• In your question, I assume you want $U$ to be open. (That's what you assume in your solution, at least.) Otherwise the question is not true. Jul 8 '21 at 12:43

Looks fine but here's a simpler way of doing it: First note that $$f(A_y) = \{y\} \subset U$$. Thus, $$A_y \subset f^{-1}(U)$$. In turn, $$A_y \cap I \subset f^{-1}(U) \cap I$$.
Since $$A_y$$ is $$\frak c$$-dense, it follows that $$|A_y \cap I| = \frak c$$ and we are done.
(Essentially, this is your proof but I've shown that I can take $$P = A_y \cap I$$ itself, which I know to be of cardinality $$\frak c$$.)