Homotopies, sections, retractions, (bi-)inverses [01FH]
So far we have encountered three possible kinds of sameness for dependent functions f,g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}:
- They could be judgementally equal in the sense that f\equiv g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} holds. We have seen that this is equivalent to the values of the function being equal in the sense that x:A\vdash fx\equiv gx:B[x] holds.
- They could be identified by an element p:f=_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}B[x]}g of the identification type.
- Their values could be identified by a family x:A\vdash h[x]:fx=_{B[x]}gx of identifications, or (equivalent) by a dependent function h:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}fx=_{B[x]}gx assigning identifications to elements of A.
The third notion is above is called a homotopy from f to g. With the foundations that we have set up so far, homotopies are the most correct way to express the mathematical sameness of two functions. Later on, we will see how univalent foundations ensures that identifications of functions (the second notion) are equivalent to homotopies between functions.
Definition Homotopy [01FO]
Let f,g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} be two dependent functions. A homotopy from f to g is defined to be a dependent function h:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{fx=_{B[x]}gx} sending each element of A to an identification between its respective values in f and g. We will sometimes write f\sim g for the type of homotopies from f to g.
Definition Sections and retractions [01FQ]
A section-retraction pair is defined to be a pair of functions s:B\to A and r:A\to B equipped with a homotopy r\circ s\sim 1_B. In this context, s is called a section of r and r is called a retraction of s. The idea is that r “undoes” or “retracts” whatever s does. B is called a retract of A in the presence of such a section-retraction pair.
Given a function r:A\to B, the type of sections of r can be defined by a sum:
\mathsf {sectionOf}(r) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:B\to A)}} r\circ s \sim 1_BLikewise, for a function s:B\to A, the type of retractions of s can be defined similarly:
\mathsf {retractionOf}(s) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(r:A\to B)}} r\circ s\sim 1_BIn both scenarios, such a section-retraction pair is said to witness that B is a retract of A.
Lemma Propositions are closed under retracts [01H5]
Any retract of a proposition is a proposition.
Proof.
Let A be a proposition and let B a retract of A as witnessed by a section-retraction pair as follows:
\begin {aligned} &s:B\to A \\ &r:A\to B \\ &h:r\circ s\sim 1_B \end {aligned}We fix any two elements x,y:B, and we need to witness x=_By. Because A is a proposition, we have some identification p:sx=_Asy\text {,} upon which the action on identifications of the retraction r:A\to B yiels \mathsf {act}_{r}p:rsx=_Brsy\text {.}
Conjugating with the homotopy h:r\circ s\sim 1_B we obtain:
hx \cdot \mathsf {act}_rp \cdot \overline {hy}: x=_ByLemma Contractible types are closed under retracts [01H4]
As propositions are closed under retracts, it suffices to observe that inhabited types are also closed under retracts.
Construction Sums of retracts [01H3]
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 \rangleUnravelling 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 \rangleAt 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 \rangleWe 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)Definition Quasi-inverse [01H7]
A quasi-inverse to a function f:A\to B is given by another function \bar {f}:B\to A that is simultaneously a section and a retraction of f:
\begin {aligned} &\bar {f}:B\to A\\ &\epsilon :f\circ \bar {f} \sim 1_B\\ &\eta :\bar {f}\circ f \sim 1_A\\ \end {aligned}A function is called quasi-invertible when it is equipped with a quasi-inverse.
Definition Bi-inverse [01FI]
A bi-inverse to a function f:A\to B is defined to be a pair of a section and a retraction of f. This amounts to the following data:
- The section s:B\to A with its witnesssing homotopy \sigma :f\circ s\sim 1_B.
- The retraction r:B\to A with its witnessing homotopy \rho :r\circ f\sim 1_A.
A function is called bi-invertible when it is equipped with a bi-inverse.
Remark Why a separate section and retraction? [01FT]
In ordinary mathematics when working with sets, we would define an isomorphism from A to B to be a function f:A\to B together with a function g\colon B\to A that is simultaneously a section and a retraction of f. In set theoretic foundations, the set of isomorphisms from A to B is isomorphic to the set of equivalences (in our sense) from A to B. But in univalent foundations, although we can convert in either direction, the round trips do not line up.
The problem is that in univalent foundations, it is not a mere property of a function that it be simultaneously a section and a retraction of another function. The data of the homotopy matters. We will see later on that a function being bi-invertible is actually a proposition, whereas being quasi-invertible.
Lemma From bi-inverses to quasi-inverses [01HG]
- September 12, 2025
- Jon Sterling
Evidently a quasi-invertible function is bi-invertible, as we can simply take both the section and retraction to have the same underlying map. In the other direction, we can show that the underlying map of the section (resp. retraction) of a bi-inverse is simultaneously a retraction (resp. section). This gives us two ways to construct a quasi-inverse from a bi-inverse: you take either the section or the retraction.
In particular, let f:A\to B be a function with a bi-inverse as follows:
\begin {aligned} &s:B\to A \\ &h_s: f\circ s \sim 1_B \\ & r:B\to A \\ &h_r:r\circ f\sim 1_A \end {aligned}Now we may construct a quasi-inverse, setting \bar {f}:\equiv s. We need to construct the following homotopies:
\begin {aligned} &\epsilon : f\circ \bar {f} \sim 1_B \\ &\eta : \bar {f}\circ f \sim 1_A \end {aligned}We may trivially define \epsilon :\equiv h_s. For the retraction datum, we fix x:A and observe that we have h_s(fx) : f(s(fx)) =_A fx and thus \mathsf {act}_{r}(h_s(fx)) : r(f(s(fx))) =_A r(fx) which we may conjugate by h_r to obtain:
\overline {h_r(s(fx))} \cdot \mathsf {act}_r(h_s(fx)) \cdot h_r x : s(fx) =_A xBe careful! Although we have shown above that we can convert between bi-inverses and quasi-inverses, the two notions are not equivalence in the sense of univalent foundations: indeed, it is not the case that function sending a quasi-inverse to a bi-inverse is contractible.
Lemma Quasi-invertible maps are contractible [01H9]
Let f:A\to B be a map equipped with a quasi-inverse:
\begin {aligned} &\bar {f}:B\to A \\ &\epsilon :f\circ \bar {f}\sim 1_A \\ &\eta :\bar {f}\circ f\sim 1_B \end {aligned}Then f is contractible.
Proof.
We want to show that for each b:B, the fibre \mathsf {fib}_fb \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a:A)}}fa=_Bb is contractible. We will show that this type is a retract of the singleton \{b\}_B, recalling that contractible types are closed under retracts.
We recall the construction of sums of retracts; to show that \mathsf {fib}_fb is a retract of \{b\}_B, we can start by exhibiting A as a retract of B. For this, we use the section-retraction pair (f,\bar {f},\eta ). Then we need to show that for each x:B the identification type f (\bar {f}x)=_B b is a retract of x=b. We first define the section component:
\begin {aligned} b,x:B; p:f(\bar {f}x)=_Bb &\vdash s_{b,x}p: x=_B b \end {aligned}We proceed by identification elimination.
\begin {aligned} x:B &\vdash s_{f(\bar {f}x),x}\mathsf {refl}_{f(\bar {f}x)}: x=_B f(\bar {f}x) \\ x:B &\vdash s_{f(\bar {f}x),x}\mathsf {refl}_{f(\bar {f}x)} :\equiv \overline {\epsilon x} \end {aligned}Now we need to define the retraction:
\begin {aligned} x,b:B; p:x=_Bb &\vdash r_{x,b}p: f(\bar {f}x)=_Bb \\ x,b:B; p:x=_Bb &\vdash r_{x,b}p:\equiv \epsilon x \cdot p \end {aligned}Finally, the homotopy witnessing the section-retraction pair:
\begin {aligned} x,b:B; p:f(\bar {f}x)=_Bb &\vdash h_{x,b}p: \epsilon x\cdot s_{x,b} p =_{f(\bar {f}x)=_Bb} p \\ x:B &\vdash h_{x,f(\bar {f}x)}~\mathsf {refl}_{f(\bar {f}x)} : \epsilon x \cdot \overline {\epsilon x} =_{f(\bar {f}x)=_Bf(\bar {f}x)} \mathsf {refl}_{f(\bar {f}x)} \end {aligned}We finish up recalling the laws of flipping.
Lemma Contractible maps are quasi-invertible [01HH]
- September 12, 2025
- Jon Sterling
Any contractible map f:A\to B is quasi-invertible.
Proof.
- September 12, 2025
- Jon Sterling
Let us have the following witness of contractibility:
\gamma : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \mathsf {isContr}( \mathsf {fib}_fb )This means that for each b:B we have:
\begin {aligned} &\gamma (b).1 : \mathsf {fib}_fb \\ &\gamma (b).2 : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:\mathsf {fib}_f(b))}} \gamma (b).1 =_{\mathsf {fib}_fb} u \end {aligned}Unravelling further, this is \begin {aligned} &\gamma (b).1.1 : A\\ &\gamma (b).1.2 : f(\gamma (b).1.1) =_B b\\ \end {aligned} and for each a:A and p:fa=_Bb we have \begin {aligned} \gamma (b).2\left \langle a,p\right \rangle : \gamma (b).1 =_{\mathsf {fib}_fb} \left \langle a,p\right \rangle \end {aligned} and in particular \mathsf {act}_{-.1}(\gamma (b).2\left \langle a,p\right \rangle ) : \gamma (b).1.1 =_A a \text {.}
We now assign names to some of the above.
\begin {aligned} &\bar {f}:B\to A \\ &\bar {f}b :\equiv \gamma (b).1.1 \\[12pt] &\epsilon : f\circ \bar {f} \sim 1_B \\ &\epsilon b :\equiv \gamma (b).1.2 \\[12pt] &\eta : \bar {f}\circ f\sim 1_A \\ &\eta a :\equiv \mathsf {act}_{-.1}(\gamma (b).2\left \langle a,\mathsf {refl}_{fa}\right \rangle ) \end {aligned}