 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 Th27:
  for M1 being Matrix of n,k,the carrier of V,
  M2 being Matrix of m,k,the carrier of V
  holds Sum(M1^M2) = (Sum M1)^(Sum M2)
  proof
    let M1 be Matrix of n,k,the carrier of V;
    let M2 be Matrix of m,k,the carrier of V;
    A1: dom Sum(M1^M2) = Seg len Sum(M1^M2) by FINSEQ_1:def 3;
    A2:
    now
      let i be Nat;
      assume
      A3: i in dom Sum(M1^M2);
      then i in Seg len (M1^M2) by A1,MATRLIN:def 6;
      then
      A4: i in dom (M1^M2) by FINSEQ_1:def 3;
      now
        per cases by A4,FINSEQ_1:25;
        suppose A5: i in dom M1;
          len M1 = len Sum M1 by MATRLIN:def 6;
          then
          A6: dom M1 = dom Sum M1 by FINSEQ_3:29;
          thus Sum(M1^M2).i = (Sum(M1^M2))/.i by A3,PARTFUN1:def 6
          .= Sum ((M1^M2)/.i) by A3,MATRLIN:def 6
          .= Sum (M1/.i) by A5,FINSEQ_4:68
          .= (Sum M1)/.i by A5,A6,MATRLIN:def 6
          .= (Sum M1).i by A5,A6,PARTFUN1:def 6
          .= ((Sum M1)^(Sum M2)).i by A5,A6,FINSEQ_1:def 7;
        end;
        suppose A7: ex n being Nat st n in dom M2 & i = len M1 + n;
          A8: len M1 = len Sum M1 by MATRLIN:def 6;
          len M2 = len Sum M2 by MATRLIN:def 6;
          then
          A9: dom M2 = dom Sum M2 by FINSEQ_3:29;
          consider n be Nat such that
          A10: n in dom M2 and
          A11: i = len M1 + n by A7;
          thus Sum(M1^M2).i = (Sum(M1^M2))/.i by A3,PARTFUN1:def 6
          .= Sum ((M1^M2)/.i) by A3,MATRLIN:def 6
          .= Sum (M2/.n) by A10,A11,FINSEQ_4:69
          .= (Sum M2)/.n by A10,A9,MATRLIN:def 6
          .= (Sum M2).n by A10,A9,PARTFUN1:def 6
          .= ((Sum M1)^(Sum M2)).i by A10,A11,A8,A9,FINSEQ_1:def 7;
        end;
      end;
      hence Sum(M1^M2).i = ((Sum M1)^(Sum M2)).i;
    end;
    len Sum(M1^M2) = len (M1^M2) by MATRLIN:def 6
    .= len M1 + len M2 by FINSEQ_1:22
    .= len Sum M1 + len M2 by MATRLIN:def 6
    .= len Sum M1 + len Sum M2 by MATRLIN:def 6
    .= len ((Sum M1)^(Sum M2)) by FINSEQ_1:22;
    hence thesis by A2,FINSEQ_2:9;
  end;
