While studying on texts of physics I notice that differentiation under the integral sign is usually introduced without any comment on the conditions permitting to do so. In that case, I take care of thinking about what the author is assuming and the usual assumption made in physics that all the functions are of class $C^\infty$, at least piecewise on compact subsets, often is enough to guarantee the liceity of freely commutating the derivative and integral signs.
While studying the derivation of Ampère's law from the Biot-Savart law, someting has surprised me in this proof which seems to be ubiquitous on line and in cartaceous texts. In fact the magnetic field in a point $\mathbf{x}$ is $$\mathbf{B}(\mathbf{x}):=\frac{\mu_0}{4\pi}\iiint_V\mathbf{J}(\mathbf{l})\times\frac{\mathbf{x}-\mathbf{l}}{\|\mathbf{x}-\mathbf{l}\|^3}d^3l=\frac{\mu_0}{4\pi}\iiint_V\nabla_x\times\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]d^3l$$where I would prove the identity of the integrands at both members by considering the derivatives as... well, ordinary derivatives. I keep Wikipedia's notation except for $\mathbf{x}$, which is more common as a variable, and the norm sign, for which I have always seen $\|\cdot\|$ elsewhere. Then we can notice that the proof uses a differentiation under the integral sign (at $(1)$ below): since $\nabla_x\times\left[\nabla_x\times\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]\right]=\nabla_x\left[\nabla_x\cdot\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]\right]-\nabla_x^2\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]=\nabla_x\left[\mathbf{J}(\mathbf{l})\cdot\nabla_x\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\right]$ $-\nabla^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})$, where I would calculate the derivatives as ordinarily understood, again, we have that$$\nabla_x\times\mathbf{B}(\mathbf{x})=\nabla_x\times\left[\frac{\mu_0}{4\pi}\iiint_V\nabla_x\times\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]d^3l\right]$$$$=\frac{\mu_0}{4\pi}\iiint_V\nabla_x\times\left[\nabla_x\times\left[\frac{\mathbf{J}(\mathbf{l})}{\|\mathbf{x}-\mathbf{l}\|}\right]\right]d^3l\quad(1)$$$$=\frac{\mu_0}{4\pi}\iiint_V\nabla_x\left[\mathbf{J}(\mathbf{l})\cdot\nabla_x\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\right]-\nabla_x^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d^3l$$and then the integral is split as licit for Riemann, and Lebesgue, integrals when both integrands are integrable, and the gradient and integral signs are commutated in the first of the two resulting integrals to get$$\frac{\mu_0}{4\pi}\nabla_x\iiint_V\mathbf{J}(\mathbf{l})\cdot\nabla_x\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]d^3l-\frac{\mu_0}{4\pi}\iiint_V\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d^3l$$where the first addend is $\mathbf{0}$ (I do not understand how it is calculated, but that is not the main focus of my question) and where the identity $\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]=-4\pi\delta(\mathbf{x}-\mathbf{l})$, where the derivatives are this time intended as derivatives of a distribution, is used to get$$-\frac{\mu_0}{4\pi}\iiint_V\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d^3l=\mu_0\mathbf{J}(\mathbf{x}).$$ Everything of my reasoning seemed to me to work by assuming $V\subset\mathbb{R}^3$ to be compact and such that $\mathbf{x}\notin V$ and intending the integral $\iiint...d^3l$ to be a Riemann (or Lebesgue, which, in that case, I think to be the same) integral, but at this last step I see that it was not what I thought.
What are, then, the integrals appearing in such calculations? They cannot be Riemann integrals, as far as I understand, because then it must be $\mathbf{x}\notin V$ and then $\iiint_V\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d^3l=\mathbf{0}$, and they cannot be Lebesgue integrals, because, even with $\mathbf{x}\in V$, then $\iiint_V\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d^3l$ $=\int_{V\setminus\{\mathbf{x}\}}\nabla_l^2\left[\frac{1}{\|\mathbf{x}-\mathbf{l}\|}\right]\mathbf{J}(\mathbf{l})\,d\mu_{\mathbf{l}}$ $=\mathbf{0}$, even if $\mathbf{J}(\mathbf{x})$ is not null.
What else if not Riemann or Lebesgue integrals? Why is the commutation of the integral and differential operators licit and what do the derivatives mean in such a context? If we intend them to represent functionals as in the context of functional analysis (which is the only one that I know of where Dirac's $\delta$ is defined), which function ($\varphi$, to use the notation used here) is the argument of the functional and what does the functional maps it to?
What are the derivatives expressed by $\nabla$? Since theorems such as Stokes' are usually applied when integrating $\nabla\times\mathbf{B}$, I would believe that they are the ordinary derivatives of elementary multivariate calculus, but then the $\delta$, which is a tool of the theory of distributions, pops up in the outline of proof, and in the theory of distributions there exist derivatives of distributions which are a very different thing, but they are taken, as far as I know, with respect to the variables written as "variables of integration" in the distribution integral notation, while we start with $\nabla_r\times \mathbf{B}$ with $r$ , while the integral appears with $d^3l$...
Or is that one of those cases, whose set I have been told not to be empty, where physics methods, at least at the didactic level, are not as rigourous as mathematics would require? I admit that I was rather inclined to think so until a user of PSE told me, without explaining how to interpretate the integrals and justify the steps, that the quoted proof is rigourous. I heartily thank any answerer.