(* 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*{ extras :  Matrix\_related\_defs.v }%*)
Set Implicit Arguments.
Unset Strict Implicit.
Require Export Matrices.
Require Export sums.

Section defs.
Variable F : field.
Variable n : Nat.
Variable M : matrix F n n.

Definition the_diagonal : seq n F.
apply (Build_Map (Ap:=fun i : fin n => M i i)).
red in |- *.
intros.
destruct M.
simpl in |- *.
apply Ap2_comp_proof; auto with algebra.
Defined.

Definition trace := sum the_diagonal.
End defs.