In my intro differential equations class we have often used the "equivalence" stated in title. It seems to me that somehow, the intermediate step $$ \frac{dx}{f(x)} = g(y)dy$$ is being used, in which case $dx$ and $dy$ are being used as numbers from a fraction! The equivalence is intuitively clear to me, but I would like to know what the justification for this informal process is. How would one give rigor to this equivalence?
To be clear, I am looking for a formal treatment as well as some motivation as to why we can work with $dx$'s in this manner.