Lebesgue integral on any open set is $\ge 0$, is it still $\geq 0$ on any $G_{\delta}$ set?

Definition of Lebesgue measurable function: Given a function $f: D \to \mathbb R \cup \{+\infty, -\infty\}$, defined on some domain $D \subset \mathbb{R}^n$, we say that $f$ is Lebesgue measurable if $D$ is measurable and if, for each $a\in[-\infty, +\infty]$, the set $\{x\in D \mid f(x) > a\}$ is measurable.

If $f$ is an extended real valued(codomain is $[-\infty, +\infty]$) measurable function defined on $[a, +\infty)$ and it’s Lebesgue integrable with $\int_{G} f(x) dx \ge 0$ for $\forall$ open set $G \subset (a, +\infty)$, how about its integral on a $G_{\delta}$(a countable intersection of open sets) set? Is still $\int_{G_{\delta}} f(x) dx \ge 0$?

Besides, if domain of $f$ is modified to $\mathbb R$ that is $f$ is a real valued measurable function defined on $\mathbb R$ with the same property, will the conclusion still be true?

Solutions Collecting From Web of "Lebesgue integral on any open set is $\ge 0$, is it still $\geq 0$ on any $G_{\delta}$ set?"

The answer is yes.

Let $U_n\:(\:n\in\Bbb{N})$ be countable number of open sets. Then any $G$-set
$$
G_{\delta}=\bigcap_{n=1}^{\infty}U_n=\bigcap_{n=1}^{\infty}\bigcap_{k=1}^{n}U_k=\bigcap_{n=1}^{\infty}O_n
$$
where $O_n=\bigcap_{k=1}^{n}U_k$. Clearly any $O_n$ is open set and
$$
O_1\supset O_2\supset \cdots\supset O_n\supset \cdots
$$
Since $O_n$ is open
$$
\int_{O_n}f\:dx\geqslant0
$$
So
$$
\int_{G_\delta}f\:dx=\int_{\bigcap_{n=1}^{\infty}O_n}f\:dx=\lim_{n\to\infty}\int_{O_n}f\:dx\geqslant0
$$
Here we use Monotone Class theorem in measure theory that $O_1\supset O_2\supset \cdots\supset O_n\supset \cdots$ implies
$$
\mu \left ( \bigcap _{n=1}^{\infty} O_n\right )=\lim _{n\to \infty }\mu (O_n)
$$
Since given $\epsilon>0$, there exists $M$ that for all $r>M$
$$
\left|\int_{\mathbb{R}} f\:dx-\int_{[-r,r]} f\:dx\right|<\epsilon
$$
It holds for domain of $f$ in $\mathbb{R}$.

Let $G = \bigcap_n U_n$ be a $G_\delta$. As noted already by others, by switching to $V_n =\bigcap_{i=1}^n U_n$ (this is still open with the same intersection of all sets), we can assume $U_{n+1} \subset U_n$.

Now set $f_n := f \cdot 1_{U_n}$, where $1_A$ is the indicator function of $A$. I leave it to you to verify that $f_n \to f \cdot 1_G$ pointwise. Furthermore, we have $|f_n|\leq |f|$, where $|f|$ is integrable, since you assume that $f$ is integrable (this is an important point, see below).

Thus, the dominated convergence theorem yields

$$
\int_G f\,dx =\lim_n \int_{U_n} f \, dx \geq 0.
$$

Now let us see that integrability of $f$ cannot simply be omitted. To this end, let $(x_n)_n$ be an enumeration of the rational numbers and set
$$
f = \bigg( \sum_n \frac{1}{|x-x_n|}\cdot 1_{B_{2^{-n}}(x_n)}(x) \bigg) – 1_{\overline{B_N (0)} \setminus \bigcup_n B_{2^{-n}}(x_n)}
$$
for a suitable (large) $N \in \Bbb{N}$. It is then not hard to verify
$$
\int_U f \, dx =\infty \geq 0
$$
for every nonempty open set $U$. Nevertheless, we do not have $f \geq 0$.

Even more, for the closed (hence $G_\delta$) set
$$
A := \overline{B_N (0)} \setminus \bigcup_n B_{2^{-n}}(x_n),
$$
we have
$\int_A f \, dx <0$.

In this example, $B_r (x)$ is the open ball of radius $r$ around $x$.

The hypotheses imply $f\in L^1[a,\infty).$ By the Lebesgue differention theorem,

$$ f(x) = \lim_{h\to 0} \, \frac{1}{h}\int_x^{x+h} f$$

for a.e. $x \in [a,\infty).$ Since each integral on the right is nonnegative, so is its limit when it exists. Thus $f\ge 0$ a.e. in $[a,\infty).$ It follows that $\int_E f \ge 0$ for all measurable subsets $E\subset [a,\infty),$ never mind the concern over $G_\delta$ subsets.