annotate Gutil.agda @ 234:3c3619b196dc

allListF
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 09 Dec 2020 07:12:01 +0900
parents c68956f6c3ad
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 open import Level hiding ( suc ; zero )
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 open import Algebra
14
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
3 module Gutil {n m : Level} (G : Group n m ) where
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
5 open import Data.Unit
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
6 open import Function.Inverse as Inverse using (_↔_; Inverse; _InverseOf_)
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
7 open import Function
7
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 6
diff changeset
8 open import Data.Nat hiding (_⊔_) -- using (ℕ; suc; zero)
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
9 open import Relation.Nullary
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
10 open import Data.Empty
5
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
11 open import Data.Product
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
12 open import Relation.Binary.PropositionalEquality hiding ( [_] )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 4
diff changeset
13
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
15 open Group G
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
17 import Relation.Binary.Reasoning.Setoid as EqReasoning
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
19 gsym = Algebra.Group.sym G
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
20 grefl = Algebra.Group.refl G
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
21 gtrans = Algebra.Group.trans G
8
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
22
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
23 lemma3 : ε ≈ ε ⁻¹
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
24 lemma3 = begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
25 ε ≈⟨ gsym (proj₁ inverse _) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
26 ε ⁻¹ ∙ ε ≈⟨ proj₂ identity _ ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
27 ε ⁻¹
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
28 ∎ where open EqReasoning (Algebra.Group.setoid G)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
29
8
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
30 lemma6 : {f : Carrier } → ( f ⁻¹ ) ⁻¹ ≈ f
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
31 lemma6 {f} = begin
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
32 ( f ⁻¹ ) ⁻¹ ≈⟨ gsym ( proj₁ identity _) ⟩
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
33 ε ∙ ( f ⁻¹ ) ⁻¹ ≈⟨ ∙-cong (gsym ( proj₂ inverse _ )) grefl ⟩
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
34 (f ∙ f ⁻¹ ) ∙ ( f ⁻¹ ) ⁻¹ ≈⟨ assoc _ _ _ ⟩
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
35 f ∙ ( f ⁻¹ ∙ ( f ⁻¹ ) ⁻¹ ) ≈⟨ ∙-cong grefl (proj₂ inverse _) ⟩
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
36 f ∙ ε ≈⟨ proj₂ identity _ ⟩
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
37 f
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
38 ∎ where open EqReasoning (Algebra.Group.setoid G)
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
39
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
40 ≡→≈ : {f g : Carrier } → f ≡ g → f ≈ g
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
41 ≡→≈ refl = grefl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
42
14
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
43 ---
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
44 -- to avoid assoc storm, flatten multiplication according to the template
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
45 --
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 13
diff changeset
46
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
47 data MP : Carrier → Set (Level.suc n) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
48 am : (x : Carrier ) → MP x
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
49 _o_ : {x y : Carrier } → MP x → MP y → MP ( x ∙ y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
50
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
51 mpf : {x : Carrier } → (m : MP x ) → Carrier → Carrier
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
52 mpf (am x) y = x ∙ y
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
53 mpf (m o m₁) y = mpf m ( mpf m₁ y )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
54
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
55 mp-flatten : {x : Carrier } → (m : MP x ) → Carrier
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
56 mp-flatten m = mpf m ε
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
57
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
58 mpl1 : Carrier → {x : Carrier } → MP x → Carrier
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
59 mpl1 x (am y) = x ∙ y
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
60 mpl1 x (y o y1) = mpl1 ( mpl1 x y ) y1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
61
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
62 mpl : {x z : Carrier } → MP x → MP z → Carrier
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
63 mpl (am x) m = mpl1 x m
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
64 mpl (m o m1) m2 = mpl m (m1 o m2)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
65
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
66 mp-flattenl : {x : Carrier } → (m : MP x ) → Carrier
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
67 mp-flattenl m = mpl m (am ε)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
68
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
69 test1 : ( f g : Carrier ) → Carrier
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
70 test1 f g = mp-flattenl ((am (g ⁻¹) o am (f ⁻¹) ) o ( (am f o am g) o am ((f ∙ g) ⁻¹ )))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
71
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
72 test2 : ( f g : Carrier ) → test1 f g ≡ g ⁻¹ ∙ f ⁻¹ ∙ f ∙ g ∙ (f ∙ g) ⁻¹ ∙ ε
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
73 test2 f g = _≡_.refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
74
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
75 test3 : ( f g : Carrier ) → Carrier
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
76 test3 f g = mp-flatten ((am (g ⁻¹) o am (f ⁻¹) ) o ( (am f o am g) o am ((f ∙ g) ⁻¹ )))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
77
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
78 test4 : ( f g : Carrier ) → test3 f g ≡ g ⁻¹ ∙ (f ⁻¹ ∙ (f ∙ (g ∙ ((f ∙ g) ⁻¹ ∙ ε))))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
79 test4 f g = _≡_.refl
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
80
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
81
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
82 ∙-flatten : {x : Carrier } → (m : MP x ) → x ≈ mp-flatten m
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
83 ∙-flatten {x} (am x) = gsym (proj₂ identity _)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
84 ∙-flatten {_} (am x o q) = ∙-cong grefl ( ∙-flatten q )
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
85 ∙-flatten (_o_ {_} {z} (_o_ {x} {y} p q) r) = lemma9 _ _ _ ( ∙-flatten {x ∙ y } (p o q )) ( ∙-flatten {z} r ) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
86 mp-cong : {p q r : Carrier} → (P : MP p) → q ≈ r → mpf P q ≈ mpf P r
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
87 mp-cong (am x) q=r = ∙-cong grefl q=r
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
88 mp-cong (P o P₁) q=r = mp-cong P ( mp-cong P₁ q=r )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
89 mp-assoc : {p q r : Carrier} → (P : MP p) → mpf P q ∙ r ≈ mpf P (q ∙ r )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
90 mp-assoc (am x) = assoc _ _ _
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
91 mp-assoc {p} {q} {r} (P o P₁) = begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
92 mpf P (mpf P₁ q) ∙ r ≈⟨ mp-assoc P ⟩
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
93 mpf P (mpf P₁ q ∙ r) ≈⟨ mp-cong P (mp-assoc P₁) ⟩ mpf P ((mpf P₁) (q ∙ r))
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
94 ∎ where open EqReasoning (Algebra.Group.setoid G)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
95 lemma9 : (x y z : Carrier) → x ∙ y ≈ mpf p (mpf q ε) → z ≈ mpf r ε → x ∙ y ∙ z ≈ mp-flatten ((p o q) o r)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
96 lemma9 x y z t s = begin
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
97 x ∙ y ∙ z ≈⟨ ∙-cong t grefl ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
98 mpf p (mpf q ε) ∙ z ≈⟨ mp-assoc p ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
99 mpf p (mpf q ε ∙ z) ≈⟨ mp-cong p (mp-assoc q ) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
100 mpf p (mpf q (ε ∙ z)) ≈⟨ mp-cong p (mp-cong q (proj₁ identity _ )) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
101 mpf p (mpf q z) ≈⟨ mp-cong p (mp-cong q s) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
102 mpf p (mpf q (mpf r ε))
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 10
diff changeset
103 ∎ where open EqReasoning (Algebra.Group.setoid G)
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 8
diff changeset
104
87
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
105 grepl : { x y0 y1 z : Carrier } → x ∙ y0 ≈ y1 → x ∙ ( y0 ∙ z ) ≈ y1 ∙ z
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
106 grepl eq = gtrans (gsym (assoc _ _ _ )) (∙-cong eq grefl )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
107
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
108 grm : { x y0 y1 z : Carrier } → x ∙ y0 ≈ ε → x ∙ ( y0 ∙ z ) ≈ z
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
109 grm eq = gtrans ( gtrans (gsym (assoc _ _ _ )) (∙-cong eq grefl )) ( proj₁ identity _ )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 15
diff changeset
110
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
111 -- ∙-flattenl : {x : Carrier } → (m : MP x ) → x ≈ mp-flattenl m
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
112 -- ∙-flattenl (am x) = gsym (proj₂ identity _)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
113 -- ∙-flattenl (q o am x) with ∙-flattenl q -- x₁ ∙ x ≈ mpl q (am x o am ε) , t : x₁ ≈ mpl q (am ε)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
114 -- ... | t = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
115 -- ∙-flattenl (q o (x o y )) with ∙-flattenl q
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
116 -- ... | t = gtrans (gsym (assoc _ _ _ )) {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 14
diff changeset
117
8
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
118 lemma5 : (f g : Carrier ) → g ⁻¹ ∙ f ⁻¹ ≈ (f ∙ g) ⁻¹
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
119 lemma5 f g = begin
12
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
120 g ⁻¹ ∙ f ⁻¹ ≈⟨ gsym (proj₂ identity _) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
121 g ⁻¹ ∙ f ⁻¹ ∙ ε ≈⟨ gsym (∙-cong grefl (proj₂ inverse _ )) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
122 g ⁻¹ ∙ f ⁻¹ ∙ ( (f ∙ g) ∙ (f ∙ g) ⁻¹ ) ≈⟨ ∙-flatten ((am (g ⁻¹) o am (f ⁻¹) ) o ( (am f o am g) o am ((f ∙ g) ⁻¹ ))) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
123 g ⁻¹ ∙ (f ⁻¹ ∙ (f ∙ (g ∙ ((f ∙ g) ⁻¹ ∙ ε)))) ≈⟨ ∙-cong grefl (gsym (assoc _ _ _ )) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
124 g ⁻¹ ∙ ((f ⁻¹ ∙ f) ∙ (g ∙ ((f ∙ g) ⁻¹ ∙ ε))) ≈⟨ ∙-cong grefl (gtrans (∙-cong (proj₁ inverse _ ) grefl) (proj₁ identity _)) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
125 g ⁻¹ ∙ (g ∙ ((f ∙ g) ⁻¹ ∙ ε)) ≈⟨ gsym (assoc _ _ _) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
126 (g ⁻¹ ∙ g ) ∙ ((f ∙ g) ⁻¹ ∙ ε) ≈⟨ gtrans (∙-cong (proj₁ inverse _ ) grefl) (proj₁ identity _) ⟩
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 11
diff changeset
127 (f ∙ g) ⁻¹ ∙ ε ≈⟨ proj₂ identity _ ⟩
8
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
128 (f ∙ g) ⁻¹
4e275f918e63 deriving-inv done
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 7
diff changeset
129 ∎ where open EqReasoning (Algebra.Group.setoid G)
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 5
diff changeset
130