Intuition behind a retraction from the cylinder onto the mapping cylinder. Please excuse me for including pictures, but I thought it was easier than trying to redraw them here.
I am right now reading Strøm's book Modern Classical Homotopy Theory. I have encountered a problem, 5.21b) which concerns cofibrations (see the pictures). One should show that a morphism $i: A \rightarrow X$ is a cofibration iff there is a function $\phi:X \rightarrow I$ such that $A = \phi^{-1}(0)$ is a strong neighborhood deformation retract of $U = \phi^{-1}([0,1))$. In part a) I have no problem, but with b) i.e showing that if we have such a deformation retract, then $A \rightarrow X$ is a bigger problem. One wants to produce a retraction of $X \times I$ onto the mapping cylinder $A \times I \cup X$. They call $T$ the mapping cylinder in the text. Strom gives a picture trying to show how to define it, but I can't understand it properly. First of all:
How should I think intuitively (or non-intuitively, or at least some idea) on how this retraction should be constructed? The picture probably gives it, but I don't see it now.
How is the map defined? 


 A: The function $r:X\times I\to X\times\{0\}\cup A\times I$ is defined as follows:$$r(x,t)=\begin{cases}
(x,\ 0), &\text{ if }\phi(x)=1\\
(H(x,2(1-\phi(x))t),\ 0), &\text{ if }1/2\le\phi(x)<1\\
(H(x,t/(2\phi(x))),\ 0), &\text{ if }0<\phi(x)\le1/2,\ t\le2\phi(x)\\
(H(x,1),\ t-2\phi(x)), &\text{ if }0\le\phi(x)\le1/2,\ t\ge2\phi(x)
\end{cases}$$
It is easy to prove that all these partial functions are well-defined continuous maps and that they coincide where the domains intersect. Also, $r$ is the identity on $A\times I\cup X\times\{0\}$. Now, these partial functions could easily be glued to a single continuous map if the domains were all closed. Since they are not, we have to extend each function to the closure of its domain continuously.  
To do this for the third function, let us denote $B=\{(x,t)\mid 0<\phi(x)\le1/2,\ t\le2\phi(x)\}$ which is the domain of that function. Its closure, as apparent from the picture, is $B\sqcup(\partial A\times\{0\}).$ The only way that we can extend the third map to this closure is by defining
$$f(x,t)=\begin{cases}
(H(x,t/(2\phi(x))),\ 0), &\text{ if }(x,t)\in B\\
(H(x,1),0)=(x,0), &\text{ if }(x,t)\in\partial A\times\{0\}
\end{cases}$$
Let us show that $f$ is continuous. This is clear for a point in $B$ as $B$ is open in $\overline B$. So take $a\in\partial A$. A typical neighborhood of $f(a,0)=(a,0)$ has the form $V\times[0,\epsilon)$, where $V$ is open and $\epsilon>0$. We can now apply the following lemma

Lemma: Let $X$ be a space, $A\subset X$, and $H:X\times I\to X$ a homotopy such that $H(a,t)=a$ for $a\in A.$ If $V$ is open, then there is an open $W\subseteq V$ such that $V\cap A\subseteq W$ and for every $w\in W$ the path $H(w,t)$ is contained in $V$.

Taking $X=U$ in the lemma, we obtain an open $W\ni a$ such that $f(w,t)\in V\times\{0\}$ for all $(w,t)\in W\times I$. This shows the continuity at $(a,0)$. We have thus extended the third function to a map with closed domain, in a way that is compatible with the other functions.
I am struggling with extending the second function. Funnily, I had actually just asked an own question dealing with that extension.
