hcju/stacksqa huggingface dataset:
Proof of (1). Let $U$ be an object of $\mathcal{C}$. Choose a covering $\{U_i \to U\}$ and maps $\alpha_i : \mathcal{K}_i^\bullet \to K|_{U_i}$ in $D(\mathcal{O}_{U_i})$ with $\mathcal{K}_i^\bullet$ strictly perfect and $H^j(\alpha_i)$ isomorphisms for $j > m + 1$ and surjective for $j = m + 1$. We may replace $\mathcal{K}_i^\bullet$ by $\sigma_{\geq m + 1}\mathcal{K}_i^\bullet$ and hence we may assume that $\mathcal{K}_i^j = 0$ for $j < m + 1$. After refining the covering we may choose maps $\beta_i : \mathcal{L}_i^\bullet \to L|_{U_i}$ in $D(\mathcal{O}_{U_i})$ with $\mathcal{L}_i^\bullet$ strictly perfect such that $H^j(\beta)$ is an isomorphism for $j > m$ and surjective for $j = m$. By Lemma \ref{lemma-lift-through-quasi-isomorphism} we can, after refining the covering, find maps of complexes $\gamma_i : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$ such that the diagrams $$ \xymatrix{ K|_{U_i} \ar[r] & L|_{U_i} \\ \mathcal{K}_i^\bullet \ar[u]^{\alpha_i} \ar[r]^{\gamma_i} & \mathcal{L}_i^\bullet \ar[u]_{\beta_i} } $$ are commutative in $D(\mathcal{O}_{U_i})$ (this requires representing the maps $\alpha_i$, $\beta_i$ and $K|_{U_i} \to L|_{U_i}$ by actual maps of complexes; some details omitted). The cone $C(\gamma_i)^\bullet$ is strictly perfect (Lemma \ref{lemma-cone}). The commutativity of the diagram implies that there exists a morphism of distinguished triangles $$ (\mathcal{K}_i^\bullet, \mathcal{L}_i^\bullet, C(\gamma_i)^\bullet) \longrightarrow (K|_{U_i}, L|_{U_i}, M|_{U_i}). $$ It follows from the induced map on long exact cohomology sequences and Homology, Lemmas \ref{homology-lemma-four-lemma} and \ref{homology-lemma-five-lemma} that $C(\gamma_i)^\bullet \to M|_{U_i}$ induces an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$. Hence $M$ is $m$-pseudo-coherent by Lemma \ref{lemma-pseudo-coherent-independent-representative}. \medskip\noindent Assertions (2) and (3) follow from (1) by rotating the distinguished triangle.
Assume that $K \oplus L$ is $m$-pseudo-coherent. Let $U$ be an object of $\mathcal{C}$. After replacing $U$ by the members of a covering we may assume $K \oplus L \in D^-(\mathcal{O}_U)$, hence $L \in D^-(\mathcal{O}_U)$. Note that there is a distinguished triangle $$ (K \oplus L, K \oplus L, L \oplus L[1]) = (K, K, 0) \oplus (L, L, L \oplus L[1]) $$ see Derived Categories, Lemma \ref{derived-lemma-direct-sum-triangles}. By Lemma \ref{lemma-cone-pseudo-coherent} we see that $L \oplus L[1]$ is $m$-pseudo-coherent. Hence also $L[1] \oplus L[2]$ is $m$-pseudo-coherent. By induction $L[n] \oplus L[n + 1]$ is $m$-pseudo-coherent. Since $L$ is bounded above we see that $L[n]$ is $m$-pseudo-coherent for large $n$. Hence working backwards, using the distinguished triangles $$ (L[n], L[n] \oplus L[n - 1], L[n - 1]) $$ we conclude that $L[n - 1], L[n - 2], \ldots, L$ are $m$-pseudo-coherent as desired.
Proof of (1). Let $U$ be an object of $\mathcal{C}$. We have to show that $H^m(K)$ is can be generated by finitely many sections over the members of a covering of $U$ (see Modules on Sites, Definition \ref{sites-modules-definition-site-local}). Thus during the proof we may (finitely often) choose a covering $\{U_i \to U\}$ and replace $\mathcal{C}$ by $\mathcal{C}/U_i$ and $U$ by $U_i$. In particular, by our definitions we may assume there exists a strictly perfect complex $\mathcal{E}^\bullet$ and a map $\alpha : \mathcal{E}^\bullet \to K$ which induces an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$. It suffices to prove the result for $\mathcal{E}^\bullet$. Let $n$ be the largest integer such that $\mathcal{E}^n \not = 0$. If $n = m$, then $H^m(\mathcal{E}^\bullet)$ is a quotient of $\mathcal{E}^n$ and the result is clear. If $n > m$, then $\mathcal{E}^{n - 1} \to \mathcal{E}^n$ is surjective as $H^n(E^\bullet) = 0$. By Lemma \ref{lemma-local-lift-map} we can (after replacing $U$ by the members of a covering) find a section of this surjection and write $\mathcal{E}^{n - 1} = \mathcal{E}' \oplus \mathcal{E}^n$. Hence it suffices to prove the result for the complex $(\mathcal{E}')^\bullet$ which is the same as $\mathcal{E}^\bullet$ except has $\mathcal{E}'$ in degree $n - 1$ and $0$ in degree $n$. We win by induction on $n$. \medskip\noindent Proof of (2). Pick an object $U$ of $\mathcal{C}$. As in the proof of (1) we may work locally on $U$. Hence we may assume there exists a strictly perfect complex $\mathcal{E}^\bullet$ and a map $\alpha : \mathcal{E}^\bullet \to K$ which induces an isomorphism on cohomology in degrees $> m$ and a surjection in degree $m$. As in the proof of (1) we can reduce to the case that $\mathcal{E}^i = 0$ for $i > m + 1$. Then we see that $H^{m + 1}(K) \cong H^{m + 1}(\mathcal{E}^\bullet) = \Coker(\mathcal{E}^m \to \mathcal{E}^{m + 1})$ which is of finite presentation.
As $\mathcal{E}^\bullet$ is a bounded above complex of flat modules we see that $\mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F} = \mathcal{E}^\bullet \otimes_\mathcal{O}^{\mathbf{L}} \mathcal{F}$ for any $\mathcal{O}$-module $\mathcal{F}$. Hence for every $\mathcal{O}$-module $\mathcal{F}$ the sequence $$ \mathcal{E}^{a - 2} \otimes_\mathcal{O} \mathcal{F} \to \mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F} \to \mathcal{E}^a \otimes_\mathcal{O} \mathcal{F} $$ is exact in the middle. Since $\mathcal{E}^{a - 2} \to \mathcal{E}^{a - 1} \to \mathcal{E}^a \to \Coker(d^{a - 1}) \to 0$ is a flat resolution this implies that $\text{Tor}_1^\mathcal{O}(\Coker(d^{a - 1}), \mathcal{F}) = 0$ for all $\mathcal{O}$-modules $\mathcal{F}$. This means that $\Coker(d^{a - 1})$ is flat, see Lemma \ref{lemma-flat-tor-zero}.
If (2) holds, then we may compute $E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F} = \mathcal{E}^\bullet \otimes_\mathcal{O} \mathcal{F}$ and it is clear that (1) holds. \medskip\noindent Assume that (1) holds. We may represent $E$ by a bounded above complex of flat $\mathcal{O}$-modules $\mathcal{K}^\bullet$, see Section \ref{section-flat}. Let $n$ be the largest integer such that $\mathcal{K}^n \not = 0$. If $n > b$, then $\mathcal{K}^{n - 1} \to \mathcal{K}^n$ is surjective as $H^n(\mathcal{K}^\bullet) = 0$. As $\mathcal{K}^n$ is flat we see that $\Ker(\mathcal{K}^{n - 1} \to \mathcal{K}^n)$ is flat (Modules on Sites, Lemma \ref{sites-modules-lemma-flat-ses}). Hence we may replace $\mathcal{K}^\bullet$ by $\tau_{\leq n - 1}\mathcal{K}^\bullet$. Thus, by induction on $n$, we reduce to the case that $K^\bullet$ is a complex of flat $\mathcal{O}$-modules with $\mathcal{K}^i = 0$ for $i > b$. \medskip\noindent Set $\mathcal{E}^\bullet = \tau_{\geq a}\mathcal{K}^\bullet$. Everything is clear except that $\mathcal{E}^a$ is flat which follows immediately from Lemma \ref{lemma-last-one-flat} and the definitions.
The implication (2) $\Rightarrow$ (1) is immediate. Assume (1) holds. First we choose a K-flat complex $\mathcal{K}^\bullet$ with flat terms representing $E$, see Lemma \ref{lemma-K-flat-resolution}. For any $\mathcal{O}$-module $\mathcal{M}$ the cohomology of $$ \mathcal{K}^{n - 1} \otimes_\mathcal{O} \mathcal{M} \to \mathcal{K}^n \otimes_\mathcal{O} \mathcal{M} \to \mathcal{K}^{n + 1} \otimes_\mathcal{O} \mathcal{M} $$ computes $H^n(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{M})$. This is always zero for $n < a$. Hence if we apply Lemma \ref{lemma-last-one-flat} to the complex $\ldots \to \mathcal{K}^{a - 1} \to \mathcal{K}^a \to \mathcal{K}^{a + 1}$ we conclude that $\mathcal{N} = \Coker(\mathcal{K}^{a - 1} \to \mathcal{K}^a)$ is a flat $\mathcal{O}$-module. We set $$ \mathcal{E}^\bullet = \tau_{\geq a}\mathcal{K}^\bullet = (\ldots \to 0 \to \mathcal{N} \to \mathcal{K}^{a + 1} \to \ldots ) $$ The kernel $\mathcal{L}^\bullet$ of $\mathcal{K}^\bullet \to \mathcal{E}^\bullet$ is the complex $$ \mathcal{L}^\bullet = (\ldots \to \mathcal{K}^{a - 1} \to \mathcal{I} \to 0 \to \ldots) $$ where $\mathcal{I} \subset \mathcal{K}^a$ is the image of $\mathcal{K}^{a - 1} \to \mathcal{K}^a$. Since we have the short exact sequence $0 \to \mathcal{I} \to \mathcal{K}^a \to \mathcal{N} \to 0$ we see that $\mathcal{I}$ is a flat $\mathcal{O}$-module. Thus $\mathcal{L}^\bullet$ is a bounded above complex of flat modules, hence K-flat by Lemma \ref{lemma-bounded-flat-K-flat}. It follows that $\mathcal{E}^\bullet$ is K-flat by Lemma \ref{lemma-K-flat-two-out-of-three-ses}. \medskip\noindent Proof of the final assertion. Let $f : (\mathcal{C}', \mathcal{O}') \to (\mathcal{C}, \mathcal{O})$ be a morphism of ringed sites. By Lemma \ref{lemma-pullback-K-flat} the complex $f^*\mathcal{K}^\bullet$ is K-flat with flat terms. The complex $f^*\mathcal{L}^\bullet$ is K-flat as it is a bounded above complex of flat $\mathcal{O}'$-modules. We have a short exact sequence of complexes of $\mathcal{O}'$-modules $$ 0 \to f^*\mathcal{L}^\bullet \to f^*\mathcal{K}^\bullet \to f^*\mathcal{E}^\bullet \to 0 $$ because the short exact sequence $0 \to \mathcal{I} \to \mathcal{K}^a \to \mathcal{N} \to 0$ of flat modules pulls back to a short exact sequence. By Lemma \ref{lemma-K-flat-two-out-of-three-ses}. the complex $f^*\mathcal{E}^\bullet$ is K-flat and the proof is complete.
Assume $E$ has tor amplitude in $[a, b]$. By Lemma \ref{lemma-tor-amplitude} we can represent $E$ by a complex of $\mathcal{E}^\bullet$ of flat $\mathcal{O}$-modules with $\mathcal{E}^i = 0$ for $i \not \in [a, b]$. Then $Lf^*E$ is represented by $f^*\mathcal{E}^\bullet$. By Modules on Sites, Lemma \ref{sites-modules-lemma-pullback-flat} the module $f^*\mathcal{E}^i$ are flat. Thus by Lemma \ref{lemma-tor-amplitude} we conclude that $Lf^*E$ has tor amplitude in $[a, b]$.
Proof of (1). This follows because taking stalks at $p$ is the same as pulling back by the morphism of ringed sites $(p, \mathcal{O}_p) \to (\mathcal{C}, \mathcal{O})$ and hence we can apply Lemma \ref{lemma-tor-amplitude-pullback}. \medskip\noindent Proof of (2). If $\mathcal{C}$ has enough points, then we can check vanishing of $H^i(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F})$ at stalks, see Modules on Sites, Lemma \ref{sites-modules-lemma-check-exactness-stalks}. Since $H^i(E \otimes_\mathcal{O}^\mathbf{L} \mathcal{F})_p = H^i(E_p \otimes_{\mathcal{O}_p}^\mathbf{L} \mathcal{F}_p)$ we conclude.
Let $U$ be an object of $\mathcal{C}$. After replacing $U$ by the members of a covering and $\mathcal{C}$ by the localization $\mathcal{C}/U$ we may assume there exists a strictly perfect complex $\mathcal{E}^\bullet$ and a map $\alpha : \mathcal{E}^\bullet \to E$ such that $H^i(\alpha)$ is an isomorphism for $i \geq a$. We may and do replace $\mathcal{E}^\bullet$ by $\sigma_{\geq a - 1}\mathcal{E}^\bullet$. Choose a distinguished triangle $$ \mathcal{E}^\bullet \to E \to C \to \mathcal{E}^\bullet[1] $$ From the vanishing of cohomology sheaves of $E$ and $\mathcal{E}^\bullet$ and the assumption on $\alpha$ we obtain $C \cong \mathcal{K}[a - 2]$ with $\mathcal{K} = \Ker(\mathcal{E}^{a - 1} \to \mathcal{E}^a)$. Let $\mathcal{F}$ be an $\mathcal{O}$-module. Applying $- \otimes_\mathcal{O}^\mathbf{L} \mathcal{F}$ the assumption that $E$ has tor amplitude in $[a, b]$ implies $\mathcal{K} \otimes_\mathcal{O} \mathcal{F} \to \mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F}$ has image $\Ker(\mathcal{E}^{a - 1} \otimes_\mathcal{O} \mathcal{F} \to \mathcal{E}^a \otimes_\mathcal{O} \mathcal{F})$. It follows that $\text{Tor}_1^\mathcal{O}(\mathcal{E}', \mathcal{F}) = 0$ where $\mathcal{E}' = \Coker(\mathcal{E}^{a - 1} \to \mathcal{E}^a)$. Hence $\mathcal{E}'$ is flat (Lemma \ref{lemma-flat-tor-zero}). Thus there exists a covering $\{U_i \to U\}$ such that $\mathcal{E}'|_{U_i}$ is a direct summand of a finite free module by Modules on Sites, Lemma \ref{sites-modules-lemma-flat-locally-finite-presentation}. Thus the complex $$ \mathcal{E}'|_{U_i} \to \mathcal{E}^{a - 1}|_{U_i} \to \ldots \to \mathcal{E}^b|_{U_i} $$ is quasi-isomorphic to $E|_{U_i}$ and $E$ is perfect.
Assume (1). Let $U$ be an object of $\mathcal{C}$. By definition there exists a covering $\{U_i \to U\}$ such that $E|_{U_i}$ is represented by a strictly perfect complex. Thus $E$ is pseudo-coherent (i.e., $m$-pseudo-coherent for all $m$) by Lemma \ref{lemma-pseudo-coherent-independent-representative}. Moreover, a direct summand of a finite free module is flat, hence $E|_{U_i}$ has finite Tor dimension by Lemma \ref{lemma-tor-amplitude}. Thus (2) holds. \medskip\noindent Assume (2). Let $U$ be an object of $\mathcal{C}$. After replacing $U$ by the members of a covering we may assume there exist integers $a \leq b$ such that $E|_U$ has tor amplitude in $[a, b]$. Since $E|_U$ is $m$-pseudo-coherent for all $m$ we conclude using Lemma \ref{lemma-perfect-precise}.
First proof: Combine Lemmas \ref{lemma-perfect}, \ref{lemma-cone-pseudo-coherent}, and \ref{lemma-cone-tor-amplitude}. Second proof (sketch): Say $K$ and $L$ are perfect. Let $U$ be an object of $\mathcal{C}$. After replacing $U$ by the members of a covering we may assume that $K|_U$ and $L|_U$ are represented by strictly perfect complexes $\mathcal{K}^\bullet$ and $\mathcal{L}^\bullet$. After replacing $U$ by the members of a covering we may assume the map $K|_U \to L|_U$ is given by a map of complexes $\alpha : \mathcal{K}^\bullet \to \mathcal{L}^\bullet$, see Lemma \ref{lemma-local-actual}. Then $M|_U$ is isomorphic to the cone of $\alpha$ which is strictly perfect by Lemma \ref{lemma-cone}.
Omitted. Hints: as unit $\mathbf{1}$ we take the complex having $\mathcal{O}$ in degree $0$ and zero in other degrees with obvious isomorphisms $\text{Tot}(\mathbf{1} \otimes_\mathcal{O} \mathcal{G}^\bullet) = \mathcal{G}^\bullet$ and $\text{Tot}(\mathcal{F}^\bullet \otimes_\mathcal{O} \mathbf{1}) = \mathcal{F}^\bullet$. to prove the lemma you have to check the commutativity of various diagrams, see Categories, Definitions \ref{categories-definition-monoidal-category} and \ref{categories-definition-symmetric-monoidal-category}. The verifications are straightforward in each case.
By uniqueness of left duals (Categories, Remark \ref{categories-remark-left-dual-adjoint}) we get the final statement provided we show that $\mathcal{F}^\bullet$ is as stated. Let $\mathcal{G}^\bullet, \eta, \epsilon$ be a left dual. Write $\eta = \sum \eta_n$ and $\epsilon = \sum \epsilon_n$ where $\eta_n : \mathcal{O} \to \mathcal{F}^n \otimes_\mathcal{O} \mathcal{G}^{-n}$ and $\epsilon_n : \mathcal{G}^{-n} \otimes_\mathcal{O} \mathcal{F}^n \to \mathcal{O}$. Since $(1 \otimes \epsilon) \circ (\eta \otimes 1) = \text{id}_{\mathcal{F}^\bullet}$ and $(\epsilon \otimes 1) \circ (1 \otimes \eta) = \text{id}_{\mathcal{G}^\bullet}$ by Categories, Definition \ref{categories-definition-dual} we see immediately that we have $(1 \otimes \epsilon_n) \circ (\eta_n \otimes 1) = \text{id}_{\mathcal{F}^n}$ and $(\epsilon_n \otimes 1) \circ (1 \otimes \eta_n) = \text{id}_{\mathcal{G}^{-n}}$. In other words, we see that $\mathcal{G}^{-n}$ is a left dual of $\mathcal{F}^n$ and we see that Modules on Sites, Lemma \ref{sites-modules-lemma-left-dual-module} applies to each $\mathcal{F}^n$. Let $U$ be an object of $\mathcal{C}$. There exists a covering $\{U_i \to U\}$ such that for every $i$ only a finite number of $\eta_n|_{U_i}$ are nonzero. Thus after replacing $U$ by $U_i$ we may assume only a finite number of $\eta_n|_U$ are nonzero and by the lemma cited this implies only a finite number of $\mathcal{F}^n|_U$ are  nonzero. Using the lemma again we can then find a covering $\{U_i \to U\}$ such that each $\mathcal{F}^n|_{U_i}$ is a direct summand of a finite free $\mathcal{O}$-module and the proof is complete.
We will us without further mention that formation of internal hom commutes with restriction (Lemma \ref{lemma-restriction-RHom-to-U}). Let $U$ be an arbitrary object of $\mathcal{C}$. To check that $K^\vee$ is perfect, it suffices to show that there exists a covering $\{U_i \to U\}$ such that $K^\vee|_{U_i}$ is perfect for all $i$. There is a canonical map $$ K = R\SheafHom(\mathcal{O}_X, \mathcal{O}_X) \otimes_{\mathcal{O}_X}^\mathbf{L} K \longrightarrow R\SheafHom(R\SheafHom(K, \mathcal{O}_X), \mathcal{O}_X) = (K^\vee)^\vee $$ see Lemma \ref{lemma-internal-hom-evaluate}. It suffices to prove there is a covering $\{U_i \to U\}$ such that the restriction of this map to $\mathcal{C}/U_i$ is an isomorphism for all $i$. By Lemma \ref{lemma-dual} to see the final statement it suffices to check that the map (\ref{equation-eval}) $$ M \otimes^\mathbf{L}_\mathcal{O} K^\vee \longrightarrow R\SheafHom(K, M) $$ is an isomorphism. This is a local question as well (in the sense above). Hence it suffices to prove the lemma when $K$ is represented by a strictly perfect complex. \medskip\noindent Assume $K$ is represented by the strictly perfect complex $\mathcal{E}^\bullet$. Then it follows from Lemma \ref{lemma-Rhom-strictly-perfect} that $K^\vee$ is represented by the complex whose terms are $(\mathcal{E}^n)^\vee = \SheafHom_\mathcal{O}(\mathcal{E}^n, \mathcal{O})$ in degree $-n$. Since $\mathcal{E}^n$ is a direct summand of a finite free $\mathcal{O}$-module, so is $(\mathcal{E}^n)^\vee$. Hence $K^\vee$ is represented by a strictly perfect complex too  and we see that $K^\vee$ is perfect. The map $K \to (K^\vee)^\vee$ is an isomorphism as it is given up to sign by the evaluation maps $\mathcal{E}^n \to ((\mathcal{E}^n)^\vee)^\vee$ which are isomorphisms. To see that (\ref{equation-eval}) is an isomorphism, represent $M$ by a K-flat complex $\mathcal{F}^\bullet$. By Lemma \ref{lemma-Rhom-strictly-perfect} the complex $R\SheafHom(K, M)$ is represented by the complex with terms $$ \bigoplus\nolimits_{n = p + q} \SheafHom_\mathcal{O}(\mathcal{E}^{-q}, \mathcal{F}^p) $$ On the other hand, the object $M \otimes^\mathbf{L}_\mathcal{O} K^\vee$ is represented by the complex with terms $$ \bigoplus\nolimits_{n = p + q} \mathcal{F}^p \otimes_\mathcal{O} (\mathcal{E}^{-q})^\vee $$ Thus the assertion that (\ref{equation-eval}) is an isomorphism reduces to the assertion that the canonical map $$ \mathcal{F} \otimes_\mathcal{O} \SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{O}) \longrightarrow \SheafHom_\mathcal{O}(\mathcal{E}, \mathcal{F}) $$ is an isomorphism when $\mathcal{E}$ is a direct summand of a finite free $\mathcal{O}$-module and $\mathcal{F}$ is any $\mathcal{O}$-module. This follows immediately from the corresponding statement when $\mathcal{E}$ is finite free.
By Lemma \ref{lemma-dual-perfect-complex} we have $R\lim E \otimes^\mathbf{L}_\mathcal{O} K_n^\vee = R\lim R\SheafHom(K_n, E)$ which fits into the distinguished triangle $$ R\lim R\SheafHom(K_n, E) \to \prod R\SheafHom(K_n, E) \to \prod R\SheafHom(K_n, E) $$ Because $K$ similarly fits into the distinguished triangle $\bigoplus K_n \to \bigoplus K_n \to K$ it suffices to show that $\prod R\SheafHom(K_n, E) = R\SheafHom(\bigoplus K_n, E)$. This is a formal consequence of (\ref{equation-internal-hom}) and the fact that derived tensor product commutes with direct sums.
The first statement follows immediately from the definition (see also Homology, Section \ref{homology-section-functors}). The higher derived functors vanish by Derived Categories, Lemma \ref{derived-lemma-right-derived-exact-functor}. Let $\mathcal{F}$ be a $\mathcal{G}$-torsor. Then $\mathcal{F} \to *$ is a surjective map of sheaves. Hence (3) follows from the definition as well.
Apply Lemma \ref{lemma-compact-in-terms-of-generators} where $S \subset \Ob(\textit{Mod}(\mathcal{O}))$ is the set of modules of the form $j_!\mathcal{O}_U$ with $U \in \Ob(\mathcal{C})$ quasi-compact. Assumption (1) holds by Modules on Sites, Lemma \ref{sites-modules-lemma-module-quotient-flat} and the assumption that every $U$ can be covered by quasi-compact objects. Assumption (2) follows as $$ \Hom_\mathcal{O}(j_!\mathcal{O}_U, \mathcal{F}) = \mathcal{F}(U) $$ which commutes with direct sums by Sites, Lemma \ref{sites-lemma-directed-colimits-sections}.
Since $\Hom(j_{U!}\mathcal{O}_U, -)$ is the same as the functor $\mathcal{F} \mapsto \mathcal{F}(U)$ by Modules on Sites, Equation (\ref{sites-modules-equation-map-lower-shriek-OU-into-module}) it suffices to prove that $H^p(U, M) = \bigoplus H^p(U, M_i)$. Let $\mathcal{I}_i$, $i \in I$ be a collection of injective $\mathcal{O}$-modules. By assumption we have $$ H^p(U, \bigoplus\nolimits_{i \in I} \mathcal{I}_i) = \bigoplus\nolimits_{i \in I} H^p(U, \mathcal{I}_i) = 0 $$ for all $p$. Since $M = \bigoplus M_i$ is bounded below, we see that there exists an $a \in \mathbf{Z}$ such that $H^n(M_i) = 0$ for $n < a$. Thus we can choose complexes of injective $\mathcal{O}$-modues $\mathcal{I}_i^\bullet$ representing $M_i$ with $\mathcal{I}_i^n = 0$ for $n < a$, see Derived Categories, Lemma \ref{derived-lemma-injective-resolutions-exist}. By Injectives, Lemma \ref{injectives-lemma-derived-products} we see that the direct sum complex $\bigoplus \mathcal{I}_i^\bullet$ represents $M$. By Leray acyclicity (Derived Categories, Lemma \ref{derived-lemma-leray-acyclicity}) we see that $$ R\Gamma(U, M) = \Gamma(U, \bigoplus \mathcal{I}_i^\bullet) = \bigoplus \Gamma(U, \bigoplus \mathcal{I}_i^\bullet) = \bigoplus R\Gamma(U, M_i) $$ as desired.
Assume (1) and (2). Recall that $\Hom(j_!\mathcal{O}_U, K) = R\Gamma(U, K)$ for $K$ in $D(\mathcal{O})$. Thus we have to show that $R\Gamma(U, -)$ commutes with direct sums. The first assumption means that the functor $F = H^0(U, -)$ has finite cohomological dimension. Moreover, the second assumption implies any direct sum of injective modules is acyclic for $F$. Let $K_i$ be a family of objects of $D(\mathcal{O})$. Choose K-injective representatives $I_i^\bullet$ with injective terms representing $K_i$, see Injectives, Theorem \ref{injectives-theorem-K-injective-embedding-grothendieck}. Since we may compute $RF$ by applying $F$ to any complex of acyclics (Derived Categories, Lemma \ref{derived-lemma-unbounded-right-derived}) and since $\bigoplus K_i$ is represented by $\bigoplus I_i^\bullet$ (Injectives, Lemma \ref{injectives-lemma-derived-products}) we conclude that $R\Gamma(U, \bigoplus K_i)$ is represented by $\bigoplus H^0(U, I_i^\bullet)$. Hence $R\Gamma(U, -)$ commutes with direct sums as desired.
Let $K^\vee$ be the dual of $K$, see Lemma \ref{lemma-dual-perfect-complex}. Then we have $$ \Hom_{D(\mathcal{O})}(K, M) = H^0(X, K^\vee \otimes_\mathcal{O}^\mathbf{L} M) $$ functorially in $M$ in $D(\mathcal{O})$. Since $K^\vee \otimes_\mathcal{O}^\mathbf{L} -$ commutes with direct sums it suffices to show that $R\Gamma(X, -)$ commutes with the relevant direct sums. \medskip\noindent Proof of (a). After reformulation as above this is a special case of Lemma \ref{lemma-when-jshriek-lower-compact-worked-out} with $U = X$. \medskip\noindent Proof of (b). Since $R\Gamma(X, K) = R\Hom(\mathcal{O}, K)$ and since $H^p(X, -)$ commutes with direct sums by Lemma \ref{lemma-colim-works-over-collection} this is a special case of Lemma \ref{lemma-when-jshriek-compact}.