Although this question is going to seem completely trivial to anyone with any exposure to path integrals, I'm looking to answer this precisely and haven't been able to find any materials after looking for about 40 minutes, which leads me to believe that it makes sense to ask the question here. In particular I'm looking for an answer wherin any mathematical claims are phrased as precisely as possible, with detailed proofs either provided or referenced. Also my search for a solution has led me to think I'm actually looking for a good explenation of Wick rotation, which I can't really claim to understand in detail. Any good references about this would be very welcome as well.
I'm looking to make sense of the following integral identity:
$$\int_{-\infty}^{\infty} dx \ \exp\left(i\frac{a}{2}x^2+iJx\right)=\left(\frac{2\pi i}{a}\right)^{1/2}\exp\left(\frac{-iJ^2}{2a}\right), \qquad a,J\in\mathbb{R}$$
Wikipedia (and various other sources) say that "This result is valid as an integration in the complex plane as long as a has a positive imaginary part." Clearly the left hand side does not exist in Lebesgue sense for real $a, J$. An answer to the question "Wick rotation in field theory - rigorous justification?" claims:
"it is convergent as a Riemann integral, thanks to some rather delicate cancellations. To make the integral well defined -- equivalently to see how these cancellations occur -- we need to supply some additional information. Wick rotation provides a way of doing this. You observe that the left hand side is analytic in t , and that the right hand side is well-defined if Im(t)<0. Then you can define the integral for real t by saying that it's analytic continued from complex t with negative imaginary part."
I want to see the gory details and all known motivation for the validity of this procedure for the kinds of applications where such integrals occur. Suggestions such as "include an $i\epsilon$ in order to make it finite" seem arbitrary. In that case one would have to motivate that prescription from the very start, that is within the modeling procedure that ends up giving that integral expression (which is likely the correct way to approach this). I'm also not sure how to interpret the right hand side, since it involves the square root of an imaginary number, which should involve some choice of branch cut, which I have never seen specified in connection to this formula.