Help understand a calculation involving RHom of sheaves on manifolds I am reading a paper and there is some computation of RHom of sheaves that I don't understand. I hope this is the right place to ask.
It is this paper, example 3.10 , page 25
arxiv.org/pdf/1005.1517v4.pdf
In the first RHom equality there, They claim that:
$R\mathcal{Hom}(k_{\Delta\times\{0\}}, k_{M\times M\times \mathbb R}) \simeq k_{\Delta\times\{0\}}[-n-1]$
Where, for a closed immersion $j: N\to M$ of manifolds we denote by $k_N := j_*j^{-1}k_M$ where $k_M$ is the constant sheaf on $M$, and the diagonal of $M\times M$ is denoted by $\Delta$. 
Why does the result come shifted by the codimension?
How does one begin to compute RHoms of such sheaves in general? will deRahm resolution work?
Thanks !
 A: In my experience finding an explicit resolution is rarely possible. Instead you want to learn how to use the six operations. A good reference is section 8.3 of Chriss and Ginzburg.
First a few general facts. Let $X$ be a variety and let $p: X \to pt$ be the unique map to the point. There are two interesting sheaves on $X$: the constant sheaf $k_X = p^* k_{pt}$ and the dualizing sheaf $\mathbb{D}_X = p^! k_{pt}$. Note that the constant sheaf is preserved under $*$-pullbacks and the dualizing sheaf is preserved by $!$-pullbacks. Furthermore if $X$ is smooth we have $\mathbb{D}_X = k_X[\dim_{\mathbb{R}} X]$.
Now we are ready to solve your problem. Let $i: \Delta M \times \{0\} \to M \times M \times \mathbb{R}$. Note that since $i$ is closed we have $i_! = i_*$. Now we compute 
\begin{align}
\mathcal{RHom}(i_! i^* k_{M \times M \times \mathbb{R}}, k_{M \times M \times \mathbb{R}}) &= \mathcal{RHom}(i^* k_{M \times M \times \mathbb{R}}, i^!\mathbb{D}_{M \times M \times \mathbb{R}}[-2m-1]) \\ 
&= \mathcal{RHom}(k_{\Delta M \times \{0\}}, \mathbb{D}_{\Delta M \times \{0\}}[-2m-1]) \\ 
&= \mathcal{RHom}(k_{\Delta M \times \{0\}}, k_{\Delta M \times \{0\}}[-m-1]) \\
&= k_{\Delta M \times \{0\}}[-m-1]
\end{align}
where $m = \dim_{\mathbb{R}} M$.
