Timings for AbHom.v
Require Import Basics Types.
Require Import WildCat HSet Truncations.Core Modalities.ReflectiveSubuniverse.
Require Import AbelianGroup Biproduct.
(** * Homomorphisms from a group to an abelian group form an abelian group. *)
(** We can add group homomorphisms. *)
Definition ab_homo_add {A : Group} {B : AbGroup} (f g : A $-> B)
: A $-> B.
refine (grp_homo_compose ab_codiagonal _).
(** [fun a => f(a) + g(a)] **)
exact (grp_prod_corec f g).
(** We can negate a group homomorphism by composing with [ab_homo_negation]. *)
Global Instance negate_hom {A : Group} {B : AbGroup}
: Negate (@Hom Group _ A B) := grp_homo_compose ab_homo_negation.
(** For [A] and [B] groups, with [B] abelian, homomorphisms [A $-> B] form an abelian group. *)
Definition grp_hom `{Funext} (A : Group) (B : AbGroup) : Group.
nrefine (Build_Group (GroupHomomorphism A B)
ab_homo_add grp_homo_const negate_hom _).
all: hnf; intros; apply equiv_path_grouphomomorphism; intro; cbn.
Definition ab_hom `{Funext} (A : Group) (B : AbGroup) : AbGroup.
snrapply (Build_AbGroup (grp_hom A B)).
apply equiv_path_grouphomomorphism; intro x; cbn.
(** ** The bifunctor [ab_hom] *)
Global Instance is0functor_ab_hom01 `{Funext} {A : Group^op}
: Is0Functor (ab_hom A).
snrapply (Build_Is0Functor _ AbGroup); intros B B' f.
snrapply Build_GroupHomomorphism.
1: exact (fun g => grp_homo_compose f g).
apply equiv_path_grouphomomorphism; intro a; cbn.
exact (grp_homo_op f _ _).
Global Instance is0functor_ab_hom10 `{Funext} {B : AbGroup@{u}}
: Is0Functor (flip (ab_hom : Group^op -> AbGroup -> AbGroup) B).
snrapply (Build_Is0Functor (Group^op) AbGroup); intros A A' f.
snrapply Build_GroupHomomorphism.
1: exact (fun g => grp_homo_compose g f).
by apply equiv_path_grouphomomorphism.
Global Instance is1functor_ab_hom01 `{Funext} {A : Group^op}
: Is1Functor (ab_hom A).
nrapply Build_Is1Functor.
apply equiv_path_grouphomomorphism; intro a; cbn.
by apply equiv_path_grouphomomorphism.
by apply equiv_path_grouphomomorphism.
Global Instance is1functor_ab_hom10 `{Funext} {B : AbGroup@{u}}
: Is1Functor (flip (ab_hom : Group^op -> AbGroup -> AbGroup) B).
nrapply Build_Is1Functor.
apply equiv_path_grouphomomorphism; intro a; cbn.
by apply equiv_path_grouphomomorphism.
by apply equiv_path_grouphomomorphism.
Global Instance is0bifunctor_ab_hom `{Funext}
: Is0Bifunctor (ab_hom : Group^op -> AbGroup -> AbGroup).
rapply Build_Is0Bifunctor''.
Global Instance is1bifunctor_ab_hom `{Funext}
: Is1Bifunctor (ab_hom : Group^op -> AbGroup -> AbGroup).
nrapply Build_Is1Bifunctor''.
intros A A' f B B' g phi; cbn.
by apply equiv_path_grouphomomorphism.
(** ** Properties of [ab_hom] *)
(** Precomposition with a surjection is an embedding. *)
(* This could be deduced from [isembedding_precompose_surjection_hset], but relating precomposition of homomorphisms with precomposition of the underlying maps is tedious, so we give a direct proof. *)
Global Instance isembedding_precompose_surjection_ab `{Funext} {A B C : AbGroup}
(f : A $-> B) `{IsSurjection f}
: IsEmbedding (fmap10 (A:=Group^op) ab_hom f C).
apply isembedding_isinj_hset; intros g0 g1 p.
apply equiv_path_grouphomomorphism.
rapply (conn_map_elim (Tr (-1)) f).
exact (equiv_path_grouphomomorphism^-1 p).