Debian Codegraph @

src/Algebra/Properties/CommutativeMonoid.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Some derivable properties
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 open import Algebra.Bundles using (CommutativeMonoid)
10
11 module Algebra.Properties.CommutativeMonoid
12 {g₁ g₂} (M : CommutativeMonoid g₁ g₂)
13 where
14
15 open import Algebra.Definitions using (LeftInvertible; RightInvertible; Invertible)
16 open import Data.Product.Base using (_,_; proj₂)
17
18 open CommutativeMonoid M
19 renaming
20 ( ε to 0#
21 ; _∙_ to _+_
22 ; ∙-cong to +-cong
23 ; ∙-congˡ to +-congˡ
24 ; ∙-congʳ to +-congʳ
25 ; identityˡ to +-identityˡ
26 ; identityʳ to +-identityʳ
27 ; assoc to +-assoc
28 ; comm to +-comm
29 )
30
31 private variable
32 x : Carrier
33
34 invertibleˡ⇒invertibleʳ : LeftInvertible _≈_ 0# _+_ x → RightInvertible _≈_ 0# _+_ x
35 invertibleˡ⇒invertibleʳ {x} (-x , -x+x≈1) = -x , trans (+-comm x -x) -x+x≈1
36
37 invertibleʳ⇒invertibleˡ : RightInvertible _≈_ 0# _+_ x → LeftInvertible _≈_ 0# _+_ x
38 invertibleʳ⇒invertibleˡ {x} (-x , x+-x≈1) = -x , trans (+-comm -x x) x+-x≈1
39
40 invertibleˡ⇒invertible : LeftInvertible _≈_ 0# _+_ x → Invertible _≈_ 0# _+_ x
41 invertibleˡ⇒invertible left@(-x , -x+x≈1) = -x , -x+x≈1 , invertibleˡ⇒invertibleʳ left .proj₂
42
43 invertibleʳ⇒invertible : RightInvertible _≈_ 0# _+_ x → Invertible _≈_ 0# _+_ x
44 invertibleʳ⇒invertible right@(-x , x+-x≈1) = -x , invertibleʳ⇒invertibleˡ right .proj₂ , x+-x≈1