(* 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 Group_util.
Require Export Abelian_group_facts.
Section Free_abelian_group_def.
Variable V : SET.

Inductive FaG : Type :=
  | Var : V -> FaG
  | Law : FaG -> FaG -> FaG
  | Unit : FaG
  | Inv : FaG -> FaG.

Inductive eqFaG : FaG -> FaG -> Prop :=
  | eqFaG_Var : forall x y : V, Equal x y -> (eqFaG (Var x) (Var y):Prop)
  | eqFaG_law :
      forall x x' y y' : FaG,
      eqFaG x x' -> eqFaG y y' -> (eqFaG (Law x y) (Law x' y'):Prop)
  | eqFaG_law_assoc :
      forall x y z : FaG, eqFaG (Law (Law x y) z) (Law x (Law y z)):Prop
  | eqFaG_law0r : forall x : FaG, eqFaG (Law x Unit) x:Prop
  | eqFaG_inv : forall x y : FaG, eqFaG x y -> eqFaG (Inv x) (Inv y)
  | eqFaG_invr : forall x : FaG, eqFaG (Law x (Inv x)) Unit
  | eqFaG_refl : forall x : FaG, eqFaG x x:Prop
  | eqFaG_sym : forall x y : FaG, eqFaG x y -> (eqFaG y x:Prop)
  | eqFaG_trans :
      forall x y z : FaG, eqFaG x y -> eqFaG y z -> (eqFaG x z:Prop)
  | eqFaG_com : forall x y : FaG, eqFaG (Law x y) (Law y x).
Hint Resolve eqFaG_Var eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_invr
  eqFaG_refl eqFaG_com: algebra.
Hint Immediate eqFaG_sym: algebra.

Lemma eqFaG_Equiv : equivalence eqFaG.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x y : FaG) (H' : eqFaG x y) => @eqFaG_ind (fun x0 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x0 x' y0 y' : FaG) (_ : eqFaG x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x0 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x0 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun x0 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x0)) (fun x0 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun (x0 y0 z : FaG) (_ : eqFaG x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x0 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x0) (FaG_lift_fun y0)) x y H')) FaG_var) *)
red in |- *.
(* Goal: and (@transitive FaG eqFaG) (@symmetric FaG eqFaG) *)
split; [ try assumption | idtac ].
(* Goal: @reflexive FaG eqFaG *)
(* Goal: @partial_equivalence FaG eqFaG *)
exact eqFaG_refl.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x y : FaG) (H' : eqFaG x y) => @eqFaG_ind (fun x0 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x0 x' y0 y' : FaG) (_ : eqFaG x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x0 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x0 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun x0 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x0)) (fun x0 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun (x0 y0 z : FaG) (_ : eqFaG x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x0 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x0) (FaG_lift_fun y0)) x y H')) FaG_var) *)
red in |- *.
(* Goal: and (@transitive FaG eqFaG) (@symmetric FaG eqFaG) *)
split; [ try assumption | idtac ].
(* Goal: @transitive FaG eqFaG *)
(* Goal: @symmetric FaG eqFaG *)
exact eqFaG_trans.
(* Goal: @symmetric FaG eqFaG *)
exact eqFaG_sym.
Qed.

Definition FaG_set := Build_Setoid eqFaG_Equiv.

Definition FreeAbelianGroup : ABELIAN_GROUP.
apply
 (BUILD_ABELIAN_GROUP (E:=FaG_set) (genlaw:=Law) (e:=Unit) (geninv:=Inv)).
(* Goal: forall (x x' y y' : Carrier FaG_set) (_ : @Equal FaG_set x x') (_ : @Equal FaG_set y y'), @Equal FaG_set (Law x y) (Law x' y') *)
(* Goal: forall x y z : Carrier FaG_set, @Equal FaG_set (Law (Law x y) z) (Law x (Law y z)) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x Unit) x *)
(* Goal: forall (x y : Carrier FaG_set) (_ : @Equal FaG_set x y), @Equal FaG_set (Inv x) (Inv y) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x (Inv x)) Unit *)
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_law.
(* Goal: forall x y z : Carrier FaG_set, @Equal FaG_set (Law (Law x y) z) (Law x (Law y z)) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x Unit) x *)
(* Goal: forall (x y : Carrier FaG_set) (_ : @Equal FaG_set x y), @Equal FaG_set (Inv x) (Inv y) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x (Inv x)) Unit *)
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_law_assoc.
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x Unit) x *)
(* Goal: forall (x y : Carrier FaG_set) (_ : @Equal FaG_set x y), @Equal FaG_set (Inv x) (Inv y) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x (Inv x)) Unit *)
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_law0r.
(* Goal: forall (x y : Carrier FaG_set) (_ : @Equal FaG_set x y), @Equal FaG_set (Inv x) (Inv y) *)
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x (Inv x)) Unit *)
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_inv.
(* Goal: forall x : Carrier FaG_set, @Equal FaG_set (Law x (Inv x)) Unit *)
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_invr.
(* Goal: forall x y : Carrier FaG_set, @Equal FaG_set (Law x y) (Law y x) *)
exact eqFaG_com.
Defined.
Section Universal_prop.
Variable G : ABELIAN_GROUP.
Variable f : Hom V G.

Fixpoint FaG_lift_fun (p : FreeAbelianGroup) : G :=
  match p with
  | Var v => f v
  | Law p1 p2 => sgroup_law _ (FaG_lift_fun p1) (FaG_lift_fun p2)
  | Unit => monoid_unit G
  | Inv p1 => group_inverse G (FaG_lift_fun p1)
  end.

Definition FaG_lift : Hom FreeAbelianGroup G.
(* Goal: Carrier (@Hom ABELIAN_GROUP FreeAbelianGroup G) *)
apply (BUILD_HOM_GROUP (G:=FreeAbelianGroup) (G':=G) (ff:=FaG_lift_fun)).
(* Goal: forall (x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))))) (_ : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))) x y), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x) (FaG_lift_fun y) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) x y)) (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x) (FaG_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) (monoid_on_def (group_monoid (abelian_group_group FreeAbelianGroup))))) (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group G))) (monoid_on_def (group_monoid (abelian_group_group G)))) *)
intros x y H'; try assumption.
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x) (FaG_lift_fun y) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) x y)) (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x) (FaG_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) (monoid_on_def (group_monoid (abelian_group_group FreeAbelianGroup))))) (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group G))) (monoid_on_def (group_monoid (abelian_group_group G)))) *)
elim H'; simpl in |- *; auto with algebra.
(* Goal: forall (x y z : FaG) (_ : eqFaG x y) (_ : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x) (FaG_lift_fun y)) (_ : eqFaG y z) (_ : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y) (FaG_lift_fun z)), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x) (FaG_lift_fun z) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) x y)) (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x) (FaG_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) (monoid_on_def (group_monoid (abelian_group_group FreeAbelianGroup))))) (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group G))) (monoid_on_def (group_monoid (abelian_group_group G)))) *)
intros x0 y0 z H'0 H'1 H'2 H'3; try assumption.
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun z) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) x y)) (sgroup_law (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x) (FaG_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))) (monoid_on_def (group_monoid (abelian_group_group FreeAbelianGroup))))) (@monoid_unit (monoid_sgroup (group_monoid (abelian_group_group G))) (monoid_on_def (group_monoid (abelian_group_group G)))) *)
apply Trans with (FaG_lift_fun y0); auto with algebra.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
Defined.

Definition FaG_var : Hom V FreeAbelianGroup.
(* Goal: Carrier (@Hom SET V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup))))) *)
apply (Build_Map (A:=V) (B:=FreeAbelianGroup) (Ap:=Var)).
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x y : FaG) (H' : eqFaG x y) => @eqFaG_ind (fun x0 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x0 x' y0 y' : FaG) (_ : eqFaG x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x0 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x0 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun x0 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x0)) (fun x0 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun (x0 y0 z : FaG) (_ : eqFaG x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x0 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x0) (FaG_lift_fun y0)) x y H')) FaG_var) *)
red in |- *.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group FreeAbelianGroup)))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
Defined.

Lemma FaG_comp_prop :
 Equal f (comp_hom (FaG_lift:Hom (FreeAbelianGroup:SET) G) FaG_var).
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f x) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x0 y : FaG) (H' : eqFaG x0 y) => @eqFaG_ind (fun x1 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) (fun (x1 y0 : Carrier V) (H : @Equal V x1 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x1 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x1 x' y0 y' : FaG) (_ : eqFaG x1 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x1) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x1 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x1) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x1 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x1)) (fun (x1 y0 : FaG) (_ : eqFaG x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x1) (FaG_lift_fun y0) H0) (fun x1 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x1)) (fun x1 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1)) (fun (x1 y0 : FaG) (_ : eqFaG x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0) H0) (fun (x1 y0 z : FaG) (_ : eqFaG x1 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x1 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x1) (FaG_lift_fun y0)) x0 y H')) FaG_var) x) *)
simpl in |- *.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x y : FaG) (H' : eqFaG x y) => @eqFaG_ind (fun x0 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x0 x' y0 y' : FaG) (_ : eqFaG x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x0 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x0 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun x0 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x0)) (fun x0 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0)) (fun (x0 y0 : FaG) (_ : eqFaG x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) H0) (fun (x0 y0 z : FaG) (_ : eqFaG x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x0) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x0 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x0) (FaG_lift_fun y0)) x y H')) FaG_var) *)
red in |- *.
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f x) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@comp_hom SET V FaG_set (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@f2 (@Group_util.G FaG_set Law Unit Inv eqFaG_law eqFaG_law_assoc eqFaG_law0r eqFaG_inv eqFaG_invr) (abelian_group_group G) FaG_lift_fun (fun (x0 y : FaG) (H' : eqFaG x0 y) => @eqFaG_ind (fun x1 y0 : FaG => @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) (fun (x1 y0 : Carrier V) (H : @Equal V x1 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f f x1 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G))))) f)) (fun (x1 x' y0 y' : FaG) (_ : eqFaG x1 x') (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun x')) (_ : eqFaG y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun y')) => @SGROUP_comp (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x1) (FaG_lift_fun x') (FaG_lift_fun y0) (FaG_lift_fun y') H0 H2) (fun x1 y0 z : FaG => @SGROUP_assoc (monoid_sgroup (group_monoid (abelian_group_group G))) (FaG_lift_fun x1) (FaG_lift_fun y0) (FaG_lift_fun z)) (fun x1 : FaG => @MONOID_unit_r (group_monoid (abelian_group_group G)) (FaG_lift_fun x1)) (fun (x1 y0 : FaG) (_ : eqFaG x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) => @GROUP_comp (abelian_group_group G) (FaG_lift_fun x1) (FaG_lift_fun y0) H0) (fun x1 : FaG => @GROUP_inverse_r (abelian_group_group G) (FaG_lift_fun x1)) (fun x1 : FaG => @Refl (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1)) (fun (x1 y0 : FaG) (_ : eqFaG x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0) H0) (fun (x1 y0 z : FaG) (_ : eqFaG x1 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0)) (_ : eqFaG y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun y0) (FaG_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (FaG_lift_fun x1) (FaG_lift_fun y0) (FaG_lift_fun z) H'1 H'3) (fun x1 y0 : FaG => @ABELIAN_GROUP_com G (FaG_lift_fun x1) (FaG_lift_fun y0)) x0 y H')) FaG_var) x) *)
simpl in |- *.
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f x) (@Ap V (sgroup_set (monoid_sgroup (group_monoid (abelian_group_group G)))) f x) *)
auto with algebra.
Qed.
End Universal_prop.
End Free_abelian_group_def.
Hint Resolve FaG_comp_prop: algebra.
