# 9.9 The Rezk completion

###### Lemma 9.9.1.

If $A,B,C$ are precategories and $H:A\to B$ is an essentially surjective functor, then $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ H):C^{B}\to C^{A}$ is faithful  .

###### Proof.

Let $F,G:B\to C$, and $\gamma,\delta:F\to G$ be such that $\gamma H=\delta H$; we must show $\gamma=\delta$. Thus let $b:B$; we want to show $\gamma_{b}=\delta_{b}$. This is a mere proposition, so since $H$ is essentially surjective, we may assume given an $a:A$ and an isomorphism        $f:Ha\cong b$. But now we have

 $\gamma_{b}=G(f)\circ\gamma_{Ha}\circ F({f}^{-1})=G(f)\circ\delta_{Ha}\circ F({% f}^{-1})=\delta_{b}.\qed$
###### Lemma 9.9.2.

If $A,B,C$ are precategories and $H:A\to B$ is essentially surjective and full, then $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ H):C^{B}\to C^{A}$ is fully faithful.

###### Proof.

It remains to show fullness. Thus, let $F,G:B\to C$ and $\gamma:FH\to GH$. We claim that for any $b:B$, the type

 $\mathchoice{\sum_{(g:\hom_{C}(Fb,Gb))}\,}{\mathchoice{{\textstyle\sum_{(g:\hom% _{C}(Fb,Gb))}}}{\sum_{(g:\hom_{C}(Fb,Gb))}}{\sum_{(g:\hom_{C}(Fb,Gb))}}{\sum_{% (g:\hom_{C}(Fb,Gb))}}}{\mathchoice{{\textstyle\sum_{(g:\hom_{C}(Fb,Gb))}}}{% \sum_{(g:\hom_{C}(Fb,Gb))}}{\sum_{(g:\hom_{C}(Fb,Gb))}}{\sum_{(g:\hom_{C}(Fb,% Gb))}}}{\mathchoice{{\textstyle\sum_{(g:\hom_{C}(Fb,Gb))}}}{\sum_{(g:\hom_{C}(% Fb,Gb))}}{\sum_{(g:\hom_{C}(Fb,Gb))}}{\sum_{(g:\hom_{C}(Fb,Gb))}}}\mathchoice{% \prod_{(a:A)}\,}{\mathchoice{{\textstyle\prod_{(a:A)}}}{\prod_{(a:A)}}{\prod_{% (a:A)}}{\prod_{(a:A)}}}{\mathchoice{{\textstyle\prod_{(a:A)}}}{\prod_{(a:A)}}{% \prod_{(a:A)}}{\prod_{(a:A)}}}{\mathchoice{{\textstyle\prod_{(a:A)}}}{\prod_{(% a:A)}}{\prod_{(a:A)}}{\prod_{(a:A)}}}\mathchoice{\prod_{(f:Ha\cong b)}\,}{% \mathchoice{{\textstyle\prod_{(f:Ha\cong b)}}}{\prod_{(f:Ha\cong b)}}{\prod_{(% f:Ha\cong b)}}{\prod_{(f:Ha\cong b)}}}{\mathchoice{{\textstyle\prod_{(f:Ha% \cong b)}}}{\prod_{(f:Ha\cong b)}}{\prod_{(f:Ha\cong b)}}{\prod_{(f:Ha\cong b)% }}}{\mathchoice{{\textstyle\prod_{(f:Ha\cong b)}}}{\prod_{(f:Ha\cong b)}}{% \prod_{(f:Ha\cong b)}}{\prod_{(f:Ha\cong b)}}}(\gamma_{a}={Gf}^{-1}\circ g% \circ Ff)$ (9.9.3)

is contractible  . Since contractibility is a mere property, and $H$ is essentially surjective, we may assume given $a_{0}:A$ and $h:Ha_{0}\cong b$.

Now take $g:\!\!\equiv Gh\circ\gamma_{a_{0}}\circ{Fh}^{-1}$. Then given any other $a:A$ and $f:Ha\cong b$, we must show $\gamma_{a}={Gf}^{-1}\circ g\circ Ff$. Since $H$ is full, there merely exists a morphism $k:\hom_{A}(a,a_{0})$ such that $Hk={h}^{-1}\circ f$. And since our goal is a mere proposition, we may assume given some such $k$. Then we have

 $\displaystyle\gamma_{a}$ $\displaystyle={GHk}^{-1}\circ\gamma_{a_{0}}\circ FHk$ $\displaystyle={Gf}^{-1}\circ Gh\circ\gamma_{a_{0}}\circ{Fh}^{-1}\circ Ff$ $\displaystyle={Gf}^{-1}\circ g\circ Ff.$

Thus, (9.9.3) is inhabited. It remains to show it is a mere proposition. Let $g,g^{\prime}:\hom_{C}(Fb,Gb)$ be such that for all $a:A$ and $f:Ha\cong b$, we have both $(\gamma_{a}={Gf}^{-1}\circ g\circ Ff)$ and $(\gamma_{a}={Gf}^{-1}\circ g^{\prime}\circ Ff)$. The dependent product types are mere propositions, so all we have to prove is $g=g^{\prime}$. But this is a mere proposition, so we may assume $a_{0}:A$ and $h:Ha_{0}\cong b$, in which case we have

 $g=Gh\circ\gamma_{a_{0}}\circ{Fh}^{-1}=g^{\prime}.$

This proves that (9.9.3) is contractible for all $b:B$. Now we define $\delta:F\to G$ by taking $\delta_{b}$ to be the unique $g$ in (9.9.3) for that $b$. To see that this is natural, suppose given $f:\hom_{B}(b,b^{\prime})$; we must show $Gf\circ\delta_{b}=\delta_{b^{\prime}}\circ Ff$. As before, we may assume $a:A$ and $h:Ha\cong b$, and likewise $a^{\prime}:A$ and $h^{\prime}:Ha^{\prime}\cong b^{\prime}$. Since $H$ is full as well as essentially surjective, we may also assume $k:\hom_{A}(a,a^{\prime})$ with $Hk={h^{\prime}}^{-1}\circ f\circ h$.

Since $\gamma$ is natural, $GHk\circ\gamma_{a}=\gamma_{a^{\prime}}\circ FHk$. Using the definition of $\delta$, we have

 $\displaystyle Gf\circ\delta_{b}$ $\displaystyle=Gf\circ Gh\circ\gamma_{a}\circ{Fh}^{-1}$ $\displaystyle=Gh^{\prime}\circ GHk\circ\gamma_{a}\circ{Fh}^{-1}$ $\displaystyle=Gh^{\prime}\circ\gamma_{a^{\prime}}\circ FHk\circ{Fh}^{-1}$ $\displaystyle=Gh^{\prime}\circ\gamma_{a^{\prime}}\circ{Fh^{\prime}}^{-1}\circ Ff$ $\displaystyle=\delta_{b^{\prime}}\circ Ff.$

Thus, $\delta$ is natural. Finally, for any $a:A$, applying the definition of $\delta_{Ha}$ to $a$ and $1_{a}$, we obtain $\gamma_{a}=\delta_{Ha}$. Hence, $\delta\circ H=\gamma$. ∎

The rest of the theorem follows almost exactly the same lines, with the category-ness of $C$ inserted in one crucial step, which we have italicized below for emphasis. This is the point at which we are trying to define a function into objects without using choice, and so we must be careful about what it means for an object to be “uniquely specified”. In classical category theory, all one can say is that this object is specified up to unique isomorphism, but in set-theoretic foundations this is not a sufficient amount of uniqueness to give us a function without invoking $\mathsf{AC}$. In univalent foundations, however, if $C$ is a category, then isomorphism is equality, and we have the appropriate sort of uniqueness (namely, living in a contractible space).

###### Theorem 9.9.4.

If $A,B$ are precategories, $C$ is a category, and $H:A\to B$ is a weak equivalence, then $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ H):C^{B}\to C^{A}$ is an isomorphism.

###### Proof.

By \autorefct:functor-cat, $C^{B}$ and $C^{A}$ are categories. Thus, by \autorefct:eqv-levelwise it will suffice to show that $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ H)$ is an equivalence. But since we know from the preceding two lemmas that it is fully faithful, by \autorefct:catweq it will suffice to show that it is essentially surjective. Thus, suppose $F:A\to C$; we want there to merely exist a $G:B\to C$ such that $GH\cong F$.

For each $b:B$, let $X_{b}$ be the type whose elements consist of:

1. 1.

An element $c:C$; and

2. 2.

For each $a:A$ and $h:Ha\cong b$, an isomorphism $k_{a,h}:Fa\cong c$; such that

3. 3.

For each $(a,h)$ and $(a^{\prime},h^{\prime})$ as in 2 and each $f:\hom_{A}(a,a^{\prime})$ such that $h^{\prime}\circ Hf=h$, we have $k_{a^{\prime},h^{\prime}}\circ Ff=k_{a,h}$.

We claim that for any $b:B$, the type $X_{b}$ is contractible. As this is a mere proposition, we may assume given $a_{0}:A$ and $h_{0}:Ha_{0}\cong b$. Let $c^{0}:\!\!\equiv Fa_{0}$. Next, given $a:A$ and $h:Ha\cong b$, since $H$ is fully faithful there is a unique isomorphism $g_{a,h}:a\to a_{0}$ with $Hg_{a,h}={h_{0}}^{-1}\circ h$; define $k^{0}_{a,h}:\!\!\equiv Fg_{a,h}$. Finally, if $h^{\prime}\circ Hf=h$, then ${h_{0}}^{-1}\circ h^{\prime}\circ Hf={h_{0}}^{-1}\circ h$, hence $g_{a^{\prime},h^{\prime}}\circ f=g_{a,h}$ and thus $k^{0}_{a^{\prime},h^{\prime}}\circ Ff=k^{0}_{a,h}$. Therefore, $X_{b}$ is inhabited.

Now suppose given another $(c^{1},k^{1}):X_{b}$. Then $k^{1}_{a_{0},h_{0}}:c^{0}\equiv Fa_{0}\cong c^{1}$. Since $C$ is a category, we have $p:c^{0}=c^{1}$ with $\mathsf{idtoiso}(p)=k^{1}_{a_{0},h_{0}}$. And for any $a:A$ and $h:Ha\cong b$, by 3 for $(c^{1},k^{1})$ with $f:\!\!\equiv g_{a,h}$, we have

 $k^{1}_{a,h}=k^{1}_{a_{0},h_{0}}\circ k^{0}_{a,h}={p}_{*}\mathopen{}\left({k^{0% }_{a,h}}\right)\mathclose{}$

This gives the requisite data for an equality $(c^{0},k^{0})=(c^{1},k^{1})$, completing the proof that $X_{b}$ is contractible.

Now since $X_{b}$ is contractible for each $b$, the type $\mathchoice{\prod_{b:B}\,}{\mathchoice{{\textstyle\prod_{(b:B)}}}{\prod_{(b:B)% }}{\prod_{(b:B)}}{\prod_{(b:B)}}}{\mathchoice{{\textstyle\prod_{(b:B)}}}{\prod% _{(b:B)}}{\prod_{(b:B)}}{\prod_{(b:B)}}}{\mathchoice{{\textstyle\prod_{(b:B)}}% }{\prod_{(b:B)}}{\prod_{(b:B)}}{\prod_{(b:B)}}}X_{b}$ is also contractible. In particular, it is inhabited, so we have a function assigning to each $b:B$ a $c$ and a $k$. Define $G_{0}(b)$ to be this $c$; this gives a function $G_{0}:B_{0}\to C_{0}$.

Next we need to define the action of $G$ on morphisms. For each $b,b^{\prime}:B$ and $f:\hom_{B}(b,b^{\prime})$, let $Y_{f}$ be the type whose elements consist of:

[resume]
1. 1.

A morphism $g:\hom_{C}(Gb,Gb^{\prime})$, such that

2. 2.

For each $a:A$ and $h:Ha\cong b$, and each $a^{\prime}:A$ and $h^{\prime}:Ha^{\prime}\cong b^{\prime}$, and any $\ell:\hom_{A}(a,a^{\prime})$, we have

 $(h^{\prime}\circ H\ell=f\circ h)\to(k_{a^{\prime},h^{\prime}}\circ F\ell=g% \circ k_{a,h}).$

We claim that for any $b,b^{\prime}$ and $f$, the type $Y_{f}$ is contractible. As this is a mere proposition, we may assume given $a_{0}:A$ and $h_{0}:Ha_{0}\cong b$, and each $a^{\prime}_{0}:A$ and $h^{\prime}_{0}:Ha^{\prime}_{0}\cong b^{\prime}$. Then since $H$ is fully faithful, there is a unique $\ell_{0}:\hom_{A}(a_{0},a_{0}^{\prime})$ such that $h^{\prime}_{0}\circ H\ell_{0}=f\circ h_{0}$. Define $g_{0}:\!\!\equiv k_{a_{0}^{\prime},h_{0}^{\prime}}\circ F\ell_{0}\circ{(k_{a_{% 0},h_{0}})}^{-1}$.

Now for any $a,h,a^{\prime},h^{\prime}$, and $\ell$ such that $(h^{\prime}\circ H\ell=f\circ h)$, we have ${h}^{-1}\circ h_{0}:Ha_{0}\cong Ha$, hence there is a unique $m:a_{0}\cong a$ with $Hm={h}^{-1}\circ h_{0}$ and hence $h\circ Hm=h_{0}$. Similarly, we have a unique $m^{\prime}:a_{0}^{\prime}\cong a^{\prime}$ with $h^{\prime}\circ Hm^{\prime}=h_{0}^{\prime}$. Now by 3, we have $k_{a,h}\circ Fm=k_{a_{0},h_{0}}$ and $k_{a^{\prime},h^{\prime}}\circ Fm^{\prime}=k_{a_{0}^{\prime},h_{0}^{\prime}}$. We also have

 $\displaystyle Hm^{\prime}\circ H\ell_{0}$ $\displaystyle={(h^{\prime})}^{-1}\circ h_{0}^{\prime}\circ H\ell_{0}$ $\displaystyle={(h^{\prime})}^{-1}\circ f\circ h_{0}$ $\displaystyle={(h^{\prime})}^{-1}\circ f\circ h\circ{h}^{-1}\circ h_{0}$ $\displaystyle=H\ell\circ Hm$

and hence $m^{\prime}\circ\ell_{0}=\ell\circ m$ since $H$ is fully faithful. Finally, we can compute

 $\displaystyle g_{0}\circ k_{a,h}$ $\displaystyle=k_{a_{0}^{\prime},h_{0}^{\prime}}\circ F\ell_{0}\circ{(k_{a_{0},% h_{0}})}^{-1}\circ k_{a,h}$ $\displaystyle=k_{a_{0}^{\prime},h_{0}^{\prime}}\circ F\ell_{0}\circ{Fm}^{-1}$ $\displaystyle=k_{a_{0}^{\prime},h_{0}^{\prime}}\circ{(Fm^{\prime})}^{-1}\circ F\ell$ $\displaystyle=k_{a^{\prime},h^{\prime}}\circ F\ell.$

This completes      the proof that $Y_{f}$ is inhabited. To show it is contractible, since hom-sets are sets, it suffices to take another $g_{1}:\hom_{C}(Gb,Gb^{\prime})$ satisfying 2 and show $g_{0}=g_{1}$. However, we still have our specified $a_{0},h_{0},a_{0}^{\prime},h_{0}^{\prime},\ell_{0}$ around, and 2 implies both $g_{0}$ and $g_{1}$ must be equal to $k_{a_{0}^{\prime},h_{0}^{\prime}}\circ F\ell_{0}\circ{(k_{a_{0},h_{0}})}^{-1}$.

This completes the proof that $Y_{f}$ is contractible for each $b,b^{\prime}:B$ and $f:\hom_{B}(b,b^{\prime})$. Therefore, there is a function assigning to each such $f$ its unique inhabitant; denote this function $G_{b,b^{\prime}}:\hom_{B}(b,b^{\prime})\to\hom_{C}(Gb,Gb^{\prime})$. The proof that $G$ is a functor  is straightforward; in each case we can choose $a,h$ and apply 2.

Finally, for any $a_{0}:A$, defining $c:\!\!\equiv Fa_{0}$ and $k_{a,h}:\!\!\equiv Fg$, where $g:\hom_{A}(a,a_{0})$ is the unique isomorphism with $Hg=h$, gives an element of $X_{Ha_{0}}$. Thus, it is equal to the specified one; hence $GHa=Fa$. Similarly, for $f:\hom_{A}(a_{0},a_{0}^{\prime})$ we can define an element of $Y_{Hf}$ by transporting along these equalities, which must therefore be equal to the specified one. Hence, we have $GH=F$, and thus $GH\cong F$ as desired. ∎

Therefore, if a precategory $A$ admits a weak equivalence functor $A\to\widehat{A}$, then that is its “reflection” into categories: any functor from $A$ into a category will factor essentially uniquely through $\widehat{A}$. We now give two constructions of such a weak equivalence.

###### Theorem 9.9.5.

For any precategory $A$, there is a category $\widehat{A}$ and a weak equivalence $A\to\widehat{A}$.

###### First proof.

Let $\widehat{A}_{0}:\!\!\equiv\setof{F:\mathcal{S}et^{A^{\mathrm{op}}}|\exists(a:A% ).\,(\mathbf{y}a\cong F)}$, with hom-sets inherited from $\mathcal{S}et^{A^{\mathrm{op}}}$. Then the inclusion $\widehat{A}\to\mathcal{S}et^{A^{\mathrm{op}}}$ is fully faithful and an embedding on objects. Since $\mathcal{S}et^{A^{\mathrm{op}}}$ is a category (by \autorefct:functor-cat, since $\mathcal{S}et$ is so by univalence), $\widehat{A}$ is also a category.

Let $A\to\widehat{A}$ be the Yoneda embedding. This is fully faithful by \autorefct:yoneda-embedding, and essentially surjective by definition of $\widehat{A}_{0}$. Thus it is a weak equivalence. ∎

This proof is very slick, but it has the drawback that it increases universe  level. If $A$ is a category in a universe $\mathcal{U}$, then in this proof $\mathcal{S}et$ must be at least as large as $\mathcal{S}et_{\mathcal{U}}$. Then $\mathcal{S}et_{\mathcal{U}}$ and $(\mathcal{S}et_{\mathcal{U}})^{A^{\mathrm{op}}}$ are not themselves categories in $\mathcal{U}$, but only in a higher universe, and a priori the same is true of $\widehat{A}$. One could imagine a resizing axiom that could deal with this, but it is also possible to give a direct construction using higher inductive types.

###### Second proof.

We define a higher inductive type $\widehat{A}_{0}$ with the following constructors:

• A function $i:A_{0}\to\widehat{A}_{0}$.

• For each $a,b:A$ and $e:a\cong b$, an equality $je:ia=ib$.

• For each $a:A$, an equality $j(1_{a})=\mathsf{refl}_{ia}$.

• For each $(a,b,c:A)$, $(f:a\cong b)$, and $(g:b\cong c)$, an equality $j(g\circ f)=j(f)\mathchoice{\mathbin{\raisebox{2.15pt}{\displaystyle% \centerdot}}}{\mathbin{\raisebox{2.15pt}{\centerdot}}}{\mathbin{\raisebox{1% .075pt}{\scriptstyle\,\centerdot\,}}}{\mathbin{\raisebox{0.43pt}{% \scriptscriptstyle\,\centerdot\,}}}j(g)$.

• 1-truncation: for all $x,y:\widehat{A}_{0}$ and $p,q:x=y$ and $r,s:p=q$, an equality $r=s$.

Note that for any $a,b:A$ and $p:a=b$, we have $j(\mathsf{idtoiso}(p))={i}\mathopen{}\left({p}\right)\mathclose{}$. This follows by path induction  on $p$ and the third constructor.

The type $\widehat{A}_{0}$ will be the type of objects of $\widehat{A}$; we now build all the rest of the structure  . (The following proof is of the sort that can benefit a lot from the help of a computer proof assistant: it is wide and shallow with many short cases to consider, and a large part of the work consists of writing down what needs to be checked.)

Step 1: We define a family $\hom_{\widehat{A}}:\widehat{A}_{0}\to\widehat{A}_{0}\to\set$ by double induction on $\widehat{A}_{0}$. Since \setis a 1-type, we can ignore the 1-truncation constructor. When $x$ and $y$ are of the form $ia$ and $ib$, we take $\hom_{\widehat{A}}(ia,ib):\!\!\equiv\hom_{A}(a,b)$. It remains to consider all the other possible pairs of constructors.

Let us keep $x=ia$ fixed at first. If $y$ varies along the identity   $je:ib=ib^{\prime}$, for some $e:b\cong b^{\prime}$, we require an identity $\hom_{A}(a,b)=\hom_{A}(a,b^{\prime})$. By univalence, it suffices to give an equivalence $\hom_{A}(a,b)\simeq\hom_{A}(a,b^{\prime})$. We take this to be the function $(e\circ\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}):\hom_{A}(a,b)\to\hom_{A}(a% ,b^{\prime})$. To see that this is an equivalence, we give its inverse    as $({e}^{-1}\circ\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt})$, with witnesses to inversion coming from the fact that ${e}^{-1}$ is the inverse of $e$ in $A$.

As $y$ varies along the identity $j(1_{b})=\mathsf{refl}_{ib}$, we require an identity $(1_{b}\circ\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt})=\mathsf{refl}_{\hom_{A% }(a,b)}$; this follows from the identity axiom $1_{b}\circ g=g$ of a precategory. Similarly, as $y$ varies along the identity $j(g\circ f)=j(f)\mathchoice{\mathbin{\raisebox{2.15pt}{\displaystyle% \centerdot}}}{\mathbin{\raisebox{2.15pt}{\centerdot}}}{\mathbin{\raisebox{1% .075pt}{\scriptstyle\,\centerdot\,}}}{\mathbin{\raisebox{0.43pt}{% \scriptscriptstyle\,\centerdot\,}}}j(g)$, we require an identity $((g\circ f)\circ\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt})=(g\circ(f\circ% \mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}))$, which follows from associativity.

Now we consider the other constructors for $x$. Say that $x$ varies along the identity $j(e):ia=ia^{\prime}$, for some $e:a\cong a^{\prime}$; we again must deal with all the constructors for $y$. If $y$ is $ib$, then we require an identity $\hom_{A}(a,b)=\hom_{A}(a^{\prime},b)$. By univalence, this may come from an equivalence, and for this we can use $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ{e}^{-1})$, with inverse $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ e)$.

Still with $x$ varying along $j(e)$, suppose now that $y$ also varies along $j(f)$ for some $f:b\cong b^{\prime}$. Then we need to know that the two concatenated identities

 $\displaystyle\hom_{A}(a,b)=\hom_{A}(a^{\prime},b)=\hom_{A}(a^{\prime},b^{% \prime})\mathrlap{\qquad\text{and}}$ $\displaystyle\hom_{A}(a,b)=\hom_{A}(a,b^{\prime})=\hom_{A}(a^{\prime},b^{% \prime})$

are identical. This follows from associativity: $(f\circ\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt})\circ{e}^{-1}=f\circ(% \mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ{e}^{-1})$. The other two constructors for $y$ are trivial, since they are 2-fold equalities in sets.

For the next two constructors of $x$, all but the first constructor for $y$ is likewise trivial. When $x$ varies along $j(1_{a})=\mathsf{refl}_{ia}$ and $y$ is $ib$, we use the identity axiom again. Similarly, when $x$ varies along $j(g\circ f)=j(f)\mathchoice{\mathbin{\raisebox{2.15pt}{\displaystyle% \centerdot}}}{\mathbin{\raisebox{2.15pt}{\centerdot}}}{\mathbin{\raisebox{1% .075pt}{\scriptstyle\,\centerdot\,}}}{\mathbin{\raisebox{0.43pt}{% \scriptscriptstyle\,\centerdot\,}}}j(g)$, we use associativity again. This completes the construction of $\hom_{\widehat{A}}:\widehat{A}_{0}\to\widehat{A}_{0}\to\set$.

Step 2: We give the precategory structure on $\widehat{A}$, always by induction on $\widehat{A}_{0}$. We are now eliminating into sets (the hom-sets of $\widehat{A}$), so all but the first two constructors are trivial to deal with.

For identities, if $x$ is $ia$ then we have $\hom_{\widehat{A}}(x,x)\equiv\hom_{A}(a,a)$ and we define $1_{x}:\!\!\equiv 1_{ia}$. If $x$ varies along $je$ for $e:a\cong a^{\prime}$, we must show that $\mathsf{transport}^{x\mapsto\hom_{\widehat{A}}(x,x)}(je,1_{ia})=1_{ia^{\prime}}$. But by definition of $\hom_{\widehat{A}}$, transporting along $je$ is given by composing with $e$ and ${e}^{-1}$, and we have $e\circ 1_{ia}\circ{e}^{-1}=1_{ia^{\prime}}$.

For composition  , if $x,y,z$ are $ia,ib,ic$ respectively, then $\hom_{\widehat{A}}$ reduces to $\hom_{A}$ and we can define composition in $\widehat{A}$ to be composition in $A$. And when $x$, $y$, or $z$ varies along $je$, then we verify the following equalities:

 $\displaystyle e\circ(g\circ f)$ $\displaystyle=(e\circ g)\circ f,$ $\displaystyle g\circ f$ $\displaystyle=(g\circ{e}^{-1})\circ(e\circ f),$ $\displaystyle(g\circ f)\circ{e}^{-1}$ $\displaystyle=g\circ(f\circ{e}^{-1}).$

Finally, the associativity and unitality axioms are mere propositions, so all constructors except the first are trivial. But in that case, we have the corresponding axioms in $A$.

Step 3: We show that $\widehat{A}$ is a category. That is, we must show that for all $x,y:\widehat{A}$, the function $\mathsf{idtoiso}:(x=y)\to(x\cong y)$ is an equivalence. First we define, for all $x,y:\widehat{A}$, a function $k_{x,y}:(x\cong y)\to(x=y)$ by induction. As before, since our goal is a set, it suffices to deal with the first two constructors.

When $x$ and $y$ are $ia$ and $ib$ respectively, we have $\hom_{\widehat{A}}(ia,ib)\equiv\hom_{A}(a,b)$, with composition and identities inherited as well, so that $(ia\cong ib)$ is equivalent     to $(a\cong b)$. But now we have the constructor $j:(a\cong b)\to(ia=ib)$.

Next, if $y$ varies along $j(e)$ for some $e:b\cong b^{\prime}$, we must show that for $f:a\cong b$ we have $j({j(e)}_{*}\mathopen{}\left({f}\right)\mathclose{})=j(f)\mathchoice{\mathbin{% \raisebox{2.15pt}{\displaystyle\centerdot}}}{\mathbin{\raisebox{2.15pt}{% \centerdot}}}{\mathbin{\raisebox{1.075pt}{\scriptstyle\,\centerdot\,}}}{% \mathbin{\raisebox{0.43pt}{\scriptscriptstyle\,\centerdot\,}}}j(e)$. But by definition of $\hom_{\widehat{A}}$ on equalities, transporting along $j(e)$ is equivalent to post-composing with $e$, so this equality follows from the last constructor of $\widehat{A}_{0}$. The remaining case when $x$ varies along $j(e)$ for $e:a\cong a^{\prime}$ is similar. This completes the definition of $k:\mathchoice{\prod_{x,y:\widehat{A}_{0}}\,}{\mathchoice{{\textstyle\prod_{(x,% y:\widehat{A}_{0})}}}{\prod_{(x,y:\widehat{A}_{0})}}{\prod_{(x,y:\widehat{A}_{% 0})}}{\prod_{(x,y:\widehat{A}_{0})}}}{\mathchoice{{\textstyle\prod_{(x,y:% \widehat{A}_{0})}}}{\prod_{(x,y:\widehat{A}_{0})}}{\prod_{(x,y:\widehat{A}_{0}% )}}{\prod_{(x,y:\widehat{A}_{0})}}}{\mathchoice{{\textstyle\prod_{(x,y:% \widehat{A}_{0})}}}{\prod_{(x,y:\widehat{A}_{0})}}{\prod_{(x,y:\widehat{A}_{0}% )}}{\prod_{(x,y:\widehat{A}_{0})}}}(x\cong y)\to(x=y)$.

Now one thing we must show is that if $p:x=y$, then $k(\mathsf{idtoiso}(p))=p$. By induction on $p$, we may assume it is $\mathsf{refl}_{x}$, and hence $\mathsf{idtoiso}(p)\equiv 1_{x}$. Now we argue by induction on $x:\widehat{A}_{0}$, and since our goal is a mere proposition (since $\widehat{A}_{0}$ is a 1-type), all constructors except the first are trivial. But if $x$ is $ia$, then $k(1_{ia})\equiv j(1_{a})$, which is equal to $\mathsf{refl}_{ia}$ by the third constructor of $\widehat{A}_{0}$.

To complete the proof that $\widehat{A}$ is a category, we must show that if $f:x\cong y$, then $\mathsf{idtoiso}(k(f))=f$. By induction we may assume that $x$ and $y$ are $ia$ and $ib$ respectively, in which case $f$ must arise from an isomorphism $g:a\cong b$ and we have $k(f)\equiv j(g)$. However, for any $p$ we have $\mathsf{idtoiso}(p)={p}_{*}\mathopen{}\left({1}\right)\mathclose{}$, so in particular $\mathsf{idtoiso}(j(g))={j(g)}_{*}\mathopen{}\left({1_{ia}}\right)\mathclose{}$. And by definition of $\hom_{\widehat{A}}$ on equalities, this is given by composing $1_{ia}$ with the equivalence $g$, hence is equal to $g$.

Note the similarity of this step to the encode-decode method used in \autorefsec:compute-coprod,sec:compute-nat,cha:homotopy   . Once again we are characterizing the identity types of a higher inductive type (here, $\widehat{A}_{0}$) by defining recursively a family of codes (here, $(x,y)\mapsto(x\cong y)$) and encoding and decoding functions by induction on $\widehat{A}_{0}$ and on paths.

Step 4: We define a weak equivalence $I:A\to\widehat{A}$. We take $I_{0}:\!\!\equiv i:A_{0}\to\widehat{A}_{0}$, and by construction of $\hom_{\widehat{A}}$ we have functions $I_{a,b}:\hom_{A}(a,b)\to\hom_{\widehat{A}}(Ia,Ib)$ forming a functor $I:A\to\widehat{A}$. This functor is fully faithful by construction, so it remains to show it is essentially surjective. That is, for all $x:\widehat{A}$ we want there to merely exist an $a:A$ such that $Ia\cong x$. As always, we argue by induction on $x$, and since the goal is a mere proposition, all but the first constructor are trivial. But if $x$ is $ia$, then of course we have $a:A$ and $Ia\equiv ia$, hence $Ia\cong ia$. (Note that if we were trying to prove $I$ to be split essentially surjective, we would be stuck, because we know nothing about equalities in $A_{0}$ and thus have no way to deal with any further constructors.) ∎

We call the construction $A\mapsto\widehat{A}$ the Rezk completion, although there is also an argument (coming from higher topos semantics) for calling it the stack completion.

We have seen that most precategories arising in practice are categories, since they are constructed from $\mathcal{S}et$, which is a category by the univalence axiom. However, there are a few cases in which the Rezk completion is necessary to obtain a category.

###### Example 9.9.6.

Recall from \autorefct:fundgpd that for any type $X$ there is a pregroupoid with $X$ as its type of objects and $\hom(x,y):\!\!\equiv\mathopen{}\left\|x=y\right\|_{0}\mathclose{}$. Its Rezk completion is the fundamental groupoid    of $X$. Recalling that groupoids      are equivalent to 1-types, it is not hard to identify this groupoid with $\mathopen{}\left\|X\right\|_{1}\mathclose{}$.

###### Example 9.9.7.

Recall from \autorefct:hoprecat that there is a precategory whose type of objects is $\mathcal{U}$ and with $\hom(X,Y):\!\!\equiv\mathopen{}\left\|X\to Y\right\|_{0}\mathclose{}$. Its Rezk completion may be called the homotopy category of types. Its type of objects can be identified with $\mathopen{}\left\|\mathcal{U}\right\|_{1}\mathclose{}$ (see \autorefct:ex:hocat).

The Rezk completion also allows us to show that the notion of “category” is determined by the notion of “weak equivalence of precategories”. Thus, insofar as the latter is inevitable, so is the former.

###### Theorem 9.9.8.

A precategory $C$ is a category if and only if for every weak equivalence of precategories $H:A\to B$, the induced functor $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ H):C^{B}\to C^{A}$ is an isomorphism of precategories.

###### Proof.

“Only if” is \autorefct:cat-weq-eq. In the other direction, let $H$ be $I:A\to\widehat{A}$. Then since $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ I)_{0}$ is an equivalence, there exists $R:\widehat{A}\to A$ such that $RI=1_{A}$. Hence $IRI=I$, but again since $(\mathord{\hskip 1.0pt\text{--}\hskip 1.0pt}\circ I)_{0}$ is an equivalence, this implies $IR=1_{\widehat{A}}$. By \autorefct:isoprecatLABEL:item:ct:ipc3, $I$ is an isomorphism of precategories. But then since $\widehat{A}$ is a category, so is $A$. ∎

Title 9.9 The Rezk completion
\metatable