Mercurial > hg > Members > atton > delta_monad
view agda/similar.agda @ 32:71906644d206
Expand monad-law 1
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 18 Oct 2014 13:52:18 +0900 |
parents | c2f40b6d4027 |
children | 0bc402f970b3 |
line wrap: on
line source
open import list open import basic open import Level open import Relation.Binary.PropositionalEquality open ≡-Reasoning module similar where data Similar {l : Level} (A : Set l) : (Set (suc l)) where similar : List String -> A -> List String -> A -> Similar A fmap : {l ll : Level} {A : Set l} {B : Set ll} -> (A -> B) -> (Similar A) -> (Similar B) fmap f (similar xs x ys y) = similar xs (f x) ys (f y) mu : {l : Level} {A : Set l} -> Similar (Similar A) -> Similar A mu (similar lx (similar llx x _ _) ly (similar _ _ lly y)) = similar (lx ++ llx) x (ly ++ lly) y return : {A : Set} -> A -> Similar A return x = similar [] x [] x returnS : {A : Set} -> A -> Similar A returnS x = similar [[ (show x) ]] x [[ (show x) ]] x returnSS : {A : Set} -> A -> A -> Similar A returnSS x y = similar [[ (show x) ]] x [[ (show y) ]] y --monad-law-1 : mu ∙ (fmap mu) ≡ mu ∙ mu monad-law-1 : {l : Level} {A : Set l} -> (s : Similar (Similar (Similar A))) -> ((mu ∙ (fmap mu)) s) ≡ ((mu ∙ mu) s) monad-law-1 (similar lx (similar llx (similar lllx x _ _) _ (similar _ _ _ _)) ly (similar _ (similar _ _ _ _) lly (similar _ _ llly y))) = begin similar (lx ++ (llx ++ lllx)) x (ly ++ (lly ++ llly)) y ≡⟨ {!!} ⟩ similar (lx ++ llx ++ lllx) x (ly ++ lly ++ llly) y ∎ {- --monad-law-2 : mu ∙ fmap return ≡ mu ∙ return ≡id monad-law-2-1 : mu ∙ fmap return ≡ mu ∙ return monad-law-2-1 = {!!} monad-law-2-2 : mu ∙ return ≡ id monad-law-2-2 = {!!} monad-law-3 : ∀{f} -> return ∙ f ≡ fmap f ∙ return monad-law-3 = {!!} monad-law-4 : ∀{f} -> mu ∙ fmap (fmap f) ≡ fmap f ∙ mu monad-law-4 = {!!} -}