(* 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*{ support :  mult\_by\_scalars.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
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.
(** - mult_by_scalars is just an abbreviation for the special case of pointwise, where the operation is scalar multiplication. *)
(* That is to say: it takes two sequences of length N: one sequence v1...vN of *)
(* vectors and one sequence a1...aN of scalars. It returns the sequence of each vector *)
(* multiplied by its respective scalar; ie. a1*v1...aN*vN *)
Require Export pointwise.
Require Export modify_seq.
Require Export vecspaces_verybasic.
(** %\label{multbyscalars}% *)
Definition mult_by_scalars (R : ring) (V : module R)
(N : Nat) (a : Map (fin N) R) (v : Map (fin N) V) :
MAP (fin N) V := pointwise (uncurry (MODULE_comp (Mod:=V))) a v.

Lemma mult_by_scalars_comp :
forall (R : ring) (V : module R) (N : Nat) (a b : MAP (fin N) R)
(v w : MAP (fin N) V),
a =' b in _ ->
v =' w in _ -> mult_by_scalars a v =' mult_by_scalars b w in _.