Section CprodBy.
Variables gTH gTK : finGroupType.
Variables (H : {group gTH}) (K : {group gTK}) (gz : {morphism 'Z(H) >-> gTK}).
Definition ker_cprod_by of isom 'Z(H) 'Z(K) gz :=
[set xy | let: (x, y) := xy in (x \in 'Z(H)) && (y == (gz x)^-1)].
Hypothesis isoZ : isom 'Z(H) 'Z(K) gz.
Let kerHK := ker_cprod_by isoZ.
Let injgz : 'injm gz. Proof. by case/isomP: isoZ. Qed.
Let gzZ : gz @* 'Z(H) = 'Z(K). Proof. by case/isomP: isoZ. Qed.
Let gzZchar : gz @* 'Z(H) \char 'Z(K). Proof. by rewrite gzZ. Qed.
Let sgzZZ : gz @* 'Z(H) \subset 'Z(K) := char_sub gzZchar.
Let sZH := center_sub H.
Let sZK := center_sub K.
Let sgzZG : gz @* 'Z(H) \subset K := subset_trans sgzZZ sZK.
Canonical ker_cprod_by_group := Group ker_cprod_by_is_group.
Fact cprod_by_key : unit. Proof. by []. Qed.
Definition cprod_by_def := subFinGroupType [group of setX H K / kerHK].
Definition cprod_by := locked_with cprod_by_key cprod_by_def.
Local Notation C := [set: FinGroup.arg_sort (FinGroup.base cprod_by)].
Definition in_cprod : gTH * gTK -> cprod_by :=
let: tt as k := cprod_by_key return _ -> locked_with k cprod_by_def in
subg _ \o coset kerHK.
Canonical in_cprod_morphism := Morphism in_cprodM.
Let injH := injm_cpairg1.
Let injK := injm_cpair1g.
Hint Resolve im_cpair_cent : core.
Definition xcprodm := cprodm im_cpair_cprod xcprodm_cent xcprodmI.
Canonical xcprod_morphism := [morphism of xcprodm].

Lemma im_xcprodm : xcprodm @* C = fH @* H * fK @* K.