(* 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                                                     *)
(** %\subsection*{ examples :  vecspace\_Fn.v }%*)
(** - In this file I define the vectorspaces $F^n$ (for arbitrary fields $F$); this is done without using the 'tool' alt_build_vecspace, just to show the tediousness of having to build all successive structures from the algebraic hierarchy by hand *)
Set Automatic Coercions Import.
Set Implicit Arguments.
Unset Strict Implicit.
Section Fn_vectors.
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.

Lemma Fn_plus_associative :
forall (F : sgroup) (n : Nat), associative (Fn_plus F n).