module Algebra.Group.Instances.Integers where
private module ℤ = Integers Int-integers
The group of integers🔗
The fundamental example of an abelian group is the group of integers, under addition.
: Abelian-group lzero
ℤ-ab = to-ab mk-ℤ where
ℤ-ab open make-abelian-group
: make-abelian-group Int
mk-ℤ .ab-is-set = hlevel 2
mk-ℤ .mul x y = x +ℤ y
mk-ℤ .inv x = negℤ x
mk-ℤ .1g = 0
mk-ℤ .idl x = +ℤ-zerol x
mk-ℤ .assoc x y z = +ℤ-assoc x y z
mk-ℤ .invl x = +ℤ-invl x
mk-ℤ .comm x y = +ℤ-commutative x y
mk-ℤ
: Group lzero
ℤ = Abelian→Group ℤ-ab ℤ
We show that
is the free
group on one generator, i.e. the free object on
relative to the forgetful functor from groups to sets, Grp↪Sets
.
We start by defining the group homomorphism that sends to (or, in additive notation, where is a group and is an element of using the universal property of the integers.
module _ {ℓ} (G : Group ℓ) where
open Group-on (G .snd)
module pow (x : ⌞ G ⌟) where
: Int → ⌞ G ⌟
pow = ℤ.map-out unit ((_⋆ x) , ⋆-equivr x)
pow
: ∀ a → pow (sucℤ a) ≡ pow a ⋆ x
pow-sucr = ℤ.map-out-rotate _ _
pow-sucr
: ∀ a b → pow (a +ℤ b) ≡ pow a ⋆ pow b
pow-+ = ℤ.induction
pow-+ a (ap pow (+ℤ-zeror a) ∙ sym idr)
λ b →
(a +ℤ b) ≡ pow a ⋆ pow b ≃⟨ ap (_⋆ x) , equiv→cancellable (⋆-equivr x) ⟩
pow (a +ℤ b) ⋆ x ≡ (pow a ⋆ pow b) ⋆ x ≃⟨ ∙-post-equiv (sym associative) ⟩
pow (a +ℤ b) ⋆ x ≡ pow a ⋆ pow b ⋆ x ≃⟨ ∙-post-equiv (ap (pow a ⋆_) (sym (pow-sucr b))) ⟩
pow (a +ℤ b) ⋆ x ≡ pow a ⋆ pow (sucℤ b) ≃⟨ ∙-pre-equiv (pow-sucr (a +ℤ b)) ⟩
pow (sucℤ (a +ℤ b)) ≡ pow a ⋆ pow (sucℤ b) ≃⟨ ∙-pre-equiv (ap pow (+ℤ-sucr a b)) ⟩
pow (a +ℤ sucℤ b) ≡ pow a ⋆ pow (sucℤ b) ≃∎ pow
A type-theoretic interjection is necessary: the integers live on the zeroth universe, so to have an group of integers, we must lift it.
: Groups.Hom (LiftGroup ℓ ℤ) G
pow-hom .hom (lift i) = pow i
pow-hom .preserves .pres-⋆ (lift a) (lift b) = pow-+ a b pow-hom
This is the unique group homomorphism that sends to
: (g : Groups.Hom (LiftGroup ℓ ℤ) G) → g # 1 ≡ x → g ≡ pow-hom
pow-unique = ext $ ℤ.map-out-unique (λ i → g # lift i)
pow-unique g g1≡x (pres-id (g .preserves))
λ y →
(sym (+ℤ-oner y)) ⟩
g # lift ⌜ sucℤ y ⌝ ≡⟨ ap! (y +ℤ 1) ≡⟨ g .preserves .pres-⋆ (lift y) 1 ⟩
g # lift 1 ≡⟨ ap (g # lift y ⋆_) g1≡x ⟩
g # lift y ⋆ g #
g # lift y ⋆ x ∎
open pow public
We prove some other useful basic properties of exponentiation. 1
: ∀ x a → pow x (sucℤ a) ≡ x ⋆ pow x a
pow-sucl : ∀ x → pow x 0 ≡ unit
pow-0 : ∀ x → pow x 1 ≡ x
pow-1 : ∀ x a b → pow x (a *ℤ b) ≡ pow (pow x a) b
pow-* : ∀ n → pow unit n ≡ unit
pow-unit : ∀ x n → pow (x ⁻¹) n ≡ pow x n ⁻¹ pow-inverse
: ∀ x a → pow x (sucℤ a) ≡ x ⋆ pow x a
pow-sucl : ∀ x → pow x 0 ≡ unit
pow-0 : ∀ x → pow x 1 ≡ x
pow-1 : ∀ x a b → pow x (a *ℤ b) ≡ pow (pow x a) b
pow-* : ∀ n → pow unit n ≡ unit
pow-unit : ∀ x n → pow (x ⁻¹) n ≡ pow x n ⁻¹ pow-inverse
=
pow-sucl x a (sucℤ a) ≡˘⟨ ap (pow x) (+ℤ-onel a) ⟩
pow x (1 +ℤ a) ≡⟨ pow-+ x 1 a ⟩
pow x 1 ⋆ pow x a ≡⟨ ap (_⋆ pow x a) (pow-1 x) ⟩
pow x
x ⋆ pow x a ∎
= refl
pow-0 x
= idl
pow-1 x
= ℤ.induction (ap (pow x) (*ℤ-zeror a)) λ b →
pow-* x a (a *ℤ b) ≡ pow (pow x a) b ≃⟨ _ , equiv→cancellable (⋆-equivr _) ⟩
pow x (a *ℤ b) ⋆ pow x a ≡ pow (pow x a) b ⋆ pow x a ≃⟨ ∙-pre-equiv (pow-+ x (a *ℤ b) a) ⟩
pow x (a *ℤ b +ℤ a) ≡ pow (pow x a) b ⋆ pow x a ≃⟨ ∙-pre-equiv (ap (pow x) (*ℤ-sucr a b)) ⟩
pow x (a *ℤ sucℤ b) ≡ pow (pow x a) b ⋆ pow x a ≃⟨ ∙-post-equiv (sym (pow-sucr (pow x a) b)) ⟩
pow x (a *ℤ sucℤ b) ≡ pow (pow x a) (sucℤ b) ≃∎
pow x
= ℤ.induction refl (λ x → ∙-pre-equiv (pow-sucr unit x ∙ idr))
pow-unit
= ℤ.induction (sym inv-unit) λ n →
pow-inverse x (x ⁻¹) n ≡ pow x n ⁻¹ ≃⟨ _ , equiv→cancellable (⋆-equivr (x ⁻¹)) ⟩
pow (x ⁻¹) n ⋆ x ⁻¹ ≡ pow x n ⁻¹ ⋆ x ⁻¹ ≃⟨ ∙-pre-equiv (pow-sucr (x ⁻¹) n) ⟩
pow (x ⁻¹) (sucℤ n) ≡ pow x n ⁻¹ ⋆ x ⁻¹ ≃⟨ ∙-post-equiv (sym inv-comm) ⟩
pow (x ⁻¹) (sucℤ n) ≡ (x ⋆ pow x n) ⁻¹ ≃⟨ ∙-post-equiv (ap _⁻¹ (sym (pow-sucl x n))) ⟩
pow (x ⁻¹) (sucℤ n) ≡ pow x (sucℤ n) ⁻¹ ≃∎ pow
Finally, the properties above imply that is the free group on one generator.
: Free-object Grp↪Sets (el! ⊤)
ℤ-free .Free-object.free = LiftGroup lzero ℤ
ℤ-free .Free-object.unit _ = 1
ℤ-free .Free-object.fold {G} x = pow-hom G (x _)
ℤ-free .Free-object.commute {G} {x} = ext λ _ → pow-1 G (x _)
ℤ-free .Free-object.unique {G} {x} g comm =
ℤ-free (x _) g (unext comm _) pow-unique G
While the notation
for pow
makes sense in
multiplicative notation, we would instead write
in additive notation. In fact, we can show that
coincides with the multiplication
in the group of integers itself.
: ∀ a b → pow ℤ a b ≡ a *ℤ b
pow-ℤ = ℤ.induction (sym (*ℤ-zeror a)) λ b →
pow-ℤ a (_+ℤ a) , equiv→cancellable (Group-on.⋆-equivr (ℤ .snd) a) ⟩
pow ℤ a b ≡ a *ℤ b ≃⟨ ap (pow-sucr ℤ a b) ⟩
pow ℤ a b +ℤ a ≡ a *ℤ b +ℤ a ≃⟨ ∙-pre-equiv (sucℤ b) ≡ a *ℤ b +ℤ a ≃⟨ ∙-post-equiv (sym (*ℤ-sucr a b)) ⟩
pow ℤ a (sucℤ b) ≡ a *ℤ sucℤ b ≃∎ pow ℤ a
Order of an element🔗
module _ {ℓ} (G : Group ℓ) where
open Group-on (G .snd)
We define the order of an element of a group as the minimal positive2 integer such that if it exists.
In particular, if then we have that the order of divides We define this notion first in the code, then use it to define the order of
: ⌞ G ⌟ → Nat → Type ℓ
order-divides = pow G x (pos n) ≡ unit
order-divides x n
: ⌞ G ⌟ → Type ℓ
has-finite-order = minimal-solution λ n →
has-finite-order x
Positive n × order-divides x n
: (x : ⌞ G ⌟) → has-finite-order x → Nat
order (n , _) = n order x
An element with finite order is also called a torsion element. A group all of whose elements are torsion is called a torsion group, while a group whose only torsion element is the unit is called torsion-free.
: Type ℓ
is-torsion-group = ∀ g → has-finite-order g
is-torsion-group
: Type ℓ
is-torsion-free = ∀ g → has-finite-order g → g ≡ unit is-torsion-free
Our definition of torsion groups requires being able to compute the order of every element of the group. There is a weaker definition that only requires every element to have some such that the two definitions are equivalent if the group is discrete, since is well-ordered.
We quickly note that is torsion-free, since multiplication by a nonzero integer is injective.
: is-torsion-free ℤ
ℤ-torsion-free (k , (k>0 , nk≡0) , _) = *ℤ-injectiver (pos k) n 0
ℤ-torsion-free n (λ p → <-not-equal k>0 (pos-injective (sym p)))
(sym (pow-ℤ n (pos k)) ∙ nk≡0)
Pedantically, these properties say that
pow
is the unique near-ring homomorphism from the initial near-ring, to the near-ring of (pointed) endofunctions of a generalisation of endomorphism rings to non-abelian groups.↩︎Without this requirement, every element would trivially have order ↩︎