TITLE: $\{\omega: f_n(\omega)\in[a,b]\text{ for finitely many }n\}$ is measurable
QUESTION [5 upvotes]: The question:

Given a sequence of measurable functions $(f_n):\Omega\rightarrow \mathbb{R}$. Prove the following set $A$ is measurable:
$$A=\{\omega:f_n(\omega)\in[a,b]\text{ for finitely many }n\}$$
$$B=\{\omega:f_n(\omega)\in[a,b]\text{ for infinitely many }n\}$$

I found another similar post but I don't think it was helpful.
My thoughts:
For $A$, $f_n(\omega)\in[a,b]$ for finitely many $n$ means:
$$\forall \,N < \infty\,\,\exists \,\,n\leq N \text{ such that } f_n(\omega)\in [a,b]$$translate that to set language is:$$\bigcup_{N\in\mathbb{N}}\bigcap_{n\leq N} \{\omega:f_n(\omega) \in [a,b]\}$$However, this does not seem right, cause if for some $n \leq N$, set $\{\omega: f_n(\omega)\in[a,b]\}$ is empty, then the intersection over all $n \leq N$ would be empty, and that is not necessarily true.
For $B$, $f_n(\omega)\in[a,b]$ for infinitely many $n$ means:
$$\exists \,N < \infty\,\,\forall \,\,n\geq N \text{ such that } f_n(\omega)\in [a,b]$$
in set it is:
$$\bigcap_{N\in\mathbb{N}}\bigcup_{n\geq N} \{\omega:f_n(\omega) \in [a,b]\}$$
Are my thoughts correct? I apologize if I made any stupid mistakes. Since I don't have a solid background on sets or logic, any help would be very much appreciated!

REPLY [2 votes]: A)
For some $N$, for all $n$, if $n\geq N$, then $f_{n}(\omega)\notin[a,b]$.
$f_{n}(\omega)\notin[a,b]$ is equivalent to $f_{n}(\omega)\in(-\infty,a)\cup(b,\infty)$.
The set becomes
\begin{align*}
\bigcup_{N=1}^{\infty}\bigcap_{n\geq N}f_{n}^{-1}(-\infty,a)\cup f_{n}^{-1}(b,\infty).
\end{align*}