**Proof.**
We strongly suggest the reader skip the proof of this lemma and instead work it out on a napkin.

The first remark is that using rotation of distinguished triangles (TR2) gives an equivalence of categories between $\mathcal{I}$ and the corresponding category for the distinguished triangle $(Y, Z, X[1], g, h, -f[1])$. Using this we see for example that if we prove the functor $\mathcal{I} \to X/S$ is cofinal, then the same thing is true for the functors $\mathcal{I} \to Y/S$ and $\mathcal{I} \to Z/S$.

Note that if $s : X \to X'$ is a morphism of $S$, then using MS2 we can find $s' : Y \to Y'$ and $f' : X' \to Y'$ such that $f' \circ s = s' \circ f$, whereupon we can use MS6 to complete this into an object of $\mathcal{I}$. Hence the functor $\mathcal{I} \to X/S$ is surjective on objects. Using rotation as above this implies the same thing is true for the functors $\mathcal{I} \to Y/S$ and $\mathcal{I} \to Z/S$.

Suppose given objects $s_1 : X \to X_1 $ and $s_2 : X \to X_2$ in $X/S$ and a morphism $a : X_1 \to X_2$ in $X/S$. Since $S$ is saturated, we see that $a \in S$, see Categories, Lemma 4.27.21. By the argument of the previous paragraph we can complete $s_1 : X \to X_1$ to an object $(s_1, s'_1, s''_1) : (X, Y, Z, f, g, h) \to (X_1, Y_1, Z_1, f_1, g_1, h_1)$ in $\mathcal{I}$. Then we can repeat and find $(a, b, c) : (X_1, Y_1, Z_1, f_1, g_1, h_1) \to (X_2, Y_2, Z_2, f_2, g_2, h_2)$ with $a, b, c \in S$ completing the given $a : X_1 \to X_2$. But then $(a, b, c)$ is a morphism in $\mathcal{I}$. In this way we conclude that the functor $\mathcal{I} \to X/S$ is also surjective on arrows. Using rotation as above, this implies the same thing is true for the functors $\mathcal{I} \to Y/S$ and $\mathcal{I} \to Z/S$.

The category $\mathcal{I}$ is nonempty as the identity provides an object. This proves the condition (1) of the definition of a filtered category, see Categories, Definition 4.19.1.

We check condition (2) of Categories, Definition 4.19.1 for the category $\mathcal{I}$. Suppose given objects $(s_1, s'_1, s''_1) : (X, Y, Z, f, g, h) \to (X_1, Y_1, Z_1, f_1, g_1, h_1)$ and $(s_2, s'_2, s''_2) : (X, Y, Z, f, g, h) \to (X_2, Y_2, Z_2, f_2, g_2, h_2)$ in $\mathcal{I}$. We want to find an object of $\mathcal{I}$ which is the target of an arrow from both $(X_1, Y_1, Z_1, f_1, g_1, h_1)$ and $(X_2, Y_2, Z_2, f_2, g_2, h_2)$. By Categories, Remark 4.27.7 the categories $X/S$, $Y/S$, $Z/S$ are filtered. Thus we can find $X \to X_3$ in $X/S$ and morphisms $s : X_2 \to X_3$ and $a : X_1 \to X_3$. By the above we can find a morphism $(s, s', s'') : (X_2, Y_2, Z_2, f_2, g_2, h_2) \to (X_3, Y_3, Z_3, f_3, g_3, h_3)$ with $s', s'' \in S$. After replacing $(X_2, Y_2, Z_2)$ by $(X_3, Y_3, Z_3)$ we may assume that there exists a morphism $a : X_1 \to X_2$ in $X/S$. Repeating the argument for $Y$ and $Z$ (by rotating as above) we may assume there is a morphism $a : X_1 \to X_2$ in $X/S$, $b : Y_1 \to Y_2$ in $Y/S$, and $c : Z_1 \to Z_2$ in $Z/S$. However, these morphisms do not necessarily give rise to a morphism of distinguished triangles. On the other hand, the necessary diagrams do commute in $S^{-1}\mathcal{D}$. Hence we see (for example) that there exists a morphism $s'_2 : Y_2 \to Y_3$ in $S$ such that $s'_2 \circ f_2 \circ a = s'_2 \circ b \circ f_1$. Another replacement of $(X_2, Y_2, Z_2)$ as above then gets us to the situation where $f_2 \circ a = b \circ f_1$. Rotating and applying the same argument two more times we see that we may assume $(a, b, c)$ is a morphism of triangles. This proves condition (2).

Next we check condition (3) of Categories, Definition 4.19.1. Suppose $(s_1, s_1', s_1'') : (X, Y, Z) \to (X_1, Y_1, Z_1)$ and $(s_2, s_2', s_2'') : (X, Y, Z) \to (X_2, Y_2, Z_2)$ are objects of $\mathcal{I}$, and suppose $(a, b, c), (a', b', c')$ are two morphisms between them. Since $a \circ s_1 = a' \circ s_1$ there exists a morphism $s_3 : X_2 \to X_3$ such that $s_3 \circ a = s_3 \circ a'$. Using the surjectivity statement we can complete this to a morphism of triangles $(s_3, s_3', s_3'') : (X_2, Y_2, Z_2) \to (X_3, Y_3, Z_3)$ with $s_3, s_3', s_3'' \in S$. Thus $(s_3 \circ s_2, s_3' \circ s_2', s_3'' \circ s_2'') : (X, Y, Z) \to (X_3, Y_3, Z_3)$ is also an object of $\mathcal{I}$ and after composing the maps $(a, b, c), (a', b', c')$ with $(s_3, s_3', s_3'')$ we obtain $a = a'$. By rotating we may do the same to get $b = b'$ and $c = c'$.

Finally, we check that $\mathcal{I} \to X/S$ is cofinal, see Categories, Definition 4.17.1. The first condition is true as the functor is surjective. Suppose that we have an object $s : X \to X'$ in $X/S$ and two objects $(s_1, s'_1, s''_1) : (X, Y, Z, f, g, h) \to (X_1, Y_1, Z_1, f_1, g_1, h_1)$ and $(s_2, s'_2, s''_2) : (X, Y, Z, f, g, h) \to (X_2, Y_2, Z_2, f_2, g_2, h_2)$ in $\mathcal{I}$ as well as morphisms $t_1 : X' \to X_1$ and $t_2 : X' \to X_2$ in $X/S$. By property (2) of $\mathcal{I}$ proved above we can find morphisms $(s_3, s'_3, s''_3) : (X_1, Y_1, Z_1, f_1, g_1, h_1) \to (X_3, Y_3, Z_3, f_3, g_3, h_3)$ and $(s_4, s'_4, s''_4) : (X_2, Y_2, Z_2, f_2, g_2, h_2) \to (X_3, Y_3, Z_3, f_3, g_3, h_3)$ in $\mathcal{I}$. We would be done if the compositions $X' \to X_1 \to X_3$ and $X' \to X_2 \to X_3$ were equal (see displayed equation in Categories, Definition 4.17.1). If not, then, because $X/S$ is filtered, we can choose a morphism $X_3 \to X_4$ in $X/S$ such that the compositions $X' \to X_1 \to X_3 \to X_4$ and $X' \to X_2 \to X_3 \to X_4$ are equal. Then we finally complete $X_3 \to X_4$ to a morphism $(X_3, Y_3, Z_3) \to (X_4, Y_4, Z_4)$ in $\mathcal{I}$ and compose with that morphism to see that the result is true.
$\square$

## Comments (6)

Comment #1042 by JuanPablo on

Comment #1046 by Johan on

Comment #8102 by Et on

Comment #8213 by Stacks Project on

Comment #8380 by ElĂas Guisado on

Comment #8993 by Stacks project on

There are also: