We will use the notation $\mathcal{A}_{X/S}$ and $\mathcal{A}_{Y/S}$ introduced in Morphisms, Remark \ref{morphisms-remark-base-change-differential-operators}. Suppose that we have maps of complexes $$ \mathcal{F}_1^\bullet \to \mathcal{F}_2^\bullet \to \mathcal{F}_3^\bullet \to \mathcal{F}_1^\bullet[1] $$ in the category $\mathcal{A}_{X/S}$. Then by the functoriality of the cup product we obtain a commutative diagram $$ \xymatrix{ R\Gamma(X, \mathcal{F}_1^\bullet) \otimes_A^\mathbf{L} R\Gamma(Y, \mathcal{G}^\bullet) \ar[r] \ar[d] & R\Gamma(X \times_S Y, \text{Tot}(\mathcal{F}_1^\bullet \boxtimes \mathcal{G}^\bullet)) \ar[d] \\ R\Gamma(X, \mathcal{F}_2^\bullet) \otimes_A^\mathbf{L} R\Gamma(Y, \mathcal{G}^\bullet) \ar[r] \ar[d] & R\Gamma(X \times_S Y, \text{Tot}(\mathcal{F}_2^\bullet \boxtimes \mathcal{G}^\bullet)) \ar[d] \\ R\Gamma(X, \mathcal{F}_3^\bullet) \otimes_A^\mathbf{L} R\Gamma(Y, \mathcal{G}^\bullet) \ar[r] \ar[d] & R\Gamma(X \times_S Y, \text{Tot}(\mathcal{F}_3^\bullet \boxtimes \mathcal{G}^\bullet)) \ar[d] \\ R\Gamma(X, \mathcal{F}_1^\bullet[1]) \otimes_A^\mathbf{L} R\Gamma(Y, \mathcal{G}^\bullet) \ar[r] & R\Gamma(X \times_S Y, \text{Tot}(\mathcal{F}_1^\bullet[1] \boxtimes \mathcal{G}^\bullet)) } $$ If the original maps form a distinguished triangle in the homotopy category of $\mathcal{A}_{X/S}$, then the columns of this diagram form distinguished triangles in $D(A)$. \medskip\noindent In the situation of the lemma, suppose that $\mathcal{F}^n = 0$ for $n < i$. Then we may consider the termwise split short exact sequence of complexes $$ 0 \to \sigma_{\geq i + 1}\mathcal{F}^\bullet \to \mathcal{F}^\bullet \to \mathcal{F}^i[-i] \to 0 $$ where the truncation is as in Homology, Section \ref{homology-section-truncations}. This produces the distinguished triangle $$ \sigma_{\geq i + 1}\mathcal{F}^\bullet \to \mathcal{F}^\bullet \to \mathcal{F}^i[-i] \to (\sigma_{\geq i + 1}\mathcal{F}^\bullet)[1] $$ in the homotopy category of $\mathcal{A}_{X/S}$ where the final arrow is given by the boundary map $\mathcal{F}^i \to \mathcal{F}^{i + 1}$. It follows from the discussion above that it suffices to prove the lemma for $\mathcal{F}^i[-i]$ and $\sigma_{\geq i + 1}\mathcal{F}^\bullet$. Since $\sigma_{\geq i + 1}\mathcal{F}^\bullet$ has fewer nonzero terms, by induction, if we can prove the lemma if $\mathcal{F}^\bullet$ is nonzero only in single degree, then the lemma follows. Thus we may assume $\mathcal{F}^\bullet$ is nonzero only in one degree. \medskip\noindent Assume $\mathcal{F}^\bullet$ is the complex which has an $S$-flat quasi-coherent $\mathcal{O}_X$-module $\mathcal{F}$ sitting in degree $0$ and is zero in other degrees. Observe that $R\Gamma(X, \mathcal{F})$ has finite tor dimension by Lemma \ref{lemma-cohomology-de-rham-base-change} for example. Say it has tor amplitude in $[i, j]$. Pick $N \gg 0$ and consider the distinguished triangle $$ \sigma_{\geq N + 1}\mathcal{G}^\bullet \to \mathcal{G}^\bullet \to \sigma_{\leq N}\mathcal{G}^\bullet \to (\sigma_{\geq N + 1}\mathcal{G}^\bullet)[1] $$ in the homotopy category of $\mathcal{A}_{Y/S}$. Now observe that both $$ R\Gamma(X, \mathcal{F}) \otimes_A^\mathbf{L} R\Gamma(Y, \sigma_{\geq N + 1}\mathcal{G}^\bullet) \quad\text{and}\quad R\Gamma(X \times_S Y, \text{Tot}(\mathcal{F} \boxtimes \sigma_{\geq N + 1}\mathcal{G}^\bullet)) $$ have vanishing cohomology in degrees $\leq N + i$. Thus, using the arguments given above, if we want to prove our statement in a given degree, then we may assume $\mathcal{G}^\bullet$ is bounded. Repeating the arguments above one more time we may also assume $\mathcal{G}^\bullet$ is nonzero only in one degree. This case is handled by Lemma \ref{lemma-kunneth-single-sheaf}.