[proofplan]
We define a projection-valued measure by multiplying by the indicators of the inverse images $m^{-1}(B)$. Countable additivity follows from countable additivity of the finite scalar measures obtained by integrating $|f|^2$ over measurable subsets of $X$. We then identify the spectral integral of the identity function against this projection-valued measure with multiplication by $m$, and separately verify self-adjointness after first proving that the multiplication operator is densely defined.
[/proofplan]
[step:Define the candidate spectral projections by inverse images of Borel sets]
Let $\mathcal B(\mathbb R)$ denote the Borel $\sigma$-algebra on $\mathbb R$. Let $\mathcal L(L^2(X,\mathcal E,\mu))$ denote the space of bounded linear operators from $L^2(X,\mathcal E,\mu)$ to itself, equipped with the operator norm $\|\cdot\|_{\mathcal L(L^2)}$.
For each Borel set $B\in\mathcal B(\mathbb R)$, define an operator $P(B):L^2(X,\mathcal E,\mu)\to L^2(X,\mathcal E,\mu)$ by sending each $f\in L^2(X,\mathcal E,\mu)$ to $\mathbb{1}_{m^{-1}(B)}f$.
Since $m$ is $\mathcal E$-measurable, $m^{-1}(B)\in\mathcal E$. Hence $\mathbb{1}_{m^{-1}(B)}f$ is measurable whenever $f$ is measurable, and
\begin{align*}
\|P(B)f\|_{L^2(X)}^2=\int_X |\mathbb{1}_{m^{-1}(B)}(x)f(x)|^2\,d\mu(x).
\end{align*}
Since $|\mathbb{1}_{m^{-1}(B)}(x)|\le 1$ for every $x\in X$, we have
\begin{align*}
\int_X |\mathbb{1}_{m^{-1}(B)}(x)f(x)|^2\,d\mu(x)\le\int_X |f(x)|^2\,d\mu(x).
\end{align*}
Thus
\begin{align*}
\|P(B)f\|_{L^2(X)}^2\le\|f\|_{L^2(X)}^2.
\end{align*}
Thus $P(B)\in\mathcal L(L^2(X,\mathcal E,\mu))$ and $\|P(B)\|_{\mathcal L(L^2)}\le 1$.
Moreover $P(B)$ is an [orthogonal projection](/theorems/437). Indeed, $\mathbb{1}_{m^{-1}(B)}^2=\mathbb{1}_{m^{-1}(B)}$, so $P(B)^2=P(B)$. For $f,g\in L^2(X,\mathcal E,\mu)$, using the $L^2$ [inner product](/page/Inner%20Product)
\begin{align*}
(f,g)_{L^2(X)}=\int_X f(x)\overline{g(x)}\,d\mu(x).
\end{align*}
we have
\begin{align*}
(P(B)f,g)_{L^2(X)}=\int_X \mathbb{1}_{m^{-1}(B)}(x)f(x)\overline{g(x)}\,d\mu(x).
\end{align*}
Because $\mathbb{1}_{m^{-1}(B)}$ is real-valued, this equals
\begin{align*}
\int_X f(x)\overline{\mathbb{1}_{m^{-1}(B)}(x)g(x)}\,d\mu(x)=(f,P(B)g)_{L^2(X)}.
\end{align*}
Thus $P(B)^*=P(B)$.
[/step]
[step:Verify that the projections form a projection-valued measure]
We have $P(\varnothing)=0$ and $P(\mathbb R)=I$, because $m^{-1}(\varnothing)=\varnothing$ and $m^{-1}(\mathbb R)=X$.
If $B,C\in\mathcal B(\mathbb R)$, then
\begin{align*}
P(B)P(C)f=\mathbb{1}_{m^{-1}(B)}\mathbb{1}_{m^{-1}(C)}f.
\end{align*}
The product of indicators is the indicator of the intersection, and inverse images preserve intersections, so
\begin{align*}
\mathbb{1}_{m^{-1}(B)}\mathbb{1}_{m^{-1}(C)}f=\mathbb{1}_{m^{-1}(B)\cap m^{-1}(C)}f.
\end{align*}
Also
\begin{align*}
\mathbb{1}_{m^{-1}(B)\cap m^{-1}(C)}f=\mathbb{1}_{m^{-1}(B\cap C)}f=P(B\cap C)f.
\end{align*}
So $P(B)P(C)=P(B\cap C)$.
Let $(B_k)_{k=1}^{\infty}$ be pairwise disjoint Borel subsets of $\mathbb R$, and define $B:=\bigcup_{k=1}^{\infty}B_k$. Fix $f\in L^2(X,\mathcal E,\mu)$. Define the finite measure $\nu_f:\mathcal E\to[0,\infty)$ by
\begin{align*}
\nu_f(A)=\int_A |f(x)|^2\,d\mu(x).
\end{align*}
For each $N\in\mathbb N$, set $A_N:=m^{-1}\left(B\setminus\bigcup_{k=1}^{N}B_k\right)$. Then $(A_N)_{N=1}^{\infty}$ is a decreasing sequence of sets in $\mathcal E$, and $\bigcap_{N=1}^{\infty}A_N=\varnothing$ because $B=\bigcup_{k=1}^{\infty}B_k$. Since $\nu_f(X)=\|f\|_{L^2(X)}^2<\infty$, continuity from above for the finite measure $\nu_f$ gives $\nu_f(A_N)\to 0$. Therefore
\begin{align*}
\left\|P(B)f-\sum_{k=1}^{N}P(B_k)f\right\|_{L^2(X)}^2=\int_{A_N}|f(x)|^2\,d\mu(x).
\end{align*}
By the definition of $\nu_f$,
\begin{align*}
\int_{A_N}|f(x)|^2\,d\mu(x)=\nu_f(A_N).
\end{align*}
Hence
\begin{align*}
\left\|P(B)f-\sum_{k=1}^{N}P(B_k)f\right\|_{L^2(X)}^2\to 0.
\end{align*}
Hence $P(B)f=\sum_{k=1}^{\infty}P(B_k)f$ in $L^2(X,\mathcal E,\mu)$ for every $f$, so $P$ is countably additive in the strong operator topology. Thus $P$ is a projection-valued measure on $\mathbb R$.
[/step]
[step:Compute the spectral integral of the identity function]
Let $\iota:\mathbb R\to\mathbb R$ denote the identity function, $\iota(\lambda)=\lambda$. For each $f\in L^2(X,\mathcal E,\mu)$, the scalar measure associated to $P$ and $f$ is
\begin{align*}
\nu_f(B)=(P(B)f,f)_{L^2(X)}.
\end{align*}
Using the definition of $P(B)$, this is
\begin{align*}
\nu_f(B)=\int_X \mathbb{1}_{m^{-1}(B)}(x)|f(x)|^2\,d\mu(x).
\end{align*}
This is exactly the pushforward of the measure $|f|^2\,d\mu$ under $m$, so for every non-negative Borel function $\varphi:\mathbb R\to[0,\infty]$,
\begin{align*}
\int_{\mathbb R}\varphi(\lambda)\,d\nu_f(\lambda)
=
\int_X \varphi(m(x))|f(x)|^2\,d\mu(x).
\end{align*}
Taking $\varphi(\lambda)=|\lambda|^2$, we obtain
\begin{align*}
\int_{\mathbb R}|\lambda|^2\,d\nu_f(\lambda)
=
\int_X |m(x)|^2|f(x)|^2\,d\mu(x).
\end{align*}
For each $n\in\mathbb N$, define the truncated identity function $\iota_n:\mathbb R\to\mathbb R$ by $\iota_n(\lambda)=\lambda\,\mathbb{1}_{[-n,n]}(\lambda)$. By the spectral-integral construction for projection-valued measures in the [Spectral Theorem for Self-Adjoint Operators](/theorems/6911), the unbounded spectral integral $\int_{\mathbb R}\lambda\,dP(\lambda)$ is defined as the closed operator obtained from the bounded truncations $\int_{\mathbb R}\iota_n(\lambda)\,dP(\lambda)$, with domain consisting of those $f\in L^2(X,\mathcal E,\mu)$ for which $\int_{\mathbb R}|\lambda|^2\,d\nu_f(\lambda)<\infty$. Therefore this domain is precisely
\begin{align*}
\left\{f\in L^2(X,\mathcal E,\mu):\int_X |m(x)f(x)|^2\,d\mu(x)<\infty\right\}.
\end{align*}
By the definition of $\mathcal D(M_m)$, this set equals $\mathcal D(M_m)$.
For bounded Borel simple functions $\varphi:\mathbb R\to\mathbb C$, the definition of the spectral integral gives
\begin{align*}
\left(\int_{\mathbb R}\varphi(\lambda)\,dP(\lambda)f\right)(x)=\varphi(m(x))f(x).
\end{align*}
for $\mu$-a.e. $x\in X$. Since each $\iota_n$ is bounded and Borel but not necessarily simple, we justify the action formula for $\iota_n$ as follows. Let $S$ be a bounded Borel function on $\mathbb R$. Choose bounded Borel simple functions $(S_j)_{j=1}^{\infty}$ with $|S_j|\le \|S\|_{\infty}$ and $S_j(\lambda)\to S(\lambda)$ for every $\lambda\in\mathbb R$. The simple-function formula gives
\begin{align*}
\left(\int_{\mathbb R}S_j(\lambda)\,dP(\lambda)f\right)(x)=S_j(m(x))f(x).
\end{align*}
for $\mu$-a.e. $x\in X$. By dominated convergence applied to the scalar spectral measures and to $X$ with measure $\mu$, with dominating functions $4\|S\|_\infty^2$ for the scalar measures and $4\|S\|_\infty^2|f|^2$ on $X$, both sides converge in $L^2(X,\mathcal E,\mu)$ to the corresponding expressions with $S$. Hence the action formula holds for every bounded Borel $S$, and in particular for each $\iota_n$. Using convergence in $L^2(X,\mathcal E,\mu)$ on the domain $\mathcal D(M_m)$, we get
\begin{align*}
\left(\int_{\mathbb R}\lambda\,dP(\lambda)f\right)(x)
=
m(x)f(x)
\end{align*}
for every $f\in\mathcal D(M_m)$ and $\mu$-a.e. $x\in X$.
[guided]
Recall that $P:\mathcal B(\mathbb R)\to\mathcal L(L^2(X,\mathcal E,\mu))$ is defined by
\begin{align*}
P(B)f=\mathbb{1}_{m^{-1}(B)}f
\end{align*}
for every Borel set $B\in\mathcal B(\mathbb R)$ and every $f\in L^2(X,\mathcal E,\mu)$. The projection-valued measure $P$ should represent the operator by the spectral-integral formula displayed in the exact part of this step. To verify this, we first compute the scalar measure seen by a fixed vector $f\in L^2(X,\mathcal E,\mu)$. Define $\nu_f:\mathcal B(\mathbb R)\to[0,\infty)$ by
\begin{align*}
\nu_f(B)=(P(B)f,f)_{L^2(X)}.
\end{align*}
Using the definition of $P(B)$, this becomes
\begin{align*}
\nu_f(B)
=
\int_X \mathbb{1}_{m^{-1}(B)}(x)|f(x)|^2\,d\mu(x).
\end{align*}
Thus $\nu_f$ is the pushforward of the finite measure $|f|^2\,d\mu$ through the measurable map $m:X\to\mathbb R$. Consequently, for every non-negative Borel function $\varphi:\mathbb R\to[0,\infty]$,
\begin{align*}
\int_{\mathbb R}\varphi(\lambda)\,d\nu_f(\lambda)
=
\int_X \varphi(m(x))|f(x)|^2\,d\mu(x).
\end{align*}
The domain of an unbounded spectral integral is controlled by the square-integrability of the multiplier. For each $n\in\mathbb N$, define the truncated identity function $\iota_n:\mathbb R\to\mathbb R$ by $\iota_n(\lambda)=\lambda\,\mathbb{1}_{[-n,n]}(\lambda)$. More precisely, by the spectral-integral construction for projection-valued measures in the Spectral Theorem for [Self-Adjoint Operators](/page/Self-Adjoint%20Operators), $\int_{\mathbb R}\lambda\,dP(\lambda)$ is the closed operator obtained from the bounded truncations $\int_{\mathbb R}\iota_n(\lambda)\,dP(\lambda)$, and its domain consists exactly of those vectors for which the second moment of the scalar spectral measure is finite. Taking $\varphi(\lambda)=|\lambda|^2$ gives
\begin{align*}
\int_{\mathbb R}|\lambda|^2\,d\nu_f(\lambda)
=
\int_X |m(x)|^2|f(x)|^2\,d\mu(x).
\end{align*}
The right-hand side is finite exactly when $mf\in L^2(X,\mathcal E,\mu)$. Hence
\begin{align*}
\mathcal D\left(\int_{\mathbb R}\lambda\,dP(\lambda)\right)
=
\mathcal D(M_m).
\end{align*}
It remains to identify the action of the integral. For a bounded Borel [simple function](/page/Simple%20Function) $\varphi:\mathbb R\to\mathbb C$, write $\varphi=\sum_{j=1}^{N}a_j\mathbb{1}_{B_j}$ with pairwise disjoint Borel sets $B_j$. Then
\begin{align*}
\int_{\mathbb R}\varphi(\lambda)\,dP(\lambda)=\sum_{j=1}^{N}a_jP(B_j).
\end{align*}
so for $f\in L^2(X,\mathcal E,\mu)$,
\begin{align*}
\left(\int_{\mathbb R}\varphi(\lambda)\,dP(\lambda)f\right)(x)=\sum_{j=1}^{N}a_j\mathbb{1}_{m^{-1}(B_j)}(x)f(x).
\end{align*}
Since $x\in m^{-1}(B_j)$ exactly when $m(x)\in B_j$, this equals
\begin{align*}
\varphi(m(x))f(x).
\end{align*}
for $\mu$-a.e. $x\in X$.
This formula must be extended from bounded Borel simple functions to bounded Borel functions before we use truncated identity functions. Let $S:\mathbb R\to\mathbb C$ be bounded and Borel. Choose bounded Borel simple functions $(S_j)_{j=1}^{\infty}$ such that $|S_j|\le \|S\|_{\infty}$ and $S_j(\lambda)\to S(\lambda)$ for every $\lambda\in\mathbb R$. The simple-function formula gives the multiplication formula for each $S_j$. The [dominated convergence theorem](/theorems/4) applies first to the scalar spectral measures because $|S_j-S|^2\le 4\|S\|_\infty^2$, and it applies on $X$ with measure $\mu$ because $|(S_j(m)-S(m))f|^2\le 4\|S\|_\infty^2|f|^2$ with $|f|^2\in L^1(X,\mathcal E,\mu)$. Hence the spectral-integral side and the multiplication side converge in $L^2(X,\mathcal E,\mu)$ to the corresponding expressions with $S$. Hence the action formula holds for every bounded Borel $S$.
Now approximate the identity function by the bounded Borel functions $\iota_n:\mathbb R\to\mathbb R$ defined by $\iota_n(\lambda)=\lambda\,\mathbb{1}_{[-n,n]}(\lambda)$.
If $f\in\mathcal D(M_m)$, then
\begin{align*}
|\iota_n(m(x))f(x)-m(x)f(x)|^2\le |m(x)f(x)|^2.
\end{align*}
and the right-hand side is $\mu$-integrable. Since $\iota_n(m(x))f(x)\to m(x)f(x)$ pointwise for $\mu$-a.e. $x\in X$, and since $|m f|^2\in L^1(X,\mathcal E,\mu)$ for $f\in\mathcal D(M_m)$, the dominated convergence theorem gives convergence in $L^2(X,\mathcal E,\mu)$. Therefore
\begin{align*}
\left(\int_{\mathbb R}\lambda\,dP(\lambda)f\right)(x)
=
m(x)f(x)
\end{align*}
for every $f\in\mathcal D(M_m)$ and $\mu$-a.e. $x\in X$.
[/guided]
[/step]
[step:Compute the adjoint domain and prove self-adjointness]
We first prove that $M_m$ is densely defined. For each $n\in\mathbb N$, define $A_n=\{x\in X: |m(x)|\le n\}$. If $f\in L^2(X,\mathcal E,\mu)$, then $\mathbb{1}_{A_n}f\in\mathcal D(M_m)$ because $|m\mathbb{1}_{A_n}f|\le n|f|$. Since $m$ is finite real-valued, $A_n\uparrow X$, so $\mathbb{1}_{A_n}f\to f$ pointwise $\mu$-a.e. and $|\mathbb{1}_{A_n}f-f|^2\le |f|^2$. Dominated convergence gives $\mathbb{1}_{A_n}f\to f$ in $L^2(X,\mathcal E,\mu)$. Hence $\mathcal D(M_m)$ is dense in $L^2(X,\mathcal E,\mu)$, so the adjoint $M_m^*$ is defined.
We now prove directly that $M_m^*=M_m$. Since $m$ is real-valued, for $f,g\in\mathcal D(M_m)$,
\begin{align*}
(M_m f,g)_{L^2(X)}=\int_X m(x)f(x)\overline{g(x)}\,d\mu(x).
\end{align*}
Since $m$ is real-valued, this equals
\begin{align*}
\int_X f(x)\overline{m(x)g(x)}\,d\mu(x)=(f,M_m g)_{L^2(X)}.
\end{align*}
Thus $M_m\subset M_m^*$.
Conversely, let $g\in\mathcal D(M_m^*)$. By definition of the adjoint, there exists $h\in L^2(X,\mathcal E,\mu)$ such that
\begin{align*}
(M_m f,g)_{L^2(X)}=(f,h)_{L^2(X)}
\end{align*}
for every $f\in\mathcal D(M_m)$. Recall that $A_n=\{x\in X: |m(x)|\le n\}$. If $f\in L^2(X,\mathcal E,\mu)$ and $f=0$ $\mu$-a.e. on $X\setminus A_n$, then $mf\in L^2(X,\mathcal E,\mu)$ because $|mf|\le n|f|$ $\mu$-a.e. on $X$. Hence such $f$ belongs to $\mathcal D(M_m)$.
Applying the adjoint identity to $f=\mathbb{1}_{A_n}u$ with arbitrary $u\in L^2(X,\mathcal E,\mu)$ gives
\begin{align*}
\int_X \mathbb{1}_{A_n}(x)m(x)u(x)\overline{g(x)}\,d\mu(x)
=
\int_X \mathbb{1}_{A_n}(x)u(x)\overline{h(x)}\,d\mu(x).
\end{align*}
Equivalently,
\begin{align*}
\int_X \mathbb{1}_{A_n}(x)u(x)\overline{h(x)-m(x)g(x)}\,d\mu(x)=0
\end{align*}
for every $u\in L^2(X,\mathcal E,\mu)$. Taking $u=\mathbb{1}_{A_n}(h-mg)$, which lies in $L^2(X,\mathcal E,\mu)$ because $h\in L^2(X,\mathcal E,\mu)$ and $|mg|\le n|g|$ on $A_n$, yields
\begin{align*}
\int_{A_n}|h(x)-m(x)g(x)|^2\,d\mu(x)=0.
\end{align*}
Thus $h=mg$ $\mu$-a.e. on $A_n$ for every $n\in\mathbb N$. Since $m$ is finite real-valued, $\bigcup_{n=1}^{\infty}A_n=X$, so $h=mg$ $\mu$-a.e. on $X$. Therefore $mg\in L^2(X,\mathcal E,\mu)$, so $g\in\mathcal D(M_m)$ and $M_m^*g=M_mg$.
We have shown $\mathcal D(M_m^*)\subset\mathcal D(M_m)$ and $M_m^*g=M_mg$ on that domain. Combined with $M_m\subset M_m^*$, this proves $M_m^*=M_m$.
[/step]
[step:Identify the spectral measure of the multiplication operator]
The projection-valued measure $P$ satisfies
\begin{align*}
M_m=\int_{\mathbb R}\lambda\,dP(\lambda)
\end{align*}
with domain $\mathcal D(M_m)$, and the preceding step shows that $M_m$ is self-adjoint. By the uniqueness clause in the Spectral Theorem for Self-Adjoint Operators, the projection-valued measure representing $M_m$ through this spectral integral is unique. Hence $P$ is the spectral measure of $M_m$. Therefore, for every Borel set $B\in\mathcal B(\mathbb R)$ and every $f\in L^2(X,\mathcal E,\mu)$,
\begin{align*}
(E_{M_m}(B)f)(x)=\mathbb{1}_{m^{-1}(B)}(x)f(x)
\end{align*}
for $\mu$-a.e. $x\in X$, as claimed.
[/step]