I understand that HEP definition is the following:
$(X,A)$ has the homotopy extension property if every pair of maps $X×\{0\}→Y$ and $A×I→Y$ that agree on $A×\{0\}$ can be extended to a map $X×I→Y$ .
There is a theorem that says: A pair $(X,A)$ has the homotopy extension property if and only if $X×\{0\}∪A×I$ is a retract of $X×I$ .
For the $(\Rightarrow)$ direction, the book says that: Homotopy extension property for $(X,A)$ implies that the identity $X\times \{0\}\cup A\times I\to X\times \{0\}\cup A\times I $ extends to a map $X\times I\to X\times \{0\}\cup A\times I$ so $X\times \{0\}\cup A\times I$ is retract of $X\times I$.
But I don't understand why that is true. $(X,A)$ has the extension property i.e, map on $A\times I$ can be extended to $X\times I$. But I don't understand what allows the extension in the proof above.
Is the following correct?
Let $i:X\times \{0\}\cup A\times I\to X\times \{0\}\cup A\times I $ be the identity map. $i|_{A\times I}$ and $i|_{X\times \{0\}}$ agree on $A\times \{0\}$ so by definition we get an extension $i_{X\times I}$ of $i|_{A\times I}$. $i_{X\times I}$ is the desired retraction map.
Perhaps it is easier to see if we reformulate the HEP as follows:
Now take $Y = X\times \{0\}\cup A\times I$ and $h = id$.
Note that in the above definition we do not require that $h$ is continuous, we only require that the restrictions $h \mid_{X\times \{0\}}$ and $h \mid_{A\times I}$ are. Let us call such a function $h$ partially continuous rel. $(X,A)$.
By definition, if $(X,A)$ has the HEP, then each $h : X\times \{0\}\cup A\times I \to Y$ which is partially continuous rel. $(X,A)$ must be continuous - otherwise it could not have a continuous extension to $X \times I$.
This is a very special feature of pairs with the HEP. For an arbitrary $(X,A)$ it is not true that partial continuity rel. $(X,A)$ implies continuity. Without assuming that $(X,A)$ has the HEP we can only prove that $h$ is continuous provided $A$ is closed in $X$.
For the $\Leftarrow$ direction Hatcher gives a simple proof for $A$ closed in $X$. Indeed, in that case each $h$ which is partially continuous rel. $(X,A)$ is continuous. Therefore, if $ r : X \times I \to X\times \{0\}\cup A\times I$ is a retraction, then $h \circ r$ is the desired continuous extension of $h$.
Observe that Hatcher writes