 reserve x,y,z for object,
   i,j,k,l,n,m for Nat,
   D,E for non empty set;
 reserve M for Matrix of D;
 reserve L for Matrix of E;
 reserve k,t,i,j,m,n for Nat,
   D for non empty set;
 reserve V for free Z_Module;
 reserve a for Element of INT.Ring,
   W for Element of V;
 reserve KL1,KL2,KL3 for Linear_Combination of V,
   X for Subset of V;
 reserve V for finite-rank free Z_Module,
   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-rank free Z_Module,
   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 INT.Ring,
   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;
    defpred X[Element of V1, Element of INT.Ring] 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.INT.Ring);
    A1: for v ex u being Element of INT.Ring 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 defOrdBasis;
          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;
        end;
        hence thesis by A2;
      end;
      suppose A8: not v in rng b1;
        reconsider I0 = 0.INT.Ring as Element of INT.Ring;
        take I0;
        thus thesis by A8;
      end;
    end;
    consider KL be Function of V1, the carrier of INT.Ring such that
    A9: for v holds X[v,KL.v] from FUNCT_2:sch 3(A1);
    now
      take f = KL;
      thus KL = f & dom f = the carrier of V1 & rng f c= the carrier of
        INT.Ring by FUNCT_2:def 1;
    end;
    then KL in Funcs(the carrier of V1, the carrier of INT.Ring)
      by FUNCT_2:def 2;
    then reconsider KL1 = KL as Linear_Combination of V1
      by A9,VECTSP_6:def 1;
    assume
    A11: len d = len b1;
    now
      take KL1;
      thus
      A13: for k st 1 <= k & k <= len d holds d/.k = KL1.(b1/.k)
      proof
        let k;
        assume A141: 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,A11,A141,FINSEQ_3:25;
      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;
        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
        .= KL1.(b1/.k) * (b1/.k) by A13,A22,A23
        .= (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,defOrdBasis,Th20;
    end;
    hence thesis by A11,Def7;
  end;
