Lemma Let $f: X \rightarrow Y$ be a weak homotopy equivalence of topological spaces, let $K$ be a CW complex, and let $g: K \rightarrow Y$ be a continuous function. Then there exists a continuous function $\overline{g}: K \rightarrow X$ such that $g$ is homotopic to $f \circ \overline{g}$.

Proof. For each $n \geq -1$, let $\operatorname{sk}_{n}(K)$ denote the $n$-skeleton of $K$ (with respect to some fixed cell decomposition), so that $\operatorname{sk}_{-1}(K) = \emptyset $. To prove Lemma, it will suffice to construct a compatible sequence of continuous functions $\overline{g}_ n: \operatorname{sk}_{n}(K) \rightarrow X$ and homotopies $h_{n}: [0,1] \times \operatorname{sk}_{n}(K) \rightarrow Y$ from $\overline{g}_ n$ to $g|_{\operatorname{sk}_ n(K)}$. We proceed by recursion. Assume that $n \geq 0$ and that the pair $(\overline{g}_{n-1}, h_{n-1})$ has already been constructed. Let $S$ denote the collection of $n$-cells of $K$. For each $s \in S$, let $b_{s}: | \operatorname{\partial \Delta }^ n | \rightarrow \operatorname{sk}_{n-1}(K)$ denote the corresponding attaching map. To construct the pair $( \overline{g}_{n}, h_{n} )$, it will suffice to show that each composition $\overline{g}_{n-1} \circ b_{s}$ can be extended to a continuous map $u_ s: | \Delta ^ n | \rightarrow X$ and that each composition $h_{n-1} \circ ( b_ s \times \operatorname{id}_{[0,1]} )$ can be extended to a homotopy from $u_ s$ to $g|_{ | \Delta ^ n |}$. Unwinding the definitions, we can rephrase this as a lifting problem

\[ \xymatrix { \operatorname{\partial \Delta }^ n \ar [r] \ar [d] & \operatorname{Sing}_{\bullet }( X) \times _{ \operatorname{Fun}( \{ 0\} , \operatorname{Sing}_{\bullet }(Y) ) } \operatorname{Fun}( \Delta ^1, \operatorname{Sing}_{\bullet }(Y) ) \ar [d]^{\theta } \\ \Delta ^ n \ar [r] \ar@ {-->}[ur] & \operatorname{Fun}( \{ 1\} , \operatorname{Sing}_{\bullet }(Y) ) } \]

in the category of simplicial sets. Here the morphism $\theta $ is the path fibration of Example (associated to the map of Kan complexes $\operatorname{Sing}_{\bullet }(f): \operatorname{Sing}_{\bullet }(X) \rightarrow \operatorname{Sing}_{\bullet }(Y)$). Our assumption that $f$ is a weak homotopy equivalence guarantees that $\operatorname{Sing}_{\bullet }(f)$ is a homotopy equivalence of Kan complexes, so that $\theta $ is also a homotopy equivalence. Applying Corollary, we deduce that $\theta $ is a trivial Kan fibration, so that the lifting problem admits a solution as desired. $\square$