A dense set in the space of continuous functions Let $K$ be a compact metric space and $A \subset C(K, \mathbb{R})$ such that:
a) If $f, g \in A$ then $\text{max}(f,g)$, $\text{min}(f,g) \in A$
b) If $c_1, c_2 \in \mathbb{R}$ and $x_1, x_2 \in K$ then exists $f \in A$ such that $f(x_1)=c_1$ and $f(x_2)=c_2$.
I need to prove that $A$ is dense in $C(K, \mathbb{R})$.
Let $\phi$ be an arbitrary function in $C(K, \mathbb{R})$ if we find a function $f \in A$ such that $\Vert f - \phi \Vert_U < \varepsilon$ for every $\varepsilon >0$, where $\Vert \cdot \Vert_U$ is the uniform norm, we finish the proof. 
My idea is to construct the function $f$ but I don't know how to do it, some things that I have noticed and could be useful are that by the compactness of $K$ and by the continuity of $\phi$, we know that $\phi$ is also uniformly continuous, then for every $\varepsilon >0$ there exists $\delta >0$ such that if $d_K (x, y) < \delta$ then $\vert \phi(x) - \phi(y) \vert < \epsilon$, also we can take $\mathcal{U} = \{ U_i \}_{i=1}^n$ a finite cover of $K$ with balls of radius $\delta / 2$ then for every $x,y \in U_i$ then $\vert \phi(x) - \phi(y) \vert < \varepsilon$. If we find a function $f$ in every $U$ such that $\vert f(x) - \phi(x) \vert < \varepsilon$ we finish, but I don't know how to use the properties of the set $A$.
 A: Not a solution, just my work so far:
First, of course (b) was not quite correctly stated, it should be
b') If $c_1,c_2\in\mathbb R$, $x_1,x_2\in K$ and $x_1\ne x_2$ then...
And now that we've made that change, we need to add the assumption that $K$ contains at least two points. (Otherwise $K=\{p\}$, $A=\emptyset$ would be a counterexample.)
With those revisions the farthest I've got is this:


If $x_1,\dots ,x_n$ are distinct points of $K$ and $c_1,\dots ,c_n\in\mathbb R$ then there exists $f\in A$ with $f(x_j)=c_j$, $j=1,\dots, n$.


Proof: True for $n=2$, and hence for $n=1$, since $K$ contains at least two points. Suppose $n\ge3$. By induction, for each $k$ there exists $f_k\in A$ with $$f_k(x_j)=c_j\quad(j\ne k).$$
Say $x_k$ is an "up point" if $f_k(x_k)\ge c_k$ and a "down point" if $f_k(x_k)\le c_k$. Since $n\ge 3$ there are either at least two up points or at least two down points. But if $x_{k_1}$ and $x_{k_2}$ are distinct up points then $f=\min(f_{k_1},f_{k_2})$ works; similarly if there are two down points. QED.
So it's true if $K$ is finite. Since compactness is "almost" finiteness it's plausible. I can imagine a proof based on this: Given $f$ we find $\phi_n\in A$ that agrees with $f$ at more and more points... (heh, if only $C(K)$ were equicontinuous we'd be done. Hmm, probly we choose $x_{n+1}$ to be the point where $|f-\phi_n|$ is maximized? No, I don't see it.)
