annotate agda/deltaM/monad.agda @ 117:6f86b55bf8b4

Temporary commit : Proving association-law ....
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Mon, 02 Feb 2015 09:57:37 +0900
parents f02c5ad4a327
children 53cb21845dea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Level
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Relation.Binary.PropositionalEquality
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open ≡-Reasoning
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import basic
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import delta
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 open import delta.functor
111
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
8 open import delta.monad
98
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import deltaM
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 open import deltaM.functor
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
11 open import nat
98
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import laws
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 module deltaM.monad where
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 open Functor
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 open NaturalTransformation
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 open Monad
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
b7f0879e854e Trying Monad-laws for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
20 -- proof utils
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
21 deconstruct : {l : Level} {A : Set l} {n : Nat}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
22 {M : Set l -> Set l} {fm : Functor M} {mm : Monad M fm}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
23 (d : DeltaM M {fm} {mm} A (S n)) -> Delta (M A) (S n)
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
24 deconstruct (deltaM d) = d
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
25
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
26
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
27
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
28 -- sub proofs
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
29
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
30 deconstruct-id : {l : Level} {A : Set l} {n : Nat}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
31 {M : Set l -> Set l} {fm : Functor M} {mm : Monad M fm}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
32 (d : DeltaM M {fm} {mm} A (S n)) -> deltaM (deconstruct d) ≡ d
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
33 deconstruct-id {n = O} (deltaM x) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
34 deconstruct-id {n = S n} (deltaM x) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
35
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
36
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
37 headDeltaM-with-appendDeltaM : {l : Level} {A : Set l} {n m : Nat}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
38 {M : Set l -> Set l} {fm : Functor M} {mm : Monad M fm}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
39 (d : DeltaM M {fm} {mm} A (S n)) -> (ds : DeltaM M {fm} {mm} A (S m)) ->
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
40 headDeltaM (appendDeltaM d ds) ≡ headDeltaM d
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
41 headDeltaM-with-appendDeltaM {l} {A} {n = O} {O} (deltaM (mono _)) (deltaM _) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
42 headDeltaM-with-appendDeltaM {l} {A} {n = O} {S m} (deltaM (mono _)) (deltaM _) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
43 headDeltaM-with-appendDeltaM {l} {A} {n = S n} {O} (deltaM (delta _ _)) (deltaM _) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
44 headDeltaM-with-appendDeltaM {l} {A} {n = S n} {S m} (deltaM (delta _ _)) (deltaM _) = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
45
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
46 fmap-headDeltaM-with-deltaM-eta : {l : Level} {A : Set l} {n : Nat}
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
47 {M : Set l -> Set l} {functorM : Functor M} {monadM : Monad M functorM}
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
48 (x : M A) -> (fmap functorM ((headDeltaM {l} {A} {n} {M} {functorM} {monadM}) ∙ deltaM-eta) x) ≡ fmap functorM (eta monadM) x
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
49 fmap-headDeltaM-with-deltaM-eta {l} {A} {O} {M} {fm} {mm} x = refl
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
50 fmap-headDeltaM-with-deltaM-eta {l} {A} {S n} {M} {fm} {mm} x = refl
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
51
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
52
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
53 fmap-tailDeltaM-with-deltaM-eta : {l : Level} {A : Set l} {n : Nat}
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
54 {M : Set l -> Set l} {functorM : Functor M} {monadM : Monad M functorM}
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
55 (d : DeltaM M {functorM} {monadM} A (S n)) ->
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
56 deltaM-fmap ((tailDeltaM {n = n} {monadM = monadM} ) ∙ deltaM-eta) d ≡ deltaM-fmap (deltaM-eta) d
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
57 fmap-tailDeltaM-with-deltaM-eta {n = O} d = refl
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
58 fmap-tailDeltaM-with-deltaM-eta {n = S n} d = refl
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
59
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
60
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
61 fmap-headDeltaM-with-deltaM-mu : {l : Level} {A : Set l} {n : Nat}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
62 {M : Set l -> Set l} {fm : Functor M} {mm : Monad M fm}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
63 (x : M (DeltaM M {fm} {mm} (DeltaM M A (S n)) (S n))) ->
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
64 fmap fm (headDeltaM ∙ deltaM-mu) x ≡ fmap fm (((mu mm) ∙ (fmap fm headDeltaM)) ∙ headDeltaM) x
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
65 fmap-headDeltaM-with-deltaM-mu {l} {A} {O} {M} {fm} {mm} x = refl
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
66 fmap-headDeltaM-with-deltaM-mu {l} {A} {S n} {M} {fm} {mm} x = begin
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
67 fmap fm (headDeltaM ∙ deltaM-mu) x ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
68 fmap fm (headDeltaM ∙ (\d -> appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM d)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
69 (deltaM-mu (deltaM-fmap tailDeltaM (tailDeltaM d))))) x ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
70 fmap fm (\d -> headDeltaM (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM d)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
71 (deltaM-mu (deltaM-fmap tailDeltaM (tailDeltaM d))))) x
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
72 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
73 fmap fm (\d -> headDeltaM (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM d)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
74 (deltaM (deconstruct {A = A} {mm = mm} (deltaM-mu (deltaM-fmap tailDeltaM (tailDeltaM d))))))) x
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
75 ≡⟨ {!!} ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
76 fmap fm (\d -> headDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM d)))))) x ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
77 fmap fm (\d -> (mu mm (fmap fm headDeltaM (headDeltaM d)))) x ≡⟨ {!!} ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
78 fmap fm (((mu mm) ∙ (fmap fm headDeltaM)) ∙ headDeltaM) x
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
79
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
80
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
81
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
82
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
83 -- main proofs
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
84
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
85 postulate deltaM-eta-is-nt : {l : Level} {A B : Set l} {n : Nat}
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
86 {M : Set l -> Set l} {functorM : Functor M} {monadM : Monad M functorM}
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
87 (f : A -> B) -> (x : A) ->
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
88 ((deltaM-eta {l} {B} {n} {M} {functorM} {monadM} )∙ f) x ≡ deltaM-fmap f (deltaM-eta x)
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
89 {-
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
90 deltaM-eta-is-nt {l} {A} {B} {O} {M} {fm} {mm} f x = begin
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
91 deltaM-eta {n = O} (f x) ≡⟨ refl ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
92 deltaM (mono (eta mm (f x))) ≡⟨ cong (\de -> deltaM (mono de)) (eta-is-nt mm f x) ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
93 deltaM (mono (fmap fm f (eta mm x))) ≡⟨ refl ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
94 deltaM-fmap f (deltaM-eta {n = O} x) ∎
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
95 deltaM-eta-is-nt {l} {A} {B} {S n} {M} {fm} {mm} f x = begin
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
96 deltaM-eta {n = S n} (f x) ≡⟨ refl ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
97 deltaM (delta-eta {n = S n} (eta mm (f x))) ≡⟨ refl ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
98 deltaM (delta (eta mm (f x)) (delta-eta (eta mm (f x))))
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
99 ≡⟨ cong (\de -> deltaM (delta de (delta-eta de))) (eta-is-nt mm f x) ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
100 deltaM (delta (fmap fm f (eta mm x)) (delta-eta (fmap fm f (eta mm x))))
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
101 ≡⟨ cong (\de -> deltaM (delta (fmap fm f (eta mm x)) de)) (eta-is-nt delta-is-monad (fmap fm f) (eta mm x)) ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
102 deltaM (delta (fmap fm f (eta mm x)) (delta-fmap (fmap fm f) (delta-eta (eta mm x))))
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
103 ≡⟨ refl ⟩
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
104 deltaM-fmap f (deltaM-eta {n = S n} x)
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
105
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
106 -}
102
9c62373bd474 Trying right-unity-law on DeltaM. but do not fit implicit type in eta...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
107
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
108 postulate deltaM-right-unity-law : {l : Level} {A : Set l}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
109 {M : Set l -> Set l} {functorM : Functor M} {monadM : Monad M functorM} {n : Nat}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
110 (d : DeltaM M {functorM} {monadM} A (S n)) -> (deltaM-mu ∙ deltaM-eta) d ≡ id d
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
111 {-
111
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
112 deltaM-right-unity-law {l} {A} {M} {fm} {mm} {O} (deltaM (mono x)) = begin
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
113 deltaM-mu (deltaM-eta (deltaM (mono x))) ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
114 deltaM-mu (deltaM (mono (eta mm (deltaM (mono x))))) ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
115 deltaM (mono (mu mm (fmap fm (headDeltaM {M = M})(eta mm (deltaM (mono x))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
116 ≡⟨ cong (\de -> deltaM (mono (mu mm de))) (sym (eta-is-nt mm headDeltaM (deltaM (mono x)) )) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
117 deltaM (mono (mu mm (eta mm ((headDeltaM {l} {A} {O} {M} {fm} {mm}) (deltaM (mono x)))))) ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
118 deltaM (mono (mu mm (eta mm x))) ≡⟨ cong (\de -> deltaM (mono de)) (sym (right-unity-law mm x)) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
119 deltaM (mono x)
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
120
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
121 deltaM-right-unity-law {l} {A} {M} {fm} {mm} {S n} (deltaM (delta x d)) = begin
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
122 deltaM-mu (deltaM-eta (deltaM (delta x d)))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
123 ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
124 deltaM-mu (deltaM (delta (eta mm (deltaM (delta x d))) (delta-eta (eta mm (deltaM (delta x d))))))
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
125 ≡⟨ refl ⟩
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
126 appendDeltaM (deltaM (mono (mu mm (fmap fm (headDeltaM {monadM = mm}) (eta mm (deltaM (delta x d)))))))
111
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
127 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
128 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono (mu mm de)))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
129 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d))))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
130 (sym (eta-is-nt mm headDeltaM (deltaM (delta x d)))) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
131 appendDeltaM (deltaM (mono (mu mm (eta mm ((headDeltaM {monadM = mm}) (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
132 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
133 ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
134 appendDeltaM (deltaM (mono (mu mm (eta mm x))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
135 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d)))))))
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
136 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono de)) (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d))))))))
111
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
137 (sym (right-unity-law mm x)) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
138 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-eta (eta mm (deltaM (delta x d)))))))
103
a271f3ff1922 Delte type dependencie in Monad record for escape implicit type conflict
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 102
diff changeset
139 ≡⟨ refl ⟩
111
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
140 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-eta (eta mm (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
141 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM de))) (sym (eta-is-nt delta-is-monad (fmap fm tailDeltaM) (eta mm (deltaM (delta x d))))) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
142 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM (delta-eta (fmap fm tailDeltaM (eta mm (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
143 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM (delta-eta de)))) (sym (eta-is-nt mm tailDeltaM (deltaM (delta x d)))) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
144 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM (delta-eta (eta mm (tailDeltaM (deltaM (delta x d)))))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
145 ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
146 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM (delta-eta (eta mm (deltaM d)))))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
147 ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
148 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-eta (deltaM d)))
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
149 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) de) (deltaM-right-unity-law (deltaM d)) ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
150 appendDeltaM (deltaM (mono x)) (deltaM d)
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
151 ≡⟨ refl ⟩
9fe3d0bd1149 Prove right-unity-law on DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 104
diff changeset
152 deltaM (delta x d)
102
9c62373bd474 Trying right-unity-law on DeltaM. but do not fit implicit type in eta...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
153
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
154 -}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
155
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
156
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
157
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
158
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
159
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
160 postulate deltaM-left-unity-law : {l : Level} {A : Set l}
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
161 {M : Set l -> Set l} {functorM : Functor M} {monadM : Monad M functorM}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
162 {n : Nat}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
163 (d : DeltaM M {functorM} {monadM} A (S n)) ->
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
164 (deltaM-mu ∙ (deltaM-fmap deltaM-eta)) d ≡ id d
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
165 {-
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
166 deltaM-left-unity-law {l} {A} {M} {fm} {mm} {O} (deltaM (mono x)) = begin
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
167 deltaM-mu (deltaM-fmap deltaM-eta (deltaM (mono x)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
168 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
169 deltaM-mu (deltaM (delta-fmap (fmap fm deltaM-eta) (mono x)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
170 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
171 deltaM-mu (deltaM (mono (fmap fm deltaM-eta x)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
172 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
173 deltaM (mono (mu mm (fmap fm (headDeltaM {l} {A} {O} {M}) (fmap fm deltaM-eta x))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
174 ≡⟨ cong (\de -> deltaM (mono (mu mm de))) (sym (covariant fm deltaM-eta headDeltaM x)) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
175 deltaM (mono (mu mm (fmap fm ((headDeltaM {l} {A} {O} {M} {fm} {mm}) ∙ deltaM-eta) x)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
176 ≡⟨ cong (\de -> deltaM (mono (mu mm de))) (fmap-headDeltaM-with-deltaM-eta {l} {A} {O} {M} {fm} {mm} x) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
177 deltaM (mono (mu mm (fmap fm (eta mm) x)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
178 ≡⟨ cong (\de -> deltaM (mono de)) (left-unity-law mm x) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
179 deltaM (mono x)
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
180
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
181 deltaM-left-unity-law {l} {A} {M} {fm} {mm} {S n} (deltaM (delta x d)) = begin
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
182 deltaM-mu (deltaM-fmap deltaM-eta (deltaM (delta x d)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
183 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
184 deltaM-mu (deltaM (delta-fmap (fmap fm deltaM-eta) (delta x d)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
185 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
186 deltaM-mu (deltaM (delta (fmap fm deltaM-eta x) (delta-fmap (fmap fm deltaM-eta) d)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
187 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
188 appendDeltaM (deltaM (mono (mu mm (fmap fm (headDeltaM {l} {A} {S n} {M} {fm} {mm}) (fmap fm deltaM-eta x)))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
189 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
190 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono (mu mm de)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
191 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d)))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
192 (sym (covariant fm deltaM-eta headDeltaM x)) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
193 appendDeltaM (deltaM (mono (mu mm (fmap fm ((headDeltaM {l} {A} {S n} {M} {fm} {mm}) ∙ deltaM-eta) x))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
194 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
195 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono (mu mm de)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
196 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d)))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
197 (fmap-headDeltaM-with-deltaM-eta {l} {A} {S n} {M} {fm} {mm} x) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
198 appendDeltaM (deltaM (mono (mu mm (fmap fm (eta mm) x))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
199 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d))))
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
200
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
201 ≡⟨ cong (\de -> (appendDeltaM (deltaM (mono de)) (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d))))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
202 (left-unity-law mm x) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
203 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-eta) d))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
204 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
205 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-fmap (tailDeltaM {n = n})(deltaM-fmap deltaM-eta (deltaM d))))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
206 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) (deltaM-mu de)) (sym (covariant deltaM-is-functor deltaM-eta tailDeltaM (deltaM d))) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
207 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-fmap ((tailDeltaM {n = n}) ∙ deltaM-eta) (deltaM d)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
208 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) (deltaM-mu de)) (fmap-tailDeltaM-with-deltaM-eta (deltaM d)) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
209 appendDeltaM (deltaM (mono x)) (deltaM-mu (deltaM-fmap deltaM-eta (deltaM d)))
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
210 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono x)) de) (deltaM-left-unity-law (deltaM d)) ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
211 appendDeltaM (deltaM (mono x)) (deltaM d)
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
212 ≡⟨ refl ⟩
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
213 deltaM (delta x d)
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
214
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
215
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
216 -}
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
217 postulate nya : {l : Level} {A : Set l}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
218 (M : Set l -> Set l) (fm : Functor M) (mm : Monad M fm)
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
219 (d : DeltaM M {fm} {mm} (DeltaM M {fm} {mm} (DeltaM M {fm} {mm} A (S O)) (S O)) (S O)) ->
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
220 deltaM-mu (deltaM-fmap deltaM-mu d) ≡ deltaM-mu (deltaM-mu d)
114
08403eb8db8b Prove natural transformation for deltaM-eta
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 112
diff changeset
221
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
222
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
223
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
224
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
225
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
226
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
227
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
228 deltaM-association-law : {l : Level} {A : Set l} {n : Nat}
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
229 (M : Set l -> Set l) (fm : Functor M) (mm : Monad M fm)
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
230 (d : DeltaM M {fm} {mm} (DeltaM M {fm} {mm} (DeltaM M {fm} {mm} A (S n)) (S n)) (S n)) ->
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
231 deltaM-mu (deltaM-fmap deltaM-mu d) ≡ deltaM-mu (deltaM-mu d)
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
232 deltaM-association-law {l} {A} {O} M fm mm (deltaM (mono x)) = nya {l} {A} M fm mm (deltaM (mono x))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
233 {-
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
234 begin
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
235 deltaM-mu (deltaM-fmap deltaM-mu (deltaM (mono x))) ≡⟨ refl ⟩
116
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
236 deltaM-mu (deltaM (mono (fmap fm deltaM-mu x))) ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
237 deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM {A = DeltaM M A (S O)} {monadM = mm} (deltaM (mono (fmap fm deltaM-mu x))))))) ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
238 deltaM (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x)))) ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
239 deltaM (mono (mu mm (fmap fm (headDeltaM {A = A} {monadM = mm}) (fmap fm
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
240 (\d -> (deltaM (mono (mu mm (fmap fm headDeltaM ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}) d)))))) x))))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
241 ≡⟨ cong (\de -> deltaM (mono (mu mm de)))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
242 (sym (covariant fm (\d -> (deltaM (mono (mu mm (fmap fm headDeltaM ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}) d)))))) headDeltaM x)) ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
243 deltaM (mono (mu mm (fmap fm ((headDeltaM {A = A} {monadM = mm}) ∙
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
244 (\d -> (deltaM (mono (mu mm (fmap fm headDeltaM ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}) d))))))) x)))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
245 ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
246 deltaM (mono (mu mm (fmap fm (\d -> (headDeltaM {A = A} {monadM = mm} (deltaM (mono (mu mm (fmap fm headDeltaM ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}) d))))))) x)))
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
247 ≡⟨ refl ⟩
116
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
248 deltaM (mono (mu mm (fmap fm (\d -> (mu mm (fmap fm headDeltaM ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}) d)))) x)))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
249 ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
250 deltaM (mono (mu mm (fmap fm ((mu mm) ∙ (((fmap fm headDeltaM)) ∙ ((headDeltaM {l} {DeltaM M A (S O)} {monadM = mm})))) x)))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
251 ≡⟨ cong (\de -> deltaM (mono (mu mm de))) (covariant fm ((fmap fm headDeltaM) ∙ (headDeltaM)) (mu mm) x )⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
252 deltaM (mono (mu mm (((fmap fm (mu mm)) ∙ (fmap fm ((fmap fm headDeltaM) ∙ (headDeltaM {l} {DeltaM M A (S O)} {monadM = mm})))) x)))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
253 ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
254 deltaM (mono (mu mm (fmap fm (mu mm) ((fmap fm ((fmap fm headDeltaM) ∙ (headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}))) x))))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
255 ≡⟨ cong (\de -> deltaM (mono (mu mm (fmap fm (mu mm) de)))) (covariant fm headDeltaM (fmap fm headDeltaM) x) ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
256 deltaM (mono (mu mm (fmap fm (mu mm) (((fmap fm (fmap fm headDeltaM)) ∙ (fmap fm (headDeltaM {l} {DeltaM M A (S O)} {monadM = mm}))) x))))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
257 ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
258 deltaM (mono (mu mm (fmap fm (mu mm) (fmap fm (fmap fm headDeltaM) (fmap fm headDeltaM x)))))
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
259 ≡⟨ cong (\de -> deltaM (mono de)) (association-law mm (fmap fm (fmap fm headDeltaM) (fmap fm headDeltaM x))) ⟩
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
260 deltaM (mono (mu mm (mu mm (fmap fm (fmap fm headDeltaM) (fmap fm headDeltaM x)))))
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
261 ≡⟨ cong (\de -> deltaM (mono (mu mm de))) (mu-is-nt mm headDeltaM (fmap fm headDeltaM x)) ⟩
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
262 deltaM (mono (mu mm (fmap fm headDeltaM (mu mm (fmap fm headDeltaM x))))) ≡⟨ refl ⟩
116
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
263 deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM {A = DeltaM M A (S O)} {monadM = mm} (deltaM (mono (mu mm (fmap fm headDeltaM x)))))))) ≡⟨ refl ⟩
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
264 deltaM-mu (deltaM (mono (mu mm (fmap fm headDeltaM x)))) ≡⟨ refl ⟩
116
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
265 deltaM-mu (deltaM (mono (mu mm (fmap fm headDeltaM (headDeltaM {A = DeltaM M (DeltaM M A (S O)) (S O)} {monadM = mm} (deltaM (mono x))))))) ≡⟨ refl ⟩
f02c5ad4a327 Prove association-law for DeltaM by (S O) pattern with definition changes
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
266 deltaM-mu (deltaM-mu (deltaM (mono x))) ∎
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
267 -}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
268 deltaM-association-law {l} {A} {S n} M fm mm (deltaM (delta x d)) = {!!}
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
269 {-
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
270 deltaM-association-law {l} {A} {S n} M fm mm (deltaM (delta x d)) = begin
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
271 deltaM-mu (deltaM-fmap deltaM-mu (deltaM (delta x d))) ≡⟨ refl ⟩
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
272 deltaM-mu (deltaM (delta-fmap (fmap fm deltaM-mu) (delta x d))) ≡⟨ refl ⟩
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
273 deltaM-mu (deltaM (delta (fmap fm deltaM-mu x) (delta-fmap (fmap fm deltaM-mu) d))) ≡⟨ refl ⟩
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
274 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x)))))
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
275 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (delta-fmap (fmap fm deltaM-mu) d)))) ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
276 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
277 (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-fmap (fmap fm deltaM-mu) d))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
278 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x))))) de)
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
279 (sym (deconstruct-id (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-fmap (fmap fm deltaM-mu) d)))))) ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
280
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
281 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
282 (deltaM (deconstruct {A = A} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-fmap (fmap fm deltaM-mu) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
283 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
284 deltaM (deltaAppend (mono (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
285 (deconstruct {A = A} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-fmap (fmap fm deltaM-mu) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
286 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
287 deltaM (delta (mu mm (fmap fm headDeltaM (fmap fm deltaM-mu x)))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
288 (deconstruct {A = A} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) (delta-fmap (fmap fm deltaM-mu) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
289 ≡⟨ {!!} ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
290 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (mu mm (fmap fm headDeltaM x))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
291 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d)))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
292 ≡⟨ cong (\de -> appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (mu mm (fmap fm headDeltaM x))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
293 (deltaM-mu (deltaM-fmap tailDeltaM de)))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
294 (sym (deconstruct-id (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))) ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
295 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (mu mm (fmap fm headDeltaM x))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
296 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d)))))))
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
297
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
298 ≡⟨ refl ⟩
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
299 appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM (mu mm (fmap fm headDeltaM x))))))
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
300 (deltaM-mu (deltaM-fmap tailDeltaM (tailDeltaM ( (deltaM (delta (mu mm (fmap fm headDeltaM x))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
301 (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
302 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
303 appendDeltaM (deltaM (mono (mu mm (fmap fm (headDeltaM {monadM = mm}) (headDeltaM {monadM = mm} ((deltaM (delta (mu mm (fmap fm headDeltaM x))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
304 (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
305 (deltaM-mu (deltaM-fmap tailDeltaM (tailDeltaM ( (deltaM (delta (mu mm (fmap fm headDeltaM x))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
306 (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
307 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
308 deltaM-mu (deltaM (delta (mu mm (fmap fm headDeltaM x))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
309 (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
310 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
311 deltaM-mu (deltaM (deltaAppend (mono (mu mm (fmap fm headDeltaM x)))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
312 (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
313 ≡⟨ refl ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
314 deltaM-mu (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM x))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
315 (deltaM (deconstruct {A = DeltaM M A (S (S n))} {mm = mm} (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
316 ≡⟨ cong (\de -> deltaM-mu (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM x)))) de))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
317 (deconstruct-id (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d)))) ⟩
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
318 deltaM-mu (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM x))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
319 (deltaM-mu (deltaM (delta-fmap (fmap fm tailDeltaM) d))))
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
320 ≡⟨ refl ⟩
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
321 deltaM-mu (appendDeltaM (deltaM (mono (mu mm (fmap fm headDeltaM x))))
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
322 (deltaM-mu (deltaM-fmap tailDeltaM (deltaM d))))≡⟨ refl ⟩
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
323 deltaM-mu (deltaM-mu (deltaM (delta x d)))
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
324
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
325 -}
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
326
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
327
104
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
328
ebd0d6e2772c Trying redenition Delta with length constraints
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 103
diff changeset
329 deltaM-is-monad : {l : Level} {A : Set l} {n : Nat}
112
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
330 {M : Set l -> Set l}
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
331 (functorM : Functor M)
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
332 (monadM : Monad M functorM) ->
0a3b6cb91a05 Prove left-unity-law for DeltaM
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
333 Monad {l} (\A -> DeltaM M {functorM} {monadM} A (S n)) (deltaM-is-functor {l} {n})
115
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
334 deltaM-is-monad {l} {A} {n} {M} functorM monadM =
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
335 record { mu = deltaM-mu;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
336 eta = deltaM-eta;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
337 return = deltaM-eta;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
338 bind = deltaM-bind;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
339 association-law = (deltaM-association-law M functorM monadM) ;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
340 left-unity-law = deltaM-left-unity-law;
e6bcc7467335 Temporary commit : Proving association-law ...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 114
diff changeset
341 right-unity-law = (\x -> (sym (deltaM-right-unity-law x))) ;
117
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
342 eta-is-nt = deltaM-eta-is-nt;
6f86b55bf8b4 Temporary commit : Proving association-law ....
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
343 mu-is-nt = {!!}}
102
9c62373bd474 Trying right-unity-law on DeltaM. but do not fit implicit type in eta...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
344
9c62373bd474 Trying right-unity-law on DeltaM. but do not fit implicit type in eta...
Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
parents: 98
diff changeset
345