open import 1Lab.Reflection.Marker
open import 1Lab.HLevel.Closure
open import 1Lab.Path.Groupoid
open import 1Lab.Type.Sigma
open import 1Lab.Univalence
open import 1Lab.HLevel
open import 1Lab.Equiv
open import 1Lab.Path
open import 1Lab.Type

module 1Lab.Equiv.HalfAdjoint where


An adjoint equivalence is an isomorphism where the homotopies ( satisfy the triangle identities, thus witnessing and as adjoint functors. In Homotopy Type Theory, we can use a half adjoint equivalence - satisfying only one of the triangle identities - as a good notion of equivalence.

is-half-adjoint-equiv : β {ββ ββ} {A : Type ββ} {B : Type ββ} (f : A β B) β Type _
is-half-adjoint-equiv {A = A} {B = B} f =
Ξ£[ g β (B β A) ]
Ξ£[ Ξ· β ((x : A) β g (f x) β‘ x) ]
Ξ£[ Ξ΅ β ((y : B) β f (g y) β‘ y) ]
((x : A) β ap f (Ξ· x) β‘ Ξ΅ (f x))


The argument is an adaptation of a standard result of both category theory and homotopy theory - where we can βimproveβ an equivalence of categories into an adjoint equivalence, or a homotopy equivalence into a strong homotopy equivalence (Vogtβs lemma). In HoTT, we show this synthetically for equivalences between

is-isoβis-half-adjoint-equiv
: β {ββ ββ} {A : Type ββ} {B : Type ββ} {f : A β B}
β is-iso f β is-half-adjoint-equiv f
is-isoβis-half-adjoint-equiv {A = A} {B} {f} iiso =
g , Ξ· , Ξ΅' , Ξ» x β sym (zig x)
where
open is-iso iiso renaming (inv to g ; linv to Ξ· ; rinv to Ξ΅)


For and we can take the values provided by is-iso. However, if we want to satisfy the triangle identities, we can not in general take We can, however, alter it like thus:

    Ξ΅' : (y : B) β f (g y) β‘ y
Ξ΅' y = sym (Ξ΅ (f (g y))) β ap f (Ξ· (g y)) β Ξ΅ y


Drawn as a diagram, the path above factors like:

There is a great deal of redundancy in this definition, given that and have the same boundary! The point is that while the definition of is entirely opaque to us, is written in such a way that we can use properties of paths to make the and cancel:

    zig : (x : A) β Ξ΅' (f x) β‘ ap f (Ξ· x)
zig x =
sym (Ξ΅ (f (g (f x))))  β ap f β (Ξ· (g (f x))) β β Ξ΅ (f x)   β‘β¨ ap (Ξ» e β sym (Ξ΅ _) β ap f e β Ξ΅ _) (homotopy-invert Ξ·) β©β‘
sym (Ξ΅ (f (g (f x))))  β β ap (f β g β f) (Ξ· x) β Ξ΅ (f x) β β‘Λβ¨ apΒ‘ (homotopy-natural Ξ΅ _) β©β‘Λ
sym (Ξ΅ (f (g (f x))))  β Ξ΅ (f (g (f x)))      β ap f (Ξ· x)  β‘β¨ β-cancell (Ξ΅ (f (g (f x)))) (ap f (Ξ· x)) β©β‘
ap f (Ξ· x)                                                  β


The notion of half-adjoint equivalence is a useful stepping stone in writing a more comprehensible proof that isomorphisms are equivalences. Since this result is fundamental, the proof we actually use is written with efficiency of computation in mind - hence, cubically. The proof here is intended to be more educational.

First, we give an equivalent characterisation of paths in fibres, which will be used in proving that half adjoint equivalences are equivalences.

fibre-paths : β {ββ ββ} {A : Type ββ} {B : Type ββ} {f : A β B} {y : B}
β {f1 f2 : fibre f y}
β (f1 β‘ f2)
β (Ξ£[ Ξ³ β f1 .fst β‘ f2 .fst ] (ap f Ξ³ β f2 .snd β‘ f1 .snd))

The proof of this is not very enlightening, but itβs included here (rather than being completely invisible) for completeness:
fibre-paths {f = f} {y} {f1} {f2} =
Path (fibre f y) f1 f2                                                       ββ¨ IsoβEquiv Ξ£-path-iso eβ»ΒΉ β©β
(Ξ£[ Ξ³ β f1 .fst β‘ f2 .fst ] (subst (Ξ» xβ β f xβ β‘ _) Ξ³ (f1 .snd) β‘ f2 .snd)) ββ¨ Ξ£-ap-snd (Ξ» x β pathβequiv (lemma x)) β©β
(Ξ£[ Ξ³ β f1 .fst β‘ f2 .fst ] (ap f Ξ³ β f2 .snd β‘ f1 .snd))                    ββ
where
helper : (p' : f (f1 .fst) β‘ y)
β (subst (Ξ» x β f x β‘ y) refl (f1 .snd) β‘ p')
β‘ (ap f refl β p' β‘ f1 .snd)
helper p' =
subst (Ξ» x β f x β‘ y) refl (f1 .snd) β‘ p' β‘β¨ apβ _β‘_ (transport-refl _) refl β©β‘
(f1 .snd) β‘ p'                            β‘β¨ IsoβPath (sym , iso sym (Ξ» x β refl) (Ξ» x β refl)) β©β‘
β p' β β‘ f1 .snd                          β‘Λβ¨ apΒ‘ (β-idl _) β©β‘Λ
refl β p' β‘ f1 .snd                       β‘β¨β©
ap f refl β p' β‘ f1 .snd                  β

lemma : β {x'} {p'} β (Ξ³ : f1 .fst β‘ x')
β (subst (Ξ» x β f x β‘ _) Ξ³ (f1 .snd) β‘ p')
β‘ (ap f Ξ³ β p' β‘ f1 .snd)
lemma {x'} {p'} p =
J (Ξ» x' Ξ³ β β p' β (subst (Ξ» x β f x β‘ _) Ξ³ (f1 .snd) β‘ p')
β‘ (ap f Ξ³ β p' β‘ f1 .snd))
helper p p'


Then, given an element we can construct a fibre of of and, using the above characterisation of paths, prove that this fibre is a centre of contraction:

is-half-adjoint-equivβis-equiv
: β {ββ ββ} {A : Type ββ} {B : Type ββ} {f : A β B}
β is-half-adjoint-equiv f β is-equiv f
is-half-adjoint-equivβis-equiv {A = A} {B} {f} (g , Ξ· , Ξ΅ , zig) .is-eqv y = contr fib contract where
fib : fibre f y
fib = g y , Ξ΅ y


The fibre is given by which we can prove identical to another using a very boring calculation:

  contract : (fibβ : fibre f y) β fib β‘ fibβ
contract (x , p) = (fibre-paths eβ»ΒΉ) .fst (xβ‘gy , path) where
xβ‘gy = ap g (sym p) β Ξ· x

path : ap f (ap g (sym p) β Ξ· x) β p β‘ Ξ΅ y
path =
ap f (ap g (sym p) β Ξ· x) β p                   β‘β¨ apβ _β_ (ap-β f (ap g (sym p)) (Ξ· x)) refl β sym (β-assoc _ _ _) β©β‘
ap (Ξ» x β f (g x)) (sym p) β β ap f (Ξ· x) β β p β‘β¨ ap! (zig _) β©β‘ -- by the triangle identity
ap (f β g) (sym p) β β Ξ΅ (f x) β p β            β‘β¨ ap! (homotopy-natural Ξ΅ p)  β©β‘ -- by naturality of Ξ΅


The calculation of path factors as a bunch of boring adjustments to paths using the groupoid structure of types, and the two interesting steps above: The triangle identity says that and naturality of lets us βpush it past β to get something we can cancel:

      ap (f β g) (sym p) β ap (f β g) p β Ξ΅ y     β‘β¨ β-assoc _ _ _ β©β‘
β ap (f β g) (sym p) β ap (f β g) p β β Ξ΅ y β‘Λβ¨ apΒ‘ (ap-β (f β g) (sym p) p) β©β‘Λ
ap (f β g) β sym p β p β β Ξ΅ y              β‘β¨ ap! (β-invr _) β©β‘
ap (f β g) refl β Ξ΅ y                       β‘β¨β©
refl β Ξ΅ y                                  β‘β¨ β-idl (Ξ΅ y) β©β‘
Ξ΅ y                                         β


Putting these together, we get an alternative definition of is-isoβis-equiv:

is-isoβis-equiv'
: β {ββ ββ} {A : Type ββ} {B : Type ββ} {f : A β B}
β is-iso f β is-equiv f

_ = is-isoβis-equiv