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](http://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 !



Help understand a calculation involving RHom of sheaves on manifolds
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.](http://link.springer.com/book/10.1007%2F978-0-8176-4938-8)


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$.


