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 *)
(*********************************)
intros F n.
apply Build_abelian_monoid_on.
apply Build_abelian_sgroup_on.
exact (Fn_plus_commutative (F:=F) (n:=n)).
Qed.
Definition Fn_abmon (F : abelian_monoid) (n : Nat) : ABELIAN_MONOID :=
Build_abelian_monoid (Fn_monoid_is_abelian F n).
(***********************************)
(* What's in a name? That which we *)
(* call a group by any other word  *)
(* would smell as sweet.           *)
(***********************************)
Let Fn_inv_fun : forall (F : group) (n : Nat), Fn_monoid F n -> Fn_monoid F n.
simpl in |- *.
intros F n v.
apply (Build_Map (Ap:=fun i : fin n => group_inverse F (v i))).
red in |- *.
intros i i' H.
apply GROUP_comp; auto with algebra.
Defined.
Definition Fn_inv :
forall (F : group) (n : Nat), Map (Fn_monoid F n) (Fn_monoid F n).
intros F n.
apply (Build_Map (Ap:=Fn_inv_fun (F:=F) (n:=n))).
red in |- *.
intros.
simpl in |- *.
red in |- *.
intro i.
simpl in H.
red in H.
simpl in |- *.
apply GROUP_comp; auto with algebra.
Defined.
intros F n.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
auto with algebra.
Qed.
intros F n.
red in |- *.
intro.
simpl in |- *.
red in |- *.
intro i.
simpl in |- *.
auto with algebra.
Qed.
Definition Fn_group (F : group) (n : Nat) : GROUP :=
Build_group
(Build_group_on (group_inverse_map:=Fn_inv F n)
(Fn_inv_is_r_inverse (F:=F) (n:=n))
(Fn_inv_is_l_inverse (F:=F) (n:=n))).
(****************************)
(* Once more, Abel spoke... *)
(****************************)

Lemma Fn_group_is_abelian :
forall (F : abelian_group) (n : Nat), abelian_group_on (Fn_group F n).