split; [ try assumption | idtac ].
exact eqFMd_refl.
red in |- *.
split; [ try assumption | idtac ].
exact eqFMd_trans.
exact eqFMd_sym.
Qed.
Definition FMd_set := Build_Setoid eqFMd_Equiv.
Definition FreeModule : MODULE R.
apply
(BUILD_MODULE (R:=R) (E:=FMd_set) (genlaw:=Law) (e:=Unit) (geninv:=Inv)
(gen_module_op:=Op)).
exact eqFMd_law.
exact eqFMd_law_assoc.
exact eqFMd_law0r.
exact eqFMd_inv.
exact eqFMd_invr.
exact eqFMd_com.
exact eqFMd_op_comp.
exact eqFMd_oplin_l.
exact eqFMd_oplin_r.
exact eqFMd_op_assoc.
exact eqFMd_op_unit.
Defined.
Section Universal_prop.
Variable Mod : MODULE R.
Variable f : Hom V Mod.
Fixpoint FMd_lift_fun (p : FreeModule) : Mod :=
match p with
| Var v => f v
| Law p1 p2 => sgroup_law Mod (FMd_lift_fun p1) (FMd_lift_fun p2)
| Unit => monoid_unit Mod
| Inv p1 => group_inverse Mod (FMd_lift_fun p1)
| Op a p1 => module_mult a (FMd_lift_fun p1)
end.
Definition FMd_lift : Hom FreeModule Mod.
apply
(BUILD_HOM_MODULE (R:=R) (Mod:=FreeModule) (Mod':=Mod) (ff:=FMd_lift_fun)).
intros x y H'; try assumption.
elim H'; simpl in |- *; auto with algebra.
intros x0 y0 z H'0 H'1 H'2 H'3; try assumption.
apply Trans with (FMd_lift_fun y0); auto with algebra.
simpl in |- *; auto with algebra.
simpl in |- *; auto with algebra.
simpl in |- *; auto with algebra.
Defined.
Definition FMd_var : Hom V FreeModule.
apply (Build_Map (A:=V) (B:=FreeModule) (Ap:=Var)).
red in |- *.
simpl in |- *; auto with algebra.
Defined.

Lemma FMd_comp_prop :
Equal f (comp_hom (FMd_lift:Hom (FreeModule:SET) Mod) FMd_var).