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;

theorem Th47:
  for A be (Matrix of n,K) st i in dom A & j in Seg n holds
Deleting(block_diagonal(<*A*>^R,a),i,j)= block_diagonal(<*Deleting(A,i,j)*>^R,a
  )
proof
  let A be (Matrix of n,K) such that
A1: i in dom A and
A2: j in Seg n;
   n <> 0 by A2;
   then
A3: n>=1 by NAT_1:14;
  set AA=<*A*>;
  set b=block_diagonal(R,a);
  set B=<*b*>;
  set LAR=Sum Len(AA^R);
  set LAB=Sum Len(AA^B);
A4: width A=n by MATRIX_0:24;
  Width AA=<*width A*> by Th19;
  then
A5: Sum Width AA=width A by RVSUM_1:73;
A6: Width B=<*width b*> by Th19;
A7: Len AA=<*len A*> by Th15;
  then
A8: Sum Len AA=len A by RVSUM_1:73;
  Len(AA^B)=(Len AA)^Len B by Th14;
  then
A9: LAB=len A+Sum Len B by A7,RVSUM_1:76;
A10: Len(AA^B)=Width(AA^B) by Th46;
  Width(AA^B)=(Width AA)^Width B by Th18;
  then
A11: LAB=Sum Width AA+width b by A6,A10,RVSUM_1:74;
  Len B=<*len b*> by Th15;
  then
A12: Sum Len B=len b by RVSUM_1:73;
A13: len A=n by MATRIX_0:24;
  then
A14: dom A=Seg n by FINSEQ_1:def 3;
  per cases by A3,XXREAL_0:1;
  suppose
A15: n=1;
    then
A16: i=1 by A1,A14,FINSEQ_1:2,TARSKI:def 1;
A17: j=1 by A2,A15,FINSEQ_1:2,TARSKI:def 1;
    len Deleting(A,i,j) = 1-'1 by A1,A15,LAPLACE:2
      .= 0 by XREAL_1:232;
    then
A18: Deleting(A,i,j)={};
    thus Deleting(block_diagonal(AA^R,a),i,j) = Deleting(block_diagonal(AA^B,a
    ),i,j) by Th36
      .= Segm(block_diagonal(AA^B,a),Seg LAB\{i},Seg LAB\{j}) by MATRIX13:58
      .= b by A13,A4,A9,A11,A12,A8,A5,A15,A16,A17,Th33,FINSEQ_1:2
      .= block_diagonal(B,a) by Th34
      .= block_diagonal(<*Deleting(A,i,j)*>^B,a) by A18,Th40
      .= block_diagonal(<*Deleting(A,i,j)*>^R,a) by Th36;
  end;
  suppose
    n>1;
    then
A19: width A=width DelLine(A,i) by A13,LAPLACE:4;
    thus Deleting(block_diagonal(AA^R,a),i,j) = DelCol(DelLine(block_diagonal(
    AA^R,a),i),j)
      .= DelCol(block_diagonal(<*DelLine(A,i)*>^R,a),j) by A1,A19,Th41
      .= block_diagonal(<*DelCol(DelLine(A,i),j)*>^R,a) by A2,A4,A19,Th43
      .= block_diagonal(<*Deleting(A,i,j)*>^R,a);
  end;
end;
