{-# OPTIONS --safe #-}
module Cubical.Algebra.Group.DirProd where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Data.Sigma
open import Cubical.Algebra.Group.Base
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.Semigroup

open GroupStr
open IsGroup hiding (·IdR ; ·IdL ; ·InvR ; ·InvL)
open IsMonoid hiding (·IdR ; ·IdL)
open IsSemigroup

DirProd :  { ℓ'}  Group   Group ℓ'  Group (ℓ-max  ℓ')
fst (DirProd G H) = (fst G) × (fst H)
1g (snd (DirProd G H)) = (1g (snd G)) , (1g (snd H))
_·_ (snd (DirProd G H)) (g , h) (g' , h') = _·_ (snd G) g g' , _·_ (snd H) h h'
inv (snd (DirProd G H)) (g , h) = (inv (snd G) g) , (inv (snd H) h)
isGroup (snd (DirProd G H)) = makeIsGroup
                              (isSet× (is-set (snd G)) (is-set (snd H)))
                               x y z  ≡-× (·Assoc (snd G) _ _ _) (·Assoc (snd H) _ _ _))
                               x  ≡-× (·IdR (snd G) _) (·IdR (snd H) _))
                               x  ≡-× (·IdL (snd G) _) (·IdL (snd H) _))
                               x  ≡-× (·InvR (snd G) _) (·InvR (snd H) _))
                              λ x  ≡-× (·InvL (snd G) _) (·InvL (snd H) _)