reserve k,t,i,j,m,n for Nat,
  x,y,y1,y2 for object,
  D for non empty set;
reserve K for Field,
  V for VectSp of K,
  a for Element of K,
  W for Element of V;
reserve KL1,KL2,KL3 for Linear_Combination of V,
  X for Subset of V;
reserve s for FinSequence,
  V1,V2,V3 for finite-dimensional VectSp of K,
  f,f1,f2 for Function of V1,V2,
  g for Function of V2,V3,
  b1 for OrdBasis of V1,
  b2 for OrdBasis of V2,
  b3 for OrdBasis of V3,
  v1,v2 for Vector of V2,
  v,w for Element of V1;
reserve p2,F for FinSequence of V1,
  p1,d for FinSequence of K,
  KL for Linear_Combination of V1;

theorem Th36:
  len d = len b1 implies d = Sum(lmlt(d,b1)) |-- b1
proof
  reconsider T = rng b1 as finite Subset of V1 by Def2;
  defpred X[Element of V1, Element of K] means ($1 in rng b1 implies (for k st
k in dom b1 & b1/.k = $1 holds $2 = d/.k)) & (not $1 in rng b1 implies $2 = 0.K
  );
A1: for v ex u being Element of K st X[v,u]
  proof
    let v be Element of V1;
    per cases;
    suppose
A2:   v in rng b1;
      then consider k be Element of NAT such that
A3:   k in dom b1 and
A4:   b1/.k = v by PARTFUN2:2;
      take u = d/.k;
      now
A5:     b1 is one-to-one by Def2;
        let i;
        assume that
A6:     i in dom b1 and
A7:     b1/.i = v;
        b1.i = b1/.k by A4,A6,A7,PARTFUN1:def 6
          .= b1.k by A3,PARTFUN1:def 6;
        hence u = d/.i by A3,A6,A5,FUNCT_1:def 4;
      end;
      hence thesis by A2;
    end;
    suppose
A8:   not v in rng b1;
      take 0.K;
      thus thesis by A8;
    end;
  end;
  consider KL be Function of V1, K such that
A9: for v holds X[v,KL.v] from FUNCT_2:sch 3(A1);
A10: now
    take T;
    let v be Element of V1;
    assume not v in T;
    hence KL.v = 0.K by A9;
  end;
  now
    take f = KL;
    thus KL = f & dom f = the carrier of V1 & rng f c= the carrier of K by
FUNCT_2:def 1,RELAT_1:def 19;
  end;
  then KL in Funcs(the carrier of V1, the carrier of K) by FUNCT_2:def 2;
  then reconsider KL1 = KL as Linear_Combination of V1 by A10,VECTSP_6:def 1;
  assume
A11: len d = len b1;
  now
    take KL1;
A12: b1 is one-to-one by Def2;
    thus
A13: for k st 1<=k & k<=len d holds d/.k=KL1.(b1/.k)
    proof
      let k;
      assume 1<=k & k<=len d;
      then
A14:  k in dom b1 by A11,FINSEQ_3:25;
      then b1.k = b1/.k by PARTFUN1:def 6;
      then b1/.k in rng b1 by A14,FUNCT_1:def 3;
      hence thesis by A9,A14;
    end;
    for x being object holds x in Carrier KL1 implies x in rng b1
    proof
      let x be object;
      assume x in Carrier KL1;
      then
A15:  ex v st x = v & KL1.v <> 0.K by VECTSP_6:1;
      assume not x in rng b1;
      hence contradiction by A9,A15;
    end;
    hence
A16: Carrier KL1 c= rng b1;
A17: dom d = dom b1 by A11,FINSEQ_3:29;
    then
A18: dom lmlt(d,b1) = dom b1 by Th12;
    then
A19: len lmlt(d,b1) = len b1 by FINSEQ_3:29
      .= len (KL1 (#) b1) by VECTSP_6:def 5;
    now
      let k be Nat;
      assume
A20:  k in dom lmlt(d,b1);
      then
A21:  k in dom (KL1 (#) b1) by A19,FINSEQ_3:29;
A22:  1<=k & k<=len d by A11,A18,A20,FINSEQ_3:25;
A23:  d/.k = d.k & b1/.k = b1.k by A17,A18,A20,PARTFUN1:def 6;
      thus lmlt(d,b1).k = (the lmult of V1).(d.k,b1.k) by A20,FUNCOP_1:22
        .= (d/.k) * (b1/.k) by A23,VECTSP_1:def 12
        .= KL1.(b1/.k) * (b1/.k) by A13,A22
        .= (KL1 (#) b1).k by A21,VECTSP_6:def 5;
    end;
    hence Sum(lmlt(d,b1)) = Sum(KL1 (#) b1) by A19,FINSEQ_2:9
      .= Sum KL1 by A16,A12,Th20;
  end;
  hence thesis by A11,Def7;
end;
