In most textbooks of physics I've found this demonstration of work-kinetic energy theorem:
$$\begin{align} W &= \int_{x_{1}}^{x_{2}} F(x)\ dx \tag{1}\\ &= \int_{x_{1}}^{x_{2}} m\cdot a\ dx \tag{2}\\ &= m\int_{x_{1}}^{x_{2}} \frac{dv}{dt}\ dx \tag{3}\\ &= m\int_{x_{1}}^{x_{2}} \frac{dv}{dx} \cdot \frac{dx}{dt}\ dx \tag{4}\\ &= m\int_{x_{1}}^{x_{2}} \frac{dv}{dx} \cdot v \ dx \tag{5}\\ &= m\int_{v_{1}}^{v_{2}} v \ dv \tag{6}\\ &= \frac{1}{2}mv_{2}^{2} - \frac{1}{2}mv_{1}^{2} \tag{7} \end{align}$$
I don't fully understand how they go from (5) to (6). It seems that they cancel the dx as if they were algebraic elements. I know from calculus that $\int f(g(x))\cdot g'(x)\ dx = F(g(x))$, where $f(x)=F'(x)$ because we are applying the chain rule reversed. And in order to do so, Leibniz's notation can help us. If we define $u=g(x)$ and the "differential" $du=g'(x)dx$ the former integral turns in $\int f(u)\ du = F(u)$. But du and dx doesn't exist, they are just a notation we use to realize more easily that we can find the antiderivatives applying the chain rule reversed. So, what are the true mathematical operation they are doing between (5) and (6)?