Section MorphismStructure.
Variables aT rT : finGroupType.
Structure morphism (D : {set aT}) : Type := Morphism {
mfun :> aT -> FinGroup.sort rT;
_ : {in D &, {morph mfun : x y / x * y}}
}.
(* We give the 'lightest' possible specification to define morphisms: local   *)
(* congruence, in D, with the group law of aT. We then provide the properties *)
(* for the 'textbook' notion of morphism, when the required structures are    *)
(* available (e.g. its domain is a group).                                    *)
Definition morphism_for D of phant rT := morphism D.
Definition clone_morphism D f :=
let: Morphism _ fM := f
return {type of @Morphism D for f} -> morphism_for D (Phant rT)
in fun k => k fM.
Variables (D A : {set aT}) (R : {set rT}) (x : aT) (y : rT) (f : aT -> rT).
Variant morphim_spec : Prop := MorphimSpec z & z \in D & z \in A & y = f z.
Canonical morphpre_group fPh M :=
@group _ (morphpre fPh M) (morphpre_groupset M).
Canonical morphim_group fPh G := @group _ (morphim fPh G) (morphim_groupset G).
Canonical ker_group fPh : {group aT} := Eval hnf in [group of ker fPh].
(* injectivity of image and preimage *)

Lemma morphim_cycle x : x \in D -> f @* <[x]> = <[f x]>.