Here is Prob. 15, Sec. 30, in the book Topology by James R. Munkres, 2nd edition:
Give $\mathbb{R}^I$ the uniform metric, where $I = [0, 1]$. Let $\mathscr{C}(I, \mathbb{R})$ be the subspace consisting of continuous functions. Show that $\mathscr{C}(I, \mathbb{R})$ has a countable dense subset, and therefore a countable basis. [Hint: Consider those continuous functions whose graphs consist of finitely many line segments with rational end points.]
My Attempt:
Here we have $I = [0, 1]$. Then $\mathbb{R}^I$ is the set of all the real-valued functions with domain $I$, and the uniform metric $\bar{\rho}$ on $\mathbb{R}^I$ is defined by $$ \bar{\rho}( \mathbf{x}, \mathbf{y} ) := \sup_{t \in I} \min \big\{ 1, \lvert \mathbf{x}(t) - \mathbf{y}(t) \rvert \big\} $$ for all $\mathbf{x}, \mathbf{y} \in \mathbb{R}^I$.
Let $\mathscr{F}$ be the collection of all those finite subsets of $I \cap \mathbb{Q}$ that contain both the endpoints $0$ and $1$.
Is this $\mathscr{F}$ countable? If so, how? A direct and rigorous argument please.
And, let $\mathscr{D}$ be the set of all the real-valued functions $\mathbf{y}$ defined on $I = [0, 1]$ such that the graph of $\mathbf{y}$ consists of a finite number of line segments joined end to end with endpoints in the set $A \times \mathbb{Q}$, where $A$ is any set in the collection $\mathscr{F}$.
Is this $\mathscr{D}$ countable? If so, how?
Now let $\mathbf{x}$ be any point in $\mathscr{C}( I, \mathbb{R} )$, and let $\epsilon$ be any real number such that $0 < \epsilon < 1$.
As $\mathbf{x}$ is a continuous real-valued function defined on $I = [0, 1]$, so $\mathbf{x}$ is uniformly continuous on $I$ so that there exists a real number $\delta = \delta(\epsilon) > 0$ such that $$ \big\lvert \mathbf{x}(s) - \mathbf{x}(t) \big\rvert < \frac{\epsilon}{4} $$ whenever $s, t \in I$ and $\lvert s-t \rvert < \delta$.
Let $A := \left\{ t_1 = 0, t_2, \ldots, t_{n-1}, t_n = 1 \right\}$ be any set in $\mathscr{F}$ such that $\lvert s-t \rvert < \delta$ for all $s, t \in A$, that is, $$ \left\lvert t_i - t_j \right\rvert < \delta $$ for any $i, j = 1, \ldots, n-1, n$. Now let $\mathbf{y} \colon I \longrightarrow \mathbb{R}$ be the function defined as follows: For each $i = 1, \ldots, n$, let $q_{i-1}$ and $q_i$ be rational numbers such that $$ \mathbf{x}\left( t_{i-1} \right) - \frac{\epsilon}{2} < q_{i-1} < \mathbf{x}\left( t_{i-1} \right) + \frac{\epsilon}{2}, \tag{1} $$ and $$ \mathbf{x}\left( t_{i} \right) - \frac{\epsilon}{2} < q_{i} < \mathbf{x}\left( t_{i} \right) + \frac{\epsilon}{2}; \tag{2} $$ now let $$ \mathbf{y}(t) := \frac{ q_i - q_{i-1} }{ t_i - t_{i-1} } \left( t - t_{i-1} \right) + q_{i-1} \qquad \mbox{ if } t_{i-1} \leq t \leq t_i. $$
This $\mathbf{y}$ clearly belongs to the set $\mathscr{D}$ above.
And, from (1) and (2) above, we find that $$ \bar{\rho}(\mathbf{x}, \mathbf{y} ) = \sup_{t \in I} \big\lvert \mathbf{x}(t) - \mathbf{y}(t) \big\rvert \leq \frac{\epsilon}{2} < \epsilon. $$
Thus it follows that the set $\mathscr{D}$ is dense in $\mathscr{C}(I, \mathbb{R} )$.
Is what I've done so far going to lead to the desired conclusion? If so, what next? How to proceed from here?
Or, is there some other route that will lead to the desired proof?
PS:
Let us put $$ S := I \cap \mathbb{Q}. $$ This set $S$, being a subset of the countable set $\mathbb{Q}$, is countable. The collection $\mathscr{F}$ of all the finite subsets of $S = I \cap \mathbb{Q}$ containing both the end points $0$ and $1$, which are of course rational, is in a bijective correspondence with a subset of the countable set
$$ \{ 0, 1 \} \cup S \cup (S \times S) \cup (S \times S \times S) \cup \cdots $$ and is thus countable.
Am I right?
The collection $\mathscr{D}$ is in bijective correspondence with the countable set $\mathscr{F} \times \mathbb{Q}$ and is thus also countable.
Am I right?