I was trying to prove something else and this came up. It must be really simple to prove but I am struggling to do it. Let $A$ be a non-empty and compact interval of $\mathbb{R}$ and $f \colon A \to \mathbb{R}$ a continuous fuction. Then:
$$ \sup_A f = \sup f|_{\mathbb Q\cap A} = \sup f |_{(\mathbb{R} \setminus \mathbb{Q})\cap A} $$
Any ideas on how can I prove it?
Hint for one proof: replace $\mathbb Q$ or $\mathbb R/\mathbb Q$ by any dense set $B$ and prove $\sup f|_A \leq \sup f|_B$ (or if you prefer: that it's impossiblle to have $\sup f|_A > \sup f|_B$ ).
Hint for another proof: prove that the image of a dense subset is dense in the image.
Hint for another proof: a continuous function is semi-continuous (both upper-and lower); read about the topological definition of upper/lower semicontinuity; everything should follow abstractly.
Hint for another proof: Let $Y$ be the set of strict upper bounds: these are numbers $y$ such that there exist positive $z$ such that for all $x$ we have $f(x)+z<y$. Prove that the set of upper bounds if the same, if $x$ is restricted to a dense subset