Section Fn_vectors.
From Algebra Require Field_facts.
Export Sets Categories Parts Sgroup_cat Monoid_cat Group_cat Abelian_group_cat Ring_cat.
Export Field_facts.
From Algebra Require Ring_facts.
Export Ring_facts.
From Algebra Require Export Field_cat.
Require Export vecspaces_verybasic.
Require Export finite.
(**************************************)
(* In the beginning there was the set *)
(**************************************)
Definition Fn_set (F : Setoid) (n : Nat) : SET := seq n F.
(******************************************)
(* And Coq said, "let there be an sgroup" *)
(******************************************)
Let Fn_plus_fun :
forall (F : sgroup) (n : Nat), Fn_set F n -> Fn_set F n -> Fn_set F n.
intros F n x y.
simpl in |- *.
apply (Build_Map (Ap:=fun i : fin n => x i +' y i)).
red in |- *.
elim x.
elim y.
intros.
red in Map_compatible_prf.
red in Map_compatible_prf0.
apply SGROUP_comp; auto with algebra.
Defined.
Definition Fn_plus :
forall (F : sgroup) (n : Nat), law_of_composition (Fn_set F n).
intros F n.
apply (uncurry (f:=Fn_plus_fun (F:=F) (n:=n))).
red in |- *.
simpl in |- *.
intros.
red in |- *.
intro i.
simpl in |- *.
apply SGROUP_comp; auto with algebra.
Defined.
red in |- *.
intros.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
apply SGROUP_assoc.
Qed.
Definition Fn_sgroup (F : sgroup) (n : Nat) : SGROUP :=
Build_sgroup (Build_sgroup_on (Fn_plus_associative (F:=F) (n:=n))).
(*****************************************************)
(* And there was an sgroup, and Abel saw it was good *)
(*****************************************************)
red in |- *.
intros.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
auto with algebra.
Qed.
Definition Fn_absgp (F : abelian_sgroup) (n : Nat) : ABELIAN_SGROUP :=
Build_abelian_sgroup
(Build_abelian_sgroup_on (A:=Fn_sgroup F n)
(Fn_plus_commutative (F:=F) (n:=n))).
(******************************************************)
(* It is a monoid, Jim, but... exactly as we know it. *)
(******************************************************)
Definition Fn_zero : forall (F : monoid) (n : Nat), Fn_sgroup F n.
intros F n.
apply (Build_Map (Ap:=fun i : fin n => zero F)).
red in |- *.
intros.
apply Refl.
Defined.
intros F n.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
apply MONOID_unit_r.
Qed.
intros F n.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
apply MONOID_unit_l.
Qed.
Definition Fn_monoid (F : monoid) (n : Nat) : MONOID :=
Build_monoid
(Build_monoid_on (A:=Fn_sgroup F n) (monoid_unit:=
Fn_zero F n) (Fn_zero_is_r_unit (F:=F) (n:=n))
(Fn_zero_is_l_unit (F:=F) (n:=n))).
(*********************************)
(* And Abel saw that it was good *)
(*********************************)

Lemma Fn_monoid_is_abelian :
forall (F : abelian_monoid) (n : Nat), abelian_monoid_on (Fn_monoid F n).