Lemma. Characterising the type of quasi-inverses [01IT]

Let f:A\to B be a quasi-invertible function. Then we have an equivalence \mathsf {qinverseOf}(f)\to {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}x=_Ax where \mathsf {qinverseOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bar {f}:B\to A)}} f\circ \bar {f}\sim 1_B \times \bar {f}\circ f\sim 1_A is the type of quasi-inverses to f.