Fix types A,A'~\mathit {type} and families x:A\vdash B[x]~\mathit {type} and x:A'\vdash B'[x]~\mathit {type}.
Suppose that A be a retract of A' as witnessed by
\begin {aligned}
&s_A:A\to A'
\\
&r_A:A'\to A
\\
&h_A:r_A\circ s_A\sim 1_{A}
\end {aligned}
and for each x:A' the component B[r_Ax] is a retract of B'[x] as witnessed by
\begin {aligned}
&s_B^x:
B[r_Ax]\to B'[x]
\\
&r_B^x:
B'[x]\to B[r_Ax]
\\
&h_B^x:
r_B^x\circ s_B^x \sim 1_{B[r_Ax]}
\text {.}
\end {aligned}
Then we may exhibit {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}{B[x]} as a retract of {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A')}}{B'[x]} as follows. We define the retraction first:
\begin {aligned}
&r:
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A')}}{B'[x]}
\to
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}{B[x]}
\\
&
(r\left \langle x,y\right \rangle ).1 :\equiv r_Ax
\\
&
(r\left \langle x,y\right \rangle ).2 :\equiv r_B^{x}y
\end {aligned}
The section is more difficult. We start as follows:
\begin {aligned}
&s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A')}}{B'[x]}
\\
&(s \left \langle x,y\right \rangle ).1:A'
\\
&(s\left \langle x,y\right \rangle ).2:
B'[
(s\left \langle x,y\right \rangle ).1
]
\end {aligned}
In the first component, we have only one choice: to use section s_A.
\begin {aligned}
&s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A')}}{B'[x]}
\\
&
(s \left \langle x,y\right \rangle ).1 :\equiv s_Ax
\\
&(s\left \langle x,y\right \rangle ).2:
B'[
s_Ax
]
\end {aligned}
In the second component, we have no choice but to the section s_B^{s_Ax}, which requires as input an element of B[r_A(s_Ax)]. As r_A is a section of s_A, we have an identification h_Ax:r_A(s_Ax)=_Ax, along which we must transport.
\begin {aligned}
&s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A')}}{B'[x]}
\\
&
(s \left \langle x,y\right \rangle ).1 :\equiv s_Ax
\\
&
(s\left \langle x,y\right \rangle ).2 :\equiv
s_B^{s_Ax}\left (
\overline {h_Ax}_*^B
y
\right )
\end {aligned}
Next we must construct the homotopy witnessing the section-retraction pair.
x:A,
y:B[x]
\vdash
h\left \langle x,y\right \rangle :
r(s\left \langle x,y\right \rangle ) =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x]} \left \langle x,y\right \rangle
Unravelling definitions, this is:
x:A,
y:B[x]
\vdash
h\left \langle x,y\right \rangle :
\left \langle
r_A(s_Ax),
r_B^{s_Ax}
\left (
s_B^{s_Ax}\left (
\overline {h_Ax}_*^By
\right )
\right )
\right \rangle
=_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x]} \left \langle x,y\right \rangle
At this point, we must “generalise” the goal in order to replace the complicated parts by variables that we can then contract using identification elimination. In this case, we will generalise over the pair
\left \langle s_A x, h_Ax\right \rangle
:
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x':A')}}{r_Ax'=x}
so that our generalised goal becomes
\begin {aligned}
&x:A,
x':A',
p:r_Ax'=_Ax,
y:B[x]
\vdash
\\
&\quad
h'~\left \langle x,y\right \rangle ~\left \langle x',p\right \rangle :
\left \langle
r_Ax',
r_B^{x'}
\left (
s_B^{x'}\left ( \bar {p}_*^By \right )
\right )
\right \rangle
=_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x]} \left \langle x,y\right \rangle
\end {aligned}
so that we may define
h\left \langle x,y\right \rangle :\equiv h'~\left \langle x,y\right \rangle ~\left \langle s_Ax,h_Ax\right \rangle
To fill in the generalised term h', we proceed by identification elimination on (x,p):
\begin {aligned}
&
x':A',
y:B[r_Ax']
\vdash
\\
&\quad
h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax}\right \rangle :
\left \langle
r_Ax',
r_B^{x'}
\left (
s_B^{x'}\left ( \overline {\mathsf {refl}_{r_Ax'}}_*^By \right )
\right )
\right \rangle
=_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x]} \left \langle r_Ax',y\right \rangle
\end {aligned}
Recalling that flipping and transport are both defined so as to compute definitionally on the reflexivity term, our goal gets simpler:
x':A',
y:B[r_Ax']
\vdash
h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax}\right \rangle :
\left \langle
r_Ax',
r_B^{x'} ( s_B^{x'}y )
\right \rangle
=_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}B[x]} \left \langle r_Ax',y\right \rangle
We can now use the action on identifications of the pairing function
\left \langle r_Ax',-\right \rangle
\colon
B[r_Ax']
\to
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum }
}_{(x:A)}}{B[x]}
on the identification
h_B^{x'}y:r_B^{x'}(s_B^{x'}y) =_{B[r_Ax']} y
as follows:
x':A',
y:B[r_Ax']
\vdash
h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax'}\right \rangle
:\equiv
\mathsf {act}_{\left \langle r_Ax',-\right \rangle }
(h_B^{x'}y)