Computing Ext for a complex of modules, help with a proof in Stacks Project

I am stuck on a step in the proof of Lemma 15.66.2 here. Let $R$ be a commutative ring with identity and let $K^{\bullet}$ be a complex of $R$-modules. I am stuck on the following sentence:

"Choose a nonzero map $R \rightarrow H^{n}(K)$. Since $\hom_{R}(R,−)$ is an exact functor, we see that $Ext^{n}_{R}(R,K)=\hom_{R}(R,H^{n}(K))=H^{n}(K)$."

So first of all, why are they choosing a map $R \rightarrow H^{n}(K)$? They don't seem to use that choice anywhere in the sentence. And is the Hom functor supposed to be in $\text{C}(R)$ of chain complexes on $R$? It is clear that $\hom_{R}(R,H^{n}(K))=H^{n}(K)$, but how exactly does the first equality follow? I'm assuming that's where exactness is used?

• You might have mentioned the hypothesis that $K\in D(R)$. I'm not sure what $D(R)$ is, presumably some sort of derived category, but it will surely have some notion of Ext attached to it, possibly making the first equality evident. – Lord Shark the Unknown Sep 19 '18 at 5:56

Recall that $$\operatorname{Ext}^n_R(R,K)$$ is $$\hom_{D(R)}(R,K[n])$$. In the homotopy category $$K(R)$$, a map $$R\to K[n]$$ corresponds to a map of complexes $$R\to K^n$$ which is simply picking a cycle in $$K^n$$, since $$R$$ has zero differential, modulo null-homotopic maps which are just the boundaries, giving $$H^n(K)$$. Since $$R$$ is projective, this $$\hom$$ is the same as in $$D(R)$$.