How to prove that the function $f$ is continuous on $\mathbb{R}$ Let
$$f:\mathbb{R}\to \mathbb{R} : f(x)=\begin{cases} a^x & \text{if $x \in \mathbb{Q}$} \\ \sup\{ f(y):y<x \text{ and }y \in \mathbb{Q} \} & \text{if $x \in \mathbb{R} \setminus \mathbb{Q}$}\end{cases}$$ where $a>0$. 
Prove that $f$ is continuous on $\mathbb{R}$.
 A: Hint: Use $f(x+y)=f(x)f(y)$ for $x,y\in\Bbb Q$ and $f(x)\approx 1$ for $0\approx x\in\Bbb Q$.
A: This is essentially a justification of the definition of the symbol $a^x$ for the case when $x$ is irrational. Moreover your definition requires $a\geq 1$ and for $0<a<1$ you need to replace the $\sup$ in your definition by $\inf$.
The case $a=1$ as $f(x) =1$ for all $x\in\mathbb {R} $. Let's take $a>1$ and we prove that $\lim_{x\to 0}f(x)=1$ so that $f$ is continuous at $1$. Let's first observe that $f$ is increasing on $\mathbb {R} $ (it is strictly increasing but we don't need that in the proof that follows). 
We start with the standard result $\lim_{n\to\infty} a^{1/n}=1$. Let $\epsilon >0$ be arbitrary. Then there is a positive integer $m_1$ such that $|a^{1/n}-1|<\epsilon$ for all $n\geq m_1$ and similarly there is a positive integer $m_2$ such that $|a^{-1/n}-1|<\epsilon$ whenever $n\geq m_2$. Now we choose $\delta=1/m, m=\max(m_1,m_2)$ and if $-\delta<x<\delta$ then $$a^{-1/m}=f(-\delta)\leq f(x) \leq f(\delta) =a^{1/m}$$ Since both $a^{-1/m}$ and $a^{1/m}$ lie in interval $(1-\epsilon, 1+\epsilon) $ it follows that $f(x) $ also lies in the same interval so that $|f(x) - 1|<\epsilon $ and this completes the proof that $f$ is continuous at $0$.
Next step is to prove that $f(x+y) =f(x) f(y) $ and this part is not difficult but rather long. Using the functional equation and continuity at $0$ one can then prove continuity of $f$ at any point $x$. 
A: If $a \geq 1$ there is nothing to prove as $f(x)=a^x$, $\forall x$ by conitnuity of $a^x$ and the fact that $\mathbb{Q}$ is dense in $\mathbb{R}$. 
So let $a <1$. If $a < 1$ then $f(x) = \infty$ for $x > 0$ and $x \in \mathbb{R} \setminus \mathbb{Q}$ and $f$ is not continuous as let $a=1/2$. $\sup\{(1/2)^y : y < x,y \in \mathbb{Q}\} \geq \lim_{n \rightarrow \infty} (1/2)^{(-n)} = \infty$.
