Use different name for function composition

This commit is contained in:
Frederik Hanghøj Iversen 2018-03-08 00:22:55 +01:00
parent 36cbe711fb
commit c8fef1d2b5

View file

@ -4,7 +4,6 @@ module Cat.Category.Monad where
open import Agda.Primitive
open import Data.Product
open import Function renaming (_∘_ to _∘f_) using (_$_)
open import Cubical
open import Cubical.NType.Properties using (lemPropF ; lemSig ; lemSigP)
@ -689,10 +688,11 @@ module _ {a b : Level} { : Category a b} where
private
= a b
module = Category
open using (Object ; Arrow ; _∘_)
open using (Object ; Arrow)
open NaturalTransformation
module M = Monoidal
module K = Kleisli
open import Function using (_∘_ ; _$_)
module _ (omap : Omap ) (pure : {X : Object} Arrow X (omap X)) where
open voe-2-3 omap pure
@ -728,23 +728,23 @@ module _ {a b : Level} { : Category a b} where
Kleisli→Monoidal = inverse Monoidal≃Kleisli
forth : voe-2-3-1 voe-2-3-2
forth = voe-2-3-2-fromMonad f Monoidal→Kleisli f voe-2-3-1.toMonad
forth = voe-2-3-2-fromMonad Monoidal→Kleisli voe-2-3-1.toMonad
back : voe-2-3-2 voe-2-3-1
back = voe-2-3-1-fromMonad f Kleisli→Monoidal f voe-2-3-2.toMonad
back = voe-2-3-1-fromMonad Kleisli→Monoidal voe-2-3-2.toMonad
Voe-2-3-1-inverse = (toMonad f fromMonad) Function.id
Voe-2-3-1-inverse = (toMonad fromMonad) Function.id
where
fromMonad : (m : M.Monad) voe-2-3.voe-2-3-1 (M.Monad.Romap m) (λ {X} M.Monad.pureT m X)
fromMonad = voe-2-3-1-fromMonad
toMonad : {omap} {pure : {X : Object} Arrow X (omap X)} voe-2-3.voe-2-3-1 omap pure M.Monad
toMonad = voe-2-3.voe-2-3-1.toMonad
-- voe-2-3-1-inverse : (voe-2-3.voe-2-3-1.toMonad ∘f voe-2-3-1-fromMonad) ≡ Function.id
-- voe-2-3-1-inverse : (voe-2-3.voe-2-3-1.toMonad ∘ voe-2-3-1-fromMonad) ≡ Function.id
voe-2-3-1-inverse : Voe-2-3-1-inverse
voe-2-3-1-inverse = refl
Voe-2-3-2-inverse = (toMonad f fromMonad) Function.id
Voe-2-3-2-inverse = (toMonad fromMonad) Function.id
where
fromMonad : (m : K.Monad) voe-2-3.voe-2-3-2 (K.Monad.omap m) (K.Monad.pure m)
fromMonad = voe-2-3-2-fromMonad
@ -756,77 +756,77 @@ module _ {a b : Level} { : Category a b} where
forthEq' : m _ _
forthEq' m = begin
(forth f back) m ≡⟨⟩
(forth back) m ≡⟨⟩
-- In full gory detail:
( voe-2-3-2-fromMonad
f Monoidal→Kleisli
f voe-2-3.voe-2-3-1.toMonad
f voe-2-3-1-fromMonad
f Kleisli→Monoidal
f voe-2-3.voe-2-3-2.toMonad
Monoidal→Kleisli
voe-2-3.voe-2-3-1.toMonad
voe-2-3-1-fromMonad
Kleisli→Monoidal
voe-2-3.voe-2-3-2.toMonad
) m ≡⟨⟩ -- fromMonad and toMonad are inverses
( voe-2-3-2-fromMonad
f Monoidal→Kleisli
f Kleisli→Monoidal
f voe-2-3.voe-2-3-2.toMonad
Monoidal→Kleisli
Kleisli→Monoidal
voe-2-3.voe-2-3-2.toMonad
) m ≡⟨ u
-- Monoidal→Kleisli and Kleisli→Monoidal are inverses
-- I should be able to prove this using congruence and `lem` below.
( voe-2-3-2-fromMonad
f voe-2-3.voe-2-3-2.toMonad
voe-2-3.voe-2-3-2.toMonad
) m ≡⟨⟩
( voe-2-3-2-fromMonad
f voe-2-3.voe-2-3-2.toMonad
voe-2-3.voe-2-3-2.toMonad
) m ≡⟨⟩ -- fromMonad and toMonad are inverses
m
where
lem : Monoidal→Kleisli f Kleisli→Monoidal Function.id
lem : Monoidal→Kleisli Kleisli→Monoidal Function.id
lem = verso-recto Monoidal≃Kleisli
t : { : Level} {A B : Set } {a : _ A} {b : B _}
a f (Monoidal→Kleisli f Kleisli→Monoidal) f b a f b
t {a = a} {b} = cong (λ φ a f φ f b) lem
a (Monoidal→Kleisli Kleisli→Monoidal) b a b
t {a = a} {b} = cong (λ φ a φ b) lem
u : { : Level} {A B : Set } {a : _ A} {b : B _}
{m : _} (a f (Monoidal→Kleisli f Kleisli→Monoidal) f b) m (a f b) m
{m : _} (a (Monoidal→Kleisli Kleisli→Monoidal) b) m (a b) m
u {m = m} = cong (λ φ φ m) t
forthEq : m (forth f back) m m
forthEq : m (forth back) m m
forthEq m = begin
(forth f back) m ≡⟨⟩
(forth back) m ≡⟨⟩
-- In full gory detail:
( voe-2-3-2-fromMonad
f Monoidal→Kleisli
f voe-2-3-1.toMonad
f voe-2-3-1-fromMonad
f Kleisli→Monoidal
f voe-2-3-2.toMonad
Monoidal→Kleisli
voe-2-3-1.toMonad
voe-2-3-1-fromMonad
Kleisli→Monoidal
voe-2-3-2.toMonad
) m ≡⟨ {!!} -- fromMonad and toMonad are inverses
( voe-2-3-2-fromMonad
f Monoidal→Kleisli
f Kleisli→Monoidal
f voe-2-3-2.toMonad
Monoidal→Kleisli
Kleisli→Monoidal
voe-2-3-2.toMonad
) m ≡⟨ {!!} -- Monoidal→Kleisli and Kleisli→Monoidal are inverses
( voe-2-3-2-fromMonad
f voe-2-3-2.toMonad
voe-2-3-2.toMonad
) m ≡⟨ {!!} -- fromMonad and toMonad are inverses
m
backEq : m (back f forth) m m
backEq : m (back forth) m m
backEq m = begin
(back f forth) m ≡⟨⟩
(back forth) m ≡⟨⟩
( voe-2-3-1-fromMonad
f Kleisli→Monoidal
f voe-2-3-2.toMonad
f voe-2-3-2-fromMonad
f Monoidal→Kleisli
f voe-2-3-1.toMonad
Kleisli→Monoidal
voe-2-3-2.toMonad
voe-2-3-2-fromMonad
Monoidal→Kleisli
voe-2-3-1.toMonad
) m ≡⟨ {!!} -- fromMonad and toMonad are inverses
( voe-2-3-1-fromMonad
f Kleisli→Monoidal
f Monoidal→Kleisli
f voe-2-3-1.toMonad
Kleisli→Monoidal
Monoidal→Kleisli
voe-2-3-1.toMonad
) m ≡⟨ {!!} -- Monoidal→Kleisli and Kleisli→Monoidal are inverses
( voe-2-3-1-fromMonad
f voe-2-3-1.toMonad
voe-2-3-1.toMonad
) m ≡⟨ {!!} -- fromMonad and toMonad are inverses
m