Skip to content

Commit ba505b0

Browse files
authored
[ DRY ] refactor Algebra.Properties.{Quasigroup|Loop} (#2768)
* [ DRY ] refactor `Algebra.Properties.Quasigroup` * refactor: also `Loop` properties
1 parent eef9345 commit ba505b0

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

src/Algebra/Properties/Loop.agda

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,16 @@ open import Data.Product.Base using (proj₂)
1717
open import Relation.Binary.Reasoning.Setoid setoid
1818

1919
x//x≈ε : x x // x ≈ ε
20-
x//x≈ε x = begin
21-
x // x ≈⟨ //-congʳ (identityˡ x) ⟨
22-
(ε ∙ x) // x ≈⟨ rightDividesʳ x ε ⟩
23-
ε ∎
20+
x//x≈ε x = sym (x≈z//y _ _ _ (identityˡ x))
2421

2522
x\\x≈ε : x x \\ x ≈ ε
26-
x\\x≈ε x = begin
27-
x \\ x ≈⟨ \\-congˡ (identityʳ x ) ⟨
28-
x \\ (x ∙ ε) ≈⟨ leftDividesʳ x ε ⟩
29-
ε ∎
23+
x\\x≈ε x = sym (y≈x\\z _ _ _ (identityʳ x))
3024

3125
ε\\x≈x : x ε \\ x ≈ x
32-
ε\\x≈x x = begin
33-
ε \\ x ≈⟨ identityˡ (ε \\ x) ⟨
34-
ε ∙ (ε \\ x) ≈⟨ leftDividesˡ ε x ⟩
35-
x ∎
26+
ε\\x≈x x = sym (y≈x\\z _ _ _ (identityˡ x))
3627

3728
x//ε≈x : x x // ε ≈ x
38-
x//ε≈x x = begin
39-
x // ε ≈⟨ identityʳ (x // ε) ⟨
40-
(x // ε) ∙ ε ≈⟨ rightDividesˡ ε x ⟩
41-
x ∎
29+
x//ε≈x x = sym (x≈z//y _ _ _ (identityʳ x))
4230

4331
identityˡ-unique : x y x ∙ y ≈ y x ≈ ε
4432
identityˡ-unique x y eq = begin

src/Algebra/Properties/Quasigroup.agda

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,29 @@ open import Algebra.Definitions _≈_
1515
open import Relation.Binary.Reasoning.Setoid setoid
1616
open import Data.Product.Base using (_,_)
1717

18+
y≈x\\z : x y z x ∙ y ≈ z y ≈ x \\ z
19+
y≈x\\z x y z eq = begin
20+
y ≈⟨ leftDividesʳ x y ⟨
21+
x \\ (x ∙ y) ≈⟨ \\-congˡ eq ⟩
22+
x \\ z ∎
23+
24+
x≈z//y : x y z x ∙ y ≈ z x ≈ z // y
25+
x≈z//y x y z eq = begin
26+
x ≈⟨ rightDividesʳ y x ⟨
27+
(x ∙ y) // y ≈⟨ //-congʳ eq ⟩
28+
z // y ∎
29+
1830
cancelˡ : LeftCancellative _∙_
1931
cancelˡ x y z eq = begin
20-
y ≈⟨ leftDividesʳ x y ⟨
21-
x \\ (x ∙ y) ≈⟨ \\-congˡ eq ⟩
32+
y ≈⟨ y≈x\\z x y (x ∙ z) eq ⟩
2233
x \\ (x ∙ z) ≈⟨ leftDividesʳ x z ⟩
2334
z ∎
2435

2536
cancelʳ : RightCancellative _∙_
2637
cancelʳ x y z eq = begin
27-
y ≈⟨ rightDividesʳ x y ⟨
28-
(y ∙ x) // x ≈⟨ //-congʳ eq ⟩
38+
y ≈⟨ x≈z//y y x (z ∙ x) eq ⟩
2939
(z ∙ x) // x ≈⟨ rightDividesʳ x z ⟩
3040
z ∎
3141

3242
cancel : Cancellative _∙_
3343
cancel = cancelˡ , cancelʳ
34-
35-
y≈x\\z : x y z x ∙ y ≈ z y ≈ x \\ z
36-
y≈x\\z x y z eq = begin
37-
y ≈⟨ leftDividesʳ x y ⟨
38-
x \\ (x ∙ y) ≈⟨ \\-congˡ eq ⟩
39-
x \\ z ∎
40-
41-
x≈z//y : x y z x ∙ y ≈ z x ≈ z // y
42-
x≈z//y x y z eq = begin
43-
x ≈⟨ rightDividesʳ y x ⟨
44-
(x ∙ y) // y ≈⟨ //-congʳ eq ⟩
45-
z // y ∎

0 commit comments

Comments
 (0)