Mercurial > hg > Members > atton > delta_monad
comparison agda/delta/functor.agda @ 87:6789c65a75bc
Split functor-proofs into delta.functor
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 19 Jan 2015 11:00:34 +0900 |
parents | |
children | 5411ce26d525 |
comparison
equal
deleted
inserted
replaced
86:5c083ddd73ed | 87:6789c65a75bc |
---|---|
1 open import delta | |
2 open import basic | |
3 open import laws | |
4 | |
5 open import Level | |
6 open import Relation.Binary.PropositionalEquality | |
7 | |
8 | |
9 module delta.functor where | |
10 | |
11 -- Functor-laws | |
12 | |
13 -- Functor-law-1 : T(id) = id' | |
14 functor-law-1 : {l : Level} {A : Set l} -> (d : Delta A) -> (fmap id) d ≡ id d | |
15 functor-law-1 (mono x) = refl | |
16 functor-law-1 (delta x d) = cong (delta x) (functor-law-1 d) | |
17 | |
18 -- Functor-law-2 : T(f . g) = T(f) . T(g) | |
19 functor-law-2 : {l ll lll : Level} {A : Set l} {B : Set ll} {C : Set lll} -> | |
20 (f : B -> C) -> (g : A -> B) -> (d : Delta A) -> | |
21 (fmap (f ∙ g)) d ≡ (fmap f) (fmap g d) | |
22 functor-law-2 f g (mono x) = refl | |
23 functor-law-2 f g (delta x d) = cong (delta (f (g x))) (functor-law-2 f g d) | |
24 | |
25 delta-is-functor : {l : Level} -> Functor (Delta {l}) | |
26 delta-is-functor = record { fmap = fmap ; | |
27 preserve-id = functor-law-1; | |
28 covariant = \f g -> functor-law-2 g f} |