{-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Properties where

open import Cubical.Foundations.Prelude

open import Cubical.Algebra.AbGroup.Base
open import Cubical.Algebra.Group

private variable
   : Level

module AbGroupTheory (A : AbGroup ) where
  open GroupTheory (AbGroup→Group A)
  open AbGroupStr (snd A)

  comm-4 :  a b c d  (a + b) + (c + d)  (a + c) + (b + d)
  comm-4 a b c d =
                 (a + b) + (c + d)  ≡⟨ +Assoc (a + b) c d 
                 ((a + b) + c) + d  ≡⟨ cong  X  X + d) (sym (+Assoc a b c)) 
                 (a + (b + c)) + d  ≡⟨ cong  X  (a + X) + d) (+Comm b c) 
                 (a + (c + b)) + d  ≡⟨ cong  X  X + d) (+Assoc a c b) 
                 ((a + c) + b) + d  ≡⟨ sym (+Assoc (a + c) b d) 
                 (a + c) + (b + d)  

  implicitInverse :  {a b}  a + b  0g  b  - a
  implicitInverse b+a≡0 = invUniqueR b+a≡0