{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module GroupTheory.PropertiesI where
open import GroupTheory.Base
open import Common.FOL.Relation.Binary.EqReasoning
·-leftCong : ∀ {a b c} → a ≡ b → a · c ≡ b · c
·-leftCong refl = refl
·-rightCong : ∀ {a b c} → b ≡ c → a · b ≡ a · c
·-rightCong refl = refl
⁻¹-cong : ∀ {a b} → a ≡ b → a ⁻¹ ≡ b ⁻¹
⁻¹-cong refl = refl
leftCancellation : ∀ {a b c} → a · b ≡ a · c → b ≡ c
leftCancellation {a} {b} {c} h =
b ≡⟨ sym (leftIdentity b) ⟩
ε · b ≡⟨ ·-leftCong (sym (leftInverse a)) ⟩
a ⁻¹ · a · b ≡⟨ assoc (a ⁻¹) a b ⟩
a ⁻¹ · (a · b) ≡⟨ ·-rightCong h ⟩
a ⁻¹ · (a · c) ≡⟨ sym (assoc (a ⁻¹) a c) ⟩
a ⁻¹ · a · c ≡⟨ ·-leftCong (leftInverse a) ⟩
ε · c ≡⟨ leftIdentity c ⟩
c ∎
leftCancellation' : ∀ {a b c} → a · b ≡ a · c → b ≡ c
leftCancellation' {a} {b} {c} h =
b ≡⟨ sym (leftIdentity b) ⟩
ε · b ≡⟨ subst (λ t → ε · b ≡ t · b) (sym (leftInverse a)) refl ⟩
a ⁻¹ · a · b ≡⟨ assoc (a ⁻¹) a b ⟩
a ⁻¹ · (a · b) ≡⟨ subst (λ t → a ⁻¹ · (a · b) ≡ a ⁻¹ · t) h refl ⟩
a ⁻¹ · (a · c) ≡⟨ sym (assoc (a ⁻¹) a c) ⟩
a ⁻¹ · a · c ≡⟨ subst (λ t → a ⁻¹ · a · c ≡ t · c) (leftInverse a) refl ⟩
ε · c ≡⟨ leftIdentity c ⟩
c ∎
rightIdentity : ∀ a → a · ε ≡ a
rightIdentity a = leftCancellation prf
where
prf : a ⁻¹ · (a · ε) ≡ a ⁻¹ · a
prf = a ⁻¹ · (a · ε) ≡⟨ sym (assoc (a ⁻¹) a ε) ⟩
a ⁻¹ · a · ε ≡⟨ ·-leftCong (leftInverse a) ⟩
ε · ε ≡⟨ leftIdentity ε ⟩
ε ≡⟨ sym (leftInverse a) ⟩
a ⁻¹ · a ∎
rightInverse : ∀ a → a · a ⁻¹ ≡ ε
rightInverse a = leftCancellation prf
where
prf : a ⁻¹ · (a · a ⁻¹) ≡ a ⁻¹ · ε
prf = a ⁻¹ · (a · a ⁻¹) ≡⟨ sym (assoc (a ⁻¹) a (a ⁻¹)) ⟩
a ⁻¹ · a · a ⁻¹ ≡⟨ ·-leftCong (leftInverse a) ⟩
ε · a ⁻¹ ≡⟨ leftIdentity (a ⁻¹) ⟩
a ⁻¹ ≡⟨ sym (rightIdentity (a ⁻¹)) ⟩
a ⁻¹ · ε ∎
rightCancellation : ∀ {a b c} → b · a ≡ c · a → b ≡ c
rightCancellation {a} {b} {c} h =
b ≡⟨ sym (rightIdentity b) ⟩
b · ε ≡⟨ ·-rightCong (sym (rightInverse a)) ⟩
b · (a · a ⁻¹) ≡⟨ sym (assoc b a (a ⁻¹)) ⟩
b · a · a ⁻¹ ≡⟨ ·-leftCong h ⟩
c · a · a ⁻¹ ≡⟨ assoc c a (a ⁻¹) ⟩
c · (a · a ⁻¹) ≡⟨ ·-rightCong (rightInverse a) ⟩
c · ε ≡⟨ rightIdentity c ⟩
c ∎
y≡x⁻¹[xy] : ∀ a b → b ≡ a ⁻¹ · (a · b)
y≡x⁻¹[xy] a b = b ≡⟨ sym (leftIdentity b) ⟩
ε · b ≡⟨ ·-leftCong (sym (leftInverse a)) ⟩
a ⁻¹ · a · b ≡⟨ assoc (a ⁻¹) a b ⟩
a ⁻¹ · (a · b) ∎
x≡[xy]y⁻¹ : ∀ a b → a ≡ (a · b) · b ⁻¹
x≡[xy]y⁻¹ a b = a ≡⟨ sym (rightIdentity a) ⟩
a · ε ≡⟨ ·-rightCong (sym (rightInverse b)) ⟩
a · (b · b ⁻¹) ≡⟨ sym (assoc a b (b ⁻¹)) ⟩
a · b · b ⁻¹ ∎
rightIdentityUnique : ∀ r → (∀ a → a · r ≡ a) → r ≡ ε
rightIdentityUnique r h = trans (sym (leftIdentity r)) (h ε)
rightIdentityUnique' : ∀ a r → a · r ≡ a → r ≡ ε
rightIdentityUnique' a r h = r ≡⟨ y≡x⁻¹[xy] a r ⟩
a ⁻¹ · (a · r) ≡⟨ ·-rightCong h ⟩
a ⁻¹ · a ≡⟨ leftInverse a ⟩
ε ∎
leftIdentityUnique : ∀ l → (∀ a → l · a ≡ a) → l ≡ ε
leftIdentityUnique l h = trans (sym (rightIdentity l)) (h ε)
leftIdentityUnique' : ∀ a l → l · a ≡ a → l ≡ ε
leftIdentityUnique' a l h = l ≡⟨ x≡[xy]y⁻¹ l a ⟩
l · a · a ⁻¹ ≡⟨ ·-leftCong h ⟩
a · a ⁻¹ ≡⟨ rightInverse a ⟩
ε ∎
rightInverseUnique : ∀ {a} → ∃[ r ] (a · r ≡ ε) ∧
(∀ r' → a · r' ≡ ε → r ≡ r')
rightInverseUnique {a} =
_ , rightInverse a , prf
where
prf : ∀ r' → a · r' ≡ ε → a ⁻¹ ≡ r'
prf r' ar'≡ε = leftCancellation aa⁻¹≡ar'
where
aa⁻¹≡ar' : a · a ⁻¹ ≡ a · r'
aa⁻¹≡ar' = a · a ⁻¹ ≡⟨ rightInverse a ⟩
ε ≡⟨ sym ar'≡ε ⟩
a · r' ∎
rightInverseUnique' : ∀ {a r} → a · r ≡ ε → a ⁻¹ ≡ r
rightInverseUnique' {a} {r} ar≡ε = leftCancellation aa⁻¹≡ar
where
aa⁻¹≡ar : a · a ⁻¹ ≡ a · r
aa⁻¹≡ar = a · a ⁻¹ ≡⟨ rightInverse a ⟩
ε ≡⟨ sym ar≡ε ⟩
a · r ∎
leftInverseUnique : ∀ {a} → ∃[ l ] (l · a ≡ ε) ∧
(∀ l' → l' · a ≡ ε → l ≡ l')
leftInverseUnique {a} =
_ , leftInverse a , prf
where
prf : ∀ l' → l' · a ≡ ε → a ⁻¹ ≡ l'
prf l' l'a≡ε = rightCancellation a⁻¹a≡l'a
where
a⁻¹a≡l'a : a ⁻¹ · a ≡ l' · a
a⁻¹a≡l'a = a ⁻¹ · a ≡⟨ leftInverse a ⟩
ε ≡⟨ sym l'a≡ε ⟩
l' · a ∎
leftInverseUnique' : ∀ {a l} → l · a ≡ ε → a ⁻¹ ≡ l
leftInverseUnique' {a} {l} la≡ε = rightCancellation a⁻¹a≡la
where
a⁻¹a≡la : a ⁻¹ · a ≡ l · a
a⁻¹a≡la = a ⁻¹ · a ≡⟨ leftInverse a ⟩
ε ≡⟨ sym la≡ε ⟩
l · a ∎
⁻¹-involutive : ∀ a → a ⁻¹ ⁻¹ ≡ a
⁻¹-involutive a = rightInverseUnique' (leftInverse a)
identityInverse : ε ⁻¹ ≡ ε
identityInverse = rightInverseUnique' (leftIdentity ε)
inverseDistribution : ∀ a b → (a · b) ⁻¹ ≡ b ⁻¹ · a ⁻¹
inverseDistribution a b = leftInverseUnique' b⁻¹a⁻¹[ab]≡ε
where
b⁻¹a⁻¹[ab]≡ε : b ⁻¹ · a ⁻¹ · (a · b) ≡ ε
b⁻¹a⁻¹[ab]≡ε =
b ⁻¹ · a ⁻¹ · (a · b)
≡⟨ assoc (b ⁻¹) (a ⁻¹) (a · b) ⟩
b ⁻¹ · (a ⁻¹ · (a · b))
≡⟨ ·-rightCong (sym (assoc (a ⁻¹) a b)) ⟩
b ⁻¹ · (a ⁻¹ · a · b)
≡⟨ ·-rightCong (·-leftCong (leftInverse a)) ⟩
b ⁻¹ · (ε · b)
≡⟨ ·-rightCong (leftIdentity b) ⟩
b ⁻¹ · b
≡⟨ leftInverse b ⟩
ε ∎
x²≡ε→comm : (∀ a → a · a ≡ ε) → ∀ {b c d} → b · c ≡ d → c · b ≡ d
x²≡ε→comm h {b} {c} {d} bc≡d = sym d≡cb
where
db≡c : d · b ≡ c
db≡c =
d · b
≡⟨ sym (rightIdentity (d · b)) ⟩
d · b · ε
≡⟨ ·-rightCong (sym (h c)) ⟩
d · b · (c · c)
≡⟨ assoc d b (c · c) ⟩
d · (b · (c · c))
≡⟨ ·-rightCong (sym (assoc b c c)) ⟩
d · ((b · c) · c)
≡⟨ ·-rightCong (·-leftCong bc≡d) ⟩
d · (d · c)
≡⟨ sym (assoc d d c) ⟩
d · d · c
≡⟨ ·-leftCong (h d) ⟩
ε · c
≡⟨ leftIdentity c ⟩
c ∎
d≡cb : d ≡ c · b
d≡cb = d ≡⟨ sym (rightIdentity d) ⟩
d · ε ≡⟨ ·-rightCong (sym (h b)) ⟩
d · (b · b) ≡⟨ sym (assoc d b b) ⟩
d · b · b ≡⟨ ·-leftCong db≡c ⟩
c · b ∎