Make parameter to monad equivalence explicit

This commit is contained in:
Frederik Hanghøj Iversen 2018-03-14 11:20:07 +01:00
parent 7aec22b30a
commit 360e2b95dd
2 changed files with 18 additions and 10 deletions

View file

@ -39,7 +39,7 @@ module Monoidal = Cat.Category.Monad.Monoidal
module Kleisli = Cat.Category.Monad.Kleisli module Kleisli = Cat.Category.Monad.Kleisli
-- | The monoidal- and kleisli presentation of monads are equivalent. -- | The monoidal- and kleisli presentation of monads are equivalent.
module _ {a b : Level} { : Category a b} where module _ {a b : Level} ( : Category a b) where
private private
module = Category module = Category
open using (Object ; Arrow ; 𝟙 ; _∘_ ; _>>>_) open using (Object ; Arrow ; 𝟙 ; _∘_ ; _>>>_)

View file

@ -21,7 +21,7 @@ open import Cat.Categories.Fun
-- Utilities -- Utilities
module _ {a b : Level} {A : Set a} {B : Set b} where module _ {a b : Level} {A : Set a} {B : Set b} where
module _ (e : A B) where module Equivalence (e : A B) where
obverse : A B obverse : A B
obverse = proj₁ e obverse = proj₁ e
@ -145,13 +145,25 @@ module voe {a b : Level} ( : Category a b) where
; isMnd = K.Monad.isMonad m ; isMnd = K.Monad.isMonad m
} }
-- | In the following we seek to transform the equivalence `Monoidal≃Kleisli`
-- | to talk about voevodsky's construction.
module _ (omap : Omap ) (pure : {X : Object} Arrow X (omap X)) where module _ (omap : Omap ) (pure : {X : Object} Arrow X (omap X)) where
private private
-- Could just open this module and rename stuff accordingly, but as
-- documentation I will put in the type-annotations here.
module E = Equivalence (Monoidal≃Kleisli )
Monoidal→Kleisli : M.Monad K.Monad Monoidal→Kleisli : M.Monad K.Monad
Monoidal→Kleisli = proj₁ Monoidal≃Kleisli Monoidal→Kleisli = E.obverse
Kleisli→Monoidal : K.Monad M.Monad Kleisli→Monoidal : K.Monad M.Monad
Kleisli→Monoidal = inverse Monoidal≃Kleisli Kleisli→Monoidal = E.reverse
ve-re : Kleisli→Monoidal Monoidal→Kleisli Function.id
ve-re = E.verso-recto
re-ve : Monoidal→Kleisli Kleisli→Monoidal Function.id
re-ve = E.recto-verso
forth : §2-3.§1 omap pure §2-3.§2 omap pure forth : §2-3.§1 omap pure §2-3.§2 omap pure
forth = §2-fromMonad Monoidal→Kleisli §2-3.§1.toMonad forth = §2-fromMonad Monoidal→Kleisli §2-3.§1.toMonad
@ -185,11 +197,9 @@ module voe {a b : Level} ( : Category a b) where
) m ≡⟨⟩ -- fromMonad and toMonad are inverses ) m ≡⟨⟩ -- fromMonad and toMonad are inverses
m m
where where
ve-re : Monoidal→Kleisli Kleisli→Monoidal Function.id
ve-re = {!recto-verso Monoidal≃Kleisli!}
t' : ((Monoidal→Kleisli Kleisli→Monoidal) §2-3.§2.toMonad {omap} {pure}) t' : ((Monoidal→Kleisli Kleisli→Monoidal) §2-3.§2.toMonad {omap} {pure})
§2-3.§2.toMonad §2-3.§2.toMonad
t' = cong (\ φ φ §2-3.§2.toMonad) ve-re t' = cong (\ φ φ §2-3.§2.toMonad) {!re-ve!}
cong-d : {} {A : Set } {'} {B : A Set '} {x y : A} cong-d : {} {A : Set } {'} {B : A Set '} {x y : A}
(f : (x : A) B x) (eq : x y) PathP (\ i B (eq i)) (f x) (f y) (f : (x : A) B x) (eq : x y) PathP (\ i B (eq i)) (f x) (f y)
cong-d f p = λ i f (p i) cong-d f p = λ i f (p i)
@ -226,12 +236,10 @@ module voe {a b : Level} ( : Category a b) where
) m ≡⟨⟩ -- fromMonad and toMonad are inverses ) m ≡⟨⟩ -- fromMonad and toMonad are inverses
m m
where where
re-ve : Kleisli→Monoidal Monoidal→Kleisli Function.id
re-ve = verso-recto Monoidal≃Kleisli
t : §1-fromMonad Kleisli→Monoidal Monoidal→Kleisli §2-3.§1.toMonad t : §1-fromMonad Kleisli→Monoidal Monoidal→Kleisli §2-3.§1.toMonad
§1-fromMonad §2-3.§1.toMonad §1-fromMonad §2-3.§1.toMonad
-- Why does `re-ve` not satisfy this goal? -- Why does `re-ve` not satisfy this goal?
t = cong (λ φ §1-fromMonad φ §2-3.§1.toMonad) ({!re-ve!}) t = cong (λ φ §1-fromMonad φ §2-3.§1.toMonad) ({!ve-re!})
voe-isEquiv : isEquiv (§2-3.§1 omap pure) (§2-3.§2 omap pure) forth voe-isEquiv : isEquiv (§2-3.§1 omap pure) (§2-3.§2 omap pure) forth
voe-isEquiv = gradLemma forth back forthEq backEq voe-isEquiv = gradLemma forth back forthEq backEq