A deformation retract is a retract which is also a section up to homotopy. Equivalently, it is a homotopy equivalence one of whose two homotopies is in fact an identity?.
Let $\mathcal{C}$ be a category equipped with a notion of homotopy between its morphisms. Then a deformation retraction of a morphism
(the deformation retract itself) is another morphism
such that
and
In particular, if “homotopy” in $\mathcal{C}$ means left homotopy with respect to an cylinder object $I \otimes X$
then a deformation retract of $i : A \to X$ is a morphism $r : X \to A$ such that $r \circ i = id_A$ and such that there exists a morphism $\eta : I \otimes X \to X$ fitting into a diagram
If the cylinder object assignment here is functorial, we say that $\eta$ is a strong deformation retract if moreover
(hence if the homotopy restricted to the inclusion is “constant” as seen by the chosen cylinder object).
In parts of the literature, deformation retracts are required to be strong by default.
In the category Top of topological spaces the standard cylinder object is given by cartesian product with the interval $I := [0,1]$.
With respect to the corresponding notion of left homotopy, if $X$ is a topological space and $A\subset X$ a subspace, then $A$ is a strong deformation retract of $X$ if there exists a continuous map $H:X\times I\to X$ such that $H(a,t)=a$ for all $a\in A$, $t\in I=[0,1]$, $H(x,0) = x$ for all $x\in X$ and $H(x,1)\in A$ for all $x\in X$.
Equivalently, there are continuous maps $i:A\to X$ and $r:X\to A$ such that $r\circ i = id_A$ and $i\circ r\sim id_X (rel A)$, where $\sim (rel A)$ denotes homotopy with fixed $A$. More generally, for any continuous map $j:Z\to Y$ we say that it is deformation retractable if there is $r:Y\to Z$ such that $j\circ r\sim id_Y$ and $r\circ j = id_Z$.
A pair $(X,A)$ is an NDR-pair if there are two continuous maps, $u:X\to I,\; H:X\times I\to X$ such that $H(a,t)=a$ for all $a\in A$ and all $t$, $H(x,0)=x$ for all $x\in X$, $u^{-1}(0)=A$ and $H(x,1)\in A$ for all $x$ such that $u(x)\lt 1$. If $(X,A)$ is an NDR-pair, then the inclusion has a left homotopy inverse iff $A$ is also a retract of $X$ (in Top, in the standard categorical sense).
The pair $(X,A)$ is a DR-pair if it is a deformation retract and there is a function $u:X\to I$ such that $A=u^{-1}(0)$ (i.e. it gives simultaneously a deformation retract and a NDR-pair). If $(X,A)$ is an NDR-pair then the inclusion $A\hookrightarrow X$ is a homotopy equivalence iff $A$ is a deformation retract of $X$. Any map $f:X\to Y$ is a homotopy equivalence iff $X$ is the deformation retract of the mapping cylinder of $f$. If $(X,A)$ is an NDR-pair and $A$ is contractible, then the quotient map $X\to X/A$ is a homotopy equivalence.
There is also the notion of a deformation retract of a homotopical category, which has a similar feel in some ways but is not closely related. (It should not be confused with the idea of a deformation retract in a model category, which is a direct generalization of the notion described above for Top.)
For instance