[proofplan]
We verify three things: that $Y$ is $\mathcal{G}$-measurable (immediate from the definition as a linear combination of indicator [functions](/page/Function) of atoms), that $Y$ is integrable (by exploiting the disjointness of the partition and the triangle inequality), and that the [integral](/page/Integral)-matching condition $\mathbb{E}[Y \mathbb{1}_A] = \mathbb{E}[X \mathbb{1}_A]$ holds for all $A \in \mathcal{G}$ (by reducing to atoms $B_m$ and extending to general $A$ via the [Dominated Convergence Theorem](/theorems/4)).
[/proofplan]
[step:Verify $\mathcal{G}$-measurability of $Y$]
Each indicator $\mathbb{1}_{B_i}$ is $\mathcal{G}$-measurable since $B_i \in \mathcal{G}$ by construction, and the coefficients $\mathbb{E}[X \mid B_i]$ are constants. The function $Y = \sum_{i \in I} \mathbb{E}[X \mid B_i] \, \mathbb{1}_{B_i}$ is therefore $\mathcal{G}$-measurable as a countable linear combination of $\mathcal{G}$-[measurable functions](/page/Measurable%20Functions).
[/step]
[step:Establish $L^1$-integrability using the partition structure]
Since the [sets](/page/Set) $(B_i)_{i \in I}$ are pairwise disjoint, the sum defining $Y$ has at most one nonzero term at each $\omega \in \Omega$. Therefore $|Y(\omega)| = |\mathbb{E}[X \mid B_i]|$ for the unique $i$ with $\omega \in B_i$. We estimate:
\begin{align*}
\mathbb{E}[|Y|] &= \sum_{i \in I} |\mathbb{E}[X \mid B_i]| \, \mathbb{P}(B_i) \\
&\leq \sum_{i \in I} \mathbb{E}[|X| \mid B_i] \, \mathbb{P}(B_i) \\
&= \sum_{i \in I} \frac{\mathbb{E}[|X| \mathbb{1}_{B_i}]}{\mathbb{P}(B_i)} \cdot \mathbb{P}(B_i) \\
&= \sum_{i \in I} \mathbb{E}[|X| \mathbb{1}_{B_i}] \\
&= \mathbb{E}[|X|] < \infty.
\end{align*}
The first inequality applies the triangle inequality $|\mathbb{E}[X \mid B_i]| = \bigl|\mathbb{E}[X \mathbb{1}_{B_i}]\bigr| / \mathbb{P}(B_i) \leq \mathbb{E}[|X| \mathbb{1}_{B_i}] / \mathbb{P}(B_i) = \mathbb{E}[|X| \mid B_i]$ for each atom with $\mathbb{P}(B_i) > 0$. The terms with $\mathbb{P}(B_i) = 0$ contribute zero to both sides. The final equality uses $\sum_{i \in I} \mathbb{1}_{B_i} = \mathbb{1}_\Omega$ (the partition property).
[guided]
The key structural observation is that the partition $(B_i)_{i \in I}$ makes $Y$ take a single constant value on each atom: for $\omega \in B_j$, only the $j$-th term in the sum survives, giving $Y(\omega) = \mathbb{E}[X \mid B_j]$. This disjointness converts the sum of integrals into an integral of a sum.
We estimate $\mathbb{E}[|Y|]$ by first noting that on each atom $B_i$ with $\mathbb{P}(B_i) > 0$:
\begin{align*}
|\mathbb{E}[X \mid B_i]| = \left|\frac{\mathbb{E}[X \mathbb{1}_{B_i}]}{\mathbb{P}(B_i)}\right| \leq \frac{\mathbb{E}[|X| \mathbb{1}_{B_i}]}{\mathbb{P}(B_i)} = \mathbb{E}[|X| \mid B_i],
\end{align*}
where the inequality uses $|\mathbb{E}[Z]| \leq \mathbb{E}[|Z|]$ applied to the random variable $Z = X \mathbb{1}_{B_i} / \mathbb{P}(B_i)$. Then:
\begin{align*}
\mathbb{E}[|Y|] = \sum_{i \in I} |\mathbb{E}[X \mid B_i]| \, \mathbb{P}(B_i) \leq \sum_{i \in I} \mathbb{E}[|X| \mid B_i] \, \mathbb{P}(B_i) = \sum_{i \in I} \mathbb{E}[|X| \mathbb{1}_{B_i}] = \mathbb{E}[|X|].
\end{align*}
The cancellation $\mathbb{E}[|X| \mid B_i] \cdot \mathbb{P}(B_i) = \mathbb{E}[|X| \mathbb{1}_{B_i}]$ follows directly from the definition of $\mathbb{E}[\cdot \mid B_i]$, and the final step reassembles the partition: $\sum_i \mathbb{E}[|X| \mathbb{1}_{B_i}] = \mathbb{E}\bigl[|X| \sum_i \mathbb{1}_{B_i}\bigr] = \mathbb{E}[|X|]$.
[/guided]
[/step]
[step:Verify the integral-matching condition on atoms]
It suffices to verify $\mathbb{E}[Y \mathbb{1}_A] = \mathbb{E}[X \mathbb{1}_A]$ for each atom $A = B_m$, since every $A \in \mathcal{G}$ is a countable union of atoms. For a single atom $B_m$ with $\mathbb{P}(B_m) > 0$, the disjointness of the partition gives:
\begin{align*}
\mathbb{E}[Y \mathbb{1}_{B_m}] = \mathbb{E}[\mathbb{E}[X \mid B_m] \, \mathbb{1}_{B_m}] = \mathbb{E}[X \mid B_m] \cdot \mathbb{P}(B_m) = \mathbb{E}[X \mathbb{1}_{B_m}].
\end{align*}
The second equality uses the fact that $\mathbb{E}[X \mid B_m]$ is a constant, and the third substitutes the definition $\mathbb{E}[X \mid B_m] = \mathbb{E}[X \mathbb{1}_{B_m}] / \mathbb{P}(B_m)$. When $\mathbb{P}(B_m) = 0$, both sides are zero.
[/step]
[step:Extend the integral-matching condition to all $A \in \mathcal{G}$]
Every set $A \in \mathcal{G}$ has the form $A = \bigcup_{j \in J} B_{m_j}$ for some $J \subset I$. For a finite union $A = \bigcup_{j=1}^n B_{m_j}$, linearity of expectation and the preceding step give:
\begin{align*}
\mathbb{E}[Y \mathbb{1}_A] = \sum_{j=1}^n \mathbb{E}[Y \mathbb{1}_{B_{m_j}}] = \sum_{j=1}^n \mathbb{E}[X \mathbb{1}_{B_{m_j}}] = \mathbb{E}[X \mathbb{1}_A].
\end{align*}
For a countably infinite union, write $A_n = \bigcup_{j=1}^n B_{m_j}$ and observe that $Y \mathbb{1}_{A_n} \to Y \mathbb{1}_A$ and $X \mathbb{1}_{A_n} \to X \mathbb{1}_A$ pointwise as $n \to \infty$. Since $|Y \mathbb{1}_{A_n}| \leq |Y| \in L^1$ and $|X \mathbb{1}_{A_n}| \leq |X| \in L^1$, the [Dominated Convergence Theorem](/theorems/4) gives:
\begin{align*}
\mathbb{E}[Y \mathbb{1}_A] = \lim_{n \to \infty} \mathbb{E}[Y \mathbb{1}_{A_n}] = \lim_{n \to \infty} \mathbb{E}[X \mathbb{1}_{A_n}] = \mathbb{E}[X \mathbb{1}_A].
\end{align*}
[/step]