 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 Th32:
  for M being Matrix of the carrier of V1 holds Sum Sum M = Sum Sum (M@)
  proof
    defpred X[Nat] means for M being Matrix of the carrier of V1 st len M = $1
    holds Sum Sum M = Sum Sum (M@);
    let M be Matrix of the carrier of V1;
    A1: for P being FinSequence of V1 holds Sum Sum <*P*> = Sum Sum (<*P*>@)
    proof
      defpred X[FinSequence of V1] means Sum Sum <*$1*> = Sum Sum(<*$1*>@);
      let P be FinSequence of V1;
      len <*<*>(the carrier of V1)*> = 1 by MATRIX_0:def 2;
      then width <*<*>(the carrier of V1)*> = 0 by MATRIX_0:20;
      then
      A2: len (<*<*>(the carrier of V1)*>@) = 0 by MATRIX_0:def 6;
      A3: for P being FinSequence of V1, x being Element of V1 st X[P]
      holds X[P^<*x*>]
      proof
        let P be FinSequence of V1, x be Element of V1 such that
        A4: Sum Sum <*P*> = Sum Sum (<*P*>@);
        Seg len (<*P*> ^^ <*<*x*>*>) = dom (<*P*> ^^ <*<*x*>*>)
        by FINSEQ_1:def 3
        .= dom <*P*> /\ dom <*<*x*>*> by PRE_POLY:def 4
        .= Seg 1 /\ dom <*<*x*>*> by FINSEQ_1:38
        .= Seg 1 /\ Seg 1 by FINSEQ_1:38
        .= Seg 1;
        then
        A5: len (<*P*> ^^ <*<*x*>*>) = 1 by FINSEQ_1:6
        .= len <*P^<*x*>*> by FINSEQ_1:39;
        then
        A6: dom (<*P*> ^^ <*<*x*>*>) = Seg len <*P^<*x*>*> by FINSEQ_1:def 3;
        A7:
        now
          let i be Nat;
          assume
          A8: i in dom (<*P*> ^^ <*<*x*>*>);
          then i in { 1 } by A6,FINSEQ_1:2,40;
          then
          A9: i = 1 by TARSKI:def 1;
          reconsider m1 = <*P*>.i, m2 = <*<*x*>*>.i as FinSequence;
          thus (<*P*> ^^ <*<*x*>*>).i = m1 ^ m2 by A8,PRE_POLY:def 4
          .= P ^ m2 by A9
          .= P ^ <*x*> by A9
          .= <*P^<*x*>*>.i by A9;
        end;
        per cases;
        suppose len P = 0;
          then
          A10: P = {};
          hence Sum Sum <*P^<*x*>*> = Sum Sum <*<*x*>*> by FINSEQ_1:34
          .= Sum Sum (<*<*x*>*>@) by MATRLIN:15
          .= Sum Sum (<*P^<*x*>*>@) by A10,FINSEQ_1:34;
        end;
        suppose A11: len P <> 0;
          A12: len <*<*x*>*> = 1 by FINSEQ_1:40;
          then
          A13: width <*<*x*>*> = len <*x*> by MATRIX_0:20
          .= 1 by FINSEQ_1:40;
          then
          A14: len (<*<*x*>*>@) = 1 by MATRIX_0:def 6;
          A15: len <*P*> = 1 by FINSEQ_1:40;
          then
          A16: width <*P*> = len P by MATRIX_0:20;
          then
          A17: len (<*P*>@) = len P by MATRIX_0:def 6;
          width (<*P*>@) = 1 by A11,A15,A16,MATRIX_0:54;
          then reconsider d1 = <*P*>@ as Matrix of len P,1,the carrier of V1
          by A11,A17,MATRIX_0:20;
          A18: len <*P^<*x*>*> = 1 by FINSEQ_1:40;
          then
          A19: width <*P^<*x*>*> = len (P^<*x*>) by MATRIX_0:20
          .= len P + len <*x*> by FINSEQ_1:22
          .= len P + 1 by FINSEQ_1:40;
          A20: (<*<*x*>*>@)@ = <*<*x*>*> by A12,A13,MATRIX_0:57;
          A21: width (<*P*>@) = len <*P*> by A11,A16,MATRIX_0:54
          .= width (<*<*x*>*>@) by A15,A12,A13,MATRIX_0:54;
          then width (<*<*x*>*>@) = 1 by A11,A15,A16,MATRIX_0:54;
          then reconsider d2 = <*<*x*>*>@ as Matrix of 1,1,the carrier of V1
          by A14,MATRIX_0:20;
          A22: (d1 ^ d2)@ = ((<*P*>@)@) ^^ ((<*<*x*>*>@)@) by A21,MATRLIN:28
          .= <*P*> ^^ <*<*x*>*> by A11,A15,A16,A20,MATRIX_0:57
          .= <*P^<*x*>*> by A5,A7,FINSEQ_2:9
          .= (<*P^<*x*>*>@)@ by A18,A19,MATRIX_0:57;
          A23: len ((<*P*>@) ^ (<*<*x*>*>@)) = len (<*P*>@) + len (<*<*x*>*>@)
          by FINSEQ_1:22
          .= width <*P*> + len (<*<*x*>*>@) by MATRIX_0:def 6
          .= width <*P*> + width <*<*x*>*> by MATRIX_0:def 6
          .= len (<*P^<*x*>*>@) by A16,A13,A19,MATRIX_0:def 6;
          thus Sum Sum <*P^<*x*>*> = Sum Sum (<*P*> ^^ <*<*x*>*>)
          by A5,A7,FINSEQ_2:9
          .= Sum Sum (<*P*>@) + Sum Sum <*<*x*>*> by A4,A15,A12,Th31
          .= Sum Sum (<*P*>@) + Sum Sum (<*<*x*>*>@) by MATRLIN:15
          .= Sum (Sum d1 ^ Sum d2) by RLVECT_1:41
          .= Sum Sum (d1 ^ d2) by Th27
          .= Sum Sum (<*P^<*x*>*>@) by A23,A22,MATRIX_0:53;
        end;
      end;
      <*<*>(the carrier of V1)*> is Matrix of 0+1,0,the carrier of V1;
      then Sum Sum <*<*>(the carrier of V1)*> = 0.V1 by Th14
      .= Sum Sum (<*<*>(the carrier of V1)*>@) by A2,Th13;
      then
      A24: X[<*>(the carrier of V1)];
      for P be FinSequence of V1 holds X[P] from FINSEQ_2:sch 2(A24,A3);
      hence thesis;
    end;
    A25: for n st X[n] holds X[n+1]
    proof
      let n such that
      A26: for M being Matrix of the carrier of V1 st len M = n holds
      Sum Sum M = Sum Sum (M@);
      thus for M being Matrix of the carrier of V1 st len M = n+1 holds
      Sum Sum M = Sum Sum (M@)
      proof
        let M be Matrix of the carrier of V1 such that
        A27: len M = n+1;
        A28: M <> {} by A27;
        A29: dom M = Seg len M by FINSEQ_1:def 3;
        per cases;
        suppose A30: n = 0;
          then M.1 = Line(M,1) by A27,A29,FINSEQ_1:4,MATRIX_0:60;
          then reconsider G = M.1 as FinSequence of V1;
          M = <*G*> by A27,A30,FINSEQ_1:40;
          hence thesis by A1;
        end;
        suppose A31: n > 0;
          A32: M.(n+1) = Line(M,n+1) by A27,A29,FINSEQ_1:4,MATRIX_0:60;
          then reconsider M1 = M.(n+1) as FinSequence of V1;
          len M1 = width M by A32,MATRIX_0:def 7;
          then reconsider R = <*M1*> as Matrix of 1,width M,the carrier of V1;
          reconsider M9 = M as Matrix of n+1,width M,the carrier of V1
          by A27,MATRIX_0:20;
          reconsider W = Del(M9,n+1) as Matrix of n,width M,the carrier of V1
          by MATRLIN:3;
          A33: width W = width M9 by A31,MATRLIN:2
          .= width R by MATRLIN:2;
          A34: len (W@) = width W by MATRIX_0:def 6
          .= len (R@) by A33,MATRIX_0:def 6;
          A35: len Del(M,n+1) = n by A27,PRE_POLY:12;
          thus Sum Sum M = Sum Sum (W ^ R) by A28,PRE_POLY:13,A27
          .= Sum (Sum W ^ Sum R) by Th27
          .= Sum Sum Del(M,n+1) + Sum Sum R by RLVECT_1:41
          .= Sum Sum (Del(M,n+1)@) + Sum Sum R by A26,A35
          .= Sum Sum (Del(M,n+1)@) + Sum Sum (R@) by A1
          .= Sum Sum ((W@) ^^ (R@)) by A34,Th31
          .= Sum Sum ((W ^ R)@) by A33,MATRLIN:28
          .= Sum Sum (M@) by A28,PRE_POLY:13,A27;
        end;
      end;
    end;
    A36: X[0]
    proof
      let M be Matrix of the carrier of V1;
      assume
      A37: len M = 0;
      then width M = 0 by MATRIX_0:def 3;
      then
      A38: len (M@) = 0 by MATRIX_0:def 6;
      thus Sum Sum M = 0.V1 by A37,Th13
      .= Sum Sum (M@) by A38,Th13;
    end;
    for n holds X[n] from NAT_1:sch 2(A36,A25);
    then X[len M];
    hence thesis;
  end;
