{-# OPTIONS --without-K --safe #-}
module Categories.Category.Construction.Properties.Kleisli where
open import Level
import Relation.Binary.PropositionalEquality as β‘
open import Categories.Adjoint
open import Categories.Adjoint.Properties
open import Categories.Category
open import Categories.Functor using (Functor; _βF_)
open import Categories.Functor.Equivalence
open import Categories.Monad
import Categories.Morphism.Reasoning as MR
open import Categories.Adjoint.Construction.Kleisli
open import Categories.Category.Construction.Kleisli
private
variable
o β e : Level
π π : Category o β e
module _ {F : Functor π π} {G : Functor π π} (Fβ£G : Adjoint F G) where
private
T : Monad π
T = adjointβmonad Fβ£G
πβ : Category _ _ _
πβ = Kleisli T
module π = Category π
module π = Category π
module πβ = Category πβ
module T = Monad T
module F = Functor F
module G = Functor G
open Adjoint Fβ£G
ComparisonF : Functor πβ π
ComparisonF = record
{ Fβ = Ξ» X β F.Fβ X
; Fβ = Ξ» {A} {B} f β π [ counit.Ξ· (F.Fβ B) β F.Fβ f ]
; identity = zig
; homomorphism = Ξ» {X} {Y} {Z} {f} {g} β begin
π [ counit.Ξ· (F.Fβ Z) β F.Fβ (π [ π [ G.Fβ (counit.Ξ· (F.Fβ Z)) β G.Fβ (F.Fβ g)] β f ])] ββ¨ reflβ©ββ¨ F.homomorphism β©
π [ counit.Ξ· (F.Fβ Z) β π [ F.Fβ (π [ G.Fβ (counit.Ξ· (F.Fβ Z)) β G.Fβ (F.Fβ g) ]) β F.Fβ f ] ] ββ¨ reflβ©ββ¨ F.homomorphism β©ββ¨refl β©
π [ counit.Ξ· (F.Fβ Z) β π [ π [ F.Fβ (G.Fβ (counit.Ξ· (F.Fβ Z))) β F.Fβ (G.Fβ (F.Fβ g)) ] β F.Fβ f ] ] ββ¨ centerβ»ΒΉ refl refl β©
π [ π [ counit.Ξ· (F.Fβ Z) β F.Fβ (G.Fβ (counit.Ξ· (F.Fβ Z))) ] β π [ F.Fβ (G.Fβ (F.Fβ g)) β F.Fβ f ] ] ββ¨ counit.commute (counit.Ξ· (F.Fβ Z)) β©ββ¨refl β©
π [ π [ counit.Ξ· (F.Fβ Z) β (counit.Ξ· (F.Fβ (G.Fβ (F.Fβ Z)))) ] β π [ F.Fβ (G.Fβ (F.Fβ g)) β F.Fβ f ] ] ββ¨ extendΒ² (counit.commute (F.Fβ g)) β©
π [ π [ counit.Ξ· (F.Fβ Z) β F.Fβ g ] β π [ counit.Ξ· (F.Fβ Y) β F.Fβ f ] ] β
; F-resp-β = Ξ» eq β π.β-resp-βΚ³ (F.F-resp-β eq)
}
where
open π.HomReasoning
open π.Equiv
open MR π
private
L = ComparisonF
module L = Functor L
module Gβ = Functor (Forgetful T)
module Fβ = Functor (Free T)
GβLβ‘Forgetful : (G βF L) β‘F Forgetful T
GβLβ‘Forgetful = record
{ eqβ = Ξ» X β β‘.refl
; eqβ = Ξ» {A} {B} f β begin
π [ π.id β G.Fβ (π [ counit.Ξ· (F.Fβ B) β F.Fβ f ]) ] ββ¨ π.identityΛ‘ β©
G.Fβ (π [ counit.Ξ· (F.Fβ B) β F.Fβ f ]) ββ¨ G.homomorphism β©
π [ G.Fβ (counit.Ξ· (F.Fβ B)) β G.Fβ (F.Fβ f) ] βΛβ¨ π.identityΚ³ β©
π [ π [ G.Fβ (counit.Ξ· (F.Fβ B)) β G.Fβ (F.Fβ f) ] β π.id ] β
}
where
open π.HomReasoning
LβFreeβ‘F : (L βF Free T) β‘F F
LβFreeβ‘F = record
{ eqβ = Ξ» X β β‘.refl
; eqβ = Ξ» {A} {B} f β begin
π [ π.id β π [ counit.Ξ· (F.Fβ B) β F.Fβ (π [ unit.Ξ· B β f ]) ] ] ββ¨ π.identityΛ‘ β©
π [ counit.Ξ· (F.Fβ B) β F.Fβ (π [ unit.Ξ· B β f ]) ] ββ¨ pushΚ³ F.homomorphism β©
π [ π [ counit.Ξ· (F.Fβ B) β F.Fβ (unit.Ξ· B) ] β F.Fβ f ] ββ¨ elimΛ‘ zig β©
F.Fβ f βΛβ¨ π.identityΚ³ β©
π [ F.Fβ f β π.id ] β
}
where
open π.HomReasoning
open MR π