Why can you deform the contour in the integral expression for the Klein-Gordon propagator to get the Euclidean propagator? I'm trying to understand the use of the Euclidean correlation functions in QFT. I chased down the problems I was having to how they manifest in the simplest example I could think of: the two-point propagator for the Klein-Gordon equation. V. P. Nair (pdf pages 57-58) starts with the Feynman propagator for the Klein Gordon equation,
$$
  G(x,y) = \lim_{\epsilon\to0^+}\int_{-\infty}^\infty dk_0 \int_{\mathbb{R}^3}d^3\textbf{k}\; \frac{i}{k_0^2-\textbf{k}^2-m^2+i\epsilon}e^{-ik_0(x_0-y_0)+i\textbf{k}\cdot(\textbf{x}-\textbf{y})}.\tag{4.13}
$$
He then argues that you can deform the contour such that the $k_0$ integral goes up the imaginary axis, to get
$$
    G(x,y) = \int_{-i\infty}^{i\infty} dk_0 \int_{\mathbb{R}^3}d^3\textbf{k}\; \frac{i}{k_0^2-\textbf{k}^2-m^2}e^{-ik_0(x_0-y_0)+i\textbf{k}\cdot(\textbf{x}-\textbf{y})},\tag{4.17}
$$
at which point you're a change of variables away from getting the relationship we want between the Minkowski and Euclidean propagators. Nair says that "there is no crossing of poles of the integrand in this deformation", and I can see that: you're deforming the contour through the upper right and lower left quadrants of the complex plane, so avoid the poles. My issue is what about the quarter-circular contours at infinity? You have to leave the endpoints fixed when you deform the contour, so to get the $k_0$ integral to go along the imaginary line we must have a contour that joins the ends of the imaginary to the real line which vanishes. But surely this can't be the case in both the upper right and lower left contours, as the integrand has a factor $\propto \exp\left(\text{Im}\{k_0\} x_0\right)$, which depending on the sign of $x_0$ will diverge at either large positive imaginary $k_0$ or large negative imaginary $k_0$?
There is a slightly different way of driving at the same problem. Nair arrives at the relation
$$
  G(x,y) = G_E(x,y)|_{x^4=-ix^0,y^4=-iy^0},\tag{4.18}
$$
where the Euclidean propagator is defined
$$
   G_E(x,y) = \int_{\mathbb{R}^4} d^4k\; \frac{1}{\sum_{j=1}^4(k_j)^2+m^2}e^{i\sum_{j=1}^4k_j(x_j-y_j)}.\tag{4.19}
$$
The issue here is that if you put imaginary values of $x_4-y_4$ into the defining integral then you get an exponential divergence in the $k_4$ integral, so the result is poorly defined.
So what's going on here? Am I missing something obvious or is Nair doing some egregious handwaving? And, if the latter, could you possibly point me in the direction of a treatment of the relationship between the Euclidean and Minkowski correlation functions which isn't quite as mathematically technical as the Osterwalder and Schrader paper? (Which is all I've managed to find referenced elsewhere!) When I've tried to find the relation in more complicated and general cases - for instance by looking at the partition function expressed as a path integral - I think I've stumbled on more or less the same problem, of this divergence of the exponential factor, so I do feel that if I get this derivation of the KG propagator sorted then the rest ought to fall into place.
 A: This is perhaps a bit unclear in the way Nair has written it, but it is essential that you make both the replacements $k_0=ik_4$ and $x^0=ix^4$ simultaneously. This keeps the convergence properties of the original integral intact.
Note that there is an additional sign in Nair's convention because he is changing from time-like quantities to a space-like quantities, which then get a different sign in the vector multiplication $k\cdot x$. Instead you could have done $k_0\to ik_0$ and $x^0\to -ix^0$, leaving them as time-like quantities. If you do it this way it's clear that you are just assigning $k_0$ and $x^0$ equal but opposite phases. Rather than a full $\pi/2$, you could have used any phase $k_0\to e^{i\theta}k_0$ and $x^0\to e^{-i\theta}x^0$ and it's clear that the product $k_0 x^0$ is unchanged.
I don't know if Nair covers this, but this addition of an imaginary part to the time coordinate has physical significance in perturbation theory. It introduces non-unitary evolution because the evolution operator $e^{-i\hat H x^0}$ is no longer unitary if $x^0$ has an imaginary part. This non-unitary evolution lets you automatically project out the interacting vacuum from the free vacuum, thus letting you build up perturbative approximations to quantities in the interacting theory using the ingredients of the free theory. I won't try to write the details in this answer, but these things are covered in Peskin & Schroder Ch.4, specifically pages 86-87 and 95.
A: The way that $G(x,y)$ is prepared to be used for complex numbers $x_0,y_0$ is to use the inverse Laplace transform (instead of inverse Fourier transform)
$$
    G_E(x,y) = \int_{-i\infty}^{i\infty} dk_0 \int_{\mathbb{R}^3}d^3\textbf{k}\; \frac{i}{k_0^2-\textbf{k}^2-m^2}e^{-k_0(x_0-y_0)+i\textbf{k}\cdot(\textbf{x}-\textbf{y})},
$$
where the exponent part contains $-k_0(x_0-y_0)$ as seen in Laplace transform. This way there should be no nasty divergence. In fact, the integral can always be shifted in the inverse Laplace transform $\int_{\tau-i\infty}^{\tau-i\infty}.$ It's probably just like saying let's use the kernel of Klein-Gordon and see what we can find.
It turns out that replacing $k_0\leftarrow -ik_0$ in the above equation produces
$$
    G_E(x,y) = \int_{-\infty}^{\infty} dk_0 \int_{\mathbb{R}^3}d^3\textbf{k}\; \frac{1}{k_0^2+\textbf{k}^2+m^2}e^{ik_0(x_0-y_0)+i\textbf{k}\cdot(\textbf{x}-\textbf{y})},
$$
which is the Euclidean propagator. This is, at least what I feel like, how Wick's rotation should have been done.
A: *

*User kaylimekay's answer is exactly right that the inner product $k_{\mu} x^{\mu}$ must in principle remain invariant under a Wick rotation, cf. e.g. my Phys.SE answers here,  here & here.


*Unfortunately the transformation rule $x^0=ix^4$ in Ref.1 is opposite the standard Wick transformation $x^4=ix^0$, cf. e.g. this Phys.SE post.


*It complicates matters that Ref. 1 uses the $(+,-,-,-)$ Minkowski sign convention, cf. my Phys.SE answer here.
References:

*

*V.P. Nair QFT: A Modern Perspective,  2004; chapter 4, p. 43-46, eqs. (4.13-19).

