forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGroup.agda
158 lines (124 loc) · 5.49 KB
/
Group.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
------------------------------------------------------------------------
-- The Agda standard library
--
-- Some derivable properties
------------------------------------------------------------------------
{-# OPTIONS --cubical-compatible --safe #-}
open import Algebra.Bundles
module Algebra.Properties.Group {g₁ g₂} (G : Group g₁ g₂) where
import Algebra.Properties.Loop as LoopProperties
import Algebra.Properties.Quasigroup as QuasigroupProperties
open import Data.Product.Base using (_,_)
open import Function.Base using (_$_)
open import Function.Definitions
open Group G
open import Algebra.Consequences.Setoid setoid
open import Algebra.Definitions _≈_
open import Algebra.Structures _≈_ using (IsLoop; IsQuasigroup)
open import Relation.Binary.Reasoning.Setoid setoid
\\-cong₂ : Congruent₂ _\\_
\\-cong₂ x≈y u≈v = ∙-cong (⁻¹-cong x≈y) u≈v
//-cong₂ : Congruent₂ _//_
//-cong₂ x≈y u≈v = ∙-cong x≈y (⁻¹-cong u≈v)
------------------------------------------------------------------------
-- Groups are quasi-groups
\\-leftDividesˡ : LeftDividesˡ _∙_ _\\_
\\-leftDividesˡ x y = begin
x ∙ (x \\ y) ≈⟨ assoc x (x ⁻¹) y ⟨
x ∙ x ⁻¹ ∙ y ≈⟨ ∙-congʳ (inverseʳ x) ⟩
ε ∙ y ≈⟨ identityˡ y ⟩
y ∎
\\-leftDividesʳ : LeftDividesʳ _∙_ _\\_
\\-leftDividesʳ x y = begin
x \\ x ∙ y ≈⟨ assoc (x ⁻¹) x y ⟨
x ⁻¹ ∙ x ∙ y ≈⟨ ∙-congʳ (inverseˡ x) ⟩
ε ∙ y ≈⟨ identityˡ y ⟩
y ∎
\\-leftDivides : LeftDivides _∙_ _\\_
\\-leftDivides = \\-leftDividesˡ , \\-leftDividesʳ
//-rightDividesˡ : RightDividesˡ _∙_ _//_
//-rightDividesˡ x y = begin
(y // x) ∙ x ≈⟨ assoc y (x ⁻¹) x ⟩
y ∙ (x ⁻¹ ∙ x) ≈⟨ ∙-congˡ (inverseˡ x) ⟩
y ∙ ε ≈⟨ identityʳ y ⟩
y ∎
//-rightDividesʳ : RightDividesʳ _∙_ _//_
//-rightDividesʳ x y = begin
y ∙ x // x ≈⟨ assoc y x (x ⁻¹) ⟩
y ∙ (x // x) ≈⟨ ∙-congˡ (inverseʳ x) ⟩
y ∙ ε ≈⟨ identityʳ y ⟩
y ∎
//-rightDivides : RightDivides _∙_ _//_
//-rightDivides = //-rightDividesˡ , //-rightDividesʳ
isQuasigroup : IsQuasigroup _∙_ _\\_ _//_
isQuasigroup = record
{ isMagma = isMagma
; \\-cong = \\-cong₂
; //-cong = //-cong₂
; leftDivides = \\-leftDivides
; rightDivides = //-rightDivides
}
quasigroup : Quasigroup _ _
quasigroup = record { isQuasigroup = isQuasigroup }
open QuasigroupProperties quasigroup public
using (x≈z//y; y≈x\\z)
renaming (cancelˡ to ∙-cancelˡ; cancelʳ to ∙-cancelʳ; cancel to ∙-cancel)
------------------------------------------------------------------------
-- Groups are loops
isLoop : IsLoop _∙_ _\\_ _//_ ε
isLoop = record { isQuasigroup = isQuasigroup ; identity = identity }
loop : Loop _ _
loop = record { isLoop = isLoop }
open LoopProperties loop public
using (identityˡ-unique; identityʳ-unique; identity-unique)
------------------------------------------------------------------------
-- Other properties
inverseˡ-unique : ∀ x y → x ∙ y ≈ ε → x ≈ y ⁻¹
inverseˡ-unique x y eq = trans (x≈z//y x y ε eq) (identityˡ _)
inverseʳ-unique : ∀ x y → x ∙ y ≈ ε → y ≈ x ⁻¹
inverseʳ-unique x y eq = trans (y≈x\\z x y ε eq) (identityʳ _)
ε⁻¹≈ε : ε ⁻¹ ≈ ε
ε⁻¹≈ε = sym $ inverseˡ-unique _ _ (identityˡ ε)
⁻¹-selfInverse : SelfInverse _⁻¹
⁻¹-selfInverse {x} {y} eq = sym $ inverseˡ-unique x y $ begin
x ∙ y ≈⟨ ∙-congˡ eq ⟨
x ∙ x ⁻¹ ≈⟨ inverseʳ x ⟩
ε ∎
⁻¹-involutive : Involutive _⁻¹
⁻¹-involutive = selfInverse⇒involutive ⁻¹-selfInverse
⁻¹-injective : Injective _≈_ _≈_ _⁻¹
⁻¹-injective = selfInverse⇒injective ⁻¹-selfInverse
⁻¹-anti-homo-∙ : ∀ x y → (x ∙ y) ⁻¹ ≈ y ⁻¹ ∙ x ⁻¹
⁻¹-anti-homo-∙ x y = ∙-cancelˡ _ _ _ $ begin
x ∙ y ∙ (x ∙ y) ⁻¹ ≈⟨ inverseʳ _ ⟩
ε ≈⟨ inverseʳ _ ⟨
x ∙ x ⁻¹ ≈⟨ ∙-congʳ (//-rightDividesʳ y x) ⟨
(x ∙ y) ∙ y ⁻¹ ∙ x ⁻¹ ≈⟨ assoc (x ∙ y) (y ⁻¹) (x ⁻¹) ⟩
x ∙ y ∙ (y ⁻¹ ∙ x ⁻¹) ∎
⁻¹-anti-homo-// : ∀ x y → (x // y) ⁻¹ ≈ y // x
⁻¹-anti-homo-// x y = begin
(x // y) ⁻¹ ≡⟨⟩
(x ∙ y ⁻¹) ⁻¹ ≈⟨ ⁻¹-anti-homo-∙ x (y ⁻¹) ⟩
(y ⁻¹) ⁻¹ ∙ x ⁻¹ ≈⟨ ∙-congʳ (⁻¹-involutive y) ⟩
y ∙ x ⁻¹ ≡⟨⟩
y // x ∎
⁻¹-anti-homo-\\ : ∀ x y → (x \\ y) ⁻¹ ≈ y \\ x
⁻¹-anti-homo-\\ x y = begin
(x \\ y) ⁻¹ ≡⟨⟩
(x ⁻¹ ∙ y) ⁻¹ ≈⟨ ⁻¹-anti-homo-∙ (x ⁻¹) y ⟩
y ⁻¹ ∙ (x ⁻¹) ⁻¹ ≈⟨ ∙-congˡ (⁻¹-involutive x) ⟩
y ⁻¹ ∙ x ≡⟨⟩
y \\ x ∎
\\≗flip-//⇒comm : (∀ x y → x \\ y ≈ y // x) → Commutative _∙_
\\≗flip-//⇒comm \\≗//ᵒ x y = begin
x ∙ y ≈⟨ ∙-congˡ (//-rightDividesˡ x y) ⟨
x ∙ ((y // x) ∙ x) ≈⟨ ∙-congˡ (∙-congʳ (\\≗//ᵒ x y)) ⟨
x ∙ ((x \\ y) ∙ x) ≈⟨ assoc x (x \\ y) x ⟨
x ∙ (x \\ y) ∙ x ≈⟨ ∙-congʳ (\\-leftDividesˡ x y) ⟩
y ∙ x ∎
comm⇒\\≗flip-// : Commutative _∙_ → ∀ x y → x \\ y ≈ y // x
comm⇒\\≗flip-// comm x y = begin
x \\ y ≡⟨⟩
x ⁻¹ ∙ y ≈⟨ comm _ _ ⟩
y ∙ x ⁻¹ ≡⟨⟩
y // x ∎