The full theorem is "if and only if", but it would be too long for a thread if I posted two directions together. The reverse direction is here.
I'm trying to prove this theorem about the measurability of $\overline{\mathbb{R}}$-valued functions. Could you please verify if my proof looks fine or contains logical gaps/errors? Thank you so much for your help!
Let $(X, \mathcal{A}, \mu)$ be a complete, $\sigma$-finite measure space and $(E,\|\cdot\|)$ a Banach space.
We say $f \in E^{X}$ is $\boldsymbol{\mu}\textbf{-simple}$ if $f(X)$ is finite, $f^{-1}(e) \in \mathcal{A}$ for every $e \in E,$ and $\mu\left(f^{-1}(E \backslash\{0\})\right)<\infty$.
Suppose $f_n, f \in E^{X}$ for $n \in \mathbb{N} .$ Then $(f_n)_{n \in \mathbb N}$ converges to $f$ $\boldsymbol{\mu}\textbf{-almost everywhere}$ if and only if there is a $\mu$-null set $N$ such that $f_{n}(x) \rightarrow f(x)$ for all $x \in N^{c}$.
In the theory of integration, it is useful to consider not only real-valued functions but also maps into the extended number line $\overline{\mathbb{R}}$. Such maps are called $\overline{\mathbb{R}}$-valued functions.
Theorem If there is a sequence of $\mu$-simple functions $f_n \in \mathbb{R}^X$ such that $(f_n)$ converges to $f \in \overline{\mathbb{R}}^X$ $\mu$-almost everywhere, then $\mathcal{A}$ contains $f^{-1}(-\infty)$, $f^{-1}(+\infty)$, and $f^{-1}(O)$ for every open subset $O$ of $\mathbb{R}$.
$\textbf{My attempt}$
Assume there exist a sequence $(\psi_{n})_{n \in \mathbb N}$ of $\mu$-simple functions and a $\mu$-null set $N$ such that $\psi_{n} (x) \to f(x)$ for all $x \in N^c$.
Let $O$ be open in $\mathbb R$. We define a sequence $(O_k)_{k \in \mathbb N^*}$ by $O_{k} = \{y \in O \mid d(y, O^{c})>1 / k \}$. Then $O_{k}$ is open and $\overline{O}_{k} \subseteq O$. Let $x \in N^{c}$. We have $x \in O \iff \exists k \in \mathbb{N}^{*}: x \in O_k$. Therefore, $f(x) \in O$ if and only if there exists $(k,m_k) \in \mathbb{N}^{*} \times \mathbb{N}$ such that $\forall n \ge m_k: \varphi_{n}(x) \in O_{k}$. Consequently, $x \in f^{-1}(O)$ if and only if there exists $(k,m_k) \in \mathbb{N}^{*} \times \mathbb{N}$ such that $\forall n \ge m_k: x \in \varphi^{-1}_{n}(O_{k})$. As a result, $$f^{-1}(O) \cap N^{c} = \left ( \bigcup_{(k,m_k) \in \mathbb{N}^{*} \times \mathbb{N}} \bigcap_{n \ge m_k} \varphi_{n}^{-1} (O_{k}) \right ) \cap N^{c} = \bigcup_{(k,m_k) \in \mathbb{N}^{*} \times \mathbb{N}} \bigcap_{n \ge m_k} \left ( \varphi_{n}^{-1} (O_{k}) \cap N^{c}\right )$$
Because $\varphi_{n}$ is $\mu$-simple, $\varphi_{n}^{-1}(O_{k}) \in \mathcal{A}$ for all $(n,k) \in \mathbb{N} \times \mathbb{N}^{*}$. Hence $f^{-1}(O) \cap N^{c} \in \mathcal{A}$. Furthermore, the completeness of $\mu$ implies $f^{-1}(O) \cap N$ is a $\mu$-null set. Altogether, we obtain $$f^{-1}(O)=\left(f^{-1}(O) \cap N\right) \cup\left(f^{-1}(O) \cap N^{c}\right) \in \mathcal{A}$$
Let $x \in N^c$. We have $f(x) = +\infty \iff \forall M \in \mathbb N, \exists N \in \mathbb N,\forall n \ge N: \varphi_n(x) \ge M$. Consequently, $x \in f^{-1}(+\infty) \iff \forall M \in \mathbb N, \exists N \in \mathbb N,\forall n \ge N: x \in \varphi^{-1}_n ([M, \infty))$. As a result, $$\begin{aligned} f^{-1}(+\infty) \cap N^c &= \left( \bigcap_{M=0}^\infty \bigcup_{N=0}^\infty \bigcap_{n=N}^\infty \varphi^{-1}_n ([M, \infty)) \right) \cap N^c \\ &= \bigcap_{M=0}^\infty \bigcup_{N=0}^\infty \bigcap_{n=N}^\infty \left( \varphi^{-1}_n ([M, \infty)) \cap N^c \right) \end{aligned}$$
Because $\varphi_{n}$ is $\mu$-simple, $\varphi_{n}^{-1}([M, \infty)) \in \mathcal{A}$ for all $(n,M) \in \mathbb{N} \times \mathbb{N}$. Hence $f^{-1}(+\infty) \cap N^{c} \in \mathcal{A}$. Furthermore, the completeness of $\mu$ implies $f^{-1}(+\infty) \cap N$ is a $\mu$-null set. Altogether, we obtain $$f^{-1}(+\infty)=\left(f^{-1}(+\infty) \cap N\right) \cup\left(f^{-1}(+\infty) \cap N^{c}\right) \in \mathcal{A}$$
With similar reasoning, we have $f^{-1}(-\infty) \in \mathcal{A}$.
Instead of $\psi_n$ or $\phi_n$ I have chosen for $f_n$.
Where it concerns the situation $\lim_{n\to\infty}f_{n}\left(x\right)=f\left(x\right)\in O$ where $O$ is an open set things would be simple if you could make use of something like: $$f\left(x\right)\in O\iff f_{n}\left(x\right)\in O\text{ for }n\text{ large enough}\tag1$$
However only $\implies$ is true is general in $(1)$ so things are more complicated.
You provided a nice solution for that by constructing a monotone sequence $O_{1}\subseteq O_{2}\subseteq\cdots\subseteq O$ of open sets satisfying $O=\bigcup_{k=1}^{\infty}\overline{O}_{k}$.
The statement: $$f\left(x\right)\in O\iff\exists k\exists m_{k}\forall n\geq m_{k}\;f_{n}\left(x\right)\in O_{k}$$ is true in general.
If $f\left(x\right)\in O$ then $f\left(x\right)\in O_{k}$ for some $k$ so that - because $O_{k}$ is open - some $m_{k}$ exists with $n\geq m_{k}\implies f_{n}\left(x\right)\in O_{k}$.
Conversely if $f_{n}\left(x\right)\in O_{k}\subseteq\overline{O}_{k}\subseteq O$ for $n\geq m_{k}$ then also $f\left(x\right)\in\overline{O}_{k}\subseteq O$ because $\overline{O}_{k}$ is closed.