Skip to content

Commit 9a4453e

Browse files
jamesmckinnaMatthewDaggitt
authored andcommitted
Add new operations (cf. RawQuasigroup) to IsGroup (#2251)
* added new operations to `IsGroup` * fixed notations * fixed `CHANGELOG` * refactoring `Group` properties: added `isQuasigroup` and `isLoop` * refactoring `*-helper` lemmas * fixed `CHANGELOG` * lemma relating quasigroup operations and `Commutative` property * simplified proof * added converse property to \¬Algebra.Properties.AbelianGroup` * moved lemma * indentation; congruence lemmas * untangled operation definitions * untangled operation definitions in `CHANGELOG` * fixed names * reflexive reasoning; tightened imports * refactoring to push properties into `Loop`, and re-export them from there and `Quasigroup` * further refactoring * final refactoring * Minor naming tweaks --------- Co-authored-by: MatthewDaggitt <[email protected]>
1 parent 5680458 commit 9a4453e

File tree

5 files changed

+202
-97
lines changed

5 files changed

+202
-97
lines changed

CHANGELOG.md

+41
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ Deprecated names
4141
1×-identityʳ ↦ ×-homo-1
4242
```
4343

44+
* In `Algebra.Structures.IsGroup`:
45+
```agda
46+
_-_ ↦ _//_
47+
```
48+
4449
* In `Data.Nat.Divisibility.Core`:
4550
```agda
4651
*-pres-∣ ↦ Data.Nat.Divisibility.*-pres-∣
@@ -135,6 +140,32 @@ Additions to existing modules
135140
rawModule : RawModule R c ℓ
136141
```
137142

143+
* In `Algebra.Properties.Group`:
144+
```agda
145+
isQuasigroup : IsQuasigroup _∙_ _\\_ _//_
146+
quasigroup : Quasigroup _ _
147+
isLoop : IsLoop _∙_ _\\_ _//_ ε
148+
loop : Loop _ _
149+
150+
\\-leftDividesˡ : LeftDividesˡ _∙_ _\\_
151+
\\-leftDividesʳ : LeftDividesʳ _∙_ _\\_
152+
\\-leftDivides : LeftDivides _∙_ _\\_
153+
//-rightDividesˡ : RightDividesˡ _∙_ _//_
154+
//-rightDividesʳ : RightDividesʳ _∙_ _//_
155+
//-rightDivides : RightDivides _∙_ _//_
156+
157+
⁻¹-selfInverse : SelfInverse _⁻¹
158+
\\≗flip-//⇒comm : (∀ x y → x \\ y ≈ y // x) → Commutative _∙_
159+
comm⇒\\≗flip-// : Commutative _∙_ → ∀ x y → x \\ y ≈ y // x
160+
```
161+
162+
* In `Algebra.Properties.Loop`:
163+
```agda
164+
identityˡ-unique : x ∙ y ≈ y → x ≈ ε
165+
identityʳ-unique : x ∙ y ≈ x → y ≈ ε
166+
identity-unique : Identity x _∙_ → x ≈ ε
167+
```
168+
138169
* In `Algebra.Construct.Terminal`:
139170
```agda
140171
rawNearSemiring : RawNearSemiring c ℓ
@@ -154,6 +185,16 @@ Additions to existing modules
154185
idem-×-homo-* : (_*_ IdempotentOn x) → (m × x) * (n × x) ≈ (m ℕ.* n) × x
155186
```
156187

188+
* In `Algebra.Structures.IsGroup`:
189+
```agda
190+
infixl 6 _//_
191+
_//_ : Op₂ A
192+
x // y = x ∙ (y ⁻¹)
193+
infixr 6 _\\_
194+
_\\_ : Op₂ A
195+
x \\ y = (x ⁻¹) ∙ y
196+
```
197+
157198
* In `Data.Container.Indexed.Core`:
158199
```agda
159200
Subtrees o c = (r : Response c) → X (next c r)

src/Algebra/Properties/Group.agda

+118-84
Original file line numberDiff line numberDiff line change
@@ -10,99 +10,133 @@ open import Algebra.Bundles
1010

1111
module Algebra.Properties.Group {g₁ g₂} (G : Group g₁ g₂) where
1212

13+
import Algebra.Properties.Loop as LoopProperties
14+
import Algebra.Properties.Quasigroup as QuasigroupProperties
15+
open import Data.Product.Base using (_,_)
16+
open import Function.Base using (_$_)
17+
open import Function.Definitions
18+
1319
open Group G
20+
open import Algebra.Consequences.Setoid setoid
1421
open import Algebra.Definitions _≈_
22+
open import Algebra.Structures _≈_ using (IsLoop; IsQuasigroup)
1523
open import Relation.Binary.Reasoning.Setoid setoid
16-
open import Function.Base using (_$_; _⟨_⟩_)
17-
open import Data.Product.Base using (_,_; proj₂)
1824

19-
ε⁻¹≈ε : ε ⁻¹ ≈ ε
20-
ε⁻¹≈ε = begin
21-
ε ⁻¹ ≈⟨ sym $ identityʳ (ε ⁻¹) ⟩
22-
ε ⁻¹ ∙ ε ≈⟨ inverseˡ ε ⟩
23-
ε ∎
24-
25-
private
26-
27-
left-helper : x y x ≈ (x ∙ y) ∙ y ⁻¹
28-
left-helper x y = begin
29-
x ≈⟨ sym (identityʳ x) ⟩
30-
x ∙ ε ≈⟨ ∙-congˡ $ sym (inverseʳ y) ⟩
31-
x ∙ (y ∙ y ⁻¹) ≈⟨ sym (assoc x y (y ⁻¹)) ⟩
32-
(x ∙ y) ∙ y ⁻¹ ∎
33-
34-
right-helper : x y y ≈ x ⁻¹ ∙ (x ∙ y)
35-
right-helper x y = begin
36-
y ≈⟨ sym (identityˡ y) ⟩
37-
ε ∙ y ≈⟨ ∙-congʳ $ sym (inverseˡ x) ⟩
38-
(x ⁻¹ ∙ x) ∙ y ≈⟨ assoc (x ⁻¹) x y ⟩
39-
x ⁻¹ ∙ (x ∙ y) ∎
40-
41-
∙-cancelˡ : LeftCancellative _∙_
42-
∙-cancelˡ x y z eq = begin
43-
y ≈⟨ right-helper x y ⟩
44-
x ⁻¹ ∙ (x ∙ y) ≈⟨ ∙-congˡ eq ⟩
45-
x ⁻¹ ∙ (x ∙ z) ≈⟨ right-helper x z ⟨
46-
z ∎
47-
48-
∙-cancelʳ : RightCancellative _∙_
49-
∙-cancelʳ x y z eq = begin
50-
y ≈⟨ left-helper y x ⟩
51-
y ∙ x ∙ x ⁻¹ ≈⟨ ∙-congʳ eq ⟩
52-
z ∙ x ∙ x ⁻¹ ≈⟨ left-helper z x ⟨
53-
z ∎
54-
55-
∙-cancel : Cancellative _∙_
56-
∙-cancel = ∙-cancelˡ , ∙-cancelʳ
57-
58-
⁻¹-involutive : x x ⁻¹ ⁻¹ ≈ x
59-
⁻¹-involutive x = begin
60-
x ⁻¹ ⁻¹ ≈⟨ identityʳ _ ⟨
61-
x ⁻¹ ⁻¹ ∙ ε ≈⟨ ∙-congˡ $ inverseˡ _ ⟨
62-
x ⁻¹ ⁻¹ ∙ (x ⁻¹ ∙ x) ≈⟨ right-helper (x ⁻¹) x ⟨
63-
x ∎
64-
65-
⁻¹-injective : {x y} x ⁻¹ ≈ y ⁻¹ x ≈ y
66-
⁻¹-injective {x} {y} eq = ∙-cancelʳ _ _ _ ( begin
67-
x ∙ x ⁻¹ ≈⟨ inverseʳ x ⟩
68-
ε ≈⟨ inverseʳ y ⟨
69-
y ∙ y ⁻¹ ≈⟨ ∙-congˡ eq ⟨
70-
y ∙ x ⁻¹ ∎ )
25+
\\-cong₂ : Congruent₂ _\\_
26+
\\-cong₂ x≈y u≈v = ∙-cong (⁻¹-cong x≈y) u≈v
7127

72-
⁻¹-anti-homo-∙ : x y (x ∙ y) ⁻¹ ≈ y ⁻¹ ∙ x ⁻¹
73-
⁻¹-anti-homo-∙ x y = ∙-cancelˡ _ _ _ ( begin
74-
x ∙ y ∙ (x ∙ y) ⁻¹ ≈⟨ inverseʳ _ ⟩
75-
ε ≈⟨ inverseʳ _ ⟨
76-
x ∙ x ⁻¹ ≈⟨ ∙-congʳ (left-helper x y) ⟩
77-
(x ∙ y) ∙ y ⁻¹ ∙ x ⁻¹ ≈⟨ assoc (x ∙ y) (y ⁻¹) (x ⁻¹) ⟩
78-
x ∙ y ∙ (y ⁻¹ ∙ x ⁻¹) ∎ )
28+
//-cong₂ : Congruent₂ _//_
29+
//-cong₂ x≈y u≈v = ∙-cong x≈y (⁻¹-cong u≈v)
30+
31+
------------------------------------------------------------------------
32+
-- Groups are quasi-groups
33+
34+
\\-leftDividesˡ : LeftDividesˡ _∙_ _\\_
35+
\\-leftDividesˡ x y = begin
36+
x ∙ (x \\ y) ≈⟨ assoc x (x ⁻¹) y ⟨
37+
x ∙ x ⁻¹ ∙ y ≈⟨ ∙-congʳ (inverseʳ x) ⟩
38+
ε ∙ y ≈⟨ identityˡ y ⟩
39+
y ∎
40+
41+
\\-leftDividesʳ : LeftDividesʳ _∙_ _\\_
42+
\\-leftDividesʳ x y = begin
43+
x \\ x ∙ y ≈⟨ assoc (x ⁻¹) x y ⟨
44+
x ⁻¹ ∙ x ∙ y ≈⟨ ∙-congʳ (inverseˡ x) ⟩
45+
ε ∙ y ≈⟨ identityˡ y ⟩
46+
y ∎
47+
48+
49+
\\-leftDivides : LeftDivides _∙_ _\\_
50+
\\-leftDivides = \\-leftDividesˡ , \\-leftDividesʳ
51+
52+
//-rightDividesˡ : RightDividesˡ _∙_ _//_
53+
//-rightDividesˡ x y = begin
54+
(y // x) ∙ x ≈⟨ assoc y (x ⁻¹) x ⟩
55+
y ∙ (x ⁻¹ ∙ x) ≈⟨ ∙-congˡ (inverseˡ x) ⟩
56+
y ∙ ε ≈⟨ identityʳ y ⟩
57+
y ∎
58+
59+
//-rightDividesʳ : RightDividesʳ _∙_ _//_
60+
//-rightDividesʳ x y = begin
61+
y ∙ x // x ≈⟨ assoc y x (x ⁻¹) ⟩
62+
y ∙ (x // x) ≈⟨ ∙-congˡ (inverseʳ x) ⟩
63+
y ∙ ε ≈⟨ identityʳ y ⟩
64+
y ∎
65+
66+
//-rightDivides : RightDivides _∙_ _//_
67+
//-rightDivides = //-rightDividesˡ , //-rightDividesʳ
68+
69+
isQuasigroup : IsQuasigroup _∙_ _\\_ _//_
70+
isQuasigroup = record
71+
{ isMagma = isMagma
72+
; \\-cong = \\-cong₂
73+
; //-cong = //-cong₂
74+
; leftDivides = \\-leftDivides
75+
; rightDivides = //-rightDivides
76+
}
77+
78+
quasigroup : Quasigroup _ _
79+
quasigroup = record { isQuasigroup = isQuasigroup }
80+
81+
open QuasigroupProperties quasigroup public
82+
using (x≈z//y; y≈x\\z)
83+
renaming (cancelˡ to ∙-cancelˡ; cancelʳ to ∙-cancelʳ; cancel to ∙-cancel)
84+
85+
------------------------------------------------------------------------
86+
-- Groups are loops
87+
88+
isLoop : IsLoop _∙_ _\\_ _//_ ε
89+
isLoop = record { isQuasigroup = isQuasigroup ; identity = identity }
7990

80-
identityˡ-unique : x y x ∙ y ≈ y x ≈ ε
81-
identityˡ-unique x y eq = begin
82-
x ≈⟨ left-helper x y ⟩
83-
(x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩
84-
y ∙ y ⁻¹ ≈⟨ inverseʳ y ⟩
85-
ε ∎
91+
loop : Loop _ _
92+
loop = record { isLoop = isLoop }
8693

87-
identityʳ-unique : x y x ∙ y ≈ x y ≈ ε
88-
identityʳ-unique x y eq = begin
89-
y ≈⟨ right-helper x y ⟩
90-
x ⁻¹ ∙ (x ∙ y) ≈⟨ refl ⟨ ∙-cong ⟩ eq ⟩
91-
x ⁻¹ ∙ x ≈⟨ inverseˡ x ⟩
92-
ε ∎
94+
open LoopProperties loop public
95+
using (identityˡ-unique; identityʳ-unique; identity-unique)
9396

94-
identity-unique : {x} Identity x _∙_ x ≈ ε
95-
identity-unique {x} id = identityˡ-unique x x (proj₂ id x)
97+
------------------------------------------------------------------------
98+
-- Other properties
9699

97100
inverseˡ-unique : x y x ∙ y ≈ ε x ≈ y ⁻¹
98-
inverseˡ-unique x y eq = begin
99-
x ≈⟨ left-helper x y ⟩
100-
(x ∙ y) ∙ y ⁻¹ ≈⟨ ∙-congʳ eq ⟩
101-
ε ∙ y ⁻¹ ≈⟨ identityˡ (y ⁻¹) ⟩
102-
y ⁻¹ ∎
101+
inverseˡ-unique x y eq = trans (x≈z//y x y ε eq) (identityˡ _)
103102

104103
inverseʳ-unique : x y x ∙ y ≈ ε y ≈ x ⁻¹
105-
inverseʳ-unique x y eq = begin
106-
y ≈⟨ sym (⁻¹-involutive y) ⟩
107-
y ⁻¹ ⁻¹ ≈⟨ ⁻¹-cong (sym (inverseˡ-unique x y eq)) ⟩
108-
x ⁻¹ ∎
104+
inverseʳ-unique x y eq = trans (y≈x\\z x y ε eq) (identityʳ _)
105+
106+
ε⁻¹≈ε : ε ⁻¹ ≈ ε
107+
ε⁻¹≈ε = sym $ inverseˡ-unique _ _ (identityˡ ε)
108+
109+
⁻¹-selfInverse : SelfInverse _⁻¹
110+
⁻¹-selfInverse {x} {y} eq = sym $ inverseˡ-unique x y $ begin
111+
x ∙ y ≈⟨ ∙-congˡ eq ⟨
112+
x ∙ x ⁻¹ ≈⟨ inverseʳ x ⟩
113+
ε ∎
114+
115+
⁻¹-involutive : Involutive _⁻¹
116+
⁻¹-involutive = selfInverse⇒involutive ⁻¹-selfInverse
117+
118+
⁻¹-injective : Injective _≈_ _≈_ _⁻¹
119+
⁻¹-injective = selfInverse⇒injective ⁻¹-selfInverse
120+
121+
⁻¹-anti-homo-∙ : x y (x ∙ y) ⁻¹ ≈ y ⁻¹ ∙ x ⁻¹
122+
⁻¹-anti-homo-∙ x y = ∙-cancelˡ _ _ _ $ begin
123+
x ∙ y ∙ (x ∙ y) ⁻¹ ≈⟨ inverseʳ _ ⟩
124+
ε ≈⟨ inverseʳ _ ⟨
125+
x ∙ x ⁻¹ ≈⟨ ∙-congʳ (//-rightDividesʳ y x) ⟨
126+
(x ∙ y) ∙ y ⁻¹ ∙ x ⁻¹ ≈⟨ assoc (x ∙ y) (y ⁻¹) (x ⁻¹) ⟩
127+
x ∙ y ∙ (y ⁻¹ ∙ x ⁻¹) ∎
128+
129+
\\≗flip-//⇒comm : ( x y x \\ y ≈ y // x) Commutative _∙_
130+
\\≗flip-//⇒comm \\≗//ᵒ x y = begin
131+
x ∙ y ≈⟨ ∙-congˡ (//-rightDividesˡ x y) ⟨
132+
x ∙ ((y // x) ∙ x) ≈⟨ ∙-congˡ (∙-congʳ (\\≗//ᵒ x y)) ⟨
133+
x ∙ ((x \\ y) ∙ x) ≈⟨ assoc x (x \\ y) x ⟨
134+
x ∙ (x \\ y) ∙ x ≈⟨ ∙-congʳ (\\-leftDividesˡ x y) ⟩
135+
y ∙ x ∎
136+
137+
comm⇒\\≗flip-// : Commutative _∙_ x y x \\ y ≈ y // x
138+
comm⇒\\≗flip-// comm x y = begin
139+
x \\ y ≡⟨⟩
140+
x ⁻¹ ∙ y ≈⟨ comm _ _ ⟩
141+
y ∙ x ⁻¹ ≡⟨⟩
142+
y // x ∎

src/Algebra/Properties/Loop.agda

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
------------------------------------------------------------------------
22
-- The Agda standard library
33
--
4-
-- Some basic properties of Quasigroup
4+
-- Some basic properties of Loop
55
------------------------------------------------------------------------
66

77
{-# OPTIONS --cubical-compatible --safe #-}
@@ -12,29 +12,46 @@ module Algebra.Properties.Loop {l₁ l₂} (L : Loop l₁ l₂) where
1212

1313
open Loop L
1414
open import Algebra.Definitions _≈_
15+
open import Algebra.Properties.Quasigroup quasigroup
16+
open import Data.Product.Base using (proj₂)
1517
open import Relation.Binary.Reasoning.Setoid setoid
16-
open import Algebra.Properties.Quasigroup
1718

1819
x//x≈ε : x x // x ≈ ε
1920
x//x≈ε x = begin
20-
x // x ≈⟨ //-congʳ (sym (identityˡ x)) ⟩
21+
x // x ≈⟨ //-congʳ (identityˡ x)
2122
(ε ∙ x) // x ≈⟨ rightDividesʳ x ε ⟩
2223
ε ∎
2324

24-
x\\x≈ε : x x \\ x ≈ ε
25+
x\\x≈ε : x x \\ x ≈ ε
2526
x\\x≈ε x = begin
26-
x \\ x ≈⟨ \\-congˡ (sym (identityʳ x )) ⟩
27+
x \\ x ≈⟨ \\-congˡ (identityʳ x )
2728
x \\ (x ∙ ε) ≈⟨ leftDividesʳ x ε ⟩
2829
ε ∎
2930

3031
ε\\x≈x : x ε \\ x ≈ x
3132
ε\\x≈x x = begin
32-
ε \\ x ≈⟨ sym (identityˡ (ε \\ x)) ⟩
33+
ε \\ x ≈⟨ identityˡ (ε \\ x)
3334
ε ∙ (ε \\ x) ≈⟨ leftDividesˡ ε x ⟩
3435
x ∎
3536

3637
x//ε≈x : x x // ε ≈ x
3738
x//ε≈x x = begin
38-
x // ε ≈⟨ sym (identityʳ (x // ε)) ⟩
39+
x // ε ≈⟨ identityʳ (x // ε)
3940
(x // ε) ∙ ε ≈⟨ rightDividesˡ ε x ⟩
4041
x ∎
42+
43+
identityˡ-unique : x y x ∙ y ≈ y x ≈ ε
44+
identityˡ-unique x y eq = begin
45+
x ≈⟨ x≈z//y x y y eq ⟩
46+
y // y ≈⟨ x//x≈ε y ⟩
47+
ε ∎
48+
49+
identityʳ-unique : x y x ∙ y ≈ x y ≈ ε
50+
identityʳ-unique x y eq = begin
51+
y ≈⟨ y≈x\\z x y x eq ⟩
52+
x \\ x ≈⟨ x\\x≈ε x ⟩
53+
ε ∎
54+
55+
identity-unique : {x} Identity x _∙_ x ≈ ε
56+
identity-unique {x} id = identityˡ-unique x x (proj₂ id x)
57+

src/Algebra/Properties/Quasigroup.agda

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ open import Data.Product.Base using (_,_)
1717

1818
cancelˡ : LeftCancellative _∙_
1919
cancelˡ x y z eq = begin
20-
y ≈⟨ sym( leftDividesʳ x y) ⟩
20+
y ≈⟨ leftDividesʳ x y
2121
x \\ (x ∙ y) ≈⟨ \\-congˡ eq ⟩
2222
x \\ (x ∙ z) ≈⟨ leftDividesʳ x z ⟩
2323
z ∎
2424

2525
cancelʳ : RightCancellative _∙_
2626
cancelʳ x y z eq = begin
27-
y ≈⟨ sym( rightDividesʳ x y) ⟩
27+
y ≈⟨ rightDividesʳ x y
2828
(y ∙ x) // x ≈⟨ //-congʳ eq ⟩
2929
(z ∙ x) // x ≈⟨ rightDividesʳ x z ⟩
3030
z ∎
@@ -34,12 +34,12 @@ cancel = cancelˡ , cancelʳ
3434

3535
y≈x\\z : x y z x ∙ y ≈ z y ≈ x \\ z
3636
y≈x\\z x y z eq = begin
37-
y ≈⟨ sym (leftDividesʳ x y) ⟩
37+
y ≈⟨ leftDividesʳ x y
3838
x \\ (x ∙ y) ≈⟨ \\-congˡ eq ⟩
3939
x \\ z ∎
4040

4141
x≈z//y : x y z x ∙ y ≈ z x ≈ z // y
4242
x≈z//y x y z eq = begin
43-
x ≈⟨ sym (rightDividesʳ y x) ⟩
43+
x ≈⟨ rightDividesʳ y x
4444
(x ∙ y) // y ≈⟨ //-congʳ eq ⟩
4545
z // y ∎

0 commit comments

Comments
 (0)