Library Coqtail.Topology.Vectors


Require Import Field_theory.

Vector spaces


Section Vector_Spaces.
  Variable (R:Type)
    (rO:R) (rI:R)
    (radd rmul rsub : RRR)
    (ropp : RR)
    (rdiv : RRR)
    (rinv : RR)
    (req : RRProp)
  .
  Variable Rfield : field_theory rO rI radd rmul rsub ropp rdiv rinv req.
  Variable (V:Type) (vO:V).
  Variable vadd : VVV.
  Variable smul : RVV.

  Record vector_space : Type := {
    vadd_comm := x y, vadd x y = vadd y x;
    vadd_assoc := x y z, vadd (vadd x y) z = vadd x (vadd y z);
    vadd_identity := x, vadd vO x = x;
    vadd_inverse := x, y, vadd x y = vO;
  
    smul_distr_vadd := a x y, smul a (vadd x y) = vadd (smul a x) (smul a y);
    smul_distr_radd := a b x, smul (radd a b) x = vadd (smul a x) (smul b x);
    smul_compat_rmul := a b x, smul a (smul b x) = smul (rmul a b) x;
    smul_identity := x, smul rI x = x
  }.

  Fixpoint finite_sum (n:nat) (v:natV) {struct n} := match n with
    | 0 ⇒ vO
    | S ivadd (v n) (finite_sum i v)
  end.

  Record Basis (I:Type) (Xi:IV) : Prop := {
    basis_spanning : x:V, n, vn : natI,
      x = finite_sum n (fun nXi (vn n));
    basis_linear_independence : n (vn : natI) (an : natR),
      ( i j , injnvn i = vn ji=j) →
      finite_sum n (fun mXi (vn m)) = vO
       i, inan i = rO
  }.

End Vector_Spaces.