Section Function_spaces.
Definition func_set (A B : Setoid) := MAP A B.
Let func_plus_fun :
forall (A : Setoid) (B : sgroup),
func_set A B -> func_set A B -> func_set A B.
intros A B f g.
simpl in |- *.
simpl in f.
simpl in g.
apply (Build_Map (A:=A) (B:=B) (Ap:=fun a : A => Ap f a +' Ap g a)).
red in |- *.
intros a a' Ha.
apply SGROUP_comp; auto with algebra.
Defined.
Definition func_plus :
forall (A : Setoid) (B : sgroup), law_of_composition (func_set A B).
intros.
simpl in |- *.
apply Map2_Mapcart.
apply (Build_Map2 (Ap2:=func_plus_fun (A:=A) (B:=B))).
red in |- *.
intros f f' g g' Hf Hg.
unfold func_plus_fun in |- *.
simpl in |- *.
red in |- *.
intro a.
simpl in |- *.
apply SGROUP_comp; auto with algebra.
Defined.
intros.
red in |- *.
intros f g h.
unfold func_plus in |- *.
simpl in |- *.
red in |- *.
intro a.
unfold func_plus_fun in |- *.
simpl in |- *.
apply SGROUP_assoc.
Qed.
Definition func_sgroup (A : Setoid) (B : sgroup) : SGROUP :=
Build_sgroup (Build_sgroup_on (func_plus_associative (A:=A) (B:=B))).
intros.
red in |- *.
intros f f'.
unfold func_plus in |- *.
simpl in |- *.
red in |- *.
intro a.
unfold func_plus_fun in |- *.
simpl in |- *.
apply ABELIAN_SGROUP_com.
Qed.
Definition func_absgp (A : Setoid) (B : abelian_sgroup) : ABELIAN_SGROUP :=
Build_abelian_sgroup
(Build_abelian_sgroup_on (A:=func_sgroup A B)
(func_plus_commutative (A:=A) (B:=B))).
Definition func_zerofun : forall (A : Setoid) (B : monoid), func_set A B.
intros.
apply (Build_Map (Ap:=fun a : A => zero B)).
red in |- *.
intros.
apply Refl.
Defined.
intros A B.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
apply MONOID_unit_r.
Qed.
intros A B.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
apply MONOID_unit_l.
Qed.
Definition func_monoid (A : Setoid) (B : monoid) : MONOID :=
Build_monoid
(Build_monoid_on (A:=func_sgroup A B) (monoid_unit:=
func_zerofun A B) (func_zerofun_is_r_unit (A:=A) (B:=B))
(func_zerofun_is_l_unit (A:=A) (B:=B))).

Lemma func_monoid_is_abelian :
forall (A : Setoid) (B : abelian_monoid),
abelian_monoid_on (func_monoid A B).