@@ -13,20 +13,17 @@ open import Algebra.Structures using (IsMagma)
13
13
module Algebra.Properties.Monoid.Reasoning {o ℓ} (M : Monoid o ℓ) where
14
14
15
15
open Monoid M
16
- using (Carrier; _∙_; _≈_; setoid; isMagma; semigroup; ε; sym; identityˡ; identityʳ
17
- ; ∙-cong; refl; assoc; ∙-congˡ; ∙-congʳ)
16
+ using (Carrier; _∙_; _≈_; setoid; isMagma; semigroup; ε; sym; identityˡ
17
+ ; identityʳ ; ∙-cong; refl; assoc; ∙-congˡ; ∙-congʳ; trans )
18
18
open import Relation.Binary.Reasoning.Setoid setoid
19
19
open import Algebra.Properties.Semigroup.Reasoning semigroup public
20
20
21
21
module Identity {a : Carrier } where
22
22
id-unique : (∀ b → b ∙ a ≈ b) → a ≈ ε
23
- id-unique b∙a≈b = trans (sym (identityˡ a) ) (b∙a≈b ε)
23
+ id-unique b∙a≈b = trans (sym (identityˡ a)) (b∙a≈b ε)
24
24
25
25
id-comm : a ∙ ε ≈ ε ∙ a
26
- id-comm = begin
27
- a ∙ ε ≈⟨ identityʳ a ⟩
28
- a ≈⟨ sym (identityˡ a)⟩
29
- ε ∙ a ∎
26
+ id-comm = trans (identityʳ a) (sym (identityˡ a))
30
27
31
28
id-comm-sym : ε ∙ a ≈ a ∙ ε
32
29
id-comm-sym = sym id-comm
@@ -35,16 +32,10 @@ open Identity public
35
32
36
33
module IntroElim {a b : Carrier} (a≈ε : a ≈ ε) where
37
34
elimʳ : b ∙ a ≈ b
38
- elimʳ = begin
39
- b ∙ a ≈⟨ ∙-congˡ a≈ε ⟩
40
- b ∙ ε ≈⟨ identityʳ b ⟩
41
- b ∎
35
+ elimʳ = trans (∙-congˡ a≈ε) (identityʳ b)
42
36
43
37
elimˡ : a ∙ b ≈ b
44
- elimˡ = begin
45
- a ∙ b ≈⟨ ∙-congʳ a≈ε ⟩
46
- ε ∙ b ≈⟨ identityˡ b ⟩
47
- b ∎
38
+ elimˡ = trans (∙-congʳ a≈ε) (identityˡ b)
48
39
49
40
introʳ : a ≈ ε → b ≈ b ∙ a
50
41
introʳ a≈ε = sym elimʳ
@@ -53,29 +44,17 @@ module IntroElim {a b : Carrier} (a≈ε : a ≈ ε) where
53
44
introˡ a≈ε = sym elimˡ
54
45
55
46
introcenter : ∀ c → b ∙ c ≈ b ∙ (a ∙ c)
56
- introcenter c = begin
57
- b ∙ c ≈⟨ ∙-congˡ (identityˡ c) ⟨
58
- b ∙ (ε ∙ c) ≈⟨ ∙-congˡ (∙-congʳ a≈ε) ⟨
59
- b ∙ (a ∙ c) ∎
47
+ introcenter c = trans (∙-congˡ (sym (identityˡ c))) (∙-congˡ (∙-congʳ (sym a≈ε)))
60
48
61
49
open IntroElim public
62
50
63
51
module Cancellers {a b c : Carrier} (inv : a ∙ c ≈ ε) where
64
52
65
53
cancelʳ : (b ∙ a) ∙ c ≈ b
66
- cancelʳ = begin
67
- (b ∙ a) ∙ c ≈⟨ assoc b a c ⟩
68
- b ∙ (a ∙ c) ≈⟨ ∙-congˡ inv ⟩
69
- b ∙ ε ≈⟨ identityʳ b ⟩
70
- b ∎
71
-
54
+ cancelʳ = trans (assoc b a c) (trans (∙-congˡ inv) (identityʳ b))
72
55
73
56
cancelˡ : a ∙ (c ∙ b) ≈ b
74
- cancelˡ = begin
75
- a ∙ (c ∙ b) ≈⟨ assoc a c b ⟨
76
- (a ∙ c) ∙ b ≈⟨ ∙-congʳ inv ⟩
77
- ε ∙ b ≈⟨ identityˡ b ⟩
78
- b ∎
57
+ cancelˡ = trans (sym (assoc a c b)) (trans (∙-congʳ inv) (identityˡ b))
79
58
80
59
insertˡ : b ≈ a ∙ (c ∙ b)
81
60
insertˡ = sym cancelˡ
@@ -84,10 +63,7 @@ module Cancellers {a b c : Carrier} (inv : a ∙ c ≈ ε) where
84
63
insertʳ = sym cancelʳ
85
64
86
65
cancelInner : ∀ {g} → (b ∙ a) ∙ (c ∙ g) ≈ b ∙ g
87
- cancelInner {g = g} = begin
88
- (b ∙ a) ∙ (c ∙ g) ≈⟨ assoc (b ∙ a) c g ⟨
89
- ((b ∙ a) ∙ c) ∙ g ≈⟨ ∙-congʳ cancelʳ ⟩
90
- b ∙ g ∎
66
+ cancelInner {g = g} = trans (sym (assoc (b ∙ a) c g)) (∙-congʳ cancelʳ)
91
67
92
68
insertInner : ∀ {g} → b ∙ g ≈ (b ∙ a) ∙ (c ∙ g)
93
69
insertInner = sym cancelInner
0 commit comments