Why is this class closed under difference? We have two independent random variables $X\perp Y$ involving three spaces: $(\Omega,\mathcal{A},P), (E,\mathcal{E}), (F,\mathcal{F}).$: $$X:\Omega \rightarrow E,\ Y:\Omega\rightarrow F$$
My book says in passing that fixing any $B\in \mathcal{F}$, the collection of sets $A\in \mathcal{E}$ where $P((X^{-1}(A_1)\cap Y^{-1}(B))=P(X^{-1}(A))P(Y^{-1}(B))$,  is closed under difference.

I've tried in vain to prove the result, and someone even gave me a close-counterexample (not the same problem structure) which makes me dubious that it is even true:

$X\perp Y, \text{ i.i.d. Bern}\{1/2\}. A=\{X=1\}, B=\{Y=1\}, C = \{X+Y \text{ even}\}.$ Now $P(A\backslash B)P(C)>0$ but $P((A\backslash B)\cap C)=0.$

 A: The reason is convoluted but technically simple. Here is a very explicit proof.
Take $A_1, A_2$ in the collection. By construction,


*

*$A_1, A_2 \in \mathcal{E}$,

*$P\left(\ X^{-1}(A_1)\cap Y^{-1}(B)\ \right)=P\left(\ X^{-1}(A_1)\ \right)\cdot P\left(\ Y^{-1}(B)\ \right)$,

*$P\left(\ X^{-1}(A_2)\cap Y^{-1}(B)\ \right)=P\left(\ X^{-1}(A_2)\ \right)\cdot P\left(\ Y^{-1}(B)\ \right).$


We want to show: 

$$P\left(\ \left[X^{-1}(A_1)\backslash X^{-1}(A_2)\right] \cap Y^{-1}(B)\ \right)=P\left(\ X^{-1}(A_1)\backslash X^{-1}(A_2)\ \right)\cdot P(Y^{-1}(B)).$$

Note that: 
\begin{align}
P\left(\ \left[X^{-1}(A_1)\backslash X^{-1}(A_2)\right]\cap Y^{-1}(B)\ \right) \overset{(1)}{=} & P\left(\ X^{-1}(A_1) \cap Y^{-1}(B)\ \right)- \ \dots \\ 
& P\left(\ X^{-1}(A_1)\cap X^{-1}(A_2)\cap Y^{-1}(B)\ \right)  \\
\overset{(2)}=& P\left(\ X^{-1}(A_1)\ \right)\cdot P\left(\ Y^{-1}(B)\ \right)-\ \dots \\ 
& P\left(\ X^{-1}(A_1 \cap A_2)\cap Y^{-1}(B)\ \right) \\
\overset{(3)}=&  P\left(\ X^{-1}(A_1)\ \right)\cdot P\left(\ Y^{-1}(B)\ \right)-\ \dots \\
& P\left(\ X^{-1}(A_1 \cap A_2)\ \right)\cdot P\left(\ Y^{-1}(B)\ \right) \\
\overset{(4)}=& P(Y^{-1}(B)) \cdot \left[\ P(X^{-1}(A_1)) - P(X^{-1}(A_1 \cap A_2))\ \right] \\
\overset{(5)}=& P(Y^{-1}(B)) \cdot P(X^{-1}(A_1\backslash A_2))\\
\end{align}


*

*$(1)$: expand the set difference into a difference of probabilities

*$(2)$: by construction, we can rewrite the first term as a product. For the second term, it is a property of functions in general that $\cap_i \text{preimage}(S_i) = \text{preimage}(\cap_i S_i)$ 

*$(3)$ $A_1\cap A_2$ is a measurable in $X$'s range, and we've assumed $X\perp Y$, so we can rewrite the corresponding term as a product

*$(4)$ Factor out $P(Y^{-1}(B))$

*$(5)$ Identify set difference


The reason the counterexample isn't relevant is because $A$ and $B$ come from two different random variables, whereas in our problem they come from the same one.
