(* 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 Monoid_cat.
Require Export Sgroup_facts.
Require Export Monoid_facts.
Require Export Monoid_util.
Require Export Abelian_group_facts.
Section Free_abelian_monoid_def.
Variable V : SET.

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

Inductive eqFaM : FaM -> FaM -> Prop :=
  | eqFaM_Var : forall x y : V, Equal x y -> (eqFaM (Var x) (Var y):Prop)
  | eqFaM_law :
      forall x x' y y' : FaM,
      eqFaM x x' -> eqFaM y y' -> (eqFaM (Law x y) (Law x' y'):Prop)
  | eqFaM_law_assoc :
      forall x y z : FaM, eqFaM (Law (Law x y) z) (Law x (Law y z)):Prop
  | eqFaM_law0r : forall x : FaM, eqFaM (Law x Unit) x:Prop
  | eqFaM_law0l : forall x : FaM, eqFaM (Law Unit x) x:Prop
  | eqFaM_refl : forall x : FaM, eqFaM x x:Prop
  | eqFaM_sym : forall x y : FaM, eqFaM x y -> (eqFaM y x:Prop)
  | eqFaM_trans :
      forall x y z : FaM, eqFaM x y -> eqFaM y z -> (eqFaM x z:Prop)
  | eqFaM_com : forall x y : FaM, eqFaM (Law x y) (Law y x).
Hint Resolve eqFaM_Var eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l
  eqFaM_refl eqFaM_com: algebra.
Hint Immediate eqFaM_sym: algebra.

Lemma eqFaM_Equiv : equivalence eqFaM.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x y : FaM) (H' : eqFaM x y) => @eqFaM_ind (fun x0 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x0 x' y0 y' : FaM) (_ : eqFaM x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x0 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x0 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0)) (fun (x0 y0 : FaM) (_ : eqFaM x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) H0) (fun (x0 y0 z : FaM) (_ : eqFaM x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x0 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x0) (FaM_lift_fun y0)) x y H')) FaM_var) *)
red in |- *.
(* Goal: and (@transitive FaM eqFaM) (@symmetric FaM eqFaM) *)
split; [ try assumption | idtac ].
(* Goal: @reflexive FaM eqFaM *)
(* Goal: @partial_equivalence FaM eqFaM *)
exact eqFaM_refl.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x y : FaM) (H' : eqFaM x y) => @eqFaM_ind (fun x0 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x0 x' y0 y' : FaM) (_ : eqFaM x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x0 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x0 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0)) (fun (x0 y0 : FaM) (_ : eqFaM x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) H0) (fun (x0 y0 z : FaM) (_ : eqFaM x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x0 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x0) (FaM_lift_fun y0)) x y H')) FaM_var) *)
red in |- *.
(* Goal: and (@transitive FaM eqFaM) (@symmetric FaM eqFaM) *)
split; [ try assumption | idtac ].
(* Goal: @transitive FaM eqFaM *)
(* Goal: @symmetric FaM eqFaM *)
exact eqFaM_trans.
(* Goal: @symmetric FaM eqFaM *)
exact eqFaM_sym.
Qed.

Definition FaM_set := Build_Setoid eqFaM_Equiv.

Definition FreeAbelianMonoid : ABELIAN_MONOID.
(* Goal: Ob ABELIAN_MONOID *)
apply (BUILD_ABELIAN_MONOID (E:=FaM_set) (genlaw:=Law) (e:=Unit)).
(* Goal: forall (x x' y y' : Carrier FaM_set) (_ : @Equal FaM_set x x') (_ : @Equal FaM_set y y'), @Equal FaM_set (Law x y) (Law x' y') *)
(* Goal: forall x y z : Carrier FaM_set, @Equal FaM_set (Law (Law x y) z) (Law x (Law y z)) *)
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law x Unit) x *)
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law Unit x) x *)
(* Goal: forall x y : Carrier FaM_set, @Equal FaM_set (Law x y) (Law y x) *)
exact eqFaM_law.
(* Goal: forall x y z : Carrier FaM_set, @Equal FaM_set (Law (Law x y) z) (Law x (Law y z)) *)
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law x Unit) x *)
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law Unit x) x *)
(* Goal: forall x y : Carrier FaM_set, @Equal FaM_set (Law x y) (Law y x) *)
exact eqFaM_law_assoc.
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law x Unit) x *)
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law Unit x) x *)
(* Goal: forall x y : Carrier FaM_set, @Equal FaM_set (Law x y) (Law y x) *)
exact eqFaM_law0r.
(* Goal: forall x : Carrier FaM_set, @Equal FaM_set (Law Unit x) x *)
(* Goal: forall x y : Carrier FaM_set, @Equal FaM_set (Law x y) (Law y x) *)
exact eqFaM_law0l.
(* Goal: forall x y : Carrier FaM_set, @Equal FaM_set (Law x y) (Law y x) *)
exact eqFaM_com.
Defined.
Section Universal_prop.
Variable M : ABELIAN_MONOID.
Variable f : Hom V M.

Fixpoint FaM_lift_fun (p : FreeAbelianMonoid) : M :=
  match p with
  | Var v => f v
  | Law p1 p2 => sgroup_law _ (FaM_lift_fun p1) (FaM_lift_fun p2)
  | Unit => monoid_unit M
  end.

Definition FaM_lift : Hom FreeAbelianMonoid M.
(* Goal: Carrier (@Hom ABELIAN_MONOID FreeAbelianMonoid M) *)
apply (BUILD_HOM_MONOID (G:=FreeAbelianMonoid) (G':=M) (ff:=FaM_lift_fun)).
(* Goal: forall (x y : Carrier (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)))) (_ : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))) x y), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x) (FaM_lift_fun y) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (sgroup_law (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) x y)) (sgroup_law (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x) (FaM_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (@monoid_unit (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) (monoid_on_def (abelian_monoid_monoid FreeAbelianMonoid)))) (@monoid_unit (monoid_sgroup (abelian_monoid_monoid M)) (monoid_on_def (abelian_monoid_monoid M))) *)
intros x y H'; try assumption.
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x) (FaM_lift_fun y) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (sgroup_law (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) x y)) (sgroup_law (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x) (FaM_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (@monoid_unit (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) (monoid_on_def (abelian_monoid_monoid FreeAbelianMonoid)))) (@monoid_unit (monoid_sgroup (abelian_monoid_monoid M)) (monoid_on_def (abelian_monoid_monoid M))) *)
elim H'; simpl in |- *; auto with algebra.
(* Goal: forall (x y z : FaM) (_ : eqFaM x y) (_ : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x) (FaM_lift_fun y)) (_ : eqFaM y z) (_ : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y) (FaM_lift_fun z)), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x) (FaM_lift_fun z) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (sgroup_law (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) x y)) (sgroup_law (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x) (FaM_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (@monoid_unit (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) (monoid_on_def (abelian_monoid_monoid FreeAbelianMonoid)))) (@monoid_unit (monoid_sgroup (abelian_monoid_monoid M)) (monoid_on_def (abelian_monoid_monoid M))) *)
intros x0 y0 z H'0 H'1 H'2 H'3; try assumption.
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun z) *)
(* Goal: forall x y : Carrier (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (sgroup_law (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) x y)) (sgroup_law (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x) (FaM_lift_fun y)) *)
(* Goal: @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun (@monoid_unit (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)) (monoid_on_def (abelian_monoid_monoid FreeAbelianMonoid)))) (@monoid_unit (monoid_sgroup (abelian_monoid_monoid M)) (monoid_on_def (abelian_monoid_monoid M))) *)
apply Trans with (FaM_lift_fun y0); auto with algebra.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
Defined.

Definition FaM_var : Hom V FreeAbelianMonoid.
(* Goal: Carrier (@Hom SET V (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid)))) *)
apply (Build_Map (A:=V) (B:=FreeAbelianMonoid) (Ap:=Var)).
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x y : FaM) (H' : eqFaM x y) => @eqFaM_ind (fun x0 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x0 x' y0 y' : FaM) (_ : eqFaM x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x0 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x0 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0)) (fun (x0 y0 : FaM) (_ : eqFaM x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) H0) (fun (x0 y0 z : FaM) (_ : eqFaM x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x0 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x0) (FaM_lift_fun y0)) x y H')) FaM_var) *)
red in |- *.
(* Goal: forall (x y : Carrier V) (_ : @Equal V x y), @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid FreeAbelianMonoid))) (Var x) (Var y) *)
simpl in |- *; auto with algebra.
Defined.

Lemma FaM_comp_prop :
 Equal f (comp_hom (FaM_lift:Hom (FreeAbelianMonoid:SET) M) FaM_var).
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f x) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x0 y : FaM) (H' : eqFaM x0 y) => @eqFaM_ind (fun x1 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) (fun (x1 y0 : Carrier V) (H : @Equal V x1 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x1 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x1 x' y0 y' : FaM) (_ : eqFaM x1 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x1) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x1 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x1) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x1 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x1)) (fun x1 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x1)) (fun x1 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1)) (fun (x1 y0 : FaM) (_ : eqFaM x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0) H0) (fun (x1 y0 z : FaM) (_ : eqFaM x1 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x1 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x1) (FaM_lift_fun y0)) x0 y H')) FaM_var) x) *)
simpl in |- *.
(* Goal: @Map_eq V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x y : FaM) (H' : eqFaM x y) => @eqFaM_ind (fun x0 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (fun (x0 y0 : Carrier V) (H : @Equal V x0 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x0 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x0 x' y0 y' : FaM) (_ : eqFaM x0 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x0 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x0 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x0)) (fun x0 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0)) (fun (x0 y0 : FaM) (_ : eqFaM x0 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) H0) (fun (x0 y0 z : FaM) (_ : eqFaM x0 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x0) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x0 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x0) (FaM_lift_fun y0)) x y H')) FaM_var) *)
red in |- *.
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f x) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@comp_hom SET V FaM_set (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@f2 (@Monoid_util.M FaM_set Law Unit eqFaM_law eqFaM_law_assoc eqFaM_law0r eqFaM_law0l) (abelian_monoid_monoid M) FaM_lift_fun (fun (x0 y : FaM) (H' : eqFaM x0 y) => @eqFaM_ind (fun x1 y0 : FaM => @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) (fun (x1 y0 : Carrier V) (H : @Equal V x1 y0) => @Ap_comp V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f f x1 y0 H (@Refl (MAP V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M)))) f)) (fun (x1 x' y0 y' : FaM) (_ : eqFaM x1 x') (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun x')) (_ : eqFaM y0 y') (H2 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun y')) => @SGROUP_comp (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x1) (FaM_lift_fun x') (FaM_lift_fun y0) (FaM_lift_fun y') H0 H2) (fun x1 y0 z : FaM => @SGROUP_assoc (monoid_sgroup (abelian_monoid_monoid M)) (FaM_lift_fun x1) (FaM_lift_fun y0) (FaM_lift_fun z)) (fun x1 : FaM => @MONOID_unit_r (abelian_monoid_monoid M) (FaM_lift_fun x1)) (fun x1 : FaM => @MONOID_unit_l (abelian_monoid_monoid M) (FaM_lift_fun x1)) (fun x1 : FaM => @Refl (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1)) (fun (x1 y0 : FaM) (_ : eqFaM x1 y0) (H0 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) => @Sym (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0) H0) (fun (x1 y0 z : FaM) (_ : eqFaM x1 y0) (H'1 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0)) (_ : eqFaM y0 z) (H'3 : @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun y0) (FaM_lift_fun z)) => @Trans (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (FaM_lift_fun x1) (FaM_lift_fun y0) (FaM_lift_fun z) H'1 H'3) (fun x1 y0 : FaM => @ABELIAN_MONOID_com M (FaM_lift_fun x1) (FaM_lift_fun y0)) x0 y H')) FaM_var) x) *)
simpl in |- *.
(* Goal: forall x : Carrier V, @Equal (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f x) (@Ap V (sgroup_set (monoid_sgroup (abelian_monoid_monoid M))) f x) *)
auto with algebra.
Qed.
End Universal_prop.
End Free_abelian_monoid_def.
Hint Resolve FaM_comp_prop: algebra.