(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)


Set Implicit Arguments.
Unset Strict Implicit.
Require Export Abelian_group_cat.
(** Title "The categories of abelian rings." *)
Section Objects.

Definition dist_r (E : SET) (f g : law_of_composition E) :=
  forall x y z : E,
  Equal (f (couple (g (couple x y)) z))
    (g (couple (f (couple x z)) (f (couple y z)))).

Definition dist_l (E : SET) (f g : law_of_composition E) :=
  forall x y z : E,
  Equal (f (couple x (g (couple y z))))
    (g (couple (f (couple x y)) (f (couple x z)))).

Record ring_on (R : abelian_group) : Type := 
  {ring_mult_sgroup : sgroup_on R;
   ring_mult_monoid : monoid_on ring_mult_sgroup;
   ring_monoid :> monoid_on ring_mult_monoid;
   ring_dist_r_prf :
    dist_r (sgroup_law_map ring_mult_sgroup) (sgroup_law_map R);
   ring_dist_l_prf :
    dist_l (sgroup_law_map ring_mult_sgroup) (sgroup_law_map R)}.

Record ring : Type := 
  {ring_group :> abelian_group; ring_on_def :> ring_on ring_group}.
Coercion Build_ring : ring_on >-> ring.

Definition ring_mult (R : ring) (x y : R) : R :=
  sgroup_law_map (ring_mult_sgroup R) (couple x y).

Definition ring_unit (R : ring) : R := monoid_unit (ring_monoid R).

Record cring_on (R : ring) : Type := 
  {cring_com_prf : commutative (sgroup_law_map (ring_mult_monoid R))}.

Record cring : Type := 
  {cring_ring :> ring; cring_on_def :> cring_on cring_ring}.
Coercion Build_cring : cring_on >-> cring.

Definition cring_monoid : cring -> abelian_monoid.
(* Goal: forall _ : cring, abelian_monoid *)
intros R; try assumption.
(* Goal: abelian_monoid *)
apply (Build_abelian_monoid (abelian_monoid_monoid:=ring_monoid R)).
(* Goal: abelian_monoid_on (@Build_monoid (monoid_sgroup (@Build_monoid (@Build_sgroup (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group (cring_ring R)))))) (@ring_mult_sgroup (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) (@ring_mult_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) (@ring_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) *)
apply (Build_abelian_monoid_on (M:=ring_monoid R)).
(* Goal: abelian_sgroup_on (monoid_sgroup (@Build_monoid (monoid_sgroup (@Build_monoid (@Build_sgroup (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group (cring_ring R)))))) (@ring_mult_sgroup (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) (@ring_mult_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) (@ring_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) *)
apply (Build_abelian_sgroup_on (A:=ring_monoid R)).
(* Goal: @commutative (sgroup_set (monoid_sgroup (@Build_monoid (monoid_sgroup (@Build_monoid (@Build_sgroup (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group (cring_ring R)))))) (@ring_mult_sgroup (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) (@ring_mult_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) (@ring_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))))) (@sgroup_law_map (sgroup_set (monoid_sgroup (@Build_monoid (monoid_sgroup (@Build_monoid (@Build_sgroup (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group (cring_ring R)))))) (@ring_mult_sgroup (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) (@ring_mult_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) (@ring_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))))) (sgroup_on_def (monoid_sgroup (@Build_monoid (monoid_sgroup (@Build_monoid (@Build_sgroup (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group (cring_ring R)))))) (@ring_mult_sgroup (ring_group (cring_ring R)) (ring_on_def (cring_ring R)))) (@ring_mult_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))) (@ring_monoid (ring_group (cring_ring R)) (ring_on_def (cring_ring R))))))) *)
exact (cring_com_prf R).
Defined.
End Objects.
Section Hom.
Variable E F : ring.

Definition ring_mult_hom_unit_prop (f : Map E F) :=
  Equal (f (ring_unit E)) (ring_unit F).

Definition ring_mult_hom_prop (f : Map E F) :=
  forall x y : E, Equal (f (ring_mult x y)) (ring_mult (f x) (f y)).

Record ring_hom : Type := 
  {ring_plus_hom :> monoid_hom E F;
   ring_mult_hom_unit : ring_mult_hom_unit_prop ring_plus_hom;
   ring_mult_hom_prf : ring_mult_hom_prop ring_plus_hom}.
End Hom.

Definition ring_hom_comp :
  forall E F G : ring, ring_hom F G -> ring_hom E F -> ring_hom E G.
(* Goal: forall (E F G : ring) (_ : ring_hom F G) (_ : ring_hom E F), ring_hom E G *)
intros E F G g f; try assumption.
(* Goal: ring_hom E G *)
apply (Build_ring_hom (ring_plus_hom:=monoid_hom_comp g f)).
(* Goal: @ring_mult_hom_unit_prop E G (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group G))) (@monoid_hom_comp (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g) (@ring_plus_hom E F f)))) *)
(* Goal: @ring_mult_hom_prop E G (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group G))) (@monoid_hom_comp (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g) (@ring_plus_hom E F f)))) *)
unfold ring_mult_hom_unit_prop in |- *; auto with algebra.
(* Goal: forall (a b c : ring) (g : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) b c)) (f : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) a b)), @Equal (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (ring_hom a c) (@ring_plus_hom a c)) (@ring_hom_comp a b c g f)) (@comp_hom ABELIAN_GROUP (ring_group a) (ring_group b) (ring_group c) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (ring_hom b c) (@ring_plus_hom b c)) g) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (ring_hom a b) (@ring_plus_hom a b)) f)) *)
simpl in |- *.
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) (@ring_mult E x y)) (@ring_mult G (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x) (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y)) *)
unfold comp_map_fun in |- *.
apply
 Trans
  with (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom g))) (ring_unit F));
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
 auto with algebra.
cut
 (Equal (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) (ring_unit E))
    (ring_unit F)).
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
auto with algebra.
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) (ring_unit E)) (ring_unit F) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (ring_unit F)) (ring_unit G) *)
(* Goal: @ring_mult_hom_prop E G (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group G))) (@monoid_hom_comp (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g) (@ring_plus_hom E F f)))) *)
apply (ring_mult_hom_unit f).
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (ring_unit F)) (ring_unit G) *)
(* Goal: @ring_mult_hom_prop E G (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group G))) (@monoid_hom_comp (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g) (@ring_plus_hom E F f)))) *)
apply (ring_mult_hom_unit g).
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
unfold ring_mult_hom_prop in |- *; auto with algebra.
(* Goal: forall (a b c : ring) (g : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) b c)) (f : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) a b)), @Equal (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (ring_hom a c) (@ring_plus_hom a c)) (@ring_hom_comp a b c g f)) (@comp_hom ABELIAN_GROUP (ring_group a) (ring_group b) (ring_group c) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (ring_hom b c) (@ring_plus_hom b c)) g) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (ring_hom a b) (@ring_plus_hom a b)) f)) *)
simpl in |- *.
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) (@ring_mult E x y)) (@ring_mult G (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x) (@comp_map_fun (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y)) *)
unfold comp_map_fun in |- *.
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) (@ring_mult E x y))) (@ring_mult G (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x)) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y))) *)
intros x y; try assumption.
apply
 Trans
  with
    (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom g)))
       (ring_mult (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) x)
          (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) y)));
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
 auto with algebra.
cut
 (Equal
    (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) (ring_mult x y))
    (ring_mult (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) x)
       (Ap (sgroup_map (monoid_sgroup_hom (ring_plus_hom f))) y))).
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
auto with algebra.
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) (@ring_mult E x y)) (@ring_mult F (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@ring_mult F (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y))) (@ring_mult G (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x)) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y))) *)
apply (ring_mult_hom_prf f).
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@ring_mult F (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y))) (@ring_mult G (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) x)) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group G))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group G)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group F))) (group_monoid (abelian_group_group (ring_group G))) (@ring_plus_hom F G g))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group E))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group F))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group E)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group F)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group E))) (group_monoid (abelian_group_group (ring_group F))) (@ring_plus_hom E F f))) y))) *)
apply (ring_mult_hom_prf g).
Defined.

Definition ring_id : forall E : ring, ring_hom E E.
(* Goal: forall E : ring, ring_hom E E *)
intros E; try assumption.
(* Goal: ring_hom E E *)
apply (Build_ring_hom (ring_plus_hom:=monoid_id E)).
(* Goal: @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) *)
red in |- *.
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
simpl in |- *; auto with algebra.
(* Goal: @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) *)
red in |- *.
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
simpl in |- *; auto with algebra.
Defined.

Definition RING : category.
apply
 (subcat (C:=ABELIAN_GROUP) (C':=ring) (i:=ring_group)
    (homC':=fun E F : ring =>
            Build_subtype_image (E:=Hom (c:=ABELIAN_GROUP) E F)
              (subtype_image_carrier:=ring_hom E F)
              (ring_plus_hom (E:=E) (F:=F))) (CompC':=ring_hom_comp)
    (idC':=ring_id)).
(* Goal: forall (a b c : ring) (g : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) b c)) (f : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) a b)), @Equal (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (ring_hom a c) (@ring_plus_hom a c)) (@ring_hom_comp a b c g f)) (@comp_hom ABELIAN_GROUP (ring_group a) (ring_group b) (ring_group c) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (ring_hom b c) (@ring_plus_hom b c)) g) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (ring_hom a b) (@ring_plus_hom a b)) f)) *)
simpl in |- *.
(* Goal: forall a : ring, @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (Id (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))))) (Id (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))))) *)
(* Goal: forall (a b c : ring) (g : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) b c)) (f : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) a b)), @Equal (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (ring_hom a c) (@ring_plus_hom a c)) (@ring_hom_comp a b c g f)) (@comp_hom ABELIAN_GROUP (ring_group a) (ring_group b) (ring_group c) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (ring_hom b c) (@ring_plus_hom b c)) g) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (ring_hom a b) (@ring_plus_hom a b)) f)) *)
intros a; try assumption.
(* Goal: @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) *)
red in |- *.
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
auto with algebra.
(* Goal: forall (a b c : ring) (g : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) b c)) (f : Carrier (@subcat_Hom ABELIAN_GROUP ring ring_group (fun E F : ring => @Build_subtype_image (@Hom ABELIAN_GROUP (ring_group E) (ring_group F)) (ring_hom E F) (@ring_plus_hom E F)) a b)), @Equal (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group c)) (ring_hom a c) (@ring_plus_hom a c)) (@ring_hom_comp a b c g f)) (@comp_hom ABELIAN_GROUP (ring_group a) (ring_group b) (ring_group c) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group b) (ring_group c)) (ring_hom b c) (@ring_plus_hom b c)) g) (@subtype_image_inj (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (@Build_subtype_image (@Hom ABELIAN_GROUP (ring_group a) (ring_group b)) (ring_hom a b) (@ring_plus_hom a b)) f)) *)
simpl in |- *.
(* Goal: forall (a b c : ring) (g : ring_hom b c) (f : ring_hom a b), @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) *)
intros a b c g f; try assumption.
(* Goal: @Map_eq (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) *)
red in |- *.
(* Goal: forall x : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) (@Ap (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@comp_map_map (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group a))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group b))))) (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group (ring_group c))))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group c)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group b))) (group_monoid (abelian_group_group (ring_group c))) (@ring_plus_hom b c g))) (@sgroup_map (monoid_sgroup (group_monoid (abelian_group_group (ring_group a)))) (monoid_sgroup (group_monoid (abelian_group_group (ring_group b)))) (@monoid_sgroup_hom (group_monoid (abelian_group_group (ring_group a))) (group_monoid (abelian_group_group (ring_group b))) (@ring_plus_hom a b f)))) x) *)
auto with algebra.
Defined.

Definition CRING := full_subcat (C:=RING) (C':=cring) cring_ring.