Suppose $f$ is some measurable function. The Lebesgue version of the Leibniz integral rule is, according to Wikipedia $$\frac{d}{dx}\int_{\Omega}f(x,y)dy=\int_{\Omega}\frac{\partial}{\partial x} f(x,y)dy.$$ for $x\in X\subset \mathbb{R}$, $y\in\Omega$, and $f$ is a function from $X\times \Omega$ to $\mathbb{R}$. This statement only holds under some assumptions, namely
$f$ is Lebesgue integrable (as a function of $y$) for each $x$.
$f$ is differentiable (with respect to $x$) for almost all $y$.
There is an integrable function that dominates $|\frac{\partial}{\partial x}f(x,y)|$ for all $x$ and almost all $y$.
(If I got something wrong here, please correct it)
My Question: Suppose we have an $f$ s.t. the above assumptions hold and let $S\subset \Omega$. Under which assumptions does $$\frac{d}{dx}\int_{S}f(x,y)dy=\int_{S}\frac{\partial}{\partial x} f(x,y)dy$$ hold?
I am interested in this question because a similar term turned up in a maximum likelihood estimation problem I am trying to solve. There, $S$ is a subset of the underlying Borel $\sigma$-algebra.
Hint: Apply the rule to $f \cdot \chi_S$, where $\chi_S$ is the characteristic function of $S$.