<s>[INST] Calculating $\int_{-\infty}^{\infty}\left( \frac{\cos{\left (x \right )}}{x^{4} + 1} \right)dx$ via the Residue Theorem? In the text, "Function Theory of One Complex Variable"  by Robert E. Greene and Steven G. Krantz. I'm inquiring if my proof of $(1)$ is valid ?

$\text{Proposition} \, \, \, (1) $
$$\int_{-\infty}^{\infty}\left( \frac{\cos{\left (x \right )}}{x^{4} + 1} \right)dx=\frac{\sqrt{2}}{2 e^{\frac{\sqrt{2}}{2}}} \left(\pi \sin{\left (\frac{\sqrt{2}}{2} \right )} + \pi \cos{\left (\frac{\sqrt{2}}{2} \right )}\right) $$

The first step on our quest to prove $(1)$, is one must consider a Semicircular Contour $\gamma_{R}$, assuming $R > 1$ define
$$\gamma_{R}^{1}(t) =  t + i0 \, \,  \text{if} \, \,  -R \leq t \leq R $$
$$\gamma_{R}^{2}(t) =  Re^{it} \, \, \text{if} \, \, \, \, \, \, 0\leq t \leq \pi.$$
One can call these two curves taken together $\gamma_{R}$ or $\gamma$, after picking our $\gamma_{R}$ one can consider $$\oint_{\gamma _{R}}\frac{e^{iz}}{z^{4}+1}dz.$$
It's trivial that,
$$\oint_{\gamma_{R}}g(z)~ dz =  \oint_{\gamma_{R}^{1}} g(z) dz+ \oint_{\gamma_{R}^{2}}g(z) ~dz.$$
It's imperative that
$$\displaystyle \oint_{\gamma_{R}^{1}} g(z) dz \rightarrow \lim_{R \rightarrow \infty }\int_{-R}^{R} \frac{e^{ix}}{1+x^{4}}  \, \, \text{as}\, \,  R \rightarrow \infty $$
Using the Estimation Lemma one be relived to see
$$\bigg |\oint_{\gamma_{R}^{2}} g(z) dz  \bigg | \leq \big\{\text{length}(\gamma_{R}^{2}) \big\} \cdot \sup_{\gamma_{R}^{2}}|g(z)|\leq \pi \cdot \frac{1}{R^{4} - 1}. $$
Now it's safe to say that
$$\lim_{R \rightarrow \infty}\bigg | \oint_{\gamma_{R}^{2}}\frac{1}{1+z^{4}} dz \bigg| \rightarrow 0. $$
It's easy to note after all our struggle that
$$ \int_{-\infty}^{\infty} \frac{cos(x)}{1+x^{4}} = Re \int_{-\infty}^{\infty} \frac{e^{ix}}{1+x^{4}} = Re\bigg( \frac{\sqrt{2}}{2 e^{\frac{\sqrt{2}}{2}}} \left(\pi \sin{\left (\frac{\sqrt{2}}{2} \right )} + \pi \cos{\left (\frac{\sqrt{2}}{2} \right )}\right)\bigg) =  \frac{\sqrt{2}}{2 e^{\frac{\sqrt{2}}{2}}} \left(\pi \sin{\left (\frac{\sqrt{2}}{2} \right )} + \pi \cos{\left (\frac{\sqrt{2}}{2} \right )}\right) $$
The finial leg of our conquest is to consider that
$$\oint_{\gamma _{R}}\frac{e^{iz}}{z^{4}+1}dz  = 2 \pi i \sum_{j=1,2,3,4} Ind_{\gamma} \cdot \operatorname{Res_{f}(P_{j})}$$
It's easy to calculate that
$$\operatorname{Res_{z = \sqrt[4]{-1}}} \Big(\frac{e^{iz}}{z^{4}+1} \Big) = \frac{1}{4}\sqrt[4]{-1} \, \, -e^{(-1)^{3/4}}$$
$$\operatorname{Res_{z = \sqrt[4]{-1}}} \Big(\frac{e^{iz}}{z^{4}+1} \Big) = \frac{1}{4}\sqrt[4]{-1} \, \, e^{(-1)^{3/4}}$$
$$\operatorname{Res_{z = -(-1)^{3/4}}} \Big(\frac{e^{iz}}{z^{4}+1} \Big) = \frac{1}{4}\sqrt[4]{-1} \, \, e^{\sqrt[4]{-1}}$$
$$\operatorname{Res_{z = (-1)^{3/4}}} \Big(\frac{e^{iz}}{z^{4}+1} \Big) = \frac{1}{4}\sqrt[4]{-1} \, \, e^{\sqrt[4]{-1}}$$
Putting the pieces together we have that
$$\oint_{\gamma _{R}}\frac{e^{iz}}{z^{4}+1}dz = 2 \pi i + \frac{1}{4}\sqrt[4]{-1} \, \, -e^{(-1)^{3/4}} + \frac{1}{4}\sqrt[4]{-1} \, \, e^{(-1)^{3/4}} + \frac{1}{4}\sqrt[4]{-1} \, \, e^{\sqrt[4]{-1}} + \frac{1}{4}\sqrt[4]{-1} \, \, e^{\sqrt[4]{-1}}= \frac{\sqrt{2}}{2 e^{\frac{\sqrt{2}}{2}}} \left(\pi \sin{\left (\frac{\sqrt{2}}{2} \right )} + \pi \cos{\left (\frac{\sqrt{2}}{2} \right )}\right).$$
 [/INST] Most of it is correct, but there's a problem near the end, when you apply the residue theorem. The polynomial $x^4+1$ has four roots: $\exp\left(\frac{\pi i}4\right)$, $\exp\left(\frac{3\pi i}4\right)$, $\exp\left(\frac{5\pi i}4\right)$, and $\exp\left(\frac{7\pi i}4\right)$. But only the first two matter, since they're the only ones which are in the semicircle bounded by the image of $\gamma_R$.
</s>