[proofplan]
The proof is a direct computation from the definition of the integral of a nonnegative [simple function](/page/Simple%20Function). Since $B$ is measurable, its indicator is a measurable simple function with one nonzero value, namely $1$ on $B$. The integral is therefore the coefficient $1$ multiplied by the measure of the level set $B$. The expectation statement is the same identity applied to the [probability measure](/page/Probability%20Measure) $\mathbb P$ on $\Omega$.
[/proofplan]
[step:Recognize the indicator as a nonnegative measurable simple function]
Define the indicator function
\begin{align*}
\mathbb{1}_B:E\to\{0,1\}
\end{align*}
by setting $\mathbb{1}_B(x)=1$ for $x\in B$ and $\mathbb{1}_B(x)=0$ for $x\in E\setminus B$. Since $B\in\mathcal E$, the set on which $\mathbb{1}_B$ takes its nonzero value is measurable. Hence $\mathbb{1}_B$ is a nonnegative measurable simple function on $(E,\mathcal E,\mu)$.
[guided]
We first verify that the integral appearing in the statement is legitimate as a nonnegative [Lebesgue integral](/page/Lebesgue%20Integral). Define
\begin{align*}
\mathbb{1}_B:E\to\{0,1\}
\end{align*}
by declaring that $\mathbb{1}_B(x)=1$ when $x\in B$ and $\mathbb{1}_B(x)=0$ when $x\in E\setminus B$.
The only nonzero level set of this function is $B$. Because the hypothesis states that $B\in\mathcal E$, this level set is measurable. The zero level set is $E\setminus B$, which also belongs to $\mathcal E$ because $\mathcal E$ is a $\sigma$-algebra. Therefore $\mathbb{1}_B$ is measurable. Its range is the finite set $\{0,1\}$, so it is a simple function, and its values are nonnegative. Thus $\mathbb{1}_B$ is a nonnegative measurable simple function.
[/guided]
[/step]
[step:Compute the simple-function integral from its defining formula]
By the definition of the extended integral of a nonnegative simple function, the integral of a simple function is the sum of each positive value multiplied by the measure of the set on which that value occurs. For $\mathbb{1}_B$, the only positive value is $1$, and its level set is $B$. Therefore
\begin{align*}
\int_E \mathbb{1}_B(x)\,d\mu(x)=1\cdot\mu(B).
\end{align*}
Since $1\cdot\mu(B)=\mu(B)$, with the value $+\infty$ allowed when $\mu(B)=+\infty$, we obtain
\begin{align*}
\int_E \mathbb{1}_B(x)\,d\mu(x)=\mu(B).
\end{align*}
[/step]
[step:Specialize the identity to expectation on a probability space]
Now let $(\Omega,\mathcal F,\mathbb P)$ be a [probability space](/page/Probability%20Space) and let $A\in\mathcal F$. Applying the measure-space identity with $E=\Omega$, $\mathcal E=\mathcal F$, $\mu=\mathbb P$, and $B=A$ gives
\begin{align*}
\int_\Omega \mathbb{1}_A(\omega)\,d\mathbb P(\omega)=\mathbb P(A).
\end{align*}
By the definition of expectation as integration with respect to the probability measure,
\begin{align*}
\mathbb{E}[\mathbb{1}_A]=\int_\Omega \mathbb{1}_A(\omega)\,d\mathbb P(\omega).
\end{align*}
Combining the two displayed identities yields
\begin{align*}
\mathbb{E}[\mathbb{1}_A]=\mathbb P(A).
\end{align*}
This proves both assertions.
[/step]