Section transpose.
Definition transpose :
forall (F : field) (m n : Nat), matrix F m n -> matrix F n m.
intros.
red in |- *.
red in |- *.
red in X; red in X.
destruct X.
apply (Build_Map2 (Ap2:=fun i j => Ap2 j i)); auto with algebra.
red in Ap2_comp_proof; red in |- *.
intros.
auto with algebra.
Defined.
Definition transpose_map :
forall (F : field) (m n : Nat), MAP (matrix F m n) (matrix F n m).
intros.
apply (Build_Map (Ap:=transpose (F:=F) (m:=m) (n:=n))).
red in |- *.
unfold transpose in |- *.
intros; destruct x; destruct y.
simpl in |- *.
auto with algebra.
Defined.
intros.
unfold transpose in |- *; destruct M; simpl in |- *.
apply Refl.
Qed.
End transpose.
Hint Resolve transpose_defprop: algebra.
Definition zero_matrix : forall (F : field) (n m : Nat), matrix F n m.
intros.
apply (Build_Map2 (Ap2:=fun (i : fin n) (j : fin m) => zero F)).
red in |- *.
auto with algebra.
Defined.
Definition is_square (F : field) (n m : Nat) (M : matrix F n m) :=
n =' m in _.
Definition is_diagonal (F : field) (n : Nat) (M : matrix F n n) :=
forall i j : fin n, index i <> index j -> M i j =' (zero F) in _.
Definition identity_matrix : forall (F : field) (n : Nat), matrix F n n.
intros.
apply
(Build_Map2
(Ap2:=fun i j : fin n => Kronecker one (zero F) (index i) (index j))).
red in |- *.
unfold Kronecker in |- *.
intros; destruct x; destruct x'; destruct y; destruct y'.
simpl in |- *.
simpl in H, H0.
rewrite H.
rewrite H0.
auto with algebra.
Defined.
red in |- *.
simpl in |- *.
auto.
Qed.
Definition row (F : field) :
forall m n : Nat, matrix F m n -> fin m -> Fn F n :=
fun n m M i => Ap2_Map M i.
Definition col (F : field) :
forall m n : Nat, matrix F m n -> fin n -> Fn F m :=
fun n m M j => Ap2_Map' M j.
intros; simpl in |- *.
red in |- *; simpl in |- *.
intros; (apply Sym; auto with algebra).
Qed.
intros.
simpl in |- *.
red in |- *; simpl in |- *.
intros.
destruct M; destruct M'; simpl in |- *.
simpl in H.
apply Trans with (Ap2 i' x); auto with algebra.
Qed.

Lemma col_comp :
forall (F : field) (m n : Nat) (M M' : matrix F m n) (i i' : fin n),
M =' M' in _ -> i =' i' in _ -> col M i =' col M' i' in _.