reserve i,j,m,n,k for Nat,
  x,y for set,
  K for Field,
  a,a1,a2 for Element of K,
  D for non empty set,
  d,d1,d2 for Element of D,
  M,M1,M2 for (Matrix of D),
  A,A1,A2,B1,B2 for (Matrix of K),
  f,g for FinSequence of NAT;
reserve F,F1,F2 for FinSequence_of_Matrix of D,
  G,G9,G1,G2 for FinSequence_of_Matrix of K;
reserve S,S1,S2 for FinSequence_of_Square-Matrix of D,
  R,R1,R2 for FinSequence_of_Square-Matrix of K;
reserve N for (Matrix of n,K),
  N1 for (Matrix of m,K);
reserve p,p1 for FinSequence of K;

theorem
  Len R1 = Len R2 & Width R1 = Width R2 implies block_diagonal(R1,a1) +
  block_diagonal(R2,a2) = block_diagonal(R1(+)R2,a1+a2)
proof
  defpred P[Nat] means for R1,R2,a1,a2 st Len R1=Len R2 & Width R1=Width R2 &
len R1=$1 holds block_diagonal(R1,a1)+block_diagonal(R2,a2)= block_diagonal(R1
  (+)R2,a1+a2);
  assume that
A1: Len R1=Len R2 and
A2: Width R1=Width R2;
A3: for n st P[n] holds P[n+1]
  proof
    let n such that
A4: P[n];
    set n1=n+1;
    let R1,R2,a1,a2 such that
A5: Len R1=Len R2 and
A6: Width R1=Width R2 and
A7: len R1=n1;
A8: n1 in Seg n1 by FINSEQ_1:4;
    set R2n=R2|n;
A9: R1=(R1|n)^<*R1.n1*> by A7,FINSEQ_3:55;
    set R1n=R1|n;
    set b2n=block_diagonal(R2n,a2);
    set b1n=block_diagonal(R1n,a1);
A10: len R1n=n by A7,FINSEQ_1:59,NAT_1:11;
A11: dom Len R1=Seg n1 by A7,FINSEQ_2:124;
    then
A12: len (R1.n1) = (Len R1).n1 by A8,Def3
      .= len (R2.n1) by A5,A8,A11,Def3;
A13: len R1 = len Len R2 by A5,CARD_1:def 7
      .= len R2 by CARD_1:def 7;
    then
A14: len R2n=n by A7,FINSEQ_1:59,NAT_1:11;
A15: dom Width R1=Seg n1 by A7,FINSEQ_2:124;
    then
A16: width (R1.n1) = (Width R1).n1 by A8,Def4
      .= width (R2.n1) by A6,A8,A15,Def4;
A17: Len R1n = (Len R1) |n by Th17
      .= Len R2n by A5,Th17;
    then
A18: len b1n = Sum Len R2n by Def5
      .= len b2n by Def5;
A19: Width R1n = (Width R1) |n by Th21
      .= Width R2n by A6,Th21;
    then
A20: width b1n = Sum Width R2n by Def5
      .= width b2n by Def5;
A21: R2=(R2|n)^<*R2.n1*> by A7,A13,FINSEQ_3:55;
    hence
    block_diagonal(R1,a1)+block_diagonal(R2,a2) = block_diagonal(<*b1n,R1
    .n1*>,a1)+block_diagonal(R2n^<*R2.n1*>,a2) by A9,Th35
      .= block_diagonal(<*b1n,R1.n1*>,a1)+block_diagonal(<*b2n,R2.n1*>,a2)
    by Th35
      .= block_diagonal(<*b1n,R1.n1*>(+)<*b2n,R2.n1*>,a1+a2) by A18,A20,A12,A16
,Th71
      .= block_diagonal(<*b1n+b2n,R1.n1+R2.n1*>,a1+a2) by Th70
      .= block_diagonal(<*block_diagonal(R1n(+)R2n,a1+a2),R1.n1+R2.n1*>, a1+
    a2) by A4,A10,A17,A19
      .= block_diagonal((R1n(+)R2n)^<*R1.n1+R2.n1*>,a1+a2) by Th35
      .= block_diagonal((R1n(+)R2n)^(<*R1.n1*>(+)<*R2.n1*>),a1+a2) by Th69
      .= block_diagonal(R1(+)R2,a1+a2) by A10,A14,A9,A21,Th67;
  end;
A22: P[0]
  proof
    let R1,R2,a1,a2 such that
    Len R1=Len R2 and
    Width R1=Width R2 and
A23: len R1=0;
    set b12=block_diagonal(R1(+)R2,a1+a2);
    set b2=block_diagonal(R2,a2);
    set b1=block_diagonal(R1,a1);
A24: Len R1={} by A23;
    Len R1=Len(R1(+)R2) by Th66;
    then len b12=0 by A24,Def5,RVSUM_1:72;
    then
A25: b12={};
    len b1=0 by A24,Def5,RVSUM_1:72;
    then len (b1+b2)=0 by MATRIX_3:def 3;
    hence thesis by A25;
  end;
  for n holds P[n] from NAT_1:sch 2(A22,A3);
  hence thesis by A1,A2;
end;
