I posted the original question on Math SE but it seems like a more appropriate question for Physics SE:
https://math.stackexchange.com/q/4417225/
In calculating the instanton solutions for $SU(2)$ gauge theory on $\mathbb{R}^4$ or its compactification $S^4$, what is the correct domain on which we integrate the Yang-Mills Lagrangian in order to obtain the instanton number? Is it $\mathbb{R}^4$ or $S^4$?
The details are in the above link. This is extremely confusing for me. Could anyone explain?