(* Global Instance AbelianGroup_Tn {T} : AbelianGroup T -> forall n, AbelianGroup (Tn n T) | 10.  Lemma coeff_mat_bij {m n : nat} (x0 : T) (u : nat -> nat -> T) : forall i j, (i < m)%nat -> (j < n)%nat -> coeff_mat x0 (mk_matrix m n u) i j = u i j.  Lemma coeff_mat_ext_aux {m n : nat} (x1 x2 : T) (v1 v2 : matrix m n) : v1 = v2 <-> forall i j, (i < m)%nat -> (j < n)%nat -> (coeff_mat x1 v1 i j) = (coeff_mat x2 v2 i j).  Lemma coeff_mat_ext {m n : nat} (x0 : T) (v1 v2 : matrix m n) : v1 = v2 <-> forall i j, (coeff_mat x0 v1 i j) = (coeff_mat x0 v2 i j).  Lemma mk_matrix_ext (m n : nat) (u1 u2 : nat -> nat -> T) : (forall i j, (i < m)%nat -> (j < n)%nat -> (u1 i j) = (u2 i j)) <-> (mk_matrix m n u1) = (mk_matrix m n u2).  End Matrices.  Section MatrixGroup.  Context {G : AbelianGroup} {m n : nat}.  Definition Mzero := mk_matrix m n (fun i j => @zero G).  Definition Mplus (A B : @matrix G m n) := mk_matrix m n (fun i j => plus (coeff_mat zero A i j) (coeff_mat zero B i j)).  Definition Mopp (A : @matrix G m n) := mk_matrix m n (fun i j => opp (coeff_mat zero A i j)).  Lemma Mplus_comm : forall A B : @matrix G m n, Mplus A B = Mplus B A.  Lemma Mplus_assoc : forall A B C : @matrix G m n, Mplus A (Mplus B C) = Mplus (Mplus A B) C.  Lemma Mplus_zero_r : forall A : @matrix G m n, Mplus A Mzero = A.  Lemma Mplus_opp_r : forall A : @matrix G m n, Mplus A (Mopp A) = Mzero.  Definition matrix_AbelianGroup_mixin := AbelianGroup.Mixin _ _ _ _ Mplus_comm Mplus_assoc Mplus_zero_r Mplus_opp_r.  Canonical matrix_AbelianGroup := AbelianGroup.Pack _ matrix_AbelianGroup_mixin (@matrix G m n).  End MatrixGroup.  Section MatrixRing.  Context {T : Ring}.  Fixpoint Mone_seq i j : T := match i,j with | O, O => one | O, S _ | S _, O => zero | S i, S j => Mone_seq i j end.  Definition Mone {n} : matrix n n := mk_matrix n n Mone_seq.  Lemma Mone_seq_diag : forall i j : nat, i = j -> Mone_seq i j = @one T. Lemma Mone_seq_not_diag : forall i j : nat, i <> j -> Mone_seq i j = @zero T.  Definition Mmult {n m k} (A : @matrix T n m) (B : @matrix T m k) := mk_matrix n k (fun i j => sum_n (fun l => mult (coeff_mat zero A i l) (coeff_mat zero B l j)) (pred m)).  Lemma Mmult_assoc {n m k l} : forall (A : matrix n m) (B : matrix m k) (C : matrix k l), Mmult A (Mmult B C) = Mmult (Mmult A B) C.  Lemma Mmult_one_r {m n} : forall x : matrix m n, Mmult x Mone = x.  Lemma Mmult_one_l {m n} : forall x : matrix m n, Mmult Mone x = x.  Lemma Mmult_distr_r {m n k} : forall (A B : @matrix T m n) (C : @matrix T n k), Mmult (Mplus A B) C = Mplus (Mmult A C) (Mmult B C).  Lemma Mmult_distr_l {m n k} : forall (A : @matrix T m n) (B C : @matrix T n k), Mmult A (Mplus B C) = Mplus (Mmult A B) (Mmult A C).  Definition matrix_Ring_mixin {n} := Ring.Mixin _ _ _ (@Mmult_assoc n n n n) Mmult_one_r Mmult_one_l Mmult_distr_r Mmult_distr_l.  Canonical matrix_Ring {n} := Ring.Pack (@matrix T n n) (Ring.Class _ _ matrix_Ring_mixin) (@matrix T n n).  Definition matrix_ModuleSpace_mixin {m n} := ModuleSpace.Mixin (@matrix_Ring m) (@matrix_AbelianGroup T m n) Mmult Mmult_assoc Mmult_one_l Mmult_distr_l Mmult_distr_r.  Canonical matrix_ModuleSpace {m n} := ModuleSpace.Pack _ (@matrix T m n) (ModuleSpace.Class _ _ _ matrix_ModuleSpace_mixin) (@matrix T m n).  End MatrixRing.  (** * The topology on natural numbers *)
Definition eventually (P : nat -> Prop) :=
exists N : nat, forall n, (N <= n)%nat -> P n.
Global Instance eventually_filter : ProperFilter eventually.
(** * The topology on real numbers *)
Definition R_AbelianGroup_mixin :=
AbelianGroup.Mixin _ _ _ _ Rplus_comm (fun x y z => sym_eq (Rplus_assoc x y z)) Rplus_0_r Rplus_opp_r.
Canonical R_AbelianGroup :=
AbelianGroup.Pack _ R_AbelianGroup_mixin R.
Definition R_Ring_mixin :=
Ring.Mixin _ _ _ (fun x y z => sym_eq (Rmult_assoc x y z)) Rmult_1_r Rmult_1_l Rmult_plus_distr_r Rmult_plus_distr_l.
Canonical R_Ring :=
Ring.Pack R (Ring.Class _ _ R_Ring_mixin) R.

Lemma Rabs_m1 :
Rabs (-1) = 1.