If $A$ is self-adjoint operator defined in Hilbert space $\mathscr{H}$ and its resolvent family is $(\mathbb{C}, \mathscr{B}, E)$. If $D\in\mathbb{C}$ is a Borel measuable subset with smooth boundary $\Gamma = \partial D$ and $\Gamma\subset \rho(A)$. How to prove $$E(D)=\frac{1}{2\pi i}\oint_{\Gamma} (zI-A)^{-1}dz.$$
I try to use the $$\frac{1}{2\pi i}\oint_{\Gamma} \frac{1}{\xi-z}d\xi = \chi_{D}(z).$$ Note that $E^{A}(D)=\int_{\sigma(A)}\chi_{D}(z)E(dz)$, we get $$E^{A}(D)=\int_{\sigma(A)}\frac{1}{2\pi i}\Big(\oint_{\Gamma} \frac{1}{\xi-z}d\xi \Big)E^{A}(dz)=\frac{1}{2\pi i}\int_{\sigma(A)}(zI-\xi)^{-1}d\xi.$$
But how to go ahead in the next?
If $D$ is part of the spectrum, and if $D$ is contained in the interior of a simple closed rectifiable curve $\Gamma$ such that no other part of the spectrum is contained in the interior of or on the curve $\Gamma$, then $$ \frac{1}{2\pi i}\oint_{\Gamma} (\lambda I-A)^{-1}d\lambda \\ = \frac{1}{2\pi i}\oint_{\Gamma} \int_{\sigma(A)} \frac{1}{\lambda-\mu}dE(\mu) d\lambda \\ = \int_{\sigma(A)}\left(\frac{1}{2\pi i}\oint_{\Gamma}\frac{1}{\lambda-\mu}d\lambda\right) dE(\mu) $$ The integral in parentheses is $1$ for $\mu$ in the interior of $\Gamma$, and is $0$ for $\mu$ outside $\Gamma$. And the value of the interior integral does not matter on $\Gamma$ because $E$ is $0$ on a neighborhood of $\Gamma$. So, the above reduces to $$ \int_{\sigma(A)}\chi_{\mbox{Int}(\Gamma)}(\mu)dE(\mu)=\int_{\sigma(A)}\chi_{D}(\mu)dE(\mu) = E(D). $$