2018-02-24 14:13:25 +00:00
|
|
|
|
{-# OPTIONS --cubical --allow-unsolved-metas #-}
|
2018-02-23 16:33:09 +00:00
|
|
|
|
module Cat.Category.Monad where
|
|
|
|
|
|
2018-02-24 11:52:16 +00:00
|
|
|
|
open import Agda.Primitive
|
|
|
|
|
|
|
|
|
|
open import Data.Product
|
|
|
|
|
|
2018-02-23 16:33:09 +00:00
|
|
|
|
open import Cubical
|
|
|
|
|
|
|
|
|
|
open import Cat.Category
|
2018-02-24 11:52:16 +00:00
|
|
|
|
open import Cat.Category.Functor as F
|
|
|
|
|
open import Cat.Category.NaturalTransformation
|
2018-02-23 16:33:09 +00:00
|
|
|
|
open import Cat.Categories.Fun
|
2018-02-24 11:52:16 +00:00
|
|
|
|
|
2018-02-24 14:13:25 +00:00
|
|
|
|
-- "A monad in the monoidal form" [voe]
|
2018-02-24 11:52:16 +00:00
|
|
|
|
module Monoidal {ℓa ℓb : Level} (ℂ : Category ℓa ℓb) where
|
|
|
|
|
private
|
|
|
|
|
ℓ = ℓa ⊔ ℓb
|
|
|
|
|
|
2018-02-25 00:27:20 +00:00
|
|
|
|
open Category ℂ using (Object ; Arrow ; 𝟙 ; _∘_)
|
2018-02-24 11:52:16 +00:00
|
|
|
|
open NaturalTransformation ℂ ℂ
|
|
|
|
|
record RawMonad : Set ℓ where
|
|
|
|
|
field
|
2018-02-24 19:37:21 +00:00
|
|
|
|
-- R ~ m
|
2018-02-24 11:52:16 +00:00
|
|
|
|
R : Functor ℂ ℂ
|
2018-02-24 19:37:21 +00:00
|
|
|
|
-- η ~ pure
|
2018-02-24 11:52:16 +00:00
|
|
|
|
ηNat : NaturalTransformation F.identity R
|
2018-02-24 19:37:21 +00:00
|
|
|
|
-- μ ~ join
|
2018-02-24 11:52:16 +00:00
|
|
|
|
μNat : NaturalTransformation F[ R ∘ R ] R
|
|
|
|
|
|
2018-02-24 14:13:25 +00:00
|
|
|
|
η : Transformation F.identity R
|
|
|
|
|
η = proj₁ ηNat
|
|
|
|
|
μ : Transformation F[ R ∘ R ] R
|
|
|
|
|
μ = proj₁ μNat
|
2018-02-24 13:00:52 +00:00
|
|
|
|
|
2018-02-24 11:52:16 +00:00
|
|
|
|
private
|
2018-02-24 13:00:52 +00:00
|
|
|
|
module R = Functor R
|
|
|
|
|
module RR = Functor F[ R ∘ R ]
|
2018-02-24 11:52:16 +00:00
|
|
|
|
module _ {X : Object} where
|
|
|
|
|
IsAssociative' : Set _
|
2018-02-24 18:07:58 +00:00
|
|
|
|
IsAssociative' = μ X ∘ R.func→ (μ X) ≡ μ X ∘ μ (R.func* X)
|
2018-02-24 11:52:16 +00:00
|
|
|
|
IsInverse' : Set _
|
|
|
|
|
IsInverse'
|
2018-02-24 18:07:58 +00:00
|
|
|
|
= μ X ∘ η (R.func* X) ≡ 𝟙
|
|
|
|
|
× μ X ∘ R.func→ (η X) ≡ 𝟙
|
2018-02-24 11:52:16 +00:00
|
|
|
|
|
|
|
|
|
-- We don't want the objects to be indexes of the type, but rather just
|
|
|
|
|
-- universally quantify over *all* objects of the category.
|
|
|
|
|
IsAssociative = {X : Object} → IsAssociative' {X}
|
|
|
|
|
IsInverse = {X : Object} → IsInverse' {X}
|
|
|
|
|
|
|
|
|
|
record IsMonad (raw : RawMonad) : Set ℓ where
|
|
|
|
|
open RawMonad raw public
|
|
|
|
|
field
|
|
|
|
|
isAssociative : IsAssociative
|
|
|
|
|
isInverse : IsInverse
|
2018-02-24 13:00:52 +00:00
|
|
|
|
|
2018-02-24 13:01:57 +00:00
|
|
|
|
record Monad : Set ℓ where
|
|
|
|
|
field
|
|
|
|
|
raw : RawMonad
|
|
|
|
|
isMonad : IsMonad raw
|
|
|
|
|
open IsMonad isMonad public
|
|
|
|
|
|
2018-02-25 02:09:25 +00:00
|
|
|
|
postulate propIsMonad : ∀ {raw} → isProp (IsMonad raw)
|
|
|
|
|
Monad≡ : {m n : Monad} → Monad.raw m ≡ Monad.raw n → m ≡ n
|
|
|
|
|
Monad.raw (Monad≡ eq i) = eq i
|
|
|
|
|
Monad.isMonad (Monad≡ {m} {n} eq i) = res i
|
|
|
|
|
where
|
|
|
|
|
-- TODO: PathJ nightmare + `propIsMonad`.
|
|
|
|
|
res : (λ i → IsMonad (eq i)) [ Monad.isMonad m ≡ Monad.isMonad n ]
|
|
|
|
|
res = {!!}
|
|
|
|
|
|
2018-02-24 14:13:25 +00:00
|
|
|
|
-- "A monad in the Kleisli form" [voe]
|
2018-02-24 13:00:52 +00:00
|
|
|
|
module Kleisli {ℓa ℓb : Level} (ℂ : Category ℓa ℓb) where
|
|
|
|
|
private
|
|
|
|
|
ℓ = ℓa ⊔ ℓb
|
|
|
|
|
|
2018-02-25 02:09:25 +00:00
|
|
|
|
open Category ℂ using (Arrow ; 𝟙 ; Object ; _∘_)
|
2018-02-24 13:00:52 +00:00
|
|
|
|
record RawMonad : Set ℓ where
|
|
|
|
|
field
|
|
|
|
|
RR : Object → Object
|
2018-02-24 14:13:25 +00:00
|
|
|
|
-- Note name-change from [voe]
|
|
|
|
|
ζ : {X : Object} → ℂ [ X , RR X ]
|
2018-02-24 13:00:52 +00:00
|
|
|
|
rr : {X Y : Object} → ℂ [ X , RR Y ] → ℂ [ RR X , RR Y ]
|
2018-02-24 14:25:07 +00:00
|
|
|
|
-- Note the correspondance with Haskell:
|
|
|
|
|
--
|
|
|
|
|
-- RR ~ m
|
|
|
|
|
-- ζ ~ pure
|
|
|
|
|
-- rr ~ flip (>>=)
|
|
|
|
|
--
|
|
|
|
|
-- Where those things have these types:
|
|
|
|
|
--
|
|
|
|
|
-- m : 𝓤 → 𝓤
|
|
|
|
|
-- pure : x → m x
|
|
|
|
|
-- flip (>>=) :: (a → m b) → m a → m b
|
|
|
|
|
--
|
2018-02-24 18:08:20 +00:00
|
|
|
|
pure : {X : Object} → ℂ [ X , RR X ]
|
|
|
|
|
pure = ζ
|
2018-02-25 02:09:25 +00:00
|
|
|
|
fmap : ∀ {A B} → ℂ [ A , B ] → ℂ [ RR A , RR B ]
|
|
|
|
|
fmap f = rr (ζ ∘ f)
|
2018-02-24 18:08:20 +00:00
|
|
|
|
-- Why is (>>=) not implementable?
|
|
|
|
|
--
|
|
|
|
|
-- (>>=) : m a -> (a -> m b) -> m b
|
|
|
|
|
-- (>=>) : (a -> m b) -> (b -> m c) -> a -> m c
|
|
|
|
|
_>=>_ : {A B C : Object} → ℂ [ A , RR B ] → ℂ [ B , RR C ] → ℂ [ A , RR C ]
|
2018-02-24 19:41:47 +00:00
|
|
|
|
f >=> g = rr g ∘ f
|
2018-02-24 18:08:20 +00:00
|
|
|
|
|
2018-02-24 19:37:21 +00:00
|
|
|
|
-- fmap id ≡ id
|
2018-02-24 13:00:52 +00:00
|
|
|
|
IsIdentity = {X : Object}
|
2018-02-24 14:13:25 +00:00
|
|
|
|
→ rr ζ ≡ 𝟙 {RR X}
|
2018-02-24 13:00:52 +00:00
|
|
|
|
IsNatural = {X Y : Object} (f : ℂ [ X , RR Y ])
|
2018-02-24 19:37:21 +00:00
|
|
|
|
→ rr f ∘ ζ ≡ f
|
2018-02-24 13:00:52 +00:00
|
|
|
|
IsDistributive = {X Y Z : Object} (g : ℂ [ Y , RR Z ]) (f : ℂ [ X , RR Y ])
|
2018-02-24 19:37:21 +00:00
|
|
|
|
→ rr g ∘ rr f ≡ rr (rr g ∘ f)
|
2018-02-25 02:09:25 +00:00
|
|
|
|
Fusion = {X Y Z : Object} {g : ℂ [ Y , Z ]} {f : ℂ [ X , Y ]}
|
|
|
|
|
→ fmap (g ∘ f) ≡ fmap g ∘ fmap f
|
2018-02-24 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
record IsMonad (raw : RawMonad) : Set ℓ where
|
|
|
|
|
open RawMonad raw public
|
|
|
|
|
field
|
|
|
|
|
isIdentity : IsIdentity
|
|
|
|
|
isNatural : IsNatural
|
|
|
|
|
isDistributive : IsDistributive
|
2018-02-25 02:09:25 +00:00
|
|
|
|
fusion : Fusion
|
|
|
|
|
fusion {g = g} {f} = begin
|
|
|
|
|
fmap (g ∘ f) ≡⟨⟩
|
|
|
|
|
rr (ζ ∘ (g ∘ f)) ≡⟨ {!!} ⟩
|
|
|
|
|
rr (rr (ζ ∘ g) ∘ (ζ ∘ f)) ≡⟨ sym lem ⟩
|
|
|
|
|
rr (ζ ∘ g) ∘ rr (ζ ∘ f) ≡⟨⟩
|
|
|
|
|
fmap g ∘ fmap f ∎
|
|
|
|
|
where
|
|
|
|
|
lem : rr (ζ ∘ g) ∘ rr (ζ ∘ f) ≡ rr (rr (ζ ∘ g) ∘ (ζ ∘ f))
|
|
|
|
|
lem = isDistributive (ζ ∘ g) (ζ ∘ f)
|
2018-02-24 13:00:52 +00:00
|
|
|
|
|
|
|
|
|
record Monad : Set ℓ where
|
|
|
|
|
field
|
|
|
|
|
raw : RawMonad
|
|
|
|
|
isMonad : IsMonad raw
|
|
|
|
|
open IsMonad isMonad public
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
2018-02-25 02:09:25 +00:00
|
|
|
|
postulate propIsMonad : ∀ {raw} → isProp (IsMonad raw)
|
|
|
|
|
Monad≡ : {m n : Monad} → Monad.raw m ≡ Monad.raw n → m ≡ n
|
|
|
|
|
Monad.raw (Monad≡ eq i) = eq i
|
|
|
|
|
Monad.isMonad (Monad≡ {m} {n} eq i) = res i
|
|
|
|
|
where
|
|
|
|
|
-- TODO: PathJ nightmare + `propIsMonad`.
|
|
|
|
|
res : (λ i → IsMonad (eq i)) [ Monad.isMonad m ≡ Monad.isMonad n ]
|
|
|
|
|
res = {!!}
|
|
|
|
|
|
2018-02-24 14:13:25 +00:00
|
|
|
|
-- Problem 2.3
|
|
|
|
|
module _ {ℓa ℓb : Level} {ℂ : Category ℓa ℓb} where
|
|
|
|
|
private
|
2018-02-24 18:07:58 +00:00
|
|
|
|
open Category ℂ using (Object ; Arrow ; 𝟙 ; _∘_)
|
2018-02-24 14:13:25 +00:00
|
|
|
|
open Functor using (func* ; func→)
|
|
|
|
|
module M = Monoidal ℂ
|
|
|
|
|
module K = Kleisli ℂ
|
|
|
|
|
|
2018-02-24 18:07:58 +00:00
|
|
|
|
-- Note similarity with locally defined things in Kleisly.RawMonad!!
|
2018-02-24 14:13:25 +00:00
|
|
|
|
module _ (m : M.RawMonad) where
|
|
|
|
|
private
|
|
|
|
|
open M.RawMonad m
|
|
|
|
|
module Kraw = K.RawMonad
|
|
|
|
|
|
2018-02-24 18:07:58 +00:00
|
|
|
|
RR : Object → Object
|
|
|
|
|
RR = func* R
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
2018-02-24 18:07:58 +00:00
|
|
|
|
ζ : {X : Object} → ℂ [ X , RR X ]
|
|
|
|
|
ζ {X} = η X
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
2018-02-24 18:07:58 +00:00
|
|
|
|
rr : {X Y : Object} → ℂ [ X , RR Y ] → ℂ [ RR X , RR Y ]
|
2018-02-24 19:41:47 +00:00
|
|
|
|
rr {X} {Y} f = μ Y ∘ func→ R f
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
|
|
|
|
forthRaw : K.RawMonad
|
|
|
|
|
Kraw.RR forthRaw = RR
|
|
|
|
|
Kraw.ζ forthRaw = ζ
|
|
|
|
|
Kraw.rr forthRaw = rr
|
|
|
|
|
|
|
|
|
|
module _ {raw : M.RawMonad} (m : M.IsMonad raw) where
|
2018-02-25 02:09:25 +00:00
|
|
|
|
private
|
|
|
|
|
open M.IsMonad m
|
|
|
|
|
open K.RawMonad (forthRaw raw)
|
|
|
|
|
module Kis = K.IsMonad
|
|
|
|
|
|
|
|
|
|
isIdentity : IsIdentity
|
|
|
|
|
isIdentity {X} = begin
|
|
|
|
|
rr ζ ≡⟨⟩
|
|
|
|
|
rr (η X) ≡⟨⟩
|
|
|
|
|
μ X ∘ func→ R (η X) ≡⟨ proj₂ isInverse ⟩
|
|
|
|
|
𝟙 ∎
|
|
|
|
|
|
|
|
|
|
module R = Functor R
|
|
|
|
|
isNatural : IsNatural
|
|
|
|
|
isNatural {X} {Y} f = begin
|
|
|
|
|
rr f ∘ ζ ≡⟨⟩
|
|
|
|
|
rr f ∘ η X ≡⟨⟩
|
|
|
|
|
μ Y ∘ R.func→ f ∘ η X ≡⟨ sym ℂ.isAssociative ⟩
|
|
|
|
|
μ Y ∘ (R.func→ f ∘ η X) ≡⟨ cong (λ φ → μ Y ∘ φ) (sym (ηN f)) ⟩
|
|
|
|
|
μ Y ∘ (η (R.func* Y) ∘ f) ≡⟨ ℂ.isAssociative ⟩
|
|
|
|
|
μ Y ∘ η (R.func* Y) ∘ f ≡⟨ cong (λ φ → φ ∘ f) (proj₁ isInverse) ⟩
|
|
|
|
|
𝟙 ∘ f ≡⟨ proj₂ ℂ.isIdentity ⟩
|
|
|
|
|
f ∎
|
|
|
|
|
where
|
|
|
|
|
open NaturalTransformation
|
|
|
|
|
module ℂ = Category ℂ
|
|
|
|
|
ηN : Natural ℂ ℂ F.identity R η
|
|
|
|
|
ηN = proj₂ ηNat
|
|
|
|
|
|
|
|
|
|
isDistributive : IsDistributive
|
|
|
|
|
isDistributive {X} {Y} {Z} g f = begin
|
|
|
|
|
rr g ∘ rr f ≡⟨⟩
|
|
|
|
|
μ Z ∘ R.func→ g ∘ (μ Y ∘ R.func→ f) ≡⟨ sym lem2 ⟩
|
|
|
|
|
μ Z ∘ R.func→ (μ Z ∘ R.func→ g ∘ f) ≡⟨⟩
|
|
|
|
|
μ Z ∘ R.func→ (rr g ∘ f) ∎
|
|
|
|
|
where
|
|
|
|
|
-- Proved it in reverse here... otherwise it could be neatly inlined.
|
|
|
|
|
lem2
|
|
|
|
|
: μ Z ∘ R.func→ (μ Z ∘ R.func→ g ∘ f)
|
|
|
|
|
≡ μ Z ∘ R.func→ g ∘ (μ Y ∘ R.func→ f)
|
|
|
|
|
lem2 = begin
|
|
|
|
|
μ Z ∘ R.func→ (μ Z ∘ R.func→ g ∘ f) ≡⟨ cong (λ φ → μ Z ∘ φ) distrib ⟩
|
|
|
|
|
μ Z ∘ (R.func→ (μ Z) ∘ R.func→ (R.func→ g) ∘ R.func→ f) ≡⟨⟩
|
|
|
|
|
μ Z ∘ (R.func→ (μ Z) ∘ RR.func→ g ∘ R.func→ f) ≡⟨ {!!} ⟩ -- ●-solver?
|
|
|
|
|
(μ Z ∘ R.func→ (μ Z)) ∘ (RR.func→ g ∘ R.func→ f) ≡⟨ cong (λ φ → φ ∘ (RR.func→ g ∘ R.func→ f)) lemmm ⟩
|
|
|
|
|
(μ Z ∘ μ (R.func* Z)) ∘ (RR.func→ g ∘ R.func→ f) ≡⟨ {!!} ⟩ -- ●-solver?
|
|
|
|
|
μ Z ∘ μ (R.func* Z) ∘ RR.func→ g ∘ R.func→ f ≡⟨ {!!} ⟩ -- ●-solver + lem4
|
|
|
|
|
μ Z ∘ R.func→ g ∘ μ Y ∘ R.func→ f ≡⟨ sym (Category.isAssociative ℂ) ⟩
|
|
|
|
|
μ Z ∘ R.func→ g ∘ (μ Y ∘ R.func→ f) ∎
|
|
|
|
|
where
|
|
|
|
|
module RR = Functor F[ R ∘ R ]
|
|
|
|
|
distrib : ∀ {A B C D} {a : Arrow C D} {b : Arrow B C} {c : Arrow A B}
|
|
|
|
|
→ R.func→ (a ∘ b ∘ c)
|
|
|
|
|
≡ R.func→ a ∘ R.func→ b ∘ R.func→ c
|
|
|
|
|
distrib = {!!}
|
|
|
|
|
comm : ∀ {A B C D E}
|
|
|
|
|
→ {a : Arrow D E} {b : Arrow C D} {c : Arrow B C} {d : Arrow A B}
|
|
|
|
|
→ a ∘ (b ∘ c ∘ d) ≡ a ∘ b ∘ c ∘ d
|
|
|
|
|
comm = {!!}
|
|
|
|
|
μN = proj₂ μNat
|
|
|
|
|
lemmm : μ Z ∘ R.func→ (μ Z) ≡ μ Z ∘ μ (R.func* Z)
|
|
|
|
|
lemmm = isAssociative
|
|
|
|
|
lem4 : μ (R.func* Z) ∘ RR.func→ g ≡ R.func→ g ∘ μ Y
|
|
|
|
|
lem4 = μN g
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
|
|
|
|
forthIsMonad : K.IsMonad (forthRaw raw)
|
|
|
|
|
Kis.isIdentity forthIsMonad = isIdentity
|
|
|
|
|
Kis.isNatural forthIsMonad = isNatural
|
|
|
|
|
Kis.isDistributive forthIsMonad = isDistributive
|
|
|
|
|
|
|
|
|
|
forth : M.Monad → K.Monad
|
2018-02-25 02:09:25 +00:00
|
|
|
|
Kleisli.Monad.raw (forth m) = forthRaw (M.Monad.raw m)
|
2018-02-24 14:13:25 +00:00
|
|
|
|
Kleisli.Monad.isMonad (forth m) = forthIsMonad (M.Monad.isMonad m)
|
|
|
|
|
|
2018-02-25 02:09:25 +00:00
|
|
|
|
module _ (m : K.Monad) where
|
|
|
|
|
private
|
|
|
|
|
module ℂ = Category ℂ
|
|
|
|
|
open K.Monad m
|
|
|
|
|
module Mraw = M.RawMonad
|
|
|
|
|
open NaturalTransformation ℂ ℂ
|
|
|
|
|
|
|
|
|
|
rawR : RawFunctor ℂ ℂ
|
|
|
|
|
RawFunctor.func* rawR = RR
|
|
|
|
|
RawFunctor.func→ rawR f = rr (ζ ∘ f)
|
|
|
|
|
|
|
|
|
|
isFunctorR : IsFunctor ℂ ℂ rawR
|
|
|
|
|
IsFunctor.isIdentity isFunctorR = begin
|
|
|
|
|
rr (ζ ∘ 𝟙) ≡⟨ cong rr (proj₁ ℂ.isIdentity) ⟩
|
|
|
|
|
rr ζ ≡⟨ isIdentity ⟩
|
|
|
|
|
𝟙 ∎
|
|
|
|
|
IsFunctor.isDistributive isFunctorR {f = f} {g} = begin
|
|
|
|
|
rr (ζ ∘ (g ∘ f)) ≡⟨⟩
|
|
|
|
|
fmap (g ∘ f) ≡⟨ fusion ⟩
|
|
|
|
|
fmap g ∘ fmap f ≡⟨⟩
|
|
|
|
|
rr (ζ ∘ g) ∘ rr (ζ ∘ f) ∎
|
|
|
|
|
|
|
|
|
|
R : Functor ℂ ℂ
|
|
|
|
|
Functor.raw R = rawR
|
|
|
|
|
Functor.isFunctor R = isFunctorR
|
|
|
|
|
|
|
|
|
|
R2 : Functor ℂ ℂ
|
|
|
|
|
R2 = F[ R ∘ R ]
|
|
|
|
|
|
|
|
|
|
ηNat : NaturalTransformation F.identity R
|
|
|
|
|
ηNat = {!!}
|
|
|
|
|
|
|
|
|
|
μNat : NaturalTransformation R2 R
|
|
|
|
|
μNat = {!!}
|
|
|
|
|
|
|
|
|
|
backRaw : M.RawMonad
|
|
|
|
|
Mraw.R backRaw = R
|
|
|
|
|
Mraw.ηNat backRaw = ηNat
|
|
|
|
|
Mraw.μNat backRaw = μNat
|
|
|
|
|
|
|
|
|
|
module _ (m : K.Monad) where
|
|
|
|
|
open K.Monad m
|
|
|
|
|
open M.RawMonad (backRaw m)
|
|
|
|
|
module Mis = M.IsMonad
|
|
|
|
|
|
|
|
|
|
backIsMonad : M.IsMonad (backRaw m)
|
|
|
|
|
backIsMonad = {!!}
|
|
|
|
|
|
2018-02-24 18:07:58 +00:00
|
|
|
|
back : K.Monad → M.Monad
|
2018-02-25 02:09:25 +00:00
|
|
|
|
Monoidal.Monad.raw (back m) = backRaw m
|
|
|
|
|
Monoidal.Monad.isMonad (back m) = backIsMonad m
|
|
|
|
|
|
2018-02-25 02:12:23 +00:00
|
|
|
|
-- I believe all the proofs here should be `refl`.
|
|
|
|
|
module _ (m : K.Monad) where
|
|
|
|
|
open K.RawMonad (K.Monad.raw m)
|
|
|
|
|
forthRawEq : forthRaw (backRaw m) ≡ K.Monad.raw m
|
|
|
|
|
K.RawMonad.RR (forthRawEq _) = RR
|
|
|
|
|
K.RawMonad.ζ (forthRawEq _) = ζ
|
|
|
|
|
-- stuck
|
|
|
|
|
K.RawMonad.rr (forthRawEq i) = {!!}
|
2018-02-24 18:07:58 +00:00
|
|
|
|
|
|
|
|
|
fortheq : (m : K.Monad) → forth (back m) ≡ m
|
2018-02-25 02:09:25 +00:00
|
|
|
|
fortheq m = K.Monad≡ (forthRawEq m)
|
|
|
|
|
|
2018-02-25 02:12:23 +00:00
|
|
|
|
module _ (m : M.Monad) where
|
|
|
|
|
open M.RawMonad (M.Monad.raw m)
|
|
|
|
|
backRawEq : backRaw (forth m) ≡ M.Monad.raw m
|
|
|
|
|
-- stuck
|
|
|
|
|
M.RawMonad.R (backRawEq i) = {!!}
|
|
|
|
|
M.RawMonad.ηNat (backRawEq i) = {!!}
|
|
|
|
|
M.RawMonad.μNat (backRawEq i) = {!!}
|
2018-02-24 18:07:58 +00:00
|
|
|
|
|
|
|
|
|
backeq : (m : M.Monad) → back (forth m) ≡ m
|
2018-02-25 02:09:25 +00:00
|
|
|
|
backeq m = M.Monad≡ (backRawEq m)
|
2018-02-24 18:07:58 +00:00
|
|
|
|
|
|
|
|
|
open import Cubical.GradLemma
|
2018-02-24 14:13:25 +00:00
|
|
|
|
eqv : isEquiv M.Monad K.Monad forth
|
2018-02-24 18:07:58 +00:00
|
|
|
|
eqv = gradLemma forth back fortheq backeq
|
2018-02-24 14:13:25 +00:00
|
|
|
|
|
|
|
|
|
Monoidal≃Kleisli : M.Monad ≃ K.Monad
|
|
|
|
|
Monoidal≃Kleisli = forth , eqv
|