Prove other identity-law for monads

This commit is contained in:
Frederik Hanghøj Iversen 2018-05-01 11:33:12 +02:00
parent d726159fa0
commit e3eca8d90a
2 changed files with 14 additions and 3 deletions

View file

@ -50,13 +50,19 @@ record RawMonad : Set where
-- There may be better names than what I've chosen here.
-- `pure` is the neutral element for `bind`
IsIdentity = {X : Object}
bind pure identity {omap X}
-- pure is the left-identity for the kleisli arrow.
IsNatural = {X Y : Object} (f : [ X , omap Y ])
pure >>> (bind f) f
pure >=> f f
-- Composition interacts with bind in the following way.
IsDistributive = {X Y Z : Object} (g : [ Y , omap Z ]) (f : [ X , omap Y ])
(bind f) >>> (bind g) bind (f >=> g)
RightIdentity = {A B : Object} {m : [ A , omap B ]}
m >=> pure m
-- | Functor map fusion.
--
-- This is really a functor law. Should we have a kleisli-representation of
@ -215,6 +221,13 @@ record IsMonad (raw : RawMonad) : Set where
bind pure ≡⟨ isIdentity
identity
rightIdentity : RightIdentity
rightIdentity {m = m} = begin
m >=> pure ≡⟨⟩
m >>> bind pure ≡⟨ cong (m >>>_) isIdentity
m >>> identity ≡⟨ .leftIdentity
m
record Monad : Set where
field
raw : RawMonad

View file

@ -215,8 +215,6 @@ module Try0 {a b : Level} { : Category a b}
coe pA xa ≡⟨ .coe-dom iso
xa .<<< fst f~ ≡⟨ fst (snd f~)
ya
helper : PathP (λ i pA i) xa ya
helper = coe-lem-inv k1
in iso , coe-lem-inv k1 , coe-lem-inv k0})
, funExt (λ x lemSig
(λ x propSig prop0 (λ _ prop1))