TITLE: Help explain why "$f$ be finite a.e" is necessary in a theorem.
QUESTION [6 upvotes]: A theorem states

Let $ϕ$ be continuous on $\Bbb{R}$, let $f$ be finite on $Ω$ a.e., then $ϕ∘f$ is measurable if $f$ is measurable. 

The following is the proof from my textbook.

Since $ϕ$ is defined on $\Bbb{R}$ and is continuous, then $ϕ^{-1} (G)$ is an open set if $G$ is open, by Theorem 24. Now given any open set $G$, $(ϕ∘f)^{-1} (G)=f^{-1} (ϕ^{-1} (G))$ is measurable since $f$ is measurable and $ϕ^{-1} (G)$ is open, which gives $ϕ∘f$ is measurable.

My question is why "$f$ be finite on $Ω$ a.e." is necessary? The proof seems not using this condition. What happens if $f$ is infinite on a non-zero-measure subset of $\Omega$? Thank you!

REPLY [4 votes]: I was puzzled at similar things last year. This is indeed confusing for new learners. Most textbooks just rush through this with a handful of words.
Let's first observe some trivial fun facts, which are helpful. Suppose $f$ is defined everywhere on a set $\Omega$.

$f$ is measurable on any measurable subset of $\Omega$.
If $f$ is also measurable on $\Omega'$ then f is measurable on $Ω⋃Ω'$.
$f$ is measurable if and only if $f$ is measurable a.e. on $\Omega$.
Suppose $g$ is defined on $\Omega \backslash  Z$ for some null set $Z$ and $f=g$ on $\Omega \backslash Z$ (in other words $f=g$ a.e.), then $f$ is measurable on $\Omega$ if and only if $g$ is measurable on $\Omega \backslash  Z$. That is, if two functions only differ on a null set, then their measurability in nature has no difference.

What the theorem wants to show, I think, is that the measurability of $\phi ∘ f$ has no difference from $f$ on the set $\Omega$. I believe this theorem is later used to prove other theorems that require $\phi ∘ f$ to have such measurability. That is why the theorem has to assume $f$ finite a.e., otherwise $\phi ∘ f$ would have different measurability from $f$.