[step:Show that encoding after decoding is the identity on codes]
We prove that for all $x=(a,u):S$, $y=(b,v):S$, and all $c:\operatorname{Code}(x,y)$,
\begin{align*}
\operatorname{encode}_{x,y}(\operatorname{pairpath}_{x,y}(c))=c.
\end{align*}
Write $c=(p,q)$, where
\begin{align*}
p:\operatorname{Id}_A(a,b)
\end{align*}
and
\begin{align*}
q:\operatorname{Id}_{B(b)}\bigl(\operatorname{transport}^{B}(p)(u),v\bigr).
\end{align*}
We apply path induction to $p$. In the reflexive case $b\equiv a$ and $p\equiv\operatorname{refl}_a$, the transport term reduces to $u$, so $q:\operatorname{Id}_{B(a)}(u,v)$. Applying path induction to $q$, it remains to prove the case $v\equiv u$ and $q\equiv\operatorname{refl}_u$. In that case,
\begin{align*}
\operatorname{pairpath}_{(a,u),(a,u)}(\operatorname{refl}_a,\operatorname{refl}_u)=\operatorname{refl}_{(a,u)}
\end{align*}
and then
\begin{align*}
\operatorname{encode}_{(a,u),(a,u)}(\operatorname{refl}_{(a,u)})=(\operatorname{refl}_a,\operatorname{refl}_u).
\end{align*}
Therefore the required equality reduces to the reflexivity path of $(\operatorname{refl}_a,\operatorname{refl}_u)$. The two inductions give the desired homotopy for all codes $c$.
[/step]