Why $g_n\to g$ a.e. if we set $g_n=\min\{g,f_n\}$? 
Suppose $\{f_n\}$ is a sequence of (Lebesgue) measurable functions on $\mathbb{R}^d$ with each $f_n\geq 0$. If $f_n(x)\to f(x)$ for a.e. $x$, then by Fatou's lemma, we have
$$\int f\leq\liminf_{n\to\infty}\int f_n.$$
Its proof begins with a non-negative function $g$ that is bounded and supported on a set $E\subseteq\mathbb{R}^d$ of finite measure with $g\leq f$. If we set $g_n=\min\{g,f_n\}$, then each $g_n$ is a measurable function and supported on $E$. Furthermore, $g_n(x)\to g(x)$ for a.e. $x$. By the bounded convergence theorem, ...

The above material is quoted from the book by Stein and Shakarchi with some minor changes, and I wonder why $g_n\to g$ almost everywhere. I wish I could offer you some useful ideas, but unfortunately I know nothing, which is why I'm here. I would much appreciate it if you could do me a favor. Thank you.
 A: Given $x \in \mathbb{R^d}$, we will look at two cases: (You may try writing out these arguments in a formal manner).
$(i)$ If $f(x)=g(x)$, then $f_n(x)$ converges to $g(x)$. This completes this case as $g_n(x)=f_n(x)$ or $g_n(x)=g(x)$ for each $n\in \mathbb{N}$.
$(ii)$ If $f(x)>g(x)$, then as $f_n(x)$ converges to $f(x)$, for large $n$, $f_n(x)>g(x)$, thus $g_n(x)=g(x)$. So, again, $g_n(x)\rightarrow g(x)$.
A: The reason is because the function $\min : \mathbb{R} \times \mathbb{R} \to \mathbb{R}$ is continuous. This follows from writing $\min(a, b) = \frac{a + b}{2} - \frac{|a - b|}{2}$, or from a direct argument by cases ($a < b$, $a = b$).
Thus in your case, since $f_n \to f$ a.e., it follows that $\min(g, f_n) \to \min(g, f) = g$ a.e.
A: I think I found the answer, but I need someone to help confirm it. Let $x$ be a point such that $f_n(x)\to f(x)$. By using an $\epsilon$-$\delta$ argument, I'm going to prove $g_n(x)\to g(x)$.
There are two cases to consider: $f(x)=g(x)$ and $f(x)>g(x)$. If $f(x)=g(x)$, choose $N\in\mathbb{N}$ s.t. $n\geq N\Rightarrow|f_n(x)-f(x)|<\epsilon$. By construction, $|g_n(x)-g(x)|<\epsilon$ whenever $n\geq N$. Now consider the case $f(x)>g(x)$. This time we choose $N\in\mathbb{N}$ s.t. $n\geq N\Rightarrow|f_n(x)-f(x)|<f(x)-g(x)$. Then, as long as $n\geq N$, we must have $|g_n(x)-g(x)|<\epsilon$.
Is my proof correct? Thank you.
