Timings for Image.v
Require Import Basics Types.
Require Import Truncations.Core.
Require Import Algebra.Groups.Group.
Require Import Algebra.Groups.Subgroup.
Require Import WildCat.Core.
(** Image of group homomorphisms *)
Local Open Scope mc_scope.
Local Open Scope mc_mult_scope.
(** The image of a group homomorphism between groups is a subgroup *)
Definition grp_image {A B : Group} (f : A $-> B) : Subgroup B.
snrapply (Build_Subgroup _ (fun b => hexists (fun a => f a = b))).
1: apply tr; exists mon_unit; apply grp_homo_unit.
intros x y p q; strip_truncations; apply tr.
destruct p as [a []], q as [b []].
Definition grp_image_in {A B : Group} (f : A $-> B) : A $-> grp_image f.
snrapply Build_GroupHomomorphism.
(** When the homomorphism is an embedding, we don't need to truncate. *)
Definition grp_image_embedding {A B : Group} (f : A $-> B) `{IsEmbedding f} : Subgroup B.
snrapply (Build_Subgroup _ (hfiber f)).
exact (mon_unit; grp_homo_unit f).
intros x y [a []] [b []].
Definition grp_image_in_embedding {A B : Group} (f : A $-> B) `{IsEmbedding f}
: GroupIsomorphism A (grp_image_embedding f).
snrapply Build_GroupIsomorphism.
snrapply Build_GroupHomomorphism.
2: apply (cancelL_isembedding (g:=pr1)).
rapply contr_inhabited_hprop.
refine (transport_sigma' _ _ @ _).
by apply path_sigma_hprop.