Prove that there exists an injective function K : S → ℚ given the set S:={s ∈ R: sup {f(x): x < s}≠ inf {f(y): y > s}} $f : \Bbb R \to \Bbb R$ is an increasing function, which means that $f(x) \leq f(y)$ whenever $x \leq y$.
Define the set
$S:= \{ s \in \Bbb R \mid \sup \{f(x): x \lt s \} \neq \inf \{f(y): y \gt s \} \}$.
Show that there exists an injective function $K : S \to  \Bbb Q.$
The hint provided is to find a rational number $q$ between the sup and the inf, given $s \in S$. My question is: How would I prove the existence of an injective function by looking for this number $q$? I'm not sure what the process would look like..

Let $s \in S$. Since $f$ is increasing we have $\sup \{f(x) : x<s\} <\inf \{f(y) >s\}$. Let $q_s$ be  a rational number with $\sup \{f(x) : x<s\} <q_s<\inf \{f(y) >s\}$. Define $K(s)$ to be $q_s$. We only have to check that $K$ is injective. Suppose $s<t$. Then $q_s<\inf \{f(y) : y>s\} \leq \sup \{f(x) : x<t\}<q_t$ where the middle inequality is proves as follows: $\inf \{f(y) : y>s\} \leq f(\frac  {s+t} 2) \leq \sup \{f(x) : x<t\}$ since $f$ is increasing and $s<\frac  {s+t} 2<t$. We have proved that $s<t$ implies $K(s) <K(t)$. This implies that $k$ is injective.
