Mercurial > hg > Members > atton > delta_monad
annotate agda/delta.agda @ 70:18a20a14c4b2
Change prove method. use Int ...
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 27 Nov 2014 22:44:57 +0900 |
parents | 295e8ed39c0c |
children | 56da62d57c95 |
rev | line source |
---|---|
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 open import list |
28
6e6d646d7722
Split basic functions to file
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
27
diff
changeset
|
2 open import basic |
29
e0ba1bf564dd
Apply level to some functions
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
3 |
e0ba1bf564dd
Apply level to some functions
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
4 open import Level |
27
742e62fc63e4
Define Monad-law 1-4
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
26
diff
changeset
|
5 open import Relation.Binary.PropositionalEquality |
742e62fc63e4
Define Monad-law 1-4
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
26
diff
changeset
|
6 open ≡-Reasoning |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
8 module delta where |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 |
54
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
10 |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
11 data Delta {l : Level} (A : Set l) : (Set (suc l)) where |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
12 mono : A -> Delta A |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
13 delta : A -> Delta A -> Delta A |
54
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
14 |
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
15 deltaAppend : {l : Level} {A : Set l} -> Delta A -> Delta A -> Delta A |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
16 deltaAppend (mono x) d = delta x d |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
17 deltaAppend (delta x d) ds = delta x (deltaAppend d ds) |
54
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
18 |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
19 headDelta : {l : Level} {A : Set l} -> Delta A -> A |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
20 headDelta (mono x) = x |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
21 headDelta (delta x _) = x |
54
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
22 |
9bb7c9bee94f
Trying redefine delta for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
43
diff
changeset
|
23 tailDelta : {l : Level} {A : Set l} -> Delta A -> Delta A |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
24 tailDelta (mono x) = mono x |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
25 tailDelta (delta _ d) = d |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 |
38
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
27 |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
28 -- Functor |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
29 fmap : {l ll : Level} {A : Set l} {B : Set ll} -> (A -> B) -> (Delta A) -> (Delta B) |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
30 fmap f (mono x) = mono (f x) |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
31 fmap f (delta x d) = delta (f x) (fmap f d) |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
32 |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 |
38
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
34 |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
35 -- Monad (Category) |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
36 eta : {l : Level} {A : Set l} -> A -> Delta A |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
37 eta x = mono x |
27
742e62fc63e4
Define Monad-law 1-4
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
26
diff
changeset
|
38 |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
39 bind : {l ll : Level} {A : Set l} {B : Set ll} -> (Delta A) -> (A -> Delta B) -> Delta B |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
40 bind (mono x) f = f x |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
41 bind (delta x d) f = delta (headDelta (f x)) (bind d (tailDelta ∙ f)) |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
42 |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
43 mu : {l : Level} {A : Set l} -> Delta (Delta A) -> Delta A |
65
6d0193011f89
Trying prove monad-law-1 by another pattern
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
44 mu d = bind d id |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
45 |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
46 returnS : {l : Level} {A : Set l} -> A -> Delta A |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
47 returnS x = mono x |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
49 returnSS : {l : Level} {A : Set l} -> A -> A -> Delta A |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
50 returnSS x y = deltaAppend (returnS x) (returnS y) |
26
5ba82f107a95
Define Similar in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51 |
33 | 52 |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
53 -- Monad (Haskell) |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
54 return : {l : Level} {A : Set l} -> A -> Delta A |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
55 return = eta |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
56 |
41
23474bf242c6
Proof monad-law-h-2, trying monad-law-h-3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
40
diff
changeset
|
57 _>>=_ : {l ll : Level} {A : Set l} {B : Set ll} -> |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
58 (x : Delta A) -> (f : A -> (Delta B)) -> (Delta B) |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
59 (mono x) >>= f = f x |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
60 (delta x d) >>= f = delta (headDelta (f x)) (d >>= (tailDelta ∙ f)) |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
61 |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
62 |
38
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
63 |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
64 -- proofs |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
65 |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
66 -- Functor-laws |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
67 |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
68 -- Functor-law-1 : T(id) = id' |
55
9c8c09334e32
Redefine Delta for infinite changes in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
69 functor-law-1 : {l : Level} {A : Set l} -> (d : Delta A) -> (fmap id) d ≡ id d |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
70 functor-law-1 (mono x) = refl |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
71 functor-law-1 (delta x d) = cong (delta x) (functor-law-1 d) |
38
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
72 |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
73 -- Functor-law-2 : T(f . g) = T(f) . T(g) |
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
74 functor-law-2 : {l ll lll : Level} {A : Set l} {B : Set ll} {C : Set lll} -> |
55
9c8c09334e32
Redefine Delta for infinite changes in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
75 (f : B -> C) -> (g : A -> B) -> (d : Delta A) -> |
9c8c09334e32
Redefine Delta for infinite changes in Agda
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
76 (fmap (f ∙ g)) d ≡ ((fmap f) ∙ (fmap g)) d |
57
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
77 functor-law-2 f g (mono x) = refl |
dfcd72dc697e
ReDefine Delta used non-empty-list for infinite changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
56
diff
changeset
|
78 functor-law-2 f g (delta x d) = cong (delta (f (g x))) (functor-law-2 f g d) |
38
6ce83b2c9e59
Proof Functor-laws
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
79 |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
80 |
39 | 81 -- Monad-laws (Category) |
63
474ed34e4f02
proving monad-law-1 ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
82 |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
83 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
84 data Int : Set where |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
85 one : Int |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
86 succ : Int -> Int |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
87 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
88 n-times-tail-delta : {l : Level} {A : Set l} -> Int -> ((Delta A) -> (Delta A)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
89 n-times-tail-delta one = tailDelta |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
90 n-times-tail-delta (succ n) = (n-times-tail-delta n) ∙ tailDelta |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
91 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
92 tail-delta-to-mono : {l : Level} {A : Set l} -> (n : Int) -> (x : A) -> |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
93 (n-times-tail-delta n) (mono x) ≡ (mono x) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
94 tail-delta-to-mono one x = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
95 tail-delta-to-mono (succ n) x = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
96 n-times-tail-delta (succ n) (mono x) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
97 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
98 n-times-tail-delta n (mono x) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
99 ≡⟨ tail-delta-to-mono n x ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
100 mono x |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
101 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
102 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
103 monad-law-1-4 : {l : Level} {A : Set l} -> (n : Int) (d : Delta (Delta A)) -> |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
104 (headDelta ((n-times-tail-delta n) (headDelta ((n-times-tail-delta n) d)))) ≡ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
105 (headDelta ((n-times-tail-delta n) (mu d))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
106 monad-law-1-4 one (mono d) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
107 monad-law-1-4 one (delta d (mono ds)) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
108 monad-law-1-4 one (delta d (delta ds ds₁)) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
109 monad-law-1-4 (succ n) (mono d) = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
110 headDelta (n-times-tail-delta (succ n) (headDelta (n-times-tail-delta (succ n) (mono d)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
111 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
112 headDelta (n-times-tail-delta (succ n) (headDelta ((n-times-tail-delta n) (mono d)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
113 ≡⟨ cong (\d -> headDelta (n-times-tail-delta (succ n) (headDelta d))) (tail-delta-to-mono n d) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
114 headDelta (n-times-tail-delta (succ n) (headDelta (mono d))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
115 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
116 headDelta (n-times-tail-delta (succ n) d) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
117 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
118 headDelta (n-times-tail-delta (succ n) (mu (mono d))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
119 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
120 monad-law-1-4 (succ n) (delta d (mono ds)) = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
121 headDelta (n-times-tail-delta (succ n) (headDelta (n-times-tail-delta (succ n) (delta d (mono ds))))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
122 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
123 headDelta (n-times-tail-delta (succ n) (headDelta (n-times-tail-delta n (mono ds)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
124 ≡⟨ cong (\d -> headDelta (n-times-tail-delta (succ n) (headDelta d))) (tail-delta-to-mono n ds) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
125 headDelta (n-times-tail-delta (succ n) (headDelta (mono ds))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
126 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
127 headDelta (n-times-tail-delta (succ n) ds) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
128 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
129 headDelta (n-times-tail-delta n (tailDelta ds)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
130 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
131 headDelta (n-times-tail-delta n ((bind (mono ds) tailDelta))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
132 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
133 headDelta (n-times-tail-delta (succ n) (delta (headDelta d) (bind (mono ds) tailDelta))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
134 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
135 headDelta (n-times-tail-delta (succ n) (mu (delta d (mono ds)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
136 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
137 monad-law-1-4 (succ n) (delta d (delta dd ds)) = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
138 headDelta (n-times-tail-delta (succ n) (headDelta (n-times-tail-delta (succ n) (delta d (delta dd ds))))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
139 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
140 headDelta (n-times-tail-delta (succ n) (headDelta (n-times-tail-delta n (delta dd ds)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
141 ≡⟨ {!!} ⟩ -- ? |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
142 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
143 headDelta (n-times-tail-delta n (delta (headDelta (tailDelta dd)) (bind ds (tailDelta ∙ tailDelta)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
144 ≡⟨ {!!} ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
145 headDelta (n-times-tail-delta n (delta (headDelta (tailDelta dd)) (bind ds (tailDelta ∙ tailDelta )))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
146 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
147 headDelta (n-times-tail-delta n (bind (delta dd ds) (tailDelta))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
148 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
149 headDelta (n-times-tail-delta (succ n) (delta (headDelta d) (bind (delta dd ds) (tailDelta)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
150 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
151 headDelta (n-times-tail-delta (succ n) (mu (delta d (delta dd ds)))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
152 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
153 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
154 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
155 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
156 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
157 monad-law-1-3 : {l : Level} {A : Set l} -> (i : Int) -> (d : Delta (Delta (Delta A))) -> |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
158 (bind (fmap mu d) (n-times-tail-delta i) ≡ (bind (bind d (n-times-tail-delta i)) (n-times-tail-delta i))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
159 monad-law-1-3 one (mono (mono d)) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
160 monad-law-1-3 one (mono (delta d d₁)) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
161 monad-law-1-3 one (delta d ds) = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
162 bind (fmap mu (delta d ds)) (n-times-tail-delta one) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
163 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
164 bind (delta (mu d) (fmap mu ds)) (n-times-tail-delta one) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
165 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
166 delta (headDelta ((n-times-tail-delta one) (mu d))) (bind (fmap mu ds) ((n-times-tail-delta one) ∙ tailDelta)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
167 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
168 delta (headDelta ((n-times-tail-delta one) (mu d))) (bind (fmap mu ds) (n-times-tail-delta (succ one))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
169 ≡⟨ cong (\dx -> delta (headDelta ((n-times-tail-delta one) (mu d))) dx) (monad-law-1-3 (succ one) ds) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
170 delta (headDelta ((n-times-tail-delta one) (mu d))) (bind (bind ds (n-times-tail-delta (succ one))) (n-times-tail-delta (succ one))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
171 ≡⟨ cong (\dx -> delta dx (bind (bind ds (n-times-tail-delta (succ one))) (n-times-tail-delta (succ one )))) (sym (monad-law-1-4 one d)) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
172 delta (headDelta ((n-times-tail-delta one) (headDelta ((n-times-tail-delta one) d)))) (bind (bind ds (n-times-tail-delta (succ one))) (n-times-tail-delta (succ one))) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
173 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
174 delta (headDelta ((n-times-tail-delta one) (headDelta ((n-times-tail-delta one) d)))) ((bind (bind ds (n-times-tail-delta (succ one)))) ((n-times-tail-delta one) ∙ tailDelta)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
175 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
176 bind (delta (headDelta ((n-times-tail-delta one) d)) (bind ds (n-times-tail-delta (succ one)))) (n-times-tail-delta one) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
177 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
178 bind (delta (headDelta ((n-times-tail-delta one) d)) (bind ds ((n-times-tail-delta one) ∙ tailDelta))) (n-times-tail-delta one) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
179 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
180 bind (bind (delta d ds) (n-times-tail-delta one)) (n-times-tail-delta one) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
181 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
182 monad-law-1-3 (succ i) d = {!!} |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
183 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
184 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
185 monad-law-1-2 : {l : Level} {A : Set l} -> (d : Delta (Delta A)) -> headDelta (mu d) ≡ (headDelta (headDelta d)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
186 monad-law-1-2 (mono _) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
187 monad-law-1-2 (delta _ _) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
188 |
39 | 189 -- monad-law-1 : join . fmap join = join . join |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
190 monad-law-1 : {l : Level} {A : Set l} -> (d : Delta (Delta (Delta A))) -> ((mu ∙ (fmap mu)) d) ≡ ((mu ∙ mu) d) |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
191 monad-law-1 (mono d) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
192 monad-law-1 (delta x d) = begin |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
193 (mu ∙ fmap mu) (delta x d) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
194 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
195 mu (fmap mu (delta x d)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
196 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
197 mu (delta (mu x) (fmap mu d)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
198 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
199 delta (headDelta (mu x)) (bind (fmap mu d) tailDelta) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
200 ≡⟨ cong (\x -> delta x (bind (fmap mu d) tailDelta)) (monad-law-1-2 x) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
201 delta (headDelta (headDelta x)) (bind (fmap mu d) tailDelta) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
202 ≡⟨ cong (\d -> delta (headDelta (headDelta x)) d) (monad-law-1-3 one d) ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
203 delta (headDelta (headDelta x)) (bind (bind d tailDelta) tailDelta) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
204 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
205 mu (delta (headDelta x) (bind d tailDelta)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
206 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
207 mu (mu (delta x d)) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
208 ≡⟨ refl ⟩ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
209 (mu ∙ mu) (delta x d) |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
210 ∎ |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
211 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
212 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
213 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
214 {- |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
215 -- monad-law-2 : join . fmap return = join . return = id |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
216 -- monad-law-2-1 join . fmap return = join . return |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
217 monad-law-2-1 : {l : Level} {A : Set l} -> (d : Delta A) -> |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
218 (mu ∙ fmap eta) d ≡ (mu ∙ eta) d |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
219 monad-law-2-1 (mono x) = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
220 monad-law-2-1 (delta x d) = {!!} |
63
474ed34e4f02
proving monad-law-1 ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
221 |
474ed34e4f02
proving monad-law-1 ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
222 |
39 | 223 -- monad-law-2-2 : join . return = id |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
224 monad-law-2-2 : {l : Level} {A : Set l } -> (d : Delta A) -> (mu ∙ eta) d ≡ id d |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
225 monad-law-2-2 d = refl |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
226 |
35
c5cdbedc68ad
Proof Monad-law-2-2
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
34
diff
changeset
|
227 |
39 | 228 -- monad-law-3 : return . f = fmap f . return |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
229 monad-law-3 : {l : Level} {A B : Set l} (f : A -> B) (x : A) -> (eta ∙ f) x ≡ (fmap f ∙ eta) x |
36 | 230 monad-law-3 f x = refl |
27
742e62fc63e4
Define Monad-law 1-4
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
26
diff
changeset
|
231 |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
232 |
39 | 233 -- monad-law-4 : join . fmap (fmap f) = fmap f . join |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
234 monad-law-4 : {l ll : Level} {A : Set l} {B : Set ll} (f : A -> B) (d : Delta (Delta A)) -> |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
235 (mu ∙ fmap (fmap f)) d ≡ (fmap f ∙ mu) d |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
236 monad-law-4 f d = {!!} |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
237 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
238 |
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
239 |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
240 |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
241 -- Monad-laws (Haskell) |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
242 -- monad-law-h-1 : return a >>= k = k a |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
243 monad-law-h-1 : {l ll : Level} {A : Set l} {B : Set ll} -> |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
244 (a : A) -> (k : A -> (Delta B)) -> |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
245 (return a >>= k) ≡ (k a) |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
246 monad-law-h-1 a k = refl |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
247 |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
248 |
40
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
249 |
a7cd7740f33e
Add Haskell style Monad-laws and Proof Monad-laws-h-1
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
39
diff
changeset
|
250 -- monad-law-h-2 : m >>= return = m |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
251 monad-law-h-2 : {l : Level}{A : Set l} -> (m : Delta A) -> (m >>= return) ≡ m |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
252 monad-law-h-2 (mono x) = refl |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
253 monad-law-h-2 (delta x d) = cong (delta x) (monad-law-h-2 d) |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
254 |
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
255 |
41
23474bf242c6
Proof monad-law-h-2, trying monad-law-h-3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
40
diff
changeset
|
256 -- monad-law-h-3 : m >>= (\x -> k x >>= h) = (m >>= k) >>= h |
23474bf242c6
Proof monad-law-h-2, trying monad-law-h-3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
40
diff
changeset
|
257 monad-law-h-3 : {l ll lll : Level} {A : Set l} {B : Set ll} {C : Set lll} -> |
43
90b171e3a73e
Rename to Delta from Similar
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
42
diff
changeset
|
258 (m : Delta A) -> (k : A -> (Delta B)) -> (h : B -> (Delta C)) -> |
41
23474bf242c6
Proof monad-law-h-2, trying monad-law-h-3
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
40
diff
changeset
|
259 (m >>= (\x -> k x >>= h)) ≡ ((m >>= k) >>= h) |
59
46b15f368905
Define bind and mu for Infinite Delta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
57
diff
changeset
|
260 monad-law-h-3 (mono x) k h = refl |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
261 monad-law-h-3 (delta x d) k h = {!!} |
69
295e8ed39c0c
Change headDelta definition. return non-delta value
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
262 |
70
18a20a14c4b2
Change prove method. use Int ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
263 -} |