When is the regular set of a Birkhoff average equal to the whole space? Let $X$ be a compact metric space and let $T : X \to X$ be a continuous dynamical system. Let $\mathcal M_{1}(T)$ denote the space of all $T$-invariant Borel probability measures on $X$. Given a continous real-valued $g \in C^0(X,\mathbb R)$ and a real number $a \in \mathbb R$, let $R(g,a)$ be the regular level set of the Birkhoff average of $g$ with respect to $T$:
$$R(g,a) = \left\{x \in X : \lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} g(T^k(x)) =a\right\}.$$
I want to know if the following statement is true:

If the map $\mathcal M_1(T) \to \mathbb R : \mu \mapsto \int g d\mu$ is constant and equal to $a \in \mathbb R$, then $R(g,a) = X$.

I’m not sure how to address this question (either proof or counter-example). The Birkhoff Ergodic Theorem tells us that in this case, $\lim_{n \to \infty} \frac 1 n \sum_{k=0}^{n-1} g(T^k(x)) = a$ for $\mu$-a.e. $x \in X$ with respect to any invariant measure $\mu$. But there could still in principle be an invariant set (of measure $0$ with respect to any invariant measure) where the Birkhoff average fails to converge.
Any thoughts?
EDIT: $X$ should be compact. I’ve edited the question accordingly.
 A: Indeed the statement is true by a lemma in ergodic optimization (see Prop.2.1 on p.3 of Pavez-Molina's masters thesis available at http://www.personal.psu.edu/jzd5895/docs/Pavez_Molina_dissertation.pdf), below is a paraphrase of this lemma.

Let $X$ be compact metric, and consider the space $\mathfrak{S}(X;\mathbb{R})$ of pairs $(f,\phi)$, where $f:X\to X$ is a continuous self-map of $X$ and $\phi:X\to \mathbb{R}$ is a continuous observable. For any $(f,\phi)\in \mathfrak{S}(X;\mathbb{R})$ put
$$\text{Birk}(f,\phi)= \left\{x\in X \left| \lim_{n\to\infty}\dfrac{1}{n}\phi(n,x)\text{ exists}\right\}\right.,$$
where $\phi:\mathbb{Z}_{\geq0}\times X\to \mathbb{R}$ is the cocycle over $f$ generated by $\phi$ (i.e. $\phi(n,x) = \sum_{k=0}^{n-1}\phi\circ f^k(x)$ is the Birkhoff sum). $\text{Birk}(f,\phi)$ is the set of Birkhoff regular points of $(f,\phi)$. Next define
\begin{align*}
\text{pRot}(f,\phi)&= \left.\left\{\lim_{n\to\infty}\dfrac{1}{n}\phi(n,x) \right| x\in\text{Birk}(f,\phi)\right\},\\
\text{mRot}(f,\phi) &= \left.\left\{\mathbb{E}_{\mu}(\phi) \right| \mu\in\text{Prob}(X;f)\right\}.
\end{align*}
$\text{pRot}(f,\phi)$ and $\text{mRot}(f,\phi)$ are the pointwise and measurewise rotation sets of $(f,\phi)$, respectively, and $\text{Prob}(X;f)$ is the space of all $f$-invariant Borel probability measures on $X$.
Lemma: Let $X$ be a (nonempty) compact metric space. Then for any $(f,\phi)\in\mathfrak{S}(X;\mathbb{R})$ we have:

*

*$\text{mRot}(f,\phi)=\text{pRot}(f,\phi)$,

*$\max \text{pRot}(f,\phi) = \sup_{x\in X} \limsup_{n\to\infty} \dfrac{1}{n} \phi(n,x) = \limsup_{n\to\infty}\dfrac{1}{n}\sup_{x\in X}\phi(n,x)$,

*$\min \text{pRot}(f,\phi) = \inf_{x\in X} \liminf_{n\to\infty} \dfrac{1}{n} \phi(n,x) = \liminf_{n\to\infty}\dfrac{1}{n}\inf_{x\in X}\phi(n,x)$.

Proof: By the Birkhoff Ergodic Theorem any space average is the time average along the orbits of almost all (hence at least one) points, hence $\text{mRot}(f,\phi)\subseteq \text{pRot}(f,\phi)$. Conversely let $x\in\text{Birk}(f,\phi)$ and put $\mu_n=\dfrac{1}{n}\sum_{k=0}^{n-1}\delta_{f^k(x)}$. Then by the Krylov-Bogoliubov Theorem there is a subsequence $n_i\subseteq n$ and a $\mu\in \text{Prob}(X;f)$ such that $\text{vaguelim}_{i\to\infty}\mu_{n_i}=\mu$. Thus
$$\lim_{n\to\infty}\dfrac{1}{n} \phi(n,x) = \lim_{i\to\infty}\dfrac{1}{n_i} \phi(n_i,x) = \lim_{i\to\infty} \mathbb{E}_{\mu_{n_i}}(\phi) = \mathbb{E}_{\mu}(\phi)\in\text{mRot}(f,\phi).$$
Here the first equality is because $x\in\text{Birk}(f,\phi)$ by hypothesis. Thus $\text{pRot}(f,\phi)=\text{mRot}(f,\phi)$. In particular as $\text{mRot}(f,\phi)$ is the continuous image of a compact convex set, $\text{pRot}(f,\phi)$ is a (nonempty) compact interval.
For item 2.,  note that
\begin{align*}
\max\text{pRot}(f,\phi)
&= \sup_{x\in\text{Birk}(f,\phi)} \lim_{n\to\infty} \dfrac{1}{n} \phi(n,x)\\
&= \sup_{x\in\text{Birk}(f,\phi)} \limsup_{n\to\infty} \dfrac{1}{n} \phi(n,x)\\
&\leq \sup_{x\in X} \limsup_{n\to\infty} \dfrac{1}{n} \phi(n,x)
\end{align*}
and
\begin{align*}
&\dfrac{1}{n} \phi(n,x^\ast) \leq \dfrac{1}{n}\sup_{x\in X}  \phi(n,x)\\
&\implies\limsup_{n\to\infty}\dfrac{1}{n} \phi(n,x^\ast) \leq \limsup_{n\to\infty}\dfrac{1}{n}\sup_{x\in X}  \phi(n,x)\\
&\implies\sup_{x\in X}\limsup_{n\to\infty}\dfrac{1}{n} \phi(n,x) \leq \limsup_{n\to\infty} \dfrac{1}{n} \sup_{x\in X}\phi(n,x).
\end{align*}
Note that in this last expression the limit superior can be replaced by limit or infimum by the subadditivity of the sequence $n\mapsto \sup_{x\in X}\phi(n,x)$.
$X$ is compact and $\dfrac{1}{n} \phi(n,\bullet):X\to\mathbb{R}$ is continuous, thus there is an $x_n\in X$ such that
$$\dfrac{1}{n} \phi(n,x_n)=\sup_{x\in X} \dfrac{1}{n} \phi(n,x).$$
Put $\mu_n = \dfrac{1}{n}\sum_{k=0}^{n-1}\delta_{f^k(x_n)}$. Again by the Krylov-Bogoliubov Theorem there is a subsequence $n_i\subseteq n$ and a $\mu\in \text{Prob}(X;f)$ such that $\text{vaguelim}_{i\to \infty} \mu_{n_i}=\mu$. Thus
\begin{align*}
\limsup_{n\to\infty} \dfrac{1}{n} \sup_{x\in X}\phi(n,x)
&= \lim_{n\to\infty}\dfrac{1}{n} \sup_{x\in X} \phi(n,x)\\
&= \lim_{i\to\infty} \dfrac{1}{n_i} \phi(n_i,x_{n_i})\\
&=\lim_{i\to\infty} \mathbb{E}_{\mu_{n_i}}(\phi)
=\mathbb{E}_\mu(\phi)
\in\text{mRot}(f,\phi).
\end{align*}
Hence we have
$$\max \text{pRot}(f,\phi) \leq \sup_{x\in X} \limsup_{n\to\infty} \dfrac{1}{n} \phi(n,x) \leq \limsup_{n\to\infty}\dfrac{1}{n}\sup_{x\in X}\phi(n,x) \leq \max\text{mRot}(f,\phi).$$
Applying the same argument to $-\phi$ gives item 3.

Saying that $\mathbb{E}_\bullet(\phi):\text{Prob}(X;f)\to\mathbb{R}$ is constant is the same as saying that the measurewise rotation set $\text{mRot}(f,\phi)=\{a\}$ is a singleton. Then by the first item in the Lemma the level set $R(\phi,a)$ is in fact equal to $\text{Birk}(f,\phi)$, that is, there is exactly one level ( $=a$); and by the second and third items in the Lemma (the expressions in the middle), $\text{Birk}(f,\phi)=X$.
