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