annotate PermGroup.agda @ 4:121213cfc85a

add Solvable
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 16 Aug 2020 19:50:43 +0900
parents 6e77fefcbe41
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
1 module PermGroup where
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 open import Level hiding ( suc ; zero )
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 open import Algebra
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 open import Algebra.Structures
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 open import Data.Fin
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
7 open import Data.Product
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 open import Data.Fin.Permutation
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 open import Function hiding (id ; flip)
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 open import Function.Inverse as Inverse using (_↔_; Inverse; _InverseOf_)
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 open import Function.LeftInverse using ( _LeftInverseOf_ )
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 open import Function.Equality using (Π)
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 open import Data.Nat using (ℕ; suc; zero)
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 open import Relation.Binary.PropositionalEquality
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 f1 : Fin 3 → Fin 3
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 f1 zero = suc (suc zero)
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 f1 (suc zero) = zero
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 f1 (suc (suc zero)) = suc zero
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 lemma1 : Permutation 3 3
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 lemma1 = permutation f1 ( f1 ∘ f1 ) lemma2 where
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 lemma3 : (x : Fin 3 ) → f1 (f1 (f1 x)) ≡ x
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 lemma3 zero = refl
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 lemma3 (suc zero) = refl
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 lemma3 (suc (suc zero)) = refl
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 lemma2 : :→-to-Π (λ x → f1 (f1 x)) InverseOf :→-to-Π f1
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 lemma2 = record { left-inverse-of = λ x → lemma3 x ; right-inverse-of = λ x → lemma3 x }
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 fid : {p : ℕ } → Fin p → Fin p
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 fid x = x
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 -- Data.Fin.Permutation.id
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 pid : {p : ℕ } → Permutation p p
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 pid = permutation fid fid record { left-inverse-of = λ x → refl ; right-inverse-of = λ x → refl }
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 -- Data.Fin.Permutation.flip
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 pinv : {p : ℕ } → Permutation p p → Permutation p p
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 pinv {p} P = permutation (_⟨$⟩ˡ_ P) (_⟨$⟩ʳ_ P ) record { left-inverse-of = λ x → inverseʳ P ; right-inverse-of = λ x → inverseˡ P }
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
41 record _=p=_ {p : ℕ } ( x y : Permutation p p ) : Set where
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
42 field
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
43 peq : ( q : Fin p ) → x ⟨$⟩ʳ q ≡ y ⟨$⟩ʳ q
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
45 open _=p=_
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
47 prefl : {p : ℕ } { x : Permutation p p } → x =p= x
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
48 peq (prefl {p} {x}) q = refl
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
49
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
50 psym : {p : ℕ } { x y : Permutation p p } → x =p= y → y =p= x
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
51 peq (psym {p} {x} {y} eq ) q = sym (peq eq q)
1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
52
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
53 ptrans : {p : ℕ } { x y z : Permutation p p } → x =p= y → y =p= z → x =p= z
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
54 peq (ptrans {p} {x} {y} x=y y=z ) q = trans (peq x=y q) (peq y=z q)
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
56 Pgroup : ℕ → Group Level.zero Level.zero
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
57 Pgroup p = record {
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 Carrier = Permutation p p
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
59 ; _≈_ = _=p=_
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 ; _∙_ = _∘ₚ_
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 ; ε = pid
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 ; _⁻¹ = pinv
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
63 ; isGroup = record { isMonoid = record { isSemigroup = record { isMagma = record {
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
64 isEquivalence = record {refl = prefl ; trans = ptrans ; sym = psym }
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 ; ∙-cong = presp }
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 ; assoc = passoc }
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
67 ; identity = ( (λ q → record { peq = λ q → refl } ) , (λ q → record { peq = λ q → refl } )) }
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
68 ; inverse = ( (λ x → record { peq = λ q → inverseʳ x} ) , (λ x → record { peq = λ q → inverseˡ x} ))
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
69 ; ⁻¹-cong = λ i=j → record { peq = λ q → p-inv i=j q }
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 }
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 } where
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
72 presp : {x y u v : Permutation p p } → x =p= y → u =p= v → (x ∘ₚ u) =p= (y ∘ₚ v)
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
73 presp {x} {y} {u} {v} x=y u=v = record { peq = λ q → lemma4 q } where
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
74 lemma4 : (q : Fin p) → ((x ∘ₚ u) ⟨$⟩ʳ q) ≡ ((y ∘ₚ v) ⟨$⟩ʳ q)
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
75 lemma4 q = trans (cong (λ k → Inverse.to u Π.⟨$⟩ k) (peq x=y q) ) (peq u=v _ )
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
76 passoc : (x y z : Permutation p p) → ((x ∘ₚ y) ∘ₚ z) =p= (x ∘ₚ (y ∘ₚ z))
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
77 passoc x y z = record { peq = λ q → refl }
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
78 p-inv : {i j : Permutation p p} → i =p= j → (q : Fin p) → pinv i ⟨$⟩ʳ q ≡ pinv j ⟨$⟩ʳ q
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
79 p-inv {i} {j} i=j q = begin
4
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
80 i ⟨$⟩ˡ q ≡⟨ cong (λ k → i ⟨$⟩ˡ k) (sym (inverseʳ j) ) ⟩
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
81 i ⟨$⟩ˡ ( j ⟨$⟩ʳ ( j ⟨$⟩ˡ q )) ≡⟨ cong (λ k → i ⟨$⟩ˡ k) (sym (peq i=j _ )) ⟩
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
82 i ⟨$⟩ˡ ( i ⟨$⟩ʳ ( j ⟨$⟩ˡ q )) ≡⟨ inverseˡ i ⟩
121213cfc85a add Solvable
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 3
diff changeset
83 j ⟨$⟩ˡ q
3
6e77fefcbe41 Permutation Group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 2
diff changeset
84 ∎ where open ≡-Reasoning
0
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
dc677bac3c54 Permutation group
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86