forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroup.agda
More file actions
125 lines (100 loc) · 4.43 KB
/
Group.agda
File metadata and controls
125 lines (100 loc) · 4.43 KB
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
------------------------------------------------------------------------
-- 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
open Group G
open import Algebra.Consequences.Setoid setoid
open import Algebra.Definitions _≈_
import Algebra.Properties.Loop as LoopProperties
import Algebra.Properties.Quasigroup as QuasigroupProperties
open import Algebra.Structures _≈_ using (IsLoop; IsQuasigroup)
open import Data.Product.Base using (_,_)
open import Function.Base using (_$_)
open import Function.Definitions
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)
leftDividesˡ : ∀ x y → x ∙ (x \\ y) ≈ y
leftDividesˡ x y = begin
x ∙ (x \\ y) ≈⟨ assoc x (x ⁻¹) y ⟨
x ∙ x ⁻¹ ∙ y ≈⟨ ∙-congʳ (inverseʳ x) ⟩
ε ∙ y ≈⟨ identityˡ y ⟩
y ∎
leftDividesʳ : ∀ x y → x \\ x ∙ y ≈ y
leftDividesʳ x y = begin
x \\ x ∙ y ≈⟨ assoc (x ⁻¹) x y ⟨
x ⁻¹ ∙ x ∙ y ≈⟨ ∙-congʳ (inverseˡ x) ⟩
ε ∙ y ≈⟨ identityˡ y ⟩
y ∎
rightDividesˡ : ∀ x y → (y // x) ∙ x ≈ y
rightDividesˡ x y = begin
(y // x) ∙ x ≈⟨ assoc y (x ⁻¹) x ⟩
y ∙ (x ⁻¹ ∙ x) ≈⟨ ∙-congˡ (inverseˡ x) ⟩
y ∙ ε ≈⟨ identityʳ y ⟩
y ∎
rightDividesʳ : ∀ x y → y ∙ x // x ≈ y
rightDividesʳ x y = begin
y ∙ x // x ≈⟨ assoc y x (x ⁻¹) ⟩
y ∙ (x // x) ≈⟨ ∙-congˡ (inverseʳ x) ⟩
y ∙ ε ≈⟨ identityʳ y ⟩
y ∎
isQuasigroup : IsQuasigroup _∙_ _\\_ _//_
isQuasigroup = record
{ isMagma = isMagma
; \\-cong = \\-cong₂
; //-cong = //-cong₂
; leftDivides = leftDividesˡ , leftDividesʳ
; rightDivides = 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)
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
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)
⁻¹-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 ⁻¹) ∎
\\≗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 ∎