# Lecture 2: Equivalences

Recall that

$IsContr \, A ≝ \sum\limits_{ x:A } \prod_{y:A} x =_A y \\ IsHProp \, A ≃ \prod_{x, y: A} x =_A y \quad\text{(mere proposition)}$

# Equivalences

• $A ≃ B$
• $f: A ⟶ B$

$IsEquiv \, f$ is a mere proposition.

## First attempt at defining an equivalence

Quasi-inverse:

$Q_{inv}(f: A ⟶ B) ≝ \lbrace q_{inv}: B ⟶ A, \\ q_{sect} = \prod_x q_{inv}(f \, x) = x \\ q_{retr} = \prod_y f(q_{inv} \, y) = y \rbrace$

But the definition, is not quite accurate, because

• you can go from $x$ to $x$ by composing $f$ and its inverse
• and there’s no way to tell this path from $x$ to $x$ is $refl_x$

so it’s not a proposition

## Correct definition

$ap \, f: x=y ⟶ fx = fy$ $IsEquiv \, f ≝ \lbrace \\ g ≝ einv: B ⟶ A, \\ η ≝ esect : ∀x. einv(f \, x)=x \\ ε ≝ eretr: ∀y. f(einv \, y)=y \\ τ ≝ eadj: ∀x:A, ap f (esect \, x) = eretr(g \, x) \rbrace$

NB: By abuse of notation, we write $f(η \, x) = ε(g \, x)$

instead of $ap\, f(η \, x) = ε(g \, x)$

In category theoretical terms: we have a half-adjunction (half-adjoint equivalence): we ensure that one of the triangles commute

But that’s not a big deal, we can recover the other one:

$eadj': ∀y:B, ap \, g (eretr \, y) = esect ( f \, y)$

What’s funny is that if we add $eadj’$ to the definition, we no longer have a proposition. So we don’t add it, and show that we can obtain it:

Naturality of $H$:

• $f, g: A ⟶ B$
• $p: x =_A y$
• $H: ∀x. f x = g x$
$\begin{xy} \xymatrix{ f(x) \ar[r]^{f(p)} \ar[d]_{H(x)} & f(y) \ar[d]^{H(y)} \\ g(x) \ar[r]_{g(p)} & g(y) } \end{xy}$ $H(x) @ g p = f(p) @ H(y)$ $H(x) = H(x) @ g (refl_x) = f (refl_x) @ H(x) = H(x)$

Corollary: with $p = H(x)$

• $f: A ⟶ A$
• $H: f \sim id ≡ ∀x. fx = x$
• $f (H \, x) = H(f \, x): f(f \, x) = f \, x$
$\begin{xy} \xymatrix{ f(fx) \ar[r]^{f(H x)} \ar[d]_{H(f\, x)} & f(x) \ar[d]^{H(x)} \\ id(f x) \ar[r]_{id(H x)} & x } \end{xy}$
• $p ≝ εy$
• $H ≝ ε: f g \sim id$
• $x = fgy$
$\begin{xy} \xymatrix{ gfg(x) \ar[r]^{gfg(εy)} \ar[d]_{gε(fgy)} & gfg(y) \ar[d]^{gε(y)} \\ g(f g y) \ar[r]_{g(εy)} & g(y) } \end{xy}$

and we have a similar square for the unit $η$.

• HoTT quasi-inverses are similar to categorical equivalences
• HoTT equivalences are similar to categorical adjoints
$\begin{cases} Q_{inv} \, f &⟶ IsEquiv \, f \\ (g, η, ε) &\mapsto (g, η, ε', τ) \end{cases}$ $ε'(b) = ε(f g (b))^{-1} @ f η (g b) @ ε b$ τ(b): \begin{align*} f(η x) & = ε(fgfx)^{-1} @ fg(gf x) @ ε(fx) \\ \end{align*}

NB: beware, $(g, η, ε’, τ)$ is a dependent tuple (each coordinate depends on the previous ones), to show an equality between two such tuples, one has to do it up to transport for second coordinates (and those coming after).

Recall that

Fixpoint IsTrunc n A := match n with
| 0 => IsContr A
| S n => forall x y:A, IsTrunc n (x=y)
end.


Now, we will relate the equivalence with contractibility.

# Equivalence VS Contractibility

## Homotopy fibers

• $f: A ⟶ B$
• $y: B$
Fiber of $f$ over $y$:
$fib_f \, y ≝ \sum\limits_{ x:A } fx = y$
• $x:A$
• Is contractible: $\sum\limits_{ y:A } x=y$
$\sum\limits_{ y:B } fib_f \, y ≡ \sum\limits_{ y:B } \sum\limits_{ x:A } f x = y\\ ≃ \sum\limits_{ x:A } \sum\limits_{ y:B } f x = y\\ ≃ \sum\limits_{ x:A } A ≃ A$ $\begin{cases} IsEquiv \, f &⟶ IsContr(fib_f \, y) \\ (g, η, ε, τ) &\mapsto ((gy, εy); ⋯) \end{cases}$

We want to show

$(x, e) = (gy, εy)$

for $x: A, \; e: fx=y$

That is:

• $x = gy$

• $y \overset{e^{-1}}{=} f x = f(gy) \overset{ε(y)}{=} y$
• then the other equality up to transport

Then, conversely:

$IsContr(fib_f \, y) ⟶ IsEquiv \, f$

is inhabited (cf. Trunc.v Coq file)

In fact, we even have:

$IsContr(fib_f \, y) ≃ IsEquiv \, f$

To prove that, we resort to a trick consisting in rewriting what it means to be an equivalence:

Right invertible:
$rinv \, f ≝ \sum\limits_{ g:B ⟶ A } ∀y. fg(y)=y$

So that

$IsEquiv \, f = \sum\limits_{ (g, ε): rinv \, f } rcoh_f(g, ε)$

where

$rcoh_f(g, ε) ≡ \sum\limits_{ η: \prod\limits_{ x } gfx=x } \prod\limits_{ x } f(η x) = ε(f x)$

Indeed:

$rinv \, f ≃ \sum\limits_{ g: B ⟶ A } fg = id ≡ fib_{f \circ \_} \, id$

So

$IsEquiv \, f ≃ IsEquiv (f \circ \_)$

and

$IsEquiv \, f ≃ IsContr \, (rinv \, f)$

On top of that:

$rcoh_f(g, ε) ≃ \prod\limits_{ x:A } (gfx, εfx) =_{fib_f \, fx} (x, refl_x)$

But the fiber over an equivalence $fib_f \, (fx)$ is contractible (as we’ve seen before), and

$IsContr \, A ⟶ ∀x, y:A. IsContr \, (x=_A y)$

Therefore

$rcoh_f(g, ε) ≃ \underbrace{\prod\limits_{ x:A } (gfx, εfx) =_{fib_f \, fx} (x, refl_x)}_{\text{ is contractible}}$

and that’s it! We have

$IsEquiv \, f$

# Functional extensionality as an Equivalence

$apD10: f=g ⟶ ∀x, fx = gx$

By path induction, with $λx. refl_{f(x)}: ∀x, fx=fx$

$FunExt: IsEquiv \, (apD10 \, f \, g)$

But by defining

$BadFunExt: \prod\limits_{ x } fx = gx ⟶ f =g$

then

$BadFunExt \, (λx. refl_{f(x)}) ≠ refl_g$

Whereas:

$(e\_inv \; apD10)(apD10 \, e) = e \quad\text{(with the section of the equivalence)}$

with

$(e\_inv \; apD10)(apD10 \, refl_g) = refl_g$

so that

$(e\_inv \; apD10) \, (λx. refl_{f(x)}) ≠ refl_g$

Moreover, the retraction of the equivalence gives us:

$apD10 \; (e\_inv \; apD10 \, e) = e: ∀x. fx=gx$

# Univalence

Expressing it like

$A ≃ B ⟶ A = B$

$A=B \overset{eq\_to\_equiv}{⟶} A≃B$

If you don’t state it with an equivalence, you’re not sure that $refl$ is sent to the canonical $Equiv_id \, A$

Univalence:

for all $A, B: Type$:

$IsEquiv \; (eq\_to\_equiv \, A \, B)$

Tags:

Updated: