A function $g : \mathbb{R} \to \mathbb{R}$ is right-continuous if and only, if it preserves infima 
I want to prove that a monotone ($=$ non-decreasing) function $g : \mathbb{R} \to
 \mathbb{R}$ is right-continuous if and only, if it preserves infima.

Unfortunately, I don't know how to prove any of the two directions. How do I go about this?
Remark: I assume it is known that if $g$ is monotone, then $g(\inf_{i\in I} x_i) \leq \inf_{i\in I} g(x_i)$. So for the forward direction only the other inequality has to be proved.
 A: For a nondecreasing $g\colon \mathbb{R}\to \mathbb{R}$, we have
$$\lim_{x \to a^+} g(x) = \inf \{ g(x) : x > a\}.\tag{1}$$
Thus such a $g$ is right-continuous if and only if
$$g(a) = \lim_{x\to a^+} g(x)$$
for every $a\in\mathbb{R}$ (by definition of right continuity), if and only if
$$g(a) = g(\inf \{ x : x > a\}) = \inf \{ g(x) : x > a\}\tag{2}$$
by $(1)$.
So if $g$ preserves infima, i.e.
$$g(\inf M) = \inf \{ g(x) : x \in M\}$$
for all nonempty $M\subset \mathbb{R}$ that are bounded below, $(2)$ gives right continuity by choosing $M = (a,+\infty)$.
On the other hand, let $g$ right-continuous, and $\varnothing \neq M$ bounded below. If $\inf M \in M$, then clearly
$$g(\inf M) = \inf \{ g(x) : x \in M\}$$
by monotonicity. And if $\inf M \notin M$, then
$$g(\inf M) = \lim_{x\to (\inf M)^+} g(x) = \inf \{ g(x) : x > \inf M\} = \inf \{ g(x) : x \in M\},$$
since for every $x > \inf M$ there is an $m \in M \cap (\inf M,x)$. So $g$ preserves infima.
Note: we only consider nonempty sets that are bounded below. If we admit sets that are empty or not bounded below, the assertion may be wrong, or we must change the codomain to $[\inf g(\mathbb{R}), \sup g(\mathbb{R})]$ and set $g(-\infty) = \inf g(\mathbb{R}),\, g(+\infty) = \sup g(\mathbb{R})$, and interpret $\inf \varnothing = \sup g(\mathbb{R})$ in the codomain.
